From 4b6be7a87197dba9aa4cb44481c633a29cc8ca07 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 25 Sep 2018 16:49:26 +0800 Subject: [PATCH] - Incomplete enhancement: Add Openclipart query page (using Jamilih); need to better format results and tie into Imagelib --- .../extensions/imagelib/openclipart-es.html | 13 + editor/extensions/imagelib/openclipart.js | 193 ++ editor/external/jamilih/jml-es.js | 1623 +++++++++++++++++ package-lock.json | 665 +++++++ package.json | 3 +- 5 files changed, 2496 insertions(+), 1 deletion(-) create mode 100644 editor/extensions/imagelib/openclipart-es.html create mode 100644 editor/extensions/imagelib/openclipart.js create mode 100644 editor/external/jamilih/jml-es.js diff --git a/editor/extensions/imagelib/openclipart-es.html b/editor/extensions/imagelib/openclipart-es.html new file mode 100644 index 00000000..55dbbea8 --- /dev/null +++ b/editor/extensions/imagelib/openclipart-es.html @@ -0,0 +1,13 @@ + + + + + - + + + + + + + + diff --git a/editor/extensions/imagelib/openclipart.js b/editor/extensions/imagelib/openclipart.js new file mode 100644 index 00000000..0eca15d2 --- /dev/null +++ b/editor/extensions/imagelib/openclipart.js @@ -0,0 +1,193 @@ +import {jml, $, body} from '../../external/jamilih/jml-es.js'; + +jml('div', [ + ['style', [ + `.control { + padding-top: 10px; + }` + ]], + ['form', { + $on: { + async submit (e) { + e.preventDefault(); + await this.$submit(); + } + }, + $custom: { + async $submit () { + console.log('submit2'); + const results = $('#results'); + while (results.hasChildNodes()) { + results.firstChild.remove(); + } + const url = new URL('https://openclipart.org/search/json/'); + [ + 'query', 'sort', 'amount', 'page' + ].forEach((prop) => { + const {value} = $('#' + prop); + url.searchParams.set(prop, value); + }); + const r = await fetch(url); + const json = await r.json(); + + if (!json || json.msg !== 'success') { + alert('There was a problem downloading the results'); + } + console.log('json', json); + const {payload, info: { + results: numResults, + pages, + current_page: currentPage + }} = json; + + // $('#page').value = currentPage; + // $('#page').max = pages; + + function queryLink (uploader) { + return ['a', { + href: '#', + dataset: {value: uploader}, + $on: {click (e) { + e.preventDefault(); + const {value} = this.dataset; + console.log('v0', value); + }} + }, [uploader]]; + } + + // Unused properties: + // - `svg_filesize` always 0? + // - `dimensions: {png_thumb: {width, height}, png_full_lossy: {width, height}}` object of relevance? + // - No need for `tags` with `tags_array` + // - `svg`'s: `png_thumb`, `png_full_lossy`, `png_2400px` + jml(results, [ + ['span', [ + 'Number of results: ', + numResults + ]], + ['span', [ + 'Page ', + currentPage, + 'out of: ', + pages + ]], + ...payload.map(({ + title, description, id, + uploader, created, + svg: {url: svgURL}, + detail_link: detailLink, + tags_array: tagsArray, + downloaded_by: downloadedBy, + total_favorites: totalFavorites + }) => { + return ['div', [ + ['b', [title]], + ['br'], + ['i', [description]], + ['span', [ + ['a', { + href: detailLink, + target: '_blank' + }, ['Details']] + ]], + ['button', { + $on: { + async click () { + const svgURL = this.dataset.value; + console.log('this', svgURL); + /* + const result = await fetch(svgURL); + const svg = await result.text(); + console.log('svg', svg); + */ + // Todo: Pass to our API + } + }, + dataset: {value: svgURL} + }, [ + 'Use SVG' + ]], + ['span', [ + '(ID: ', + ['a', { + href: '#', + dataset: {value: id}, + $on: {click (e) { + e.preventDefault(); + const {value} = this.dataset; + // Todo: byids for searching by id/comma-separated ids + console.log('v', value); + }} + }, [id]], + ')' + ]], + ['span', [ + 'Uploaded by: ', + queryLink(uploader) + ]], + ...tagsArray.map((tag) => { + return ['span', [ + ' ', + queryLink(tag) + ]]; + }), + ['span', [ + 'Created date: ', + created + ]], + ['span', [ + 'Download count: ', + downloadedBy + ]], + ['span', [ + 'Times used as favorite: ', + totalFavorites + ]] + ]]; + }) + ]); + } + } + }, [ + // Todo: i18nize + ['div', {class: 'control'}, [ + ['label', [ + 'Query (Title, description, uploader, or tag): ', + ['input', {id: 'query', name: 'query'}] + ]] + ]], + ['div', {class: 'control'}, [ + ['label', [ + 'Sort by: ', + ['select', {id: 'sort'}, [ + // Todo: i18nize first values + ['Date', 'date'], + ['Downloads', 'downloads'], + ['Favorited', 'favorites'] + ].map(([text, value = text]) => { + return ['option', {value}, [text]]; + })] + ]] + ]], + ['div', {class: 'control'}, [ + ['label', [ + 'Results per page: ', + ['input', {id: 'amount', name: 'amount', value: 10, type: 'number', min: 1, max: 200, step: 1, pattern: '\\d+'}] + ]] + ]], + ['div', {class: 'control'}, [ + ['label', [ + 'Page number: ', + ['input', { + // max: 1, // We'll change this based on available results + id: 'page', name: 'page', value: 1, style: 'width: 40px;', + type: 'number', min: 1, step: 1, pattern: '\\d+' + }] + ]] + ]], + ['div', {class: 'control'}, [ + ['input', {type: 'submit'}] + ]] + ]], + ['div', {id: 'results'}] +], body); diff --git a/editor/external/jamilih/jml-es.js b/editor/external/jamilih/jml-es.js new file mode 100644 index 00000000..ff2703a0 --- /dev/null +++ b/editor/external/jamilih/jml-es.js @@ -0,0 +1,1623 @@ +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; +}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = 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); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +var get = function get(object, property, receiver) { + if (object === null) object = Function.prototype; + var desc = Object.getOwnPropertyDescriptor(object, property); + + if (desc === undefined) { + var parent = Object.getPrototypeOf(object); + + if (parent === null) { + return undefined; + } else { + return get(parent, property, receiver); + } + } else if ("value" in desc) { + return desc.value; + } else { + var getter = desc.get; + + if (getter === undefined) { + return undefined; + } + + return getter.call(receiver); + } +}; + +var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; + +var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; + +var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); + +var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } +}; + +/* +Possible todos: +0. Add XSLT to JML-string stylesheet (or even vice versa) +0. IE problem: Add JsonML code to handle name attribute (during element creation) +0. Element-specific: IE object-param handling + +Todos inspired by JsonML: https://github.com/mckamey/jsonml/blob/master/jsonml-html.js + +0. duplicate attributes? +0. expand ATTR_MAP +0. equivalent of markup, to allow strings to be embedded within an object (e.g., {$value: '
id
'}); advantage over innerHTML in that it wouldn't need to work as the entire contents (nor destroy any existing content or handlers) +0. More validation? +0. JsonML DOM Level 0 listener +0. Whitespace trimming? + +JsonML element-specific: +0. table appending +0. canHaveChildren necessary? (attempts to append to script and img) + +Other Todos: +0. Note to self: Integrate research from other jml notes +0. Allow Jamilih to be seeded with an existing element, so as to be able to add/modify attributes and children +0. Allow array as single first argument +0. Settle on whether need to use null as last argument to return array (or fragment) or other way to allow appending? Options object at end instead to indicate whether returning array, fragment, first element, etc.? +0. Allow building of generic XML (pass configuration object) +0. Allow building content internally as a string (though allowing DOM methods, etc.?) +0. Support JsonML empty string element name to represent fragments? +0. Redo browser testing of jml (including ensuring IE7 can work even if test framework can't work) +*/ + +var win = typeof window !== 'undefined' && window; +var doc = typeof document !== 'undefined' && document; +var XmlSerializer = typeof XMLSerializer !== 'undefined' && XMLSerializer; + +// STATIC PROPERTIES + +var possibleOptions = ['$plugins', '$map' // Add any other options here +]; + +var NS_HTML = 'http://www.w3.org/1999/xhtml', + hyphenForCamelCase = /-([a-z])/g; + +var ATTR_MAP = { + 'readonly': 'readOnly' +}; + +// We define separately from ATTR_DOM for clarity (and parity with JsonML) but no current need +// We don't set attribute esp. for boolean atts as we want to allow setting of `undefined` +// (e.g., from an empty variable) on templates to have no effect +var BOOL_ATTS = ['checked', 'defaultChecked', 'defaultSelected', 'disabled', 'indeterminate', 'open', // Dialog elements +'readOnly', 'selected']; +var ATTR_DOM = BOOL_ATTS.concat([// From JsonML +'accessKey', // HTMLElement +'async', 'autocapitalize', // HTMLElement +'autofocus', 'contentEditable', // HTMLElement through ElementContentEditable +'defaultValue', 'defer', 'draggable', // HTMLElement +'formnovalidate', 'hidden', // HTMLElement +'innerText', // HTMLElement +'inputMode', // HTMLElement through ElementContentEditable +'ismap', 'multiple', 'novalidate', 'pattern', 'required', 'spellcheck', // HTMLElement +'translate', // HTMLElement +'value', 'willvalidate']); +// Todo: Add more to this as useful for templating +// to avoid setting through nullish value +var NULLABLES = ['dir', // HTMLElement +'lang', // HTMLElement +'max', 'min', 'title' // HTMLElement +]; + +var $ = function $(sel) { + return doc.querySelector(sel); +}; +var $$ = function $$(sel) { + return [].concat(toConsumableArray(doc.querySelectorAll(sel))); +}; + +/** +* Retrieve the (lower-cased) HTML name of a node +* @static +* @param {Node} node The HTML node +* @returns {String} The lower-cased node name +*/ +function _getHTMLNodeName(node) { + return node.nodeName && node.nodeName.toLowerCase(); +} + +/** +* Apply styles if this is a style tag +* @static +* @param {Node} node The element to check whether it is a style tag +*/ +function _applyAnyStylesheet(node) { + if (!doc.createStyleSheet) { + return; + } + if (_getHTMLNodeName(node) === 'style') { + // IE + var ss = doc.createStyleSheet(); // Create a stylesheet to actually do something useful + ss.cssText = node.cssText; + // We continue to add the style tag, however + } +} + +/** + * Need this function for IE since options weren't otherwise getting added + * @private + * @static + * @param {DOMElement} parent The parent to which to append the element + * @param {DOMNode} child The element or other node to append to the parent + */ +function _appendNode(parent, child) { + var parentName = _getHTMLNodeName(parent); + var childName = _getHTMLNodeName(child); + + if (doc.createStyleSheet) { + if (parentName === 'script') { + parent.text = child.nodeValue; + return; + } + if (parentName === 'style') { + parent.cssText = child.nodeValue; // This will not apply it--just make it available within the DOM cotents + return; + } + } + if (parentName === 'template') { + parent.content.appendChild(child); + return; + } + try { + parent.appendChild(child); // IE9 is now ok with this + } catch (e) { + if (parentName === 'select' && childName === 'option') { + try { + // Since this is now DOM Level 4 standard behavior (and what IE7+ can handle), we try it first + parent.add(child); + } catch (err) { + // DOM Level 2 did require a second argument, so we try it too just in case the user is using an older version of Firefox, etc. + parent.add(child, null); // IE7 has a problem with this, but IE8+ is ok + } + return; + } + throw e; + } +} + +/** + * Attach event in a cross-browser fashion + * @static + * @param {DOMElement} el DOM element to which to attach the event + * @param {String} type The DOM event (without 'on') to attach to the element + * @param {Function} handler The event handler to attach to the element + * @param {Boolean} [capturing] Whether or not the event should be + * capturing (W3C-browsers only); default is false; NOT IN USE + */ +function _addEvent(el, type, handler, capturing) { + el.addEventListener(type, handler, !!capturing); +} + +/** +* Creates a text node of the result of resolving an entity or character reference +* @param {'entity'|'decimal'|'hexadecimal'} type Type of reference +* @param {String} prefix Text to prefix immediately after the "&" +* @param {String} arg The body of the reference +* @returns {Text} The text node of the resolved reference +*/ +function _createSafeReference(type, prefix, arg) { + // For security reasons related to innerHTML, we ensure this string only contains potential entity characters + if (!arg.match(/^\w+$/)) { + throw new TypeError('Bad ' + type); + } + var elContainer = doc.createElement('div'); + // Todo: No workaround for XML? + elContainer.innerHTML = '&' + prefix + arg + ';'; + return doc.createTextNode(elContainer.innerHTML); +} + +/** +* @param {String} n0 Whole expression match (including "-") +* @param {String} n1 Lower-case letter match +* @returns {String} Uppercased letter +*/ +function _upperCase(n0, n1) { + return n1.toUpperCase(); +} + +/** +* @private +* @static +*/ +function _getType(item) { + if (typeof item === 'string') { + return 'string'; + } + if ((typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object') { + if (item === null) { + return 'null'; + } + if (Array.isArray(item)) { + return 'array'; + } + if ('nodeType' in item) { + if (item.nodeType === 1) { + return 'element'; + } + if (item.nodeType === 11) { + return 'fragment'; + } + } + return 'object'; + } + return undefined; +} + +/** +* @private +* @static +*/ +function _fragReducer(frag, node) { + frag.appendChild(node); + return frag; +} + +/** +* @private +* @static +*/ +function _replaceDefiner(xmlnsObj) { + return function (n0) { + var retStr = xmlnsObj[''] ? ' xmlns="' + xmlnsObj[''] + '"' : n0 || ''; // Preserve XHTML + for (var ns in xmlnsObj) { + if (xmlnsObj.hasOwnProperty(ns)) { + if (ns !== '') { + retStr += ' xmlns:' + ns + '="' + xmlnsObj[ns] + '"'; + } + } + } + return retStr; + }; +} + +function _optsOrUndefinedJML() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return jml.apply(undefined, toConsumableArray(args[0] === undefined ? args.slice(1) : args)); +} + +/** +* @private +* @static +*/ +function _jmlSingleArg(arg) { + return jml(arg); +} + +/** +* @private +* @static +*/ +function _copyOrderedAtts(attArr) { + var obj = {}; + // Todo: Fix if allow prefixed attributes + obj[attArr[0]] = attArr[1]; // array of ordered attribute-value arrays + return obj; +} + +/** +* @private +* @static +*/ +function _childrenToJML(node) { + return function (childNodeJML, i) { + var cn = node.childNodes[i]; + var j = Array.isArray(childNodeJML) ? jml.apply(undefined, toConsumableArray(childNodeJML)) : jml(childNodeJML); + cn.parentNode.replaceChild(j, cn); + }; +} + +/** +* @private +* @static +*/ +function _appendJML(node) { + return function (childJML) { + node.appendChild(jml.apply(undefined, toConsumableArray(childJML))); + }; +} + +/** +* @private +* @static +*/ +function _appendJMLOrText(node) { + return function (childJML) { + if (typeof childJML === 'string') { + node.appendChild(doc.createTextNode(childJML)); + } else { + node.appendChild(jml.apply(undefined, toConsumableArray(childJML))); + } + }; +} + +/** +* @private +* @static +function _DOMfromJMLOrString (childNodeJML) { + if (typeof childNodeJML === 'string') { + return doc.createTextNode(childNodeJML); + } + return jml(...childNodeJML); +} +*/ + +/** + * Creates an XHTML or HTML element (XHTML is preferred, but only in browsers that support); + * Any element after element can be omitted, and any subsequent type or types added afterwards + * @requires polyfill: Array.isArray + * @requires polyfill: Array.prototype.reduce For returning a document fragment + * @requires polyfill: Element.prototype.dataset For dataset functionality (Will not work in IE <= 7) + * @param {String} el The element to create (by lower-case name) + * @param {Object} [atts] Attributes to add with the key as the attribute name and value as the + * attribute value; important for IE where the input element's type cannot + * be added later after already added to the page + * @param {DOMElement[]} [children] The optional children of this element (but raw DOM elements + * required to be specified within arrays since + * could not otherwise be distinguished from siblings being added) + * @param {DOMElement} [parent] The optional parent to which to attach the element (always the last + * unless followed by null, in which case it is the second-to-last) + * @param {null} [returning] Can use null to indicate an array of elements should be returned + * @returns {DOMElement} The newly created (and possibly already appended) element or array of elements + */ +var jml = function jml() { + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + var elem = doc.createDocumentFragment(); + function _checkAtts(atts) { + var att = void 0; + for (att in atts) { + if (!atts.hasOwnProperty(att)) { + continue; + } + var attVal = atts[att]; + att = att in ATTR_MAP ? ATTR_MAP[att] : att; + if (NULLABLES.includes(att)) { + if (attVal != null) { + elem[att] = attVal; + } + continue; + } else if (ATTR_DOM.includes(att)) { + elem[att] = attVal; + continue; + } + switch (att) { + /* + Todos: + 0. JSON mode to prevent event addition + 0. {$xmlDocument: []} // doc.implementation.createDocument + 0. Accept array for any attribute with first item as prefix and second as value? + 0. {$: ['xhtml', 'div']} for prefixed elements + case '$': // Element with prefix? + nodes[nodes.length] = elem = doc.createElementNS(attVal[0], attVal[1]); + break; + */ + case '#': + { + // Document fragment + nodes[nodes.length] = _optsOrUndefinedJML(opts, attVal); + break; + }case '$shadow': + { + var open = attVal.open, + closed = attVal.closed; + var content = attVal.content, + template = attVal.template; + + var shadowRoot = elem.attachShadow({ + mode: closed || open === false ? 'closed' : 'open' + }); + if (template) { + if (Array.isArray(template)) { + if (_getType(template[0]) === 'object') { + // Has attributes + template = jml.apply(undefined, ['template'].concat(toConsumableArray(template), [doc.body])); + } else { + // Array is for the children + template = jml('template', template, doc.body); + } + } else if (typeof template === 'string') { + template = $(template); + } + jml(template.content.cloneNode(true), shadowRoot); + } else { + if (!content) { + content = open || closed; + } + if (content && typeof content !== 'boolean') { + if (Array.isArray(content)) { + jml({ '#': content }, shadowRoot); + } else { + jml(content, shadowRoot); + } + } + } + break; + }case 'is': + { + // Not yet supported in browsers + // Handled during element creation + break; + }case '$custom': + { + Object.assign(elem, attVal); + break; + }case '$define': + { + var _ret = function () { + var localName = elem.localName.toLowerCase(); + // Note: customized built-ins sadly not working yet + var customizedBuiltIn = !localName.includes('-'); + + var def = customizedBuiltIn ? elem.getAttribute('is') : localName; + if (customElements.get(def)) { + return 'break'; + } + var getConstructor = function getConstructor(cb) { + var baseClass = options && options.extends ? doc.createElement(options.extends).constructor : customizedBuiltIn ? doc.createElement(localName).constructor : HTMLElement; + return cb ? function (_baseClass) { + inherits(_class, _baseClass); + + function _class() { + classCallCheck(this, _class); + + var _this = possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this)); + + cb.call(_this); + return _this; + } + + return _class; + }(baseClass) : function (_baseClass2) { + inherits(_class2, _baseClass2); + + function _class2() { + classCallCheck(this, _class2); + return possibleConstructorReturn(this, (_class2.__proto__ || Object.getPrototypeOf(_class2)).apply(this, arguments)); + } + + return _class2; + }(baseClass); + }; + + var constructor = void 0, + options = void 0, + prototype = void 0; + if (Array.isArray(attVal)) { + if (attVal.length <= 2) { + var _attVal = slicedToArray(attVal, 2); + + constructor = _attVal[0]; + options = _attVal[1]; + + if (typeof options === 'string') { + options = { extends: options }; + } else if (!options.hasOwnProperty('extends')) { + prototype = options; + } + if ((typeof constructor === 'undefined' ? 'undefined' : _typeof(constructor)) === 'object') { + prototype = constructor; + constructor = getConstructor(); + } + } else { + var _attVal2 = slicedToArray(attVal, 3); + + constructor = _attVal2[0]; + prototype = _attVal2[1]; + options = _attVal2[2]; + + if (typeof options === 'string') { + options = { extends: options }; + } + } + } else if (typeof attVal === 'function') { + constructor = attVal; + } else { + prototype = attVal; + constructor = getConstructor(); + } + if (!constructor.toString().startsWith('class')) { + constructor = getConstructor(constructor); + } + if (!options && customizedBuiltIn) { + options = { extends: localName }; + } + if (prototype) { + Object.assign(constructor.prototype, prototype); + } + customElements.define(def, constructor, customizedBuiltIn ? options : undefined); + return 'break'; + }(); + + if (_ret === 'break') break; + }case '$symbol': + { + var _attVal3 = slicedToArray(attVal, 2), + symbol = _attVal3[0], + func = _attVal3[1]; + + if (typeof func === 'function') { + var funcBound = func.bind(elem); + if (typeof symbol === 'string') { + elem[Symbol.for(symbol)] = funcBound; + } else { + elem[symbol] = funcBound; + } + } else { + var obj = func; + obj.elem = elem; + if (typeof symbol === 'string') { + elem[Symbol.for(symbol)] = obj; + } else { + elem[symbol] = obj; + } + } + break; + }case '$data': + { + setMap(attVal); + break; + }case '$attribute': + { + // Attribute node + var node = attVal.length === 3 ? doc.createAttributeNS(attVal[0], attVal[1]) : doc.createAttribute(attVal[0]); + node.value = attVal[attVal.length - 1]; + nodes[nodes.length] = node; + break; + }case '$text': + { + // Todo: Also allow as jml(['a text node']) (or should that become a fragment)? + var _node = doc.createTextNode(attVal); + nodes[nodes.length] = _node; + break; + }case '$document': + { + // Todo: Conditionally create XML document + var _node2 = doc.implementation.createHTMLDocument(); + if (attVal.childNodes) { + attVal.childNodes.forEach(_childrenToJML(_node2)); + // Remove any extra nodes created by createHTMLDocument(). + var j = attVal.childNodes.length; + while (_node2.childNodes[j]) { + var cn = _node2.childNodes[j]; + cn.parentNode.removeChild(cn); + j++; + } + } else { + if (attVal.$DOCTYPE) { + var dt = { $DOCTYPE: attVal.$DOCTYPE }; + var doctype = jml(dt); + _node2.firstChild.replaceWith(doctype); + } + var html = _node2.childNodes[1]; + var head = html.childNodes[0]; + var _body = html.childNodes[1]; + if (attVal.title || attVal.head) { + var meta = doc.createElement('meta'); + meta.setAttribute('charset', 'utf-8'); + head.appendChild(meta); + } + if (attVal.title) { + _node2.title = attVal.title; // Appends after meta + } + if (attVal.head) { + attVal.head.forEach(_appendJML(head)); + } + if (attVal.body) { + attVal.body.forEach(_appendJMLOrText(_body)); + } + } + nodes[nodes.length] = _node2; + break; + }case '$DOCTYPE': + { + /* + // Todo: + if (attVal.internalSubset) { + node = {}; + } + else + */ + var _node3 = void 0; + if (attVal.entities || attVal.notations) { + _node3 = { + name: attVal.name, + nodeName: attVal.name, + nodeValue: null, + nodeType: 10, + entities: attVal.entities.map(_jmlSingleArg), + notations: attVal.notations.map(_jmlSingleArg), + publicId: attVal.publicId, + systemId: attVal.systemId + // internalSubset: // Todo + }; + } else { + _node3 = doc.implementation.createDocumentType(attVal.name, attVal.publicId || '', attVal.systemId || ''); + } + nodes[nodes.length] = _node3; + break; + }case '$ENTITY': + { + /* + // Todo: Should we auto-copy another node's properties/methods (like DocumentType) excluding or changing its non-entity node values? + const node = { + nodeName: attVal.name, + nodeValue: null, + publicId: attVal.publicId, + systemId: attVal.systemId, + notationName: attVal.notationName, + nodeType: 6, + childNodes: attVal.childNodes.map(_DOMfromJMLOrString) + }; + */ + break; + }case '$NOTATION': + { + // Todo: We could add further properties/methods, but unlikely to be used as is. + var _node4 = { nodeName: attVal[0], publicID: attVal[1], systemID: attVal[2], nodeValue: null, nodeType: 12 }; + nodes[nodes.length] = _node4; + break; + }case '$on': + { + // Events + for (var p2 in attVal) { + if (attVal.hasOwnProperty(p2)) { + var val = attVal[p2]; + if (typeof val === 'function') { + val = [val, false]; + } + if (typeof val[0] === 'function') { + _addEvent(elem, p2, val[0], val[1]); // element, event name, handler, capturing + } + } + } + break; + }case 'className':case 'class': + if (attVal != null) { + elem.className = attVal; + } + break; + case 'dataset': + { + var _ret2 = function () { + // Map can be keyed with hyphenated or camel-cased properties + var recurse = function recurse(attVal, startProp) { + var prop = ''; + var pastInitialProp = startProp !== ''; + Object.keys(attVal).forEach(function (key) { + var value = attVal[key]; + if (pastInitialProp) { + prop = startProp + key.replace(hyphenForCamelCase, _upperCase).replace(/^([a-z])/, _upperCase); + } else { + prop = startProp + key.replace(hyphenForCamelCase, _upperCase); + } + if (value === null || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') { + if (value != null) { + elem.dataset[prop] = value; + } + prop = startProp; + return; + } + recurse(value, prop); + }); + }; + recurse(attVal, ''); + return 'break'; + // Todo: Disable this by default unless configuration explicitly allows (for security) + }(); + + break; + } + // #if IS_REMOVE + // Don't remove this `if` block (for sake of no-innerHTML build) + case 'innerHTML': + if (attVal != null) { + elem.innerHTML = attVal; + } + break; + // #endif + case 'htmlFor':case 'for': + if (elStr === 'label') { + if (attVal != null) { + elem.htmlFor = attVal; + } + break; + } + elem.setAttribute(att, attVal); + break; + case 'xmlns': + // Already handled + break; + default: + if (att.match(/^on/)) { + elem[att] = attVal; + // _addEvent(elem, att.slice(2), attVal, false); // This worked, but perhaps the user wishes only one event + break; + } + if (att === 'style') { + if (attVal == null) { + break; + } + if ((typeof attVal === 'undefined' ? 'undefined' : _typeof(attVal)) === 'object') { + for (var _p in attVal) { + if (attVal.hasOwnProperty(_p) && attVal[_p] != null) { + // Todo: Handle aggregate properties like "border" + if (_p === 'float') { + elem.style.cssFloat = attVal[_p]; + elem.style.styleFloat = attVal[_p]; // Harmless though we could make conditional on older IE instead + } else { + elem.style[_p.replace(hyphenForCamelCase, _upperCase)] = attVal[_p]; + } + } + } + break; + } + // setAttribute unfortunately erases any existing styles + elem.setAttribute(att, attVal); + /* + // The following reorders which is troublesome for serialization, e.g., as used in our testing + if (elem.style.cssText !== undefined) { + elem.style.cssText += attVal; + } else { // Opera + elem.style += attVal; + } + */ + break; + } + var matchingPlugin = opts && opts.$plugins && opts.$plugins.find(function (p) { + return p.name === att; + }); + if (matchingPlugin) { + matchingPlugin.set({ element: elem, attribute: { name: att, value: attVal } }); + break; + } + elem.setAttribute(att, attVal); + break; + } + } + } + var nodes = []; + var elStr = void 0; + var opts = void 0; + var isRoot = false; + if (_getType(args[0]) === 'object' && Object.keys(args[0]).some(function (key) { + return possibleOptions.includes(key); + })) { + opts = args[0]; + if (opts.state !== 'child') { + isRoot = true; + opts.state = 'child'; + } + if (opts.$map && !opts.$map.root && opts.$map.root !== false) { + opts.$map = { root: opts.$map }; + } + if ('$plugins' in opts) { + if (!Array.isArray(opts.$plugins)) { + throw new Error('$plugins must be an array'); + } + opts.$plugins.forEach(function (pluginObj) { + if (!pluginObj) { + throw new TypeError('Plugin must be an object'); + } + if (!pluginObj.name || !pluginObj.name.startsWith('$_')) { + throw new TypeError('Plugin object name must be present and begin with `$_`'); + } + if (typeof pluginObj.set !== 'function') { + throw new TypeError('Plugin object must have a `set` method'); + } + }); + } + args = args.slice(1); + } + var argc = args.length; + var defaultMap = opts && opts.$map && opts.$map.root; + var setMap = function setMap(dataVal) { + var map = void 0, + obj = void 0; + // Boolean indicating use of default map and object + if (dataVal === true) { + var _defaultMap = slicedToArray(defaultMap, 2); + + map = _defaultMap[0]; + obj = _defaultMap[1]; + } else if (Array.isArray(dataVal)) { + // Array of strings mapping to default + if (typeof dataVal[0] === 'string') { + dataVal.forEach(function (dVal) { + setMap(opts.$map[dVal]); + }); + // Array of Map and non-map data object + } else { + map = dataVal[0] || defaultMap[0]; + obj = dataVal[1] || defaultMap[1]; + } + // Map + } else if (/^\[object (?:Weak)?Map\]$/.test([].toString.call(dataVal))) { + map = dataVal; + obj = defaultMap[1]; + // Non-map data object + } else { + map = defaultMap[0]; + obj = dataVal; + } + map.set(elem, obj); + }; + for (var i = 0; i < argc; i++) { + var arg = args[i]; + switch (_getType(arg)) { + case 'null': + // null always indicates a place-holder (only needed for last argument if want array returned) + if (i === argc - 1) { + _applyAnyStylesheet(nodes[0]); // We have to execute any stylesheets even if not appending or otherwise IE will never apply them + // Todo: Fix to allow application of stylesheets of style tags within fragments? + return nodes.length <= 1 ? nodes[0] : nodes.reduce(_fragReducer, doc.createDocumentFragment()); // nodes; + } + break; + case 'string': + // Strings indicate elements + switch (arg) { + case '!': + nodes[nodes.length] = doc.createComment(args[++i]); + break; + case '?': + arg = args[++i]; + var procValue = args[++i]; + var val = procValue; + if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') { + procValue = []; + for (var p in val) { + if (val.hasOwnProperty(p)) { + procValue.push(p + '=' + '"' + val[p].replace(/"/g, '\\"') + '"'); + } + } + procValue = procValue.join(' '); + } + // Firefox allows instructions with ">" in this method, but not if placed directly! + try { + nodes[nodes.length] = doc.createProcessingInstruction(arg, procValue); + } catch (e) { + // Getting NotSupportedError in IE, so we try to imitate a processing instruction with a comment + // innerHTML didn't work + // var elContainer = doc.createElement('div'); + // elContainer.innerHTML = ''; + // nodes[nodes.length] = elContainer.innerHTML; + // Todo: any other way to resolve? Just use XML? + nodes[nodes.length] = doc.createComment('?' + arg + ' ' + procValue + '?'); + } + break; + // Browsers don't support doc.createEntityReference, so we just use this as a convenience + case '&': + nodes[nodes.length] = _createSafeReference('entity', '', args[++i]); + break; + case '#': + // // Decimal character reference - ['#', '01234'] // Ӓ // probably easier to use JavaScript Unicode escapes + nodes[nodes.length] = _createSafeReference('decimal', arg, String(args[++i])); + break; + case '#x': + // Hex character reference - ['#x', '123a'] // ሺ // probably easier to use JavaScript Unicode escapes + nodes[nodes.length] = _createSafeReference('hexadecimal', arg, args[++i]); + break; + case '![': + // '![', ['escaped <&> text'] // text]]> + // CDATA valid in XML only, so we'll just treat as text for mutual compatibility + // Todo: config (or detection via some kind of doc.documentType property?) of whether in XML + try { + nodes[nodes.length] = doc.createCDATASection(args[++i]); + } catch (e2) { + nodes[nodes.length] = doc.createTextNode(args[i]); // i already incremented + } + break; + case '': + nodes[nodes.length] = doc.createDocumentFragment(); + break; + default: + { + // An element + elStr = arg; + var _atts = args[i + 1]; + // Todo: Fix this to depend on XML/config, not availability of methods + if (_getType(_atts) === 'object' && _atts.is) { + var is = _atts.is; + + if (doc.createElementNS) { + elem = doc.createElementNS(NS_HTML, elStr, { is: is }); + } else { + elem = doc.createElement(elStr, { is: is }); + } + } else { + if (doc.createElementNS) { + elem = doc.createElementNS(NS_HTML, elStr); + } else { + elem = doc.createElement(elStr); + } + } + nodes[nodes.length] = elem; // Add to parent + break; + } + } + break; + case 'object': + // Non-DOM-element objects indicate attribute-value pairs + var atts = arg; + + if (atts.xmlns !== undefined) { + // We handle this here, as otherwise may lose events, etc. + // As namespace of element already set as XHTML, we need to change the namespace + // elem.setAttribute('xmlns', atts.xmlns); // Doesn't work + // Can't set namespaceURI dynamically, renameNode() is not supported, and setAttribute() doesn't work to change the namespace, so we resort to this hack + var replacer = void 0; + if (_typeof(atts.xmlns) === 'object') { + replacer = _replaceDefiner(atts.xmlns); + } else { + replacer = ' xmlns="' + atts.xmlns + '"'; + } + // try { + // Also fix DOMParser to work with text/html + elem = nodes[nodes.length - 1] = new DOMParser().parseFromString(new XmlSerializer().serializeToString(elem) + // Mozilla adds XHTML namespace + .replace(' xmlns="' + NS_HTML + '"', replacer), 'application/xml').documentElement; + // }catch(e) {alert(elem.outerHTML);throw e;} + } + var orderedArr = atts.$a ? atts.$a.map(_copyOrderedAtts) : [atts]; + orderedArr.forEach(_checkAtts); + break; + case 'fragment': + case 'element': + /* + 1) Last element always the parent (put null if don't want parent and want to return array) unless only atts and children (no other elements) + 2) Individual elements (DOM elements or sequences of string[/object/array]) get added to parent first-in, first-added + */ + if (i === 0) { + // Allow wrapping of element + elem = arg; + } + if (i === argc - 1 || i === argc - 2 && args[i + 1] === null) { + // parent + var elsl = nodes.length; + for (var k = 0; k < elsl; k++) { + _appendNode(arg, nodes[k]); + } + // Todo: Apply stylesheets if any style tags were added elsewhere besides the first element? + _applyAnyStylesheet(nodes[0]); // We have to execute any stylesheets even if not appending or otherwise IE will never apply them + } else { + nodes[nodes.length] = arg; + } + break; + case 'array': + // Arrays or arrays of arrays indicate child nodes + var child = arg; + var cl = child.length; + for (var j = 0; j < cl; j++) { + // Go through children array container to handle elements + var childContent = child[j]; + var childContentType = typeof childContent === 'undefined' ? 'undefined' : _typeof(childContent); + if (childContent === undefined) { + throw String('Parent array:' + JSON.stringify(args) + '; child: ' + child + '; index:' + j); + } + switch (childContentType) { + // Todo: determine whether null or function should have special handling or be converted to text + case 'string':case 'number':case 'boolean': + _appendNode(elem, doc.createTextNode(childContent)); + break; + default: + if (Array.isArray(childContent)) { + // Arrays representing child elements + _appendNode(elem, _optsOrUndefinedJML.apply(undefined, [opts].concat(toConsumableArray(childContent)))); + } else if (childContent['#']) { + // Fragment + _appendNode(elem, _optsOrUndefinedJML(opts, childContent['#'])); + } else { + // Single DOM element children + _appendNode(elem, childContent); + } + break; + } + } + break; + } + } + var ret = nodes[0] || elem; + if (opts && isRoot && opts.$map && opts.$map.root) { + setMap(true); + } + return ret; +}; + +/** +* Converts a DOM object or a string of HTML into a Jamilih object (or string) +* @param {string|HTMLElement} [dom=document.documentElement] Defaults to converting the current document. +* @param {object} [config={stringOutput:false}] Configuration object +* @param {boolean} [config.stringOutput=false] Whether to output the Jamilih object as a string. +* @returns {array|string} Array containing the elements which represent a Jamilih object, or, + if `stringOutput` is true, it will be the stringified version of + such an object +*/ +jml.toJML = function (dom, config) { + config = config || { stringOutput: false }; + if (typeof dom === 'string') { + dom = new DOMParser().parseFromString(dom, 'text/html'); // todo: Give option for XML once implemented and change JSDoc to allow for Element + } + + var ret = []; + var parent = ret; + var parentIdx = 0; + + function invalidStateError() { + // These are probably only necessary if working with text/html + function DOMException() { + return this; + } + { + // INVALID_STATE_ERR per section 9.3 XHTML 5: http://www.w3.org/TR/html5/the-xhtml-syntax.html + // Since we can't instantiate without this (at least in Mozilla), this mimicks at least (good idea?) + var e = new DOMException(); + e.code = 11; + throw e; + } + } + + function addExternalID(obj, node) { + if (node.systemId.includes('"') && node.systemId.includes("'")) { + invalidStateError(); + } + var publicId = node.publicId; + var systemId = node.systemId; + if (systemId) { + obj.systemId = systemId; + } + if (publicId) { + obj.publicId = publicId; + } + } + + function set$$1(val) { + parent[parentIdx] = val; + parentIdx++; + } + function setChildren() { + set$$1([]); + parent = parent[parentIdx - 1]; + parentIdx = 0; + } + function setObj(prop1, prop2) { + parent = parent[parentIdx - 1][prop1]; + parentIdx = 0; + if (prop2) { + parent = parent[prop2]; + } + } + + function parseDOM(node, namespaces) { + // namespaces = clone(namespaces) || {}; // Ensure we're working with a copy, so different levels in the hierarchy can treat it differently + + /* + if ((node.prefix && node.prefix.includes(':')) || (node.localName && node.localName.includes(':'))) { + invalidStateError(); + } + */ + + var type = 'nodeType' in node ? node.nodeType : null; + namespaces = Object.assign({}, namespaces); + + var xmlChars = /([\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/; // eslint-disable-line no-control-regex + if ([2, 3, 4, 7, 8].includes(type) && !xmlChars.test(node.nodeValue)) { + invalidStateError(); + } + + var children = void 0, + start = void 0, + tmpParent = void 0, + tmpParentIdx = void 0; + function setTemp() { + tmpParent = parent; + tmpParentIdx = parentIdx; + } + function resetTemp() { + parent = tmpParent; + parentIdx = tmpParentIdx; + parentIdx++; // Increment index in parent container of this element + } + switch (type) { + case 1: + // ELEMENT + setTemp(); + var nodeName = node.nodeName.toLowerCase(); // Todo: for XML, should not lower-case + + setChildren(); // Build child array since elements are, except at the top level, encapsulated in arrays + set$$1(nodeName); + + start = {}; + var hasNamespaceDeclaration = false; + + if (namespaces[node.prefix || ''] !== node.namespaceURI) { + namespaces[node.prefix || ''] = node.namespaceURI; + if (node.prefix) { + start['xmlns:' + node.prefix] = node.namespaceURI; + } else if (node.namespaceURI) { + start.xmlns = node.namespaceURI; + } + hasNamespaceDeclaration = true; + } + if (node.attributes.length) { + set$$1(Array.from(node.attributes).reduce(function (obj, att) { + obj[att.name] = att.value; // Attr.nodeName and Attr.nodeValue are deprecated as of DOM4 as Attr no longer inherits from Node, so we can safely use name and value + return obj; + }, start)); + } else if (hasNamespaceDeclaration) { + set$$1(start); + } + + children = node.childNodes; + if (children.length) { + setChildren(); // Element children array container + Array.from(children).forEach(function (childNode) { + parseDOM(childNode, namespaces); + }); + } + resetTemp(); + break; + case undefined: // Treat as attribute node until this is fixed: https://github.com/tmpvar/jsdom/issues/1641 / https://github.com/tmpvar/jsdom/pull/1822 + case 2: + // ATTRIBUTE (should only get here if passing in an attribute node) + set$$1({ $attribute: [node.namespaceURI, node.name, node.value] }); + break; + case 3: + // TEXT + if (config.stripWhitespace && /^\s+$/.test(node.nodeValue)) { + return; + } + set$$1(node.nodeValue); + break; + case 4: + // CDATA + if (node.nodeValue.includes(']]' + '>')) { + invalidStateError(); + } + set$$1(['![', node.nodeValue]); + break; + case 5: + // ENTITY REFERENCE (probably not used in browsers since already resolved) + set$$1(['&', node.nodeName]); + break; + case 6: + // ENTITY (would need to pass in directly) + setTemp(); + start = {}; + if (node.xmlEncoding || node.xmlVersion) { + // an external entity file? + start.$ENTITY = { name: node.nodeName, version: node.xmlVersion, encoding: node.xmlEncoding }; + } else { + start.$ENTITY = { name: node.nodeName }; + if (node.publicId || node.systemId) { + // External Entity? + addExternalID(start.$ENTITY, node); + if (node.notationName) { + start.$ENTITY.NDATA = node.notationName; + } + } + } + set$$1(start); + children = node.childNodes; + if (children.length) { + start.$ENTITY.childNodes = []; + // Set position to $ENTITY's childNodes array children + setObj('$ENTITY', 'childNodes'); + + Array.from(children).forEach(function (childNode) { + parseDOM(childNode, namespaces); + }); + } + resetTemp(); + break; + case 7: + // PROCESSING INSTRUCTION + if (/^xml$/i.test(node.target)) { + invalidStateError(); + } + if (node.target.includes('?>')) { + invalidStateError(); + } + if (node.target.includes(':')) { + invalidStateError(); + } + if (node.data.includes('?>')) { + invalidStateError(); + } + set$$1(['?', node.target, node.data]); // Todo: Could give option to attempt to convert value back into object if has pseudo-attributes + break; + case 8: + // COMMENT + if (node.nodeValue.includes('--') || node.nodeValue.length && node.nodeValue.lastIndexOf('-') === node.nodeValue.length - 1) { + invalidStateError(); + } + set$$1(['!', node.nodeValue]); + break; + case 9: + // DOCUMENT + setTemp(); + var docObj = { $document: { childNodes: [] } }; + + if (config.xmlDeclaration) { + docObj.$document.xmlDeclaration = { version: doc.xmlVersion, encoding: doc.xmlEncoding, standAlone: doc.xmlStandalone }; + } + + set$$1(docObj); // doc.implementation.createHTMLDocument + + // Set position to fragment's array children + setObj('$document', 'childNodes'); + + children = node.childNodes; + if (!children.length) { + invalidStateError(); + } + // set({$xmlDocument: []}); // doc.implementation.createDocument // Todo: use this conditionally + + Array.from(children).forEach(function (childNode) { + // Can't just do documentElement as there may be doctype, comments, etc. + // No need for setChildren, as we have already built the container array + parseDOM(childNode, namespaces); + }); + resetTemp(); + break; + case 10: + // DOCUMENT TYPE + setTemp(); + + // Can create directly by doc.implementation.createDocumentType + start = { $DOCTYPE: { name: node.name } }; + if (node.internalSubset) { + start.internalSubset = node.internalSubset; + } + var pubIdChar = /^(\u0020|\u000D|\u000A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/; // eslint-disable-line no-control-regex + if (!pubIdChar.test(node.publicId)) { + invalidStateError(); + } + addExternalID(start.$DOCTYPE, node); + // Fit in internal subset along with entities?: probably don't need as these would only differ if from DTD, and we're not rebuilding the DTD + set$$1(start); // Auto-generate the internalSubset instead? Avoid entities/notations in favor of array to preserve order? + + var entities = node.entities; // Currently deprecated + if (entities && entities.length) { + start.$DOCTYPE.entities = []; + setObj('$DOCTYPE', 'entities'); + Array.from(entities).forEach(function (entity) { + parseDOM(entity, namespaces); + }); + // Reset for notations + parent = tmpParent; + parentIdx = tmpParentIdx + 1; + } + + var notations = node.notations; // Currently deprecated + if (notations && notations.length) { + start.$DOCTYPE.notations = []; + setObj('$DOCTYPE', 'notations'); + Array.from(notations).forEach(function (notation) { + parseDOM(notation, namespaces); + }); + } + resetTemp(); + break; + case 11: + // DOCUMENT FRAGMENT + setTemp(); + + set$$1({ '#': [] }); + + // Set position to fragment's array children + setObj('#'); + + children = node.childNodes; + Array.from(children).forEach(function (childNode) { + // No need for setChildren, as we have already built the container array + parseDOM(childNode, namespaces); + }); + + resetTemp(); + break; + case 12: + // NOTATION + start = { $NOTATION: { name: node.nodeName } }; + addExternalID(start.$NOTATION, node, true); + set$$1(start); + break; + default: + throw new TypeError('Not an XML type'); + } + } + + parseDOM(dom, {}); + + if (config.stringOutput) { + return JSON.stringify(ret[0]); + } + return ret[0]; +}; +jml.toJMLString = function (dom, config) { + return jml.toJML(dom, Object.assign(config || {}, { stringOutput: true })); +}; +jml.toDOM = function () { + // Alias for jml() + return jml.apply(undefined, arguments); +}; +jml.toHTML = function () { + // Todo: Replace this with version of jml() that directly builds a string + var ret = jml.apply(undefined, arguments); + // Todo: deal with serialization of properties like 'selected', 'checked', 'value', 'defaultValue', 'for', 'dataset', 'on*', 'style'! (i.e., need to build a string ourselves) + return ret.outerHTML; +}; +jml.toDOMString = function () { + // Alias for jml.toHTML for parity with jml.toJMLString + return jml.toHTML.apply(jml, arguments); +}; +jml.toXML = function () { + var ret = jml.apply(undefined, arguments); + return new XmlSerializer().serializeToString(ret); +}; +jml.toXMLDOMString = function () { + // Alias for jml.toXML for parity with jml.toJMLString + return jml.toXML.apply(jml, arguments); +}; + +var JamilihMap = function (_Map) { + inherits(JamilihMap, _Map); + + function JamilihMap() { + classCallCheck(this, JamilihMap); + return possibleConstructorReturn(this, (JamilihMap.__proto__ || Object.getPrototypeOf(JamilihMap)).apply(this, arguments)); + } + + createClass(JamilihMap, [{ + key: 'get', + value: function get$$1(elem) { + elem = typeof elem === 'string' ? $(elem) : elem; + return get(JamilihMap.prototype.__proto__ || Object.getPrototypeOf(JamilihMap.prototype), 'get', this).call(this, elem); + } + }, { + key: 'set', + value: function set$$1(elem, value) { + elem = typeof elem === 'string' ? $(elem) : elem; + return get(JamilihMap.prototype.__proto__ || Object.getPrototypeOf(JamilihMap.prototype), 'set', this).call(this, elem, value); + } + }, { + key: 'invoke', + value: function invoke(elem, methodName) { + var _get; + + elem = typeof elem === 'string' ? $(elem) : elem; + + for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { + args[_key3 - 2] = arguments[_key3]; + } + + return (_get = this.get(elem))[methodName].apply(_get, [elem].concat(args)); + } + }]); + return JamilihMap; +}(Map); + +var JamilihWeakMap = function (_WeakMap) { + inherits(JamilihWeakMap, _WeakMap); + + function JamilihWeakMap() { + classCallCheck(this, JamilihWeakMap); + return possibleConstructorReturn(this, (JamilihWeakMap.__proto__ || Object.getPrototypeOf(JamilihWeakMap)).apply(this, arguments)); + } + + createClass(JamilihWeakMap, [{ + key: 'get', + value: function get$$1(elem) { + elem = typeof elem === 'string' ? $(elem) : elem; + return get(JamilihWeakMap.prototype.__proto__ || Object.getPrototypeOf(JamilihWeakMap.prototype), 'get', this).call(this, elem); + } + }, { + key: 'set', + value: function set$$1(elem, value) { + elem = typeof elem === 'string' ? $(elem) : elem; + return get(JamilihWeakMap.prototype.__proto__ || Object.getPrototypeOf(JamilihWeakMap.prototype), 'set', this).call(this, elem, value); + } + }, { + key: 'invoke', + value: function invoke(elem, methodName) { + var _get2; + + elem = typeof elem === 'string' ? $(elem) : elem; + + for (var _len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { + args[_key4 - 2] = arguments[_key4]; + } + + return (_get2 = this.get(elem))[methodName].apply(_get2, [elem].concat(args)); + } + }]); + return JamilihWeakMap; +}(WeakMap); + +jml.Map = JamilihMap; +jml.WeakMap = JamilihWeakMap; + +jml.weak = function (obj) { + var map = new JamilihWeakMap(); + + for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { + args[_key5 - 1] = arguments[_key5]; + } + + var elem = jml.apply(undefined, [{ $map: [map, obj] }].concat(args)); + return [map, elem]; +}; + +jml.strong = function (obj) { + var map = new JamilihMap(); + + for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + args[_key6 - 1] = arguments[_key6]; + } + + var elem = jml.apply(undefined, [{ $map: [map, obj] }].concat(args)); + return [map, elem]; +}; + +jml.symbol = jml.sym = jml.for = function (elem, sym) { + elem = typeof elem === 'string' ? $(elem) : elem; + return elem[(typeof sym === 'undefined' ? 'undefined' : _typeof(sym)) === 'symbol' ? sym : Symbol.for(sym)]; +}; + +jml.command = function (elem, symOrMap, methodName) { + elem = typeof elem === 'string' ? $(elem) : elem; + var func = void 0; + + for (var _len7 = arguments.length, args = Array(_len7 > 3 ? _len7 - 3 : 0), _key7 = 3; _key7 < _len7; _key7++) { + args[_key7 - 3] = arguments[_key7]; + } + + if (['symbol', 'string'].includes(typeof symOrMap === 'undefined' ? 'undefined' : _typeof(symOrMap))) { + var _func; + + func = jml.sym(elem, symOrMap); + if (typeof func === 'function') { + return func.apply(undefined, [methodName].concat(args)); // Already has `this` bound to `elem` + } + return (_func = func)[methodName].apply(_func, args); + } else { + var _func3; + + func = symOrMap.get(elem); + if (typeof func === 'function') { + var _func2; + + return (_func2 = func).call.apply(_func2, [elem, methodName].concat(args)); + } + return (_func3 = func)[methodName].apply(_func3, [elem].concat(args)); + } + // return func[methodName].call(elem, ...args); +}; + +jml.setWindow = function (wind) { + win = wind; +}; +jml.setDocument = function (docum) { + doc = docum; + if (docum && docum.body) { + body = docum.body; + } +}; +jml.setXMLSerializer = function (xmls) { + XmlSerializer = xmls; +}; + +jml.getWindow = function () { + return win; +}; +jml.getDocument = function () { + return doc; +}; +jml.getXMLSerializer = function () { + return XmlSerializer; +}; + +var body = doc && doc.body; + +var nbsp = '\xA0'; // Very commonly needed in templates + +export default jml; +export { jml, $, $$, nbsp, body }; diff --git a/package-lock.json b/package-lock.json index 58849b66..b37bb04b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -154,6 +154,12 @@ "integrity": "sha512-9NfEUDp3tgRhmoxzTpTo+lq+KIVFxZahuRX0LHF/9IzKHaWuoWsIrrJ61zw5cnnlGINX8lqJzXYfQTOICS5Q+A==", "dev": true }, + "abab": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.0.tgz", + "integrity": "sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w==", + "dev": true + }, "abstract-leveldown": { "version": "0.12.4", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-0.12.4.tgz", @@ -177,6 +183,24 @@ "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", "dev": true }, + "acorn-globals": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.0.tgz", + "integrity": "sha512-hMtHj3s5RnuhvHPowpBYvJVj3rAar82JiDQHvGs1zO0l10ocX/xEdBShNHTJaboucJUsScghp74pH3s7EnHHQw==", + "dev": true, + "requires": { + "acorn": "^6.0.1", + "acorn-walk": "^6.0.1" + }, + "dependencies": { + "acorn": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.1.tgz", + "integrity": "sha512-SiwgrRuRD2D1R6qjwwoopKcCTkmmIWjy1M15Wv+Nk/7VUsBad4P8GOPft2t6coDZG0TuR5dq9o1v0g8wo7F6+A==", + "dev": true + } + } + }, "acorn-jsx": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz", @@ -186,6 +210,12 @@ "acorn": "^5.0.3" } }, + "acorn-walk": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.0.1.tgz", + "integrity": "sha512-PqVQ8c6a3kyqdsUZlC7nljp3FFuxipBRHKu+7C1h8QygBFlzTaDX5HD383jej3Peed+1aDG8HwkfB1Z1HMNPkw==", + "dev": true + }, "ajv": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz", @@ -259,6 +289,12 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -298,6 +334,15 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, "asn1.js": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", @@ -309,18 +354,48 @@ "minimalistic-assert": "^1.0.0" } }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "atob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", "dev": true }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", + "dev": true + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -1105,6 +1180,16 @@ } } }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bl": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/bl/-/bl-0.8.2.tgz", @@ -1197,6 +1282,12 @@ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, + "browser-process-hrtime": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", + "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", + "dev": true + }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -1381,6 +1472,12 @@ "rsvp": "^3.3.3" } }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, "catharsis": { "version": "0.8.9", "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", @@ -1487,6 +1584,12 @@ "integrity": "sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU=", "dev": true }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -1518,6 +1621,15 @@ "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==", "dev": true }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.17.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", @@ -1647,6 +1759,21 @@ "randomfill": "^1.0.3" } }, + "cssom": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", + "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", + "dev": true + }, + "cssstyle": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.1.1.tgz", + "integrity": "sha512-364AI1l/M5TYcFH83JnOH/pSqgaNnKmYgKrm0didZMGKWjQB60dymwWy1rKUgL3J1ffdq9xVi2yGLHdSjjSNog==", + "dev": true, + "requires": { + "cssom": "0.3.x" + } + }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -1656,6 +1783,26 @@ "array-find-index": "^1.0.1" } }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-urls": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.1.tgz", + "integrity": "sha512-0HdcMZzK6ubMUnsMmQmG0AcLQPvbvb47R0+7CCZQCYgcd8OUWG91CG7sM6GoXgjz+WLl4ArFzHtBMy/QqSF4eg==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^7.0.0" + } + }, "debug": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", @@ -1756,6 +1903,12 @@ "rimraf": "^2.2.8" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -1834,6 +1987,26 @@ "esutils": "^2.0.2" } }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "requires": { + "webidl-conversions": "^4.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "electron-to-chromium": { "version": "1.3.48", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz", @@ -1885,6 +2058,27 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "escodegen": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", + "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "dev": true, + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, "eslint": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.6.0.tgz", @@ -2315,6 +2509,12 @@ "homedir-polyfill": "^1.0.1" } }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", @@ -2412,6 +2612,12 @@ } } }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", @@ -2592,6 +2798,34 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + } + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3212,6 +3446,15 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -3339,6 +3582,48 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "dev": true, + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + } + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3451,6 +3736,26 @@ "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", "dev": true }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "^1.0.1" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3841,6 +4146,12 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -3877,6 +4188,21 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "jamilih": { + "version": "0.41.0", + "resolved": "https://registry.npmjs.org/jamilih/-/jamilih-0.41.0.tgz", + "integrity": "sha512-r4VyXXjfjpMa/E7dBkx1Z1sewwHOR0gIW783udo2K5I62qE2wETSrA3Vvv0igDGcsoT2lO7aqRIkWIWk7V3jTA==", + "dev": true, + "requires": { + "jsdom": "12.0.0" + } + }, "jest-worker": { "version": "23.2.0", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-23.2.0.tgz", @@ -3917,6 +4243,13 @@ "xmlcreate": "^1.0.1" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, "jsdoc": { "version": "3.5.5", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", @@ -3945,12 +4278,51 @@ } } }, + "jsdom": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-12.0.0.tgz", + "integrity": "sha512-42RgZYXWwyClG0pN6Au7TExAQqRvzbtJhlcIvu58cJj4yr1bIbqZkgxHqn1btxKu80axZXPZLvldeTzg2auKow==", + "dev": true, + "requires": { + "abab": "^2.0.0", + "acorn": "^5.7.1", + "acorn-globals": "^4.1.0", + "array-equal": "^1.0.0", + "cssom": ">= 0.3.2 < 0.4.0", + "cssstyle": "^1.0.0", + "data-urls": "^1.0.1", + "domexception": "^1.0.1", + "escodegen": "^1.11.0", + "html-encoding-sniffer": "^1.0.2", + "nwsapi": "^2.0.8", + "parse5": "5.1.0", + "pn": "^1.1.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.5", + "sax": "^1.2.4", + "symbol-tree": "^3.2.2", + "tough-cookie": "^2.4.3", + "w3c-hr-time": "^1.0.1", + "webidl-conversions": "^4.0.2", + "whatwg-encoding": "^1.0.4", + "whatwg-mimetype": "^2.1.0", + "whatwg-url": "^7.0.0", + "ws": "^6.0.0", + "xml-name-validator": "^3.0.0" + } + }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -3963,6 +4335,12 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -3978,6 +4356,18 @@ "graceful-fs": "^4.1.6" } }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "just-extend": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-3.0.0.tgz", @@ -4258,6 +4648,12 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, "lolex": { "version": "2.7.5", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.5.tgz", @@ -4497,6 +4893,21 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", @@ -4677,6 +5088,18 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, + "nwsapi": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.9.tgz", + "integrity": "sha512-nlWFSCTYQcHk/6A9FFnfhKc14c3aFhfdNBXgo8Qgi9QTBu/qg3Ww+Uiz9wMzXd1T8GFxPc2QIHB6Qtf2XFryFQ==", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -4931,6 +5354,12 @@ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", "dev": true }, + "parse5": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", + "dev": true + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -5015,6 +5444,12 @@ "sha.js": "^2.4.8" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -5051,6 +5486,12 @@ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -5114,6 +5555,12 @@ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, "public-encrypt": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", @@ -5139,6 +5586,12 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "dev": true }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, "qunit": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.6.2.tgz", @@ -5375,6 +5828,62 @@ "is-finite": "^1.0.0" } }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + } + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "dev": true, + "requires": { + "lodash": "^4.13.1" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "dev": true, + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "^1.1.0", + "tough-cookie": ">=2.3.3" + } + }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -5862,6 +6371,12 @@ } } }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -6188,6 +6703,23 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -6209,6 +6741,12 @@ } } }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, "string-range": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/string-range/-/string-range-1.2.2.tgz", @@ -6292,6 +6830,12 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true + }, "table": { "version": "4.0.3", "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", @@ -6430,6 +6974,33 @@ "repeat-string": "^1.6.1" } }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "traverse-chain": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", @@ -6454,6 +7025,22 @@ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", "dev": true }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -6631,12 +7218,32 @@ "spdx-expression-parse": "^3.0.0" } }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "vlq": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", "dev": true }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, + "requires": { + "browser-process-hrtime": "^0.1.2" + } + }, "walk-sync": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-0.3.2.tgz", @@ -6674,6 +7281,49 @@ } } }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.4.tgz", + "integrity": "sha512-vM9KWN6MP2mIHZ86ytcyIv7e8Cj3KTfO2nd2c8PFDqcI4bxFmQp83ibq4wadq7rL9l9sZV6o9B0LTt8ygGAAXg==", + "dev": true, + "requires": { + "iconv-lite": "0.4.23" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, + "whatwg-mimetype": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.2.0.tgz", + "integrity": "sha512-5YSO1nMd5D1hY3WzAQV3PzZL83W3YeyR1yW9PcH26Weh1t+Vzh9B6XkDh7aXm83HBZ4nSMvkjvN2H2ySWIvBgw==", + "dev": true + }, + "whatwg-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", + "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "dev": true, + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", @@ -6704,6 +7354,21 @@ "mkdirp": "^0.5.1" } }, + "ws": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.0.0.tgz", + "integrity": "sha512-c2UlYcAZp1VS8AORtpq6y4RJIkJ9dQz18W32SpR/qXGfLDZ2jU4y4wKvvZwqbi7U6gxFQTeE+urMbXU/tsDy4w==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, "xmlcreate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-1.0.2.tgz", diff --git a/package.json b/package.json index 4251a6e5..2492820e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build-doc": "rm -rf docs/jsdoc/*;jsdoc --pedantic -c docs/jsdoc-config.json editor", "build-html": "node build-html.js", "compress-images": "imageoptim 'chrome-app/*.png' && imageoptim 'editor/extensions/*.png' && imageoptim 'editor/spinbtn/*.png' && imageoptim 'editor/jgraduate/images/*.{png,gif}' && imageoptim 'editor/images/*.png'", - "copy-deps": "cp node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets/index-es.js && cp node_modules/babel-polyfill/dist/polyfill.min.js editor/external/babel-polyfill/polyfill.min.js && cp node_modules/babel-polyfill/dist/polyfill.js editor/external/babel-polyfill/polyfill.js", + "copy-deps": "cp node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets/index-es.js && cp node_modules/babel-polyfill/dist/polyfill.min.js editor/external/babel-polyfill/polyfill.min.js && cp node_modules/babel-polyfill/dist/polyfill.js editor/external/babel-polyfill/polyfill.js && cp node_modules/jamilih/dist/jml-es.js editor/external/jamilih/jml-es.js", "eslint": "eslint .", "rollup": "rollup -c", "start-embedded": "echo \"Open file to http://localhost:8000/editor/embedapi.html\" && static -p 8000 | static -p 8001 -H '{\"Access-Control-Allow-Origin\": \"*\"}'", @@ -67,6 +67,7 @@ "eslint-plugin-standard": "4.0.0", "find-in-files": "^0.5.0", "imageoptim-cli": "^2.0.3", + "jamilih": "^0.41.0", "jsdoc": "^3.5.5", "load-stylesheets": "^0.7.0", "node-static": "^0.7.11",