123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584 |
- /******/ (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 = 1);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports) {
- module.exports = function(modules) {
- function __webpack_require__(moduleId) {
- if (installedModules[moduleId]) return installedModules[moduleId].exports;
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: !1,
- exports: {}
- };
- return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
- module.l = !0, module.exports;
- }
- var installedModules = {};
- return __webpack_require__.m = modules, __webpack_require__.c = installedModules,
- __webpack_require__.i = function(value) {
- return value;
- }, __webpack_require__.d = function(exports, name, getter) {
- __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
- configurable: !1,
- enumerable: !0,
- get: getter
- });
- }, __webpack_require__.n = function(module) {
- var getter = module && module.__esModule ? function() {
- return module.default;
- } : function() {
- return module;
- };
- return __webpack_require__.d(getter, "a", getter), getter;
- }, __webpack_require__.o = function(object, property) {
- return Object.prototype.hasOwnProperty.call(object, property);
- }, __webpack_require__.p = "dist", __webpack_require__(__webpack_require__.s = 6);
- }([ function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", {
- value: !0
- });
- var __WEBPACK_IMPORTED_MODULE_0__helpers__ = __webpack_require__(5), __WEBPACK_IMPORTED_MODULE_1__style_less__ = __webpack_require__(4), DATE_STRING_REGEX = (__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__style_less__),
- /(^\d{1,4}[\.|\\\/|-]\d{1,2}[\.|\\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/), PARTIAL_DATE_REGEX = /\d{2}:\d{2}:\d{2} GMT-\d{4}/, JSON_DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/, requestAnimationFrame = window.requestAnimationFrame || function(cb) {
- return cb(), 0;
- }, _defaultConfig = {
- hoverPreviewEnabled: !1,
- hoverPreviewArrayCount: 100,
- hoverPreviewFieldCount: 5,
- animateOpen: !0,
- animateClose: !0,
- theme: null,
- useToJSON: !0,
- sortPropertiesBy: null
- }, JSONFormatter = function() {
- function JSONFormatter(json, open, config, key) {
- void 0 === open && (open = 1), void 0 === config && (config = _defaultConfig), this.json = json,
- this.open = open, this.config = config, this.key = key, this._isOpen = null, void 0 === this.config.hoverPreviewEnabled && (this.config.hoverPreviewEnabled = _defaultConfig.hoverPreviewEnabled),
- void 0 === this.config.hoverPreviewArrayCount && (this.config.hoverPreviewArrayCount = _defaultConfig.hoverPreviewArrayCount),
- void 0 === this.config.hoverPreviewFieldCount && (this.config.hoverPreviewFieldCount = _defaultConfig.hoverPreviewFieldCount),
- void 0 === this.config.useToJSON && (this.config.useToJSON = _defaultConfig.useToJSON);
- }
- return Object.defineProperty(JSONFormatter.prototype, "isOpen", {
- get: function() {
- return null !== this._isOpen ? this._isOpen : this.open > 0;
- },
- set: function(value) {
- this._isOpen = value;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isDate", {
- get: function() {
- return this.json instanceof Date || "string" === this.type && (DATE_STRING_REGEX.test(this.json) || JSON_DATE_REGEX.test(this.json) || PARTIAL_DATE_REGEX.test(this.json));
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isUrl", {
- get: function() {
- return "string" === this.type && 0 === this.json.indexOf("http");
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isArray", {
- get: function() {
- return Array.isArray(this.json);
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isObject", {
- get: function() {
- return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.a)(this.json);
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isEmptyObject", {
- get: function() {
- return !this.keys.length && !this.isArray;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "isEmpty", {
- get: function() {
- return this.isEmptyObject || this.keys && !this.keys.length && this.isArray;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "useToJSON", {
- get: function() {
- return this.config.useToJSON && "stringifiable" === this.type;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "hasKey", {
- get: function() {
- return void 0 !== this.key;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "constructorName", {
- get: function() {
- return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.b)(this.json);
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "type", {
- get: function() {
- return null === this.json ? "null" : this.config.useToJSON && this.json && this.json.toJSON ? "stringifiable" : typeof this.json;
- },
- enumerable: !0,
- configurable: !0
- }), Object.defineProperty(JSONFormatter.prototype, "keys", {
- get: function() {
- if (this.isObject) {
- var keys = Object.keys(this.json).map(function(key) {
- return key || '""';
- });
- return !this.isArray && this.config.sortPropertiesBy ? keys.sort(this.config.sortPropertiesBy) : keys;
- }
- return [];
- },
- enumerable: !0,
- configurable: !0
- }), JSONFormatter.prototype.toggleOpen = function() {
- this.isOpen = !this.isOpen, this.element && (this.isOpen ? this.appendChildren(this.config.animateOpen) : this.removeChildren(this.config.animateClose),
- this.element.classList.toggle(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")));
- }, JSONFormatter.prototype.openAtDepth = function(depth) {
- void 0 === depth && (depth = 1), depth < 0 || (this.open = depth, this.isOpen = 0 !== depth,
- this.element && (this.removeChildren(!1), 0 === depth ? this.element.classList.remove(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")) : (this.appendChildren(this.config.animateOpen),
- this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")))));
- }, JSONFormatter.prototype.getInlinepreview = function() {
- var _this = this;
- if (this.isArray) return this.json.length > this.config.hoverPreviewArrayCount ? "Array[" + this.json.length + "]" : "[" + this.json.map(__WEBPACK_IMPORTED_MODULE_0__helpers__.d).join(", ") + "]";
- var keys = this.keys, narrowKeys = keys.slice(0, this.config.hoverPreviewFieldCount), kvs = narrowKeys.map(function(key) {
- return key + ":" + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.d)(_this.type, _this.json[key]);
- }), ellipsis = keys.length >= this.config.hoverPreviewFieldCount ? "…" : "";
- return "{" + kvs.join(", ") + ellipsis + "}";
- }, JSONFormatter.prototype.render = function() {
- this.element = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("div", "row");
- var togglerLink = this.isObject ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("a", "toggler-link") : __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
- if (this.isObject && !this.useToJSON && togglerLink.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "toggler")),
- this.hasKey && togglerLink.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "key", this.key + ":")),
- this.isObject && !this.useToJSON) {
- var value = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "value"), objectWrapperSpan = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span"), constructorName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "constructor-name", this.constructorName);
- if (objectWrapperSpan.appendChild(constructorName), this.isArray) {
- var arrayWrapperSpan = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
- arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "bracket", "[")),
- arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "number", this.json.length)),
- arrayWrapperSpan.appendChild(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "bracket", "]")),
- objectWrapperSpan.appendChild(arrayWrapperSpan);
- }
- value.appendChild(objectWrapperSpan), togglerLink.appendChild(value);
- } else {
- var value = this.isUrl ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("a") : __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span");
- value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)(this.type)),
- this.isDate && value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("date")),
- this.isUrl && (value.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("url")),
- value.setAttribute("href", this.json));
- var valuePreview = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.f)(this.type, this.json, this.useToJSON ? this.json.toJSON() : this.json);
- value.appendChild(document.createTextNode(valuePreview)), togglerLink.appendChild(value);
- }
- if (this.isObject && this.config.hoverPreviewEnabled) {
- var preview = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("span", "preview-text");
- preview.appendChild(document.createTextNode(this.getInlinepreview())), togglerLink.appendChild(preview);
- }
- var children = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.e)("div", "children");
- return this.isObject && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("object")),
- this.isArray && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("array")),
- this.isEmpty && children.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("empty")),
- this.config && this.config.theme && this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)(this.config.theme)),
- this.isOpen && this.element.classList.add(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("open")),
- this.element.appendChild(togglerLink), this.element.appendChild(children), this.isObject && this.isOpen && this.appendChildren(),
- this.isObject && !this.useToJSON && togglerLink.addEventListener("click", this.toggleOpen.bind(this)),
- this.element;
- }, JSONFormatter.prototype.appendChildren = function(animated) {
- var _this = this;
- void 0 === animated && (animated = !1);
- var children = this.element.querySelector("div." + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("children"));
- if (children && !this.isEmpty) if (animated) {
- var index_1 = 0, addAChild_1 = function() {
- var key = _this.keys[index_1], formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
- children.appendChild(formatter.render()), (index_1 += 1) < _this.keys.length && (index_1 > 10 ? addAChild_1() : requestAnimationFrame(addAChild_1));
- };
- requestAnimationFrame(addAChild_1);
- } else this.keys.forEach(function(key) {
- var formatter = new JSONFormatter(_this.json[key], _this.open - 1, _this.config, key);
- children.appendChild(formatter.render());
- });
- }, JSONFormatter.prototype.removeChildren = function(animated) {
- void 0 === animated && (animated = !1);
- var childrenElement = this.element.querySelector("div." + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__helpers__.c)("children"));
- if (animated) {
- var childrenRemoved_1 = 0, removeAChild_1 = function() {
- childrenElement && childrenElement.children.length && (childrenElement.removeChild(childrenElement.children[0]),
- childrenRemoved_1 += 1, childrenRemoved_1 > 10 ? removeAChild_1() : requestAnimationFrame(removeAChild_1));
- };
- requestAnimationFrame(removeAChild_1);
- } else childrenElement && (childrenElement.innerHTML = "");
- }, JSONFormatter;
- }();
- __webpack_exports__.default = JSONFormatter;
- }, function(module, exports, __webpack_require__) {
- exports = module.exports = __webpack_require__(2)(), exports.push([ module.i, '.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-row,\n.json-formatter-row a,\n.json-formatter-row a:hover {\n color: black;\n text-decoration: none;\n}\n.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: "No properties";\n}\n.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: "[]";\n}\n.json-formatter-row .json-formatter-string,\n.json-formatter-row .json-formatter-stringifiable {\n color: green;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-row .json-formatter-number {\n color: blue;\n}\n.json-formatter-row .json-formatter-boolean {\n color: red;\n}\n.json-formatter-row .json-formatter-null {\n color: #855A00;\n}\n.json-formatter-row .json-formatter-undefined {\n color: #ca0b69;\n}\n.json-formatter-row .json-formatter-function {\n color: #FF20ED;\n}\n.json-formatter-row .json-formatter-date {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: blue;\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-bracket {\n color: blue;\n}\n.json-formatter-row .json-formatter-key {\n color: #00008B;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler-link {\n cursor: pointer;\n}\n.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: "\\25BA";\n}\n.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n.json-formatter-dark.json-formatter-row {\n font-family: monospace;\n}\n.json-formatter-dark.json-formatter-row,\n.json-formatter-dark.json-formatter-row a,\n.json-formatter-dark.json-formatter-row a:hover {\n color: white;\n text-decoration: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-row {\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty {\n opacity: 0.5;\n margin-left: 1rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty:after {\n display: none;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-object:after {\n content: "No properties";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-children.json-formatter-empty.json-formatter-array:after {\n content: "[]";\n}\n.json-formatter-dark.json-formatter-row .json-formatter-string,\n.json-formatter-dark.json-formatter-row .json-formatter-stringifiable {\n color: #31F031;\n white-space: pre;\n word-wrap: break-word;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-number {\n color: #66C2FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-boolean {\n color: #EC4242;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-null {\n color: #EEC97D;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-undefined {\n color: #ef8fbe;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-function {\n color: #FD48CB;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-date {\n background-color: rgba(255, 255, 255, 0.05);\n}\n.json-formatter-dark.json-formatter-row .json-formatter-url {\n text-decoration: underline;\n color: #027BFF;\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-bracket {\n color: #9494FF;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-key {\n color: #23A0DB;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler-link {\n cursor: pointer;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler {\n line-height: 1.2rem;\n font-size: 0.7rem;\n vertical-align: middle;\n opacity: 0.6;\n cursor: pointer;\n padding-right: 0.2rem;\n}\n.json-formatter-dark.json-formatter-row .json-formatter-toggler:after {\n display: inline-block;\n transition: transform 100ms ease-in;\n content: "\\25BA";\n}\n.json-formatter-dark.json-formatter-row > a > .json-formatter-preview-text {\n opacity: 0;\n transition: opacity 0.15s ease-in;\n font-style: italic;\n}\n.json-formatter-dark.json-formatter-row:hover > a > .json-formatter-preview-text {\n opacity: 0.6;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-toggler-link .json-formatter-toggler:after {\n transform: rotate(90deg);\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > .json-formatter-children:after {\n display: inline-block;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open > a > .json-formatter-preview-text {\n display: none;\n}\n.json-formatter-dark.json-formatter-row.json-formatter-open.json-formatter-empty:after {\n display: block;\n}\n', "" ]);
- }, function(module, exports) {
- module.exports = function() {
- var list = [];
- return list.toString = function() {
- for (var result = [], i = 0; i < this.length; i++) {
- var item = this[i];
- item[2] ? result.push("@media " + item[2] + "{" + item[1] + "}") : result.push(item[1]);
- }
- return result.join("");
- }, list.i = function(modules, mediaQuery) {
- "string" == typeof modules && (modules = [ [ null, modules, "" ] ]);
- for (var alreadyImportedModules = {}, i = 0; i < this.length; i++) {
- var id = this[i][0];
- "number" == typeof id && (alreadyImportedModules[id] = !0);
- }
- for (i = 0; i < modules.length; i++) {
- var item = modules[i];
- "number" == typeof item[0] && alreadyImportedModules[item[0]] || (mediaQuery && !item[2] ? item[2] = mediaQuery : mediaQuery && (item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"),
- list.push(item));
- }
- }, list;
- };
- }, function(module, exports) {
- function addStylesToDom(styles, options) {
- for (var i = 0; i < styles.length; i++) {
- var item = styles[i], 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 {
- for (var parts = [], 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) {
- for (var styles = [], newStyles = {}, i = 0; i < list.length; i++) {
- var item = list[i], id = item[0], css = item[1], media = item[2], sourceMap = item[3], part = {
- css: css,
- media: media,
- sourceMap: sourceMap
- };
- newStyles[id] ? newStyles[id].parts.push(part) : styles.push(newStyles[id] = {
- id: id,
- parts: [ part ]
- });
- }
- return styles;
- }
- function insertStyleElement(options, styleElement) {
- var head = getHeadElement(), lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
- if ("top" === options.insertAt) lastStyleElementInsertedAtTop ? lastStyleElementInsertedAtTop.nextSibling ? head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling) : head.appendChild(styleElement) : head.insertBefore(styleElement, head.firstChild),
- styleElementsInsertedAtTop.push(styleElement); else {
- if ("bottom" !== options.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
- head.appendChild(styleElement);
- }
- }
- function removeStyleElement(styleElement) {
- styleElement.parentNode.removeChild(styleElement);
- var idx = styleElementsInsertedAtTop.indexOf(styleElement);
- idx >= 0 && styleElementsInsertedAtTop.splice(idx, 1);
- }
- function createStyleElement(options) {
- var styleElement = document.createElement("style");
- return styleElement.type = "text/css", insertStyleElement(options, styleElement),
- styleElement;
- }
- function createLinkElement(options) {
- var linkElement = document.createElement("link");
- return linkElement.rel = "stylesheet", insertStyleElement(options, linkElement),
- 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, !1), remove = applyToSingletonTag.bind(null, styleElement, styleIndex, !0);
- } else obj.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (styleElement = createLinkElement(options),
- update = updateLink.bind(null, styleElement), remove = function() {
- removeStyleElement(styleElement), styleElement.href && URL.revokeObjectURL(styleElement.href);
- }) : (styleElement = createStyleElement(options), update = applyToTag.bind(null, styleElement),
- remove = function() {
- removeStyleElement(styleElement);
- });
- return update(obj), function(newObj) {
- if (newObj) {
- if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return;
- update(obj = newObj);
- } else remove();
- };
- }
- 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), childNodes = styleElement.childNodes;
- childNodes[index] && styleElement.removeChild(childNodes[index]), childNodes.length ? styleElement.insertBefore(cssNode, childNodes[index]) : styleElement.appendChild(cssNode);
- }
- }
- function applyToTag(styleElement, obj) {
- var css = obj.css, media = obj.media;
- if (media && styleElement.setAttribute("media", media), styleElement.styleSheet) styleElement.styleSheet.cssText = css; else {
- for (;styleElement.firstChild; ) styleElement.removeChild(styleElement.firstChild);
- styleElement.appendChild(document.createTextNode(css));
- }
- }
- function updateLink(linkElement, obj) {
- var css = obj.css, sourceMap = obj.sourceMap;
- sourceMap && (css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */");
- var blob = new Blob([ css ], {
- type: "text/css"
- }), oldSrc = linkElement.href;
- linkElement.href = URL.createObjectURL(blob), oldSrc && URL.revokeObjectURL(oldSrc);
- }
- var stylesInDom = {}, memoize = function(fn) {
- var memo;
- return function() {
- return void 0 === memo && (memo = fn.apply(this, arguments)), 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 ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment");
- options = options || {}, void 0 === options.singleton && (options.singleton = isOldIE()),
- void 0 === options.insertAt && (options.insertAt = "bottom");
- var styles = listToStyles(list);
- return addStylesToDom(styles, options), function(newList) {
- for (var mayRemove = [], i = 0; i < styles.length; i++) {
- var item = styles[i], domStyle = stylesInDom[item.id];
- domStyle.refs--, mayRemove.push(domStyle);
- }
- if (newList) {
- addStylesToDom(listToStyles(newList), options);
- }
- for (var i = 0; i < mayRemove.length; i++) {
- var domStyle = mayRemove[i];
- if (0 === domStyle.refs) {
- for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
- delete stylesInDom[domStyle.id];
- }
- }
- };
- };
- var replaceText = function() {
- var textStore = [];
- return function(index, replacement) {
- return textStore[index] = replacement, textStore.filter(Boolean).join("\n");
- };
- }();
- }, function(module, exports, __webpack_require__) {
- var content = __webpack_require__(1);
- "string" == typeof content && (content = [ [ module.i, content, "" ] ]);
- __webpack_require__(3)(content, {});
- content.locals && (module.exports = content.locals);
- }, function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- function escapeString(str) {
- return str.replace('"', '"');
- }
- function isObject(value) {
- var type = typeof value;
- return !!value && "object" == type;
- }
- function getObjectName(object) {
- if (void 0 === object) return "";
- if (null === object) return "Object";
- if ("object" == typeof object && !object.constructor) return "Object";
- var funcNameRegex = /function ([^(]*)/, results = funcNameRegex.exec(object.constructor.toString());
- return results && results.length > 1 ? results[1] : "";
- }
- function getValuePreview(type, object, value) {
- return "null" === type || "undefined" === type ? type : ("string" !== type && "stringifiable" !== type || (value = '"' + escapeString(value) + '"'),
- "function" === type ? object.toString().replace(/[\r\n]/g, "").replace(/\{.*\}/, "") + "{…}" : value);
- }
- function getPreview(type, object) {
- var value = "";
- return isObject(object) ? (value = getObjectName(object), Array.isArray(object) && (value += "[" + object.length + "]")) : value = getValuePreview(type, object, object),
- value;
- }
- function cssClass(className) {
- return "json-formatter-" + className;
- }
- function createElement(type, className, content) {
- var el = document.createElement(type);
- return className && el.classList.add(cssClass(className)), void 0 !== content && (content instanceof Node ? el.appendChild(content) : el.appendChild(document.createTextNode(String(content)))),
- el;
- }
- __webpack_exports__.a = isObject, __webpack_exports__.b = getObjectName, __webpack_exports__.f = getValuePreview,
- __webpack_exports__.d = getPreview, __webpack_exports__.c = cssClass, __webpack_exports__.e = createElement;
- }, function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(0);
- } ]);
- //# sourceMappingURL=json-formatter.js.map
- /***/ }),
- /* 1 */
- /***/ (function(module, exports, __webpack_require__) {
- var JSONFormatter = __webpack_require__(0).default;
- var live = document.getElementById('live');
- var hoverPreviewEnabledCheckbox = document.getElementById('hoverPreviewEnabled');
- function render() {
- live.style.backgroundColor = 'transparent';
- var result = document.getElementById('live-result');
- try {
- var formatter = new JSONFormatter(JSON.parse(live.value), 1, { hoverPreviewEnabled: hoverPreviewEnabledCheckbox.checked });
- result.innerHTML = '';
- result.appendChild(formatter.render());
- } catch (e) {
- live.style.backgroundColor = 'rgba(255, 87, 34, 0.35)';
- }
- }
- live.addEventListener('keyup', render);
- hoverPreviewEnabledCheckbox.addEventListener('change', render);
- render();
- var complex = {
- numbers: [
- 1,
- 2,
- 3
- ],
- boolean: true,
- 'null': null,
- number: 123,
- anObject: {
- a: 'b',
- e: 'd',
- c: 'f\"'
- },
- string: 'Hello World',
- url: 'https://github.com/mohsen1/json-formatter-js',
- date: new Date(),
- func: function add(a, b) { return a + b; }
- };
- var deep = { a: { b: { c: { d: {} } } } };
- var examples = [
- { title: 'Complex', json: complex },
- { title: 'Number', json: 42 },
- { title: 'null', json: null },
- { title: 'Empty Object', json: Object.create(null) },
- { title: 'Empty Array', json: [] },
- { title: 'Deep', json: deep },
- { title: 'Dark', json: complex, config: { theme: 'dark' } },
- { title: 'Sorted Keys', json: complex, config: { sortPropertiesBy: (a, b) => a > b } }
- ];
- var result = document.querySelector('.result');
- examples.forEach(function (example) {
- var title = document.createElement('h3');
- var formatter = new JSONFormatter(example.json, 1, example.config);
- title.innerText = example.title;
- result.appendChild(title)
- var el = formatter.render();
- if (example.config && example.config.theme === 'dark') {
- el.style.backgroundColor = '#1E1E1E';
- }
- result.appendChild(el);
- });
- fetch('demo/giant.json').then(function (resp) {
- resp.json().then(function (giant) {
- var giantFormatter = new JSONFormatter(giant, 2, { hoverPreviewEnabled: true });
- var title = document.createElement('h3');
- title.innerText = 'Giant JSON';
- result.appendChild(title);
- console.time('Rendering giant JSON');
- result.appendChild(giantFormatter.render());
- console.timeEnd('Rendering giant JSON');
- });
- })
- /***/ })
- /******/ ]);
- //# sourceMappingURL=index.js.map
|