UNPKG

@senx/warpview-editor

Version:

WarpView Editor Elements

980 lines (957 loc) 20.3 MB
/* * Copyright 2019 SenX S.A.S. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ window.addEventListener('load', function() { const scriptPath = function () { let scripts = document.getElementsByTagName('SCRIPT'); let path = ''; if (scripts && scripts.length > 0) { for (let i in scripts) { if (scripts[i].src && scripts[i].src.match(/\/warpview-editor-elements\.js$/)) { path = scripts[i].src.replace(/(.*)\/warpview-editor-elements\.js$/, '$1'); break; } } } return path; }; const css = document.createElement('link'); css.setAttribute('rel', 'stylesheet'); css.setAttribute('href', scriptPath() + '/warpview-editor-elements.css'); document.head.appendChild(css); }); /** @license @nocompile Copyright (c) 2018 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ (function () { 'use strict'; (function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const a=HTMLElement;window.HTMLElement={HTMLElement:function HTMLElement(){return Reflect.construct(a,[],this.constructor)}}.HTMLElement,HTMLElement.prototype=a.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,a);})(); }()); /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 80972: /*!********************************************************************!*\ !*** ./node_modules/@giwisoft/wc-split/dist/esm/index-d8f4c46e.js ***! \********************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "b": function() { return /* binding */ bootstrapLazy; }, /* harmony export */ "c": function() { return /* binding */ createEvent; }, /* harmony export */ "h": function() { return /* binding */ h; }, /* harmony export */ "p": function() { return /* binding */ promiseResolve; }, /* harmony export */ "r": function() { return /* binding */ registerInstance; } /* harmony export */ }); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ 15671); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createClass.js */ 43144); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js */ 97326); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/inherits.js */ 60136); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ 29388); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_wrapNativeSuper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js */ 7112); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ 93324); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 15861); /* harmony import */ var _home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */ 89062); function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } var NAMESPACE = 'wc-split'; var scopeId; var hostTagName; var isSvgMode = false; var queuePending = false; var win = typeof window !== 'undefined' ? window : {}; var doc = win.document || { head: {} }; var plt = { $flags$: 0, $resourcesUrl$: '', jmp: function jmp(h) { return h(); }, raf: function raf(h) { return requestAnimationFrame(h); }, ael: function ael(el, eventName, listener, opts) { return el.addEventListener(eventName, listener, opts); }, rel: function rel(el, eventName, listener, opts) { return el.removeEventListener(eventName, listener, opts); }, ce: function ce(eventName, opts) { return new CustomEvent(eventName, opts); } }; var promiseResolve = function promiseResolve(v) { return Promise.resolve(v); }; var supportsConstructibleStylesheets = /*@__PURE__*/function () { try { new CSSStyleSheet(); return typeof new CSSStyleSheet().replace === 'function'; } catch (e) {} return false; }(); var HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; var createTime = function createTime(fnName) { var tagName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; { return function () { return; }; } }; var uniqueTime = function uniqueTime(key, measureText) { { return function () { return; }; } }; var rootAppliedStyles = new WeakMap(); var registerStyle = function registerStyle(scopeId, cssText, allowCS) { var style = styles.get(scopeId); if (supportsConstructibleStylesheets && allowCS) { style = style || new CSSStyleSheet(); style.replace(cssText); } else { style = cssText; } styles.set(scopeId, style); }; var addStyle = function addStyle(styleContainerNode, cmpMeta, mode, hostElm) { var scopeId = getScopeId(cmpMeta); var style = styles.get(scopeId); // if an element is NOT connected then getRootNode() will return the wrong root node // so the fallback is to always use the document for the root node in those cases styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc; if (style) { if (typeof style === 'string') { styleContainerNode = styleContainerNode.head || styleContainerNode; var appliedStyles = rootAppliedStyles.get(styleContainerNode); var styleElm; if (!appliedStyles) { rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set()); } if (!appliedStyles.has(scopeId)) { { { styleElm = doc.createElement('style'); styleElm.innerHTML = style; } styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link')); } if (appliedStyles) { appliedStyles.add(scopeId); } } } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) { styleContainerNode.adoptedStyleSheets = [].concat((0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_8__["default"])(styleContainerNode.adoptedStyleSheets), [style]); } } return scopeId; }; var attachStyles = function attachStyles(hostRef) { var cmpMeta = hostRef.$cmpMeta$; var elm = hostRef.$hostElement$; var flags = cmpMeta.$flags$; var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); var scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); if (flags & 10 /* needsScopedEncapsulation */) { // only required when we're NOT using native shadow dom (slot) // or this browser doesn't support native shadow dom // and this host element was NOT created with SSR // let's pick out the inner content for slot projection // create a node to represent where the original // content was first placed, which is useful later on // DOM WRITE!! elm['s-sc'] = scopeId; elm.classList.add(scopeId + '-h'); } endAttachStyles(); }; var getScopeId = function getScopeId(cmp, mode) { return 'sc-' + cmp.$tagName$; }; /** * Default style mode id */ /** * Reusable empty obj/array * Don't add values to these!! */ var EMPTY_OBJ = {}; var isDef = function isDef(v) { return v != null; }; var isComplexType = function isComplexType(o) { // https://jsperf.com/typeof-fn-object/5 o = typeof o; return o === 'object' || o === 'function'; }; /** * Production h() function based on Preact by * Jason Miller (@developit) * Licensed under the MIT License * https://github.com/developit/preact/blob/master/LICENSE * * Modified for Stencil's compiler and vdom */ // const stack: any[] = []; // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode; // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode; var h = function h(nodeName, vnodeData) { var child = null; var simple = false; var lastSimple = false; var vNodeChildren = []; var walk = function walk(c) { for (var i = 0; i < c.length; i++) { child = c[i]; if (Array.isArray(child)) { walk(child); } else if (child != null && typeof child !== 'boolean') { if (simple = typeof nodeName !== 'function' && !isComplexType(child)) { child = String(child); } if (simple && lastSimple) { // If the previous child was simple (string), we merge both vNodeChildren[vNodeChildren.length - 1].$text$ += child; } else { // Append a new vNode, if it's text, we create a text vNode vNodeChildren.push(simple ? newVNode(null, child) : child); } lastSimple = simple; } } }; for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { children[_key - 2] = arguments[_key]; } walk(children); if (vnodeData) { { var classData = vnodeData.className || vnodeData.class; if (classData) { vnodeData.class = typeof classData !== 'object' ? classData : Object.keys(classData).filter(function (k) { return classData[k]; }).join(' '); } } } var vnode = newVNode(nodeName, null); vnode.$attrs$ = vnodeData; if (vNodeChildren.length > 0) { vnode.$children$ = vNodeChildren; } return vnode; }; var newVNode = function newVNode(tag, text) { var vnode = { $flags$: 0, $tag$: tag, $text$: text, $elm$: null, $children$: null }; { vnode.$attrs$ = null; } return vnode; }; var Host = {}; var isHost = function isHost(node) { return node && node.$tag$ === Host; }; /** * Production setAccessor() function based on Preact by * Jason Miller (@developit) * Licensed under the MIT License * https://github.com/developit/preact/blob/master/LICENSE * * Modified for Stencil's compiler and vdom */ var setAccessor = function setAccessor(elm, memberName, oldValue, newValue, isSvg, flags) { if (oldValue !== newValue) { var isProp = isMemberInElement(elm, memberName); memberName.toLowerCase(); if (memberName === 'class') { var classList = elm.classList; var oldClasses = parseClassList(oldValue); var newClasses = parseClassList(newValue); classList.remove.apply(classList, (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_8__["default"])(oldClasses.filter(function (c) { return c && !newClasses.includes(c); }))); classList.add.apply(classList, (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_toConsumableArray_js__WEBPACK_IMPORTED_MODULE_8__["default"])(newClasses.filter(function (c) { return c && !oldClasses.includes(c); }))); } else if (memberName === 'ref') { // minifier will clean this up if (newValue) { newValue(elm); } } else { // Set property if it exists and it's not a SVG var isComplex = isComplexType(newValue); if ((isProp || isComplex && newValue !== null) && !isSvg) { try { if (!elm.tagName.includes('-')) { var n = newValue == null ? '' : newValue; // Workaround for Safari, moving the <input> caret when re-assigning the same valued if (memberName === 'list') { isProp = false; // tslint:disable-next-line: triple-equals } else if (oldValue == null || elm[memberName] != n) { elm[memberName] = n; } } else { elm[memberName] = newValue; } } catch (e) {} } if (newValue == null || newValue === false) { if (newValue !== false || elm.getAttribute(memberName) === '') { { elm.removeAttribute(memberName); } } } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) { newValue = newValue === true ? '' : newValue; { elm.setAttribute(memberName, newValue); } } } } }; var parseClassListRegex = /\s/; var parseClassList = function parseClassList(value) { return !value ? [] : value.split(parseClassListRegex); }; var updateElement = function updateElement(oldVnode, newVnode, isSvgMode, memberName) { // if the element passed in is a shadow root, which is a document fragment // then we want to be adding attrs/props to the shadow root's "host" element // if it's not a shadow root, then we add attrs/props to the same element var elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$; var oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ; var newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ; { // remove attributes no longer present on the vnode by setting them to undefined for (memberName in oldVnodeAttrs) { if (!(memberName in newVnodeAttrs)) { setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$); } } } // add new & update changed attributes for (memberName in newVnodeAttrs) { setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$); } }; var createElm = function createElm(oldParentVNode, newParentVNode, childIndex, parentElm) { // tslint:disable-next-line: prefer-const var newVNode = newParentVNode.$children$[childIndex]; var i = 0; var elm; var childNode; if (newVNode.$text$ !== null) { // create text node elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$); } else { // create element elm = newVNode.$elm$ = doc.createElement(newVNode.$tag$); // add css classes, attrs, props, listeners, etc. { updateElement(null, newVNode, isSvgMode); } if (isDef(scopeId) && elm['s-si'] !== scopeId) { // if there is a scopeId and this is the initial render // then let's add the scopeId as a css class elm.classList.add(elm['s-si'] = scopeId); } if (newVNode.$children$) { for (i = 0; i < newVNode.$children$.length; ++i) { // create the node childNode = createElm(oldParentVNode, newVNode, i); // return node could have been null if (childNode) { // append our new node elm.appendChild(childNode); } } } } return elm; }; var addVnodes = function addVnodes(parentElm, before, parentVNode, vnodes, startIdx, endIdx) { var containerElm = parentElm; var childNode; if (containerElm.shadowRoot && containerElm.tagName === hostTagName) { containerElm = containerElm.shadowRoot; } for (; startIdx <= endIdx; ++startIdx) { if (vnodes[startIdx]) { childNode = createElm(null, parentVNode, startIdx); if (childNode) { vnodes[startIdx].$elm$ = childNode; containerElm.insertBefore(childNode, before); } } } }; var removeVnodes = function removeVnodes(vnodes, startIdx, endIdx, vnode, elm) { for (; startIdx <= endIdx; ++startIdx) { if (vnode = vnodes[startIdx]) { elm = vnode.$elm$; callNodeRefs(vnode); // remove the vnode's element from the dom elm.remove(); } } }; var updateChildren = function updateChildren(parentElm, oldCh, newVNode, newCh) { var oldStartIdx = 0; var newStartIdx = 0; var oldEndIdx = oldCh.length - 1; var oldStartVnode = oldCh[0]; var oldEndVnode = oldCh[oldEndIdx]; var newEndIdx = newCh.length - 1; var newStartVnode = newCh[0]; var newEndVnode = newCh[newEndIdx]; var node; while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { if (oldStartVnode == null) { // Vnode might have been moved left oldStartVnode = oldCh[++oldStartIdx]; } else if (oldEndVnode == null) { oldEndVnode = oldCh[--oldEndIdx]; } else if (newStartVnode == null) { newStartVnode = newCh[++newStartIdx]; } else if (newEndVnode == null) { newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldStartVnode, newStartVnode)) { patch(oldStartVnode, newStartVnode); oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (isSameVnode(oldEndVnode, newEndVnode)) { patch(oldEndVnode, newEndVnode); oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldStartVnode, newEndVnode)) { patch(oldStartVnode, newEndVnode); parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldEndVnode, newStartVnode)) { patch(oldEndVnode, newStartVnode); parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$); oldEndVnode = oldCh[--oldEndIdx]; newStartVnode = newCh[++newStartIdx]; } else { { // new element node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx); newStartVnode = newCh[++newStartIdx]; } if (node) { { oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$); } } } } if (oldStartIdx > oldEndIdx) { addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx); } else if (newStartIdx > newEndIdx) { removeVnodes(oldCh, oldStartIdx, oldEndIdx); } }; var isSameVnode = function isSameVnode(vnode1, vnode2) { // compare if two vnode to see if they're "technically" the same // need to have the same element tag, and same key to be the same if (vnode1.$tag$ === vnode2.$tag$) { return true; } return false; }; var patch = function patch(oldVNode, newVNode) { var elm = newVNode.$elm$ = oldVNode.$elm$; var oldChildren = oldVNode.$children$; var newChildren = newVNode.$children$; var tag = newVNode.$tag$; var text = newVNode.$text$; if (text === null) { // element node { if (tag === 'slot') ;else { // either this is the first render of an element OR it's an update // AND we already know it's possible it could have changed // this updates the element's css classes, attrs, props, listeners, etc. updateElement(oldVNode, newVNode, isSvgMode); } } if (oldChildren !== null && newChildren !== null) { // looks like there's child vnodes for both the old and new vnodes updateChildren(elm, oldChildren, newVNode, newChildren); } else if (newChildren !== null) { // no old child vnodes, but there are new child vnodes to add if (oldVNode.$text$ !== null) { // the old vnode was text, so be sure to clear it out elm.textContent = ''; } // add the new vnode children addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1); } else if (oldChildren !== null) { // no new child vnodes, but there are old child vnodes to remove removeVnodes(oldChildren, 0, oldChildren.length - 1); } } else if (oldVNode.$text$ !== text) { // update the text content for the text only vnode // and also only if the text is different than before elm.data = text; } }; var callNodeRefs = function callNodeRefs(vNode) { { vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null); vNode.$children$ && vNode.$children$.map(callNodeRefs); } }; var renderVdom = function renderVdom(hostRef, renderFnResults) { var hostElm = hostRef.$hostElement$; var oldVNode = hostRef.$vnode$ || newVNode(null, null); var rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); hostTagName = hostElm.tagName; rootVnode.$tag$ = null; rootVnode.$flags$ |= 4 /* isHost */; hostRef.$vnode$ = rootVnode; rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm; { scopeId = hostElm['s-sc']; } // synchronous patch patch(oldVNode, rootVnode); }; var getElement = function getElement(ref) { return getHostRef(ref).$hostElement$; }; var createEvent = function createEvent(ref, name, flags) { var elm = getElement(ref); return { emit: function emit(detail) { return emitEvent(elm, name, { bubbles: !!(flags & 4 /* Bubbles */), composed: !!(flags & 2 /* Composed */), cancelable: !!(flags & 1 /* Cancellable */), detail: detail }); } }; }; var emitEvent = function emitEvent(elm, name, opts) { var ev = plt.ce(name, opts); elm.dispatchEvent(ev); return ev; }; var attachToAncestor = function attachToAncestor(hostRef, ancestorComponent) { if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { ancestorComponent['s-p'].push(new Promise(function (r) { return hostRef.$onRenderResolve$ = r; })); } }; var scheduleUpdate = function scheduleUpdate(hostRef, isInitialLoad) { { hostRef.$flags$ |= 16 /* isQueuedForUpdate */; } if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { hostRef.$flags$ |= 512 /* needsRerender */; return; } attachToAncestor(hostRef, hostRef.$ancestorComponent$); // there is no ancestor component or the ancestor component // has already fired off its lifecycle update then // fire off the initial update var dispatch = function dispatch() { return dispatchHooks(hostRef, isInitialLoad); }; return writeTask(dispatch); }; var dispatchHooks = function dispatchHooks(hostRef, isInitialLoad) { var endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); var instance = hostRef.$lazyInstance$; var promise; if (isInitialLoad) { { promise = safeCall(instance, 'componentWillLoad'); } } endSchedule(); return then(promise, function () { return updateComponent(hostRef, instance, isInitialLoad); }); }; var updateComponent = /*#__PURE__*/function () { var _ref = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_7__["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hostRef, instance, isInitialLoad) { var elm, endUpdate, rc, endRender, childrenPromises, postUpdate; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: // updateComponent elm = hostRef.$hostElement$; endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); rc = elm['s-rc']; if (isInitialLoad) { // DOM WRITE! attachStyles(hostRef); } endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); callRender(hostRef, instance); if (rc) { // ok, so turns out there are some child host elements // waiting on this parent element to load // let's fire off all update callbacks waiting rc.map(function (cb) { return cb(); }); elm['s-rc'] = undefined; } endRender(); endUpdate(); childrenPromises = elm['s-p']; postUpdate = function postUpdate() { return postUpdateComponent(hostRef); }; if (childrenPromises.length === 0) { postUpdate(); } else { Promise.all(childrenPromises).then(postUpdate); hostRef.$flags$ |= 4 /* isWaitingForChildren */; childrenPromises.length = 0; } case 12: case "end": return _context.stop(); } }, _callee); })); return function updateComponent(_x, _x2, _x3) { return _ref.apply(this, arguments); }; }(); var callRender = function callRender(hostRef, instance, elm) { try { instance = instance.render(); { hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; } { hostRef.$flags$ |= 2 /* hasRendered */; } { { // looks like we've got child nodes to render into this host element // or we need to update the css class/attrs on the host element // DOM WRITE! { renderVdom(hostRef, instance); } } } } catch (e) { consoleError(e, hostRef.$hostElement$); } return null; }; var postUpdateComponent = function postUpdateComponent(hostRef) { var tagName = hostRef.$cmpMeta$.$tagName$; var elm = hostRef.$hostElement$; var endPostUpdate = createTime('postUpdate', tagName); var instance = hostRef.$lazyInstance$; var ancestorComponent = hostRef.$ancestorComponent$; if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { hostRef.$flags$ |= 64 /* hasLoadedComponent */; { // DOM WRITE! addHydratedFlag(elm); } { safeCall(instance, 'componentDidLoad'); } endPostUpdate(); { hostRef.$onReadyResolve$(elm); if (!ancestorComponent) { appDidLoad(); } } } else { endPostUpdate(); } // load events fire from bottom to top // the deepest elements load first then bubbles up { if (hostRef.$onRenderResolve$) { hostRef.$onRenderResolve$(); hostRef.$onRenderResolve$ = undefined; } if (hostRef.$flags$ & 512 /* needsRerender */) { nextTick(function () { return scheduleUpdate(hostRef, false); }); } hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); } // ( •_•) // ( •_•)>⌐■-■ // (⌐■_■) }; var appDidLoad = function appDidLoad(who) { // on appload // we have finish the first big initial render { addHydratedFlag(doc.documentElement); } nextTick(function () { return emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }); }); }; var safeCall = function safeCall(instance, method, arg) { if (instance && instance[method]) { try { return instance[method](arg); } catch (e) { consoleError(e); } } return undefined; }; var then = function then(promise, thenFn) { return promise && promise.then ? promise.then(thenFn) : thenFn(); }; var addHydratedFlag = function addHydratedFlag(elm) { return elm.classList.add('hydrated'); }; var parsePropertyValue = function parsePropertyValue(propValue, propType) { // ensure this value is of the correct prop type if (propValue != null && !isComplexType(propValue)) { if (propType & 4 /* Boolean */) { // per the HTML spec, any string value means it is a boolean true value // but we'll cheat here and say that the string "false" is the boolean false return propValue === 'false' ? false : propValue === '' || !!propValue; } if (propType & 2 /* Number */) { // force it to be a number return parseFloat(propValue); } if (propType & 1 /* String */) { // could have been passed as a number or boolean // but we still want it as a string return String(propValue); } // redundant return here for better minification return propValue; } // not sure exactly what type we want // so no need to change to a different type return propValue; }; var getValue = function getValue(ref, propName) { return getHostRef(ref).$instanceValues$.get(propName); }; var setValue = function setValue(ref, propName, newVal, cmpMeta) { // check our new property value against our internal value var hostRef = getHostRef(ref); var oldVal = hostRef.$instanceValues$.get(propName); var flags = hostRef.$flags$; var instance = hostRef.$lazyInstance$; newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) { // gadzooks! the property's value has changed!! // set our new value! hostRef.$instanceValues$.set(propName, newVal); if (instance) { if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { // looks like this value actually changed, so we've got work to do! // but only if we've already rendered, otherwise just chill out // queue that we need to do an update, but don't worry about queuing // up millions cuz this function ensures it only runs once scheduleUpdate(hostRef, false); } } } }; var proxyComponent = function proxyComponent(Cstr, cmpMeta, flags) { if (cmpMeta.$members$) { // It's better to have a const than two Object.entries() var members = Object.entries(cmpMeta.$members$); var prototype = Cstr.prototype; members.map(function (_ref2) { var _ref3 = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_ref2, 2), memberName = _ref3[0], _ref3$ = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_ref3[1], 1), memberFlags = _ref3$[0]; if (memberFlags & 31 /* Prop */ || flags & 2 /* proxyState */ && memberFlags & 32 /* State */) { // proxyComponent - prop Object.defineProperty(prototype, memberName, { get: function get() { // proxyComponent, get value return getValue(this, memberName); }, set: function set(newValue) { // proxyComponent, set value setValue(this, memberName, newValue, cmpMeta); }, configurable: true, enumerable: true }); } }); if (flags & 1 /* isElementConstructor */) { var attrNameToPropName = new Map(); prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) { var _this = this; plt.jmp(function () { var propName = attrNameToPropName.get(attrName); _this[propName] = newValue === null && typeof _this[propName] === 'boolean' ? false : newValue; }); }; // create an array of attributes to observe // and also create a map of html attribute name to js property name Cstr.observedAttributes = members.filter(function (_ref4) { var _ref5 = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_ref4, 2), _ = _ref5[0], m = _ref5[1]; return m[0] & 15; } /* HasAttribute */) // filter to only keep props that should match attributes .map(function (_ref6) { var _ref7 = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_ref6, 2), propName = _ref7[0], m = _ref7[1]; var attrName = m[1] || propName; attrNameToPropName.set(attrName, propName); return attrName; }); } } return Cstr; }; var initializeComponent = /*#__PURE__*/function () { var _ref8 = (0,_home_xavier_workspace_warpview_editor_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_7__["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elm, hostRef, cmpMeta, hmrVersionId, Cstr) { var endLoad, endNewInstance, style, _scopeId, endRegisterStyles, ancestorComponent, schedule; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0)) { _context2.next = 16; break; } // we haven't initialized this element yet hostRef.$flags$ |= 32 /* hasInitializedComponent */; // lazy loaded components // request the component's implementation to be // wired up with the host element Cstr = loadModule(cmpMeta); if (!Cstr.then) { _context2.next = 9; break; } // Await creates a micro-task avoid if possible endLoad = uniqueTime(); _context2.next = 7; return Cstr; case 7: Cstr = _context2.sent; endLoad(); case 9: if (!Cstr.isProxied) { proxyComponent(Cstr, cmpMeta, 2 /* proxyState */); Cstr.isProxied = true; } endNewInstance = createTime('createInstance', cmpMeta.$tagName$); // ok, time to construct the instance // but let's keep track of when we start and stop // so that the getters/setters don't incorrectly step on data hostRef.$flags$ |= 8 /* isConstructingInstance */; // construct the lazy-loaded component implementation // passing the hostRef is very important during // construction in order to directly wire together the // host element and the lazy-loaded instance try { new Cstr(hostRef); } catch (e) { consoleError(e); } hostRef.$flags$ &= ~8 /* isConstructingInstance */; endNewInstance(); if (Cstr.style) { // this component has styles but we haven't registered them yet style = Cstr.style; _scopeId = getScopeId(cmpMeta); if (!styles.has(_scopeId)) { endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); registerStyle(_scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); endRegisterStyles(); } } case 16: // we've successfully created a lazy instance ancestorComponent = hostRef.$ancestorComponent$; schedule = function schedule() { return scheduleUpdate(hostRef, true); }; if (ancestorComponent && ancestorComponent['s-rc']) { // this is the intial load and this component it has an ancestor component // but the ancestor component has NOT fired its will update lifecycle yet // so let's just cool our jets and wait for the ancestor to continue first // this will get fired off when the ancestor component // finally gets around to rendering its lazy self // fire off the initial update ancestorComponent['s-rc'].push(schedule); } else { schedule(); } case 19: case "end": return _context2.stop(); } }, _callee2); })); return function initializeComponent(_x4, _x5, _x6, _x7, _x8) { return _ref8.apply(this, arguments); }; }(); var _connectedCallback = function connectedCallback(elm) { if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { var hostRef = getHostRef(elm); var cmpMeta = hostRef.$cmpMeta$; var endConnected = createTime('connectedCallback', cmpMeta.$tagName$); if (!(hostRef.$flags$ & 1 /* hasConnected */)) { // first time this component has connected hostRef.$flags$ |= 1 /* hasConnected */; { // find the first ancestor component (if there is one) and register // this component as one of the actively loading child components for its ancestor var ancestorComponent = elm; while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) { // climb up the ances