UNPKG

vue-scroll-fixed-navbar

Version:

A Simple vue scroll fixed navbar package which will help you to fix the top header or navbar while scrolling the screen.

1,772 lines (1,445 loc) 140 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["vue-scroll-fixed-navbar"] = factory(); else root["vue-scroll-fixed-navbar"] = factory(); })((typeof self !== 'undefined' ? self : this), function() { return /******/ (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; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // 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 = "fb15"); /******/ }) /************************************************************************/ /******/ ({ /***/ "06cf": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var propertyIsEnumerableModule = __webpack_require__("d1e7"); var createPropertyDescriptor = __webpack_require__("5c6c"); var toIndexedObject = __webpack_require__("fc6a"); var toPrimitive = __webpack_require__("c04e"); var has = __webpack_require__("5135"); var IE8_DOM_DEFINE = __webpack_require__("0cfb"); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; /***/ }), /***/ "0cfb": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var fails = __webpack_require__("d039"); var createElement = __webpack_require__("cc12"); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(createElement('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /***/ "1d80": /***/ (function(module, exports) { // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /***/ "1dde": /***/ (function(module, exports, __webpack_require__) { var fails = __webpack_require__("d039"); var wellKnownSymbol = __webpack_require__("b622"); var V8_VERSION = __webpack_require__("2d00"); var SPECIES = wellKnownSymbol('species'); module.exports = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION >= 51 || !fails(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; /***/ }), /***/ "23cb": /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__("a691"); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { var integer = toInteger(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), /***/ "23e7": /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__("da84"); var getOwnPropertyDescriptor = __webpack_require__("06cf").f; var createNonEnumerableProperty = __webpack_require__("9112"); var redefine = __webpack_require__("6eeb"); var setGlobal = __webpack_require__("ce4e"); var copyConstructorProperties = __webpack_require__("e893"); var isForced = __webpack_require__("94ca"); /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global; } else if (STATIC) { target = global[TARGET] || setGlobal(TARGET, {}); } else { target = (global[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine(target, key, sourceProperty, options); } }; /***/ }), /***/ "241c": /***/ (function(module, exports, __webpack_require__) { var internalObjectKeys = __webpack_require__("ca84"); var enumBugKeys = __webpack_require__("7839"); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys(O, hiddenKeys); }; /***/ }), /***/ "298e": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0ba310cd-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/VueScrollFixedNavbar.vue?vue&type=template&id=c7ff881c& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Preview',{attrs:{"isFixed":_vm.isFixed}},[_c('div',{attrs:{"id":"myHeader"}},[_vm._t("default")],2)])} var staticRenderFns = [] // CONCATENATED MODULE: ./src/components/VueScrollFixedNavbar.vue?vue&type=template&id=c7ff881c& // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js var es_array_slice = __webpack_require__("fb6a"); // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.freeze.js var es_object_freeze = __webpack_require__("dca8"); // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } // CONCATENATED MODULE: ./node_modules/vue-styled-components/dist/vue-styled-components.es.js var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''); var generateAlphabeticName = function generateAlphabeticName(code) { var lastDigit = chars[code % chars.length]; return code > chars.length ? "".concat(generateAlphabeticName(Math.floor(code / chars.length))).concat(lastDigit) : lastDigit; }; var interleave = (function (strings, interpolations) { return interpolations.reduce(function (array, interp, i) { return array.concat(interp, strings[i + 1]); }, [strings[0]]); }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** `Object#toString` result references. */ var objectTag = '[object Object]'; /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function (arg) { return func(transform(arg)); }; } /** Used for built-in method references. */ var funcProto = Function.prototype, objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var vue_styled_components_es_hasOwnProperty = objectProto.hasOwnProperty; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var getPrototype = overArg(Object.getPrototypeOf, Object); /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = vue_styled_components_es_hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } var lodash_isplainobject = isPlainObject; var _uppercasePattern = /([A-Z])/g; var msPattern = /^ms-/; function hyphenate(string) { return string.replace(_uppercasePattern, '-$1').toLowerCase(); } function hyphenateStyleName(string) { return hyphenate(string).replace(msPattern, '-ms-'); } var hyphenateStyleName_1 = hyphenateStyleName; var objToCss = function objToCss(obj, prevKey) { var css = Object.keys(obj).map(function (key) { if (lodash_isplainobject(obj[key])) return objToCss(obj[key], key); return "".concat(hyphenateStyleName_1(key), ": ").concat(obj[key], ";"); }).join(' '); return prevKey ? "".concat(prevKey, " {\n ").concat(css, "\n}") : css; }; var flatten = function flatten(chunks, executionContext) { return chunks.reduce(function (ruleSet, chunk) { if (chunk === undefined || chunk === null || chunk === false || chunk === '') return ruleSet; if (Array.isArray(chunk)) return [].concat(_toConsumableArray(ruleSet), _toConsumableArray(flatten(chunk, executionContext))); if (typeof chunk === 'function') { return executionContext ? ruleSet.concat.apply(ruleSet, _toConsumableArray(flatten([chunk(executionContext)], executionContext))) : ruleSet.concat(chunk); } return ruleSet.concat(lodash_isplainobject(chunk) ? objToCss(chunk) : chunk.toString()); }, []); }; var css = (function (rules) { for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { interpolations[_key - 1] = arguments[_key]; } return flatten(interleave(rules, interpolations)); }); function last(arr) { return arr[arr.length - 1]; } function sheetForTag(tag) { for (var i = 0; i < document.styleSheets.length; i++) { if (document.styleSheets[i].ownerNode === tag) { return document.styleSheets[i]; } } } var isDev = function (x) { return x === 'development' || !x; }("development"); var isTest = "development" === 'test'; var isBrowser = typeof document !== 'undefined' && !isTest; var oldIE = function () { if (isBrowser) { var div = document.createElement('div'); div.innerHTML = '<!--[if lt IE 10]><i></i><![endif]-->'; return div.getElementsByTagName('i').length === 1; } }(); function makeStyleTag() { var tag = document.createElement('style'); tag.type = 'text/css'; tag.appendChild(document.createTextNode('')); (document.head || document.getElementsByTagName('head')[0]).appendChild(tag); return tag; } var StyleSheet = function () { function StyleSheet() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$speedy = _ref.speedy, speedy = _ref$speedy === void 0 ? !isDev && !isTest : _ref$speedy, _ref$maxLength = _ref.maxLength, maxLength = _ref$maxLength === void 0 ? isBrowser && oldIE ? 4000 : 65000 : _ref$maxLength; _classCallCheck(this, StyleSheet); this.isSpeedy = speedy; this.sheet = undefined; this.tags = []; this.maxLength = maxLength; this.ctr = 0; } _createClass(StyleSheet, [{ key: "inject", value: function inject() { var _this = this; if (this.injected) { throw new Error('already injected stylesheet!'); } if (isBrowser) { this.tags[0] = makeStyleTag(); this.sheet = sheetForTag(this.tags[0]); } else { this.sheet = { cssRules: [], insertRule: function insertRule(rule) { var serverRule = { cssText: rule }; _this.sheet.cssRules.push(serverRule); return { serverRule: serverRule, appendRule: function appendRule(newCss) { return serverRule.cssText += newCss; } }; } }; } this.injected = true; } }, { key: "speedy", value: function speedy(bool) { if (this.ctr !== 0) { throw new Error("cannot change speedy mode after inserting any rule to sheet. Either call speedy(".concat(bool, ") earlier in your app, or call flush() before speedy(").concat(bool, ")")); } this.isSpeedy = !!bool; } }, { key: "_insert", value: function _insert(rule) { try { this.sheet.insertRule(rule, this.sheet.cssRules.length); } catch (e) { if (isDev) { console.warn('whoops, illegal rule inserted', rule); } } } }, { key: "insert", value: function insert(rule) { var insertedRule; if (isBrowser) { if (this.isSpeedy && this.sheet.insertRule) { this._insert(rule); } else { var textNode = document.createTextNode(rule); last(this.tags).appendChild(textNode); insertedRule = { textNode: textNode, appendRule: function appendRule(newCss) { return textNode.appendData(newCss); } }; if (!this.isSpeedy) { this.sheet = sheetForTag(last(this.tags)); } } } else { insertedRule = this.sheet.insertRule(rule); } this.ctr++; if (isBrowser && this.ctr % this.maxLength === 0) { this.tags.push(makeStyleTag()); this.sheet = sheetForTag(last(this.tags)); } return insertedRule; } }, { key: "flush", value: function flush() { if (isBrowser) { this.tags.forEach(function (tag) { return tag.parentNode.removeChild(tag); }); this.tags = []; this.sheet = null; this.ctr = 0; } else { this.sheet.cssRules = []; } this.injected = false; } }, { key: "rules", value: function rules() { if (!isBrowser) { return this.sheet.cssRules; } var arr = []; this.tags.forEach(function (tag) { return arr.splice.apply(arr, [arr.length, 0].concat(_toConsumableArray(Array.from(sheetForTag(tag).cssRules)))); }); return arr; } }]); return StyleSheet; }(); var StyleSheet$1 = function () { function StyleSheet$1() { _classCallCheck(this, StyleSheet$1); this.globalStyleSheet = new StyleSheet({ speedy: false }); this.componentStyleSheet = new StyleSheet({ speedy: false, maxLength: 40 }); } _createClass(StyleSheet$1, [{ key: "inject", value: function inject() { this.globalStyleSheet.inject(); this.componentStyleSheet.inject(); } }, { key: "flush", value: function flush() { if (this.globalStyleSheet.sheet) this.globalStyleSheet.flush(); if (this.componentStyleSheet.sheet) this.componentStyleSheet.flush(); } }, { key: "insert", value: function insert(rule) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { global: false }; var sheet = opts.global ? this.globalStyleSheet : this.componentStyleSheet; return sheet.insert(rule); } }, { key: "rules", value: function rules() { return this.globalStyleSheet.rules().concat(this.componentStyleSheet.rules()); } }, { key: "injected", get: function get() { return this.globalStyleSheet.injected && this.componentStyleSheet.injected; } }]); return StyleSheet$1; }(); var styleSheet = new StyleSheet$1(); function unwrapExports (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var hash = createCommonjsModule(function (module, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.default = doHash; // murmurhash2 via https://gist.github.com/raycmorgan/588423 function doHash(str, seed) { var m = 0x5bd1e995; var r = 24; var h = seed ^ str.length; var length = str.length; var currentIndex = 0; while (length >= 4) { var k = UInt32(str, currentIndex); k = Umul32(k, m); k ^= k >>> r; k = Umul32(k, m); h = Umul32(h, m); h ^= k; currentIndex += 4; length -= 4; } switch (length) { case 3: h ^= UInt16(str, currentIndex); h ^= str.charCodeAt(currentIndex + 2) << 16; h = Umul32(h, m); break; case 2: h ^= UInt16(str, currentIndex); h = Umul32(h, m); break; case 1: h ^= str.charCodeAt(currentIndex); h = Umul32(h, m); break; } h ^= h >>> 13; h = Umul32(h, m); h ^= h >>> 15; return h >>> 0; } function UInt32(str, pos) { return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8) + (str.charCodeAt(pos++) << 16) + (str.charCodeAt(pos) << 24); } function UInt16(str, pos) { return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8); } function Umul32(n, m) { n = n | 0; m = m | 0; var nlo = n & 0xffff; var nhi = n >>> 16; var res = nlo * m + ((nhi * m & 0xffff) << 16) | 0; return res; } }); var hashStr = unwrapExports(hash); var replaceWhitespace = function replaceWhitespace(str) { return str.replace(/\s|\\n/g, ''); }; var makeAnimation = function makeAnimation(name, css) { return "\n@keyframes ".concat(name, " {\n ").concat(css, "\n}\n"); }; var keyframes = (function (css) { var name = generateAlphabeticName(hashStr(replaceWhitespace(JSON.stringify(css)))); var animation = makeAnimation(name, css); if (!styleSheet.injected) styleSheet.inject(); styleSheet.insert(animation); return name; }); var stylis = createCommonjsModule(function (module, exports) { /* * __ ___ * _____/ /___ __/ (_)____ * / ___/ __/ / / / / / ___/ * (__ ) /_/ /_/ / / (__ ) * /____/\__/\__, /_/_/____/ * /____/ * * light - weight css preprocessor @licence MIT */ (function (factory) { /* eslint-disable */ module['exports'] = factory(null) ; })( /** @param {*=} options */ function factory(options) { /** * Notes * * The ['<method name>'] pattern is used to support closure compiler * the jsdoc signatures are also used to the same effect * * ---- * * int + int + int === n4 [faster] * * vs * * int === n1 && int === n2 && int === n3 * * ---- * * switch (int) { case ints...} [faster] * * vs * * if (int == 1 && int === 2 ...) * * ---- * * The (first*n1 + second*n2 + third*n3) format used in the property parser * is a simple way to hash the sequence of characters * taking into account the index they occur in * since any number of 3 character sequences could produce duplicates. * * On the other hand sequences that are directly tied to the index of the character * resolve a far more accurate measure, it's also faster * to evaluate one condition in a switch statement * than three in an if statement regardless of the added math. * * This allows the vendor prefixer to be both small and fast. */ var nullptn = /^\0+/g; /* matches leading null characters */ var formatptn = /[\0\r\f]/g; /* matches new line, null and formfeed characters */ var colonptn = /: */g; /* splits animation rules */ var cursorptn = /zoo|gra/; /* assert cursor varient */ var transformptn = /([,: ])(transform)/g; /* vendor prefix transform, older webkit */ var animationptn = /,+\s*(?![^(]*[)])/g; /* splits multiple shorthand notation animations */ var propertiesptn = / +\s*(?![^(]*[)])/g; /* animation properties */ var elementptn = / *[\0] */g; /* selector elements */ var selectorptn = /,\r+?/g; /* splits selectors */ var andptn = /([\t\r\n ])*\f?&/g; /* match & */ var escapeptn = /:global\(((?:[^\(\)\[\]]*|\[.*\]|\([^\(\)]*\))*)\)/g; /* matches :global(.*) */ var invalidptn = /\W+/g; /* removes invalid characters from keyframes */ var keyframeptn = /@(k\w+)\s*(\S*)\s*/; /* matches @keyframes $1 */ var plcholdrptn = /::(place)/g; /* match ::placeholder varient */ var readonlyptn = /:(read-only)/g; /* match :read-only varient */ var beforeptn = /\s+(?=[{\];=:>])/g; /* matches \s before ] ; = : */ var afterptn = /([[}=:>])\s+/g; /* matches \s after characters [ } = : */ var tailptn = /(\{[^{]+?);(?=\})/g; /* matches tail semi-colons ;} */ var whiteptn = /\s{2,}/g; /* matches repeating whitespace */ var pseudoptn = /([^\(])(:+) */g; /* pseudo element */ var writingptn = /[svh]\w+-[tblr]{2}/; /* match *gradient property */ var supportsptn = /\(\s*(.*)\s*\)/g; /* match supports (groups) */ var propertyptn = /([\s\S]*?);/g; /* match properties leading semicolon */ var selfptn = /-self|flex-/g; /* match flex- and -self in align-self: flex-*; */ var pseudofmt = /[^]*?(:[rp][el]a[\w-]+)[^]*/; /* match tail whitspace */ var dimensionptn = /stretch|:\s*\w+\-(?:conte|avail)/; /* match max/min/fit-content, fill-available */ var imgsrcptn = /([^-])(image-set\()/; /* vendors */ var webkit = '-webkit-'; var moz = '-moz-'; var ms = '-ms-'; /* character codes */ var SEMICOLON = 59; /* ; */ var CLOSEBRACES = 125; /* } */ var OPENBRACES = 123; /* { */ var OPENPARENTHESES = 40; /* ( */ var CLOSEPARENTHESES = 41; /* ) */ var OPENBRACKET = 91; /* [ */ var CLOSEBRACKET = 93; /* ] */ var NEWLINE = 10; /* \n */ var CARRIAGE = 13; /* \r */ var TAB = 9; /* \t */ var AT = 64; /* @ */ var SPACE = 32; /* */ var AND = 38; /* & */ var DASH = 45; /* - */ var UNDERSCORE = 95; /* _ */ var STAR = 42; /* * */ var COMMA = 44; /* , */ var COLON = 58; /* : */ var SINGLEQUOTE = 39; /* ' */ var DOUBLEQUOTE = 34; /* " */ var FOWARDSLASH = 47; /* / */ var GREATERTHAN = 62; /* > */ var PLUS = 43; /* + */ var TILDE = 126; /* ~ */ var NULL = 0; /* \0 */ var FORMFEED = 12; /* \f */ var VERTICALTAB = 11; /* \v */ /* special identifiers */ var KEYFRAME = 107; /* k */ var MEDIA = 109; /* m */ var SUPPORTS = 115; /* s */ var PLACEHOLDER = 112; /* p */ var READONLY = 111; /* o */ var IMPORT = 105; /* <at>i */ var CHARSET = 99; /* <at>c */ var DOCUMENT = 100; /* <at>d */ var PAGE = 112; /* <at>p */ var column = 1; /* current column */ var line = 1; /* current line numebr */ var pattern = 0; /* :pattern */ var cascade = 1; /* #id h1 h2 vs h1#id h2#id */ var prefix = 1; /* vendor prefix */ var escape = 1; /* escape :global() pattern */ var compress = 0; /* compress output */ var semicolon = 0; /* no/semicolon option */ var preserve = 0; /* preserve empty selectors */ /* empty reference */ var array = []; /* plugins */ var plugins = []; var plugged = 0; var should = null; /* plugin context */ var POSTS = -2; var PREPS = -1; var UNKWN = 0; var PROPS = 1; var BLCKS = 2; var ATRUL = 3; /* plugin newline context */ var unkwn = 0; /* keyframe animation */ var keyed = 1; var key = ''; /* selector namespace */ var nscopealt = ''; var nscope = ''; /** * Compile * * @param {Array<string>} parent * @param {Array<string>} current * @param {string} body * @param {number} id * @param {number} depth * @return {string} */ function compile(parent, current, body, id, depth) { var bracket = 0; /* brackets [] */ var comment = 0; /* comments /* // or /* */ var parentheses = 0; /* functions () */ var quote = 0; /* quotes '', "" */ var first = 0; /* first character code */ var second = 0; /* second character code */ var code = 0; /* current character code */ var tail = 0; /* previous character code */ var trail = 0; /* character before previous code */ var peak = 0; /* previous non-whitespace code */ var counter = 0; /* count sequence termination */ var context = 0; /* track current context */ var atrule = 0; /* track @at-rule context */ var pseudo = 0; /* track pseudo token index */ var caret = 0; /* current character index */ var format = 0; /* control character formating context */ var insert = 0; /* auto semicolon insertion */ var invert = 0; /* inverted selector pattern */ var length = 0; /* generic length address */ var eof = body.length; /* end of file(length) */ var eol = eof - 1; /* end of file(characters) */ var char = ''; /* current character */ var chars = ''; /* current buffer of characters */ var child = ''; /* next buffer of characters */ var out = ''; /* compiled body */ var children = ''; /* compiled children */ var flat = ''; /* compiled leafs */ var selector; /* generic selector address */ var result; /* generic address */ // ...build body while (caret < eof) { code = body.charCodeAt(caret); // eof varient if (caret === eol) { // last character + noop context, add synthetic padding for noop context to terminate if (comment + quote + parentheses + bracket !== 0) { if (comment !== 0) { code = comment === FOWARDSLASH ? NEWLINE : FOWARDSLASH; } quote = parentheses = bracket = 0; eof++; eol++; } } if (comment + quote + parentheses + bracket === 0) { // eof varient if (caret === eol) { if (format > 0) { chars = chars.replace(formatptn, ''); } if (chars.trim().length > 0) { switch (code) { case SPACE: case TAB: case SEMICOLON: case CARRIAGE: case NEWLINE: { break; } default: { chars += body.charAt(caret); } } code = SEMICOLON; } } // auto semicolon insertion if (insert === 1) { switch (code) { // false flags case OPENBRACES: case CLOSEBRACES: case SEMICOLON: case DOUBLEQUOTE: case SINGLEQUOTE: case OPENPARENTHESES: case CLOSEPARENTHESES: case COMMA: { insert = 0; } // ignore case TAB: case CARRIAGE: case NEWLINE: case SPACE: { break; } // valid default: { insert = 0; length = caret; first = code; caret--; code = SEMICOLON; while (length < eof) { switch (body.charCodeAt(length++)) { case NEWLINE: case CARRIAGE: case SEMICOLON: { ++caret; code = first; length = eof; break; } case COLON: { if (format > 0) { ++caret; code = first; } } case OPENBRACES: { length = eof; } } } } } } // token varient switch (code) { case OPENBRACES: { chars = chars.trim(); first = chars.charCodeAt(0); counter = 1; length = ++caret; while (caret < eof) { switch (code = body.charCodeAt(caret)) { case OPENBRACES: { counter++; break; } case CLOSEBRACES: { counter--; break; } case FOWARDSLASH: { switch (second = body.charCodeAt(caret + 1)) { // /*, // case STAR: case FOWARDSLASH: { caret = delimited(second, caret, eol, body); } } break; } // given "[" === 91 & "]" === 93 hence forth 91 + 1 + 1 === 93 case OPENBRACKET: { code++; } // given "(" === 40 & ")" === 41 hence forth 40 + 1 === 41 case OPENPARENTHESES: { code++; } // quote tail delimiter is identical to the head delimiter hence noop, // fallthrough clauses have been shifted to the correct tail delimiter case DOUBLEQUOTE: case SINGLEQUOTE: { while (caret++ < eol) { if (body.charCodeAt(caret) === code) { break; } } } } if (counter === 0) { break; } caret++; } child = body.substring(length, caret); if (first === NULL) { first = (chars = chars.replace(nullptn, '').trim()).charCodeAt(0); } switch (first) { // @at-rule case AT: { if (format > 0) { chars = chars.replace(formatptn, ''); } second = chars.charCodeAt(1); switch (second) { case DOCUMENT: case MEDIA: case SUPPORTS: case DASH: { selector = current; break; } default: { selector = array; } } child = compile(current, selector, child, second, depth + 1); length = child.length; // preserve empty @at-rule if (preserve > 0 && length === 0) { length = chars.length; } // execute plugins, @at-rule context if (plugged > 0) { selector = select(array, chars, invert); result = proxy(ATRUL, child, selector, current, line, column, length, second, depth, id); chars = selector.join(''); if (result !== void 0) { if ((length = (child = result.trim()).length) === 0) { second = 0; child = ''; } } } if (length > 0) { switch (second) { case SUPPORTS: { chars = chars.replace(supportsptn, supports); } case DOCUMENT: case MEDIA: case DASH: { child = chars + '{' + child + '}'; break; } case KEYFRAME: { chars = chars.replace(keyframeptn, '$1 $2' + (keyed > 0 ? key : '')); child = chars + '{' + child + '}'; if (prefix === 1 || prefix === 2 && vendor('@' + child, 3)) { child = '@' + webkit + child + '@' + child; } else { child = '@' + child; } break; } default: { child = chars + child; if (id === PAGE) { child = (out += child, ''); } } } } else { child = ''; } break; } // selector default: { child = compile(current, select(current, chars, invert), child, id, depth + 1); } } children += child; // reset context = 0; insert = 0; pseudo = 0; format = 0; invert = 0; atrule = 0; chars = ''; child = ''; code = body.charCodeAt(++caret); break; } case CLOSEBRACES: case SEMICOLON: { chars = (format > 0 ? chars.replace(formatptn, '') : chars).trim(); if ((length = chars.length) > 1) { // monkey-patch missing colon if (pseudo === 0) { first = chars.charCodeAt(0); // first character is a letter or dash, buffer has a space character if (first === DASH || first > 96 && first < 123) { length = (chars = chars.replace(' ', ':')).length; } } // execute plugins, property context if (plugged > 0) { if ((result = proxy(PROPS, chars, current, parent, line, column, out.length, id, depth, id)) !== void 0) { if ((length = (chars = result.trim()).length) === 0) { chars = '\0\0'; } } } first = chars.charCodeAt(0); second = chars.charCodeAt(1); switch (first) { case NULL: { break; } case AT: { if (second === IMPORT || second === CHARSET) { flat += chars + body.charAt(caret); break; } } default: { if (chars.charCodeAt(length - 1) === COLON) { break; } out += property(chars, first, second, chars.charCodeAt(2)); } } } // reset context = 0; insert = 0; pseudo = 0; format = 0; invert = 0; chars = ''; code = body.charCodeAt(++caret); break; } } } // parse characters switch (code) { case CARRIAGE: case NEWLINE: { // auto insert semicolon if (comment + quote + parentheses + bracket + semicolon === 0) { // valid non-whitespace characters that // may precede a newline switch (peak) { case CLOSEPARENTHESES: case SINGLEQUOTE: case DOUBLEQUOTE: case AT: case TILDE: case GREATERTHAN: case STAR: case PLUS: case FOWARDSLASH: case DASH: case COLON: case COMMA: case SEMICOLON: case OPENBRACES: case CLOSEBRACES: { break; } default: { // current buffer has a colon if (pseudo > 0) { insert = 1; } } } } // terminate line comment if (comment === FOWARDSLASH) { comment = 0; } else if (cascade + context === 0 && id !== KEYFRAME && chars.length > 0) { format = 1; chars += '\0'; } // execute plugins, newline context if (plugged * unkwn > 0) { proxy(UNKWN, chars, current, parent, line, column, out.length, id, depth, id); } // next line, reset column position column = 1; line++; break; } case SEMICOLON: case CLOSEBRACES: { if (comment + quote + parentheses + bracket === 0) { column++; break; } } default: { // increment c