web-component-wrapper
Version:
Generic web-component base class and framework specific wrapper.
376 lines (364 loc) • 92 kB
JavaScript
if(typeof window==='undefined'||window===null)var window=(typeof globalThis==='undefined'||globalThis===null)?{}:globalThis;import * as __WEBPACK_EXTERNAL_MODULE_clientnode__ from "clientnode";
import * as __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__ from "clientnode/property-types";
/******/ var __webpack_modules__ = ([
/* 0 */
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var x = function(y) {
var x = {}; __webpack_require__.d(x, y); return x
}
var y = function(x) { return function() { return x; }; }
module.exports = x({ ["Logger"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.Logger; }, ["NOOP"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.NOOP; }, ["UTILITY_SCOPE"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.UTILITY_SCOPE; }, ["UTILITY_SCOPE_NAMES"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.UTILITY_SCOPE_NAMES; }, ["camelCaseToDelimited"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.camelCaseToDelimited; }, ["compile"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.compile; }, ["convertPlainObjectToMap"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.convertPlainObjectToMap; }, ["copy"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.copy; }, ["delimitedToCamelCase"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.delimitedToCamelCase; }, ["evaluate"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.evaluate; }, ["extend"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.extend; }, ["isFunction"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.isFunction; }, ["isObject"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.isObject; }, ["lowerCase"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.lowerCase; }, ["replace"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.replace; }, ["represent"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.represent; }, ["timeout"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.timeout; }, ["unique"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.unique; }, ["unwrap"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode__.unwrap; } });
/***/ }),
/* 1 */
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var x = function(y) {
var x = {}; __webpack_require__.d(x, y); return x
}
var y = function(x) { return function() { return x; }; }
module.exports = x({ ["any"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.any; }, ["array"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.array; }, ["arrayOf"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.arrayOf; }, ["boolean"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.boolean; }, ["element"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.element; }, ["elementType"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.elementType; }, ["exact"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.exact; }, ["func"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.func; }, ["instanceOf"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.instanceOf; }, ["node"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.node; }, ["number"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.number; }, ["object"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.object; }, ["objectOf"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.objectOf; }, ["oneOf"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.oneOf; }, ["oneOfType"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.oneOfType; }, ["shape"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.shape; }, ["string"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.string; }, ["symbol"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.symbol; } });
/***/ }),
/* 2 */
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* unused harmony export property */
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
// #!/usr/bin/env babel-node
// -*- coding: utf-8 -*-
/** @module decorator *//* !
region header
[Project page](https://torben.website/web-component-wrapper)
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stands under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
endregion
*/// region imports
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)};// endregion
/**
* Generates a decorator based on given configuration.
* @param options - Property configuration to define how to transfer attributes
* and properties into each other.
* @param options.alias - Alternate property name.
* @param options.readAttribute - Indicates whether to read from existing
* attribute also.
* @param options.type - Value type to parse value.
* @param options.update - Indicates whether to overwrite already existing
* property configurations.
* @param options.writeAttribute - Indicates whether to sync attribute
* representation back into dom.
* @returns Generated decorator.
*/function property(options){if(options===void 0){options={}}options=_objectSpread({readAttribute:true,type:clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.string},options);/**
* Registers given property to different property / attribute conversion
* data structures.
* NOTE: It is important to set static configuration properties on its
* "own" properties instead of some inherited one. So we have to check via
* "hasOwnProperty" for existence in this decorator.
* @param target - Instance to apply given property to.
* @param name - Field name to apply.
*/return function(target,name){if(typeof name!=="string")return;var self=target.self||target.constructor;if(options.readAttribute){if(!Object.prototype.hasOwnProperty.call(self,"observedAttributes"))self.observedAttributes=self.observedAttributes?_toConsumableArray(self.observedAttributes):[];var attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if(self.observedAttributes&&!self.observedAttributes.includes(attributeName))self.observedAttributes.push(attributeName)}if(options.type){if(!Object.prototype.hasOwnProperty.call(self,"propertyTypes"))self.propertyTypes=self.propertyTypes?_objectSpread({},self.propertyTypes):{};if(self.propertyTypes&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyTypes[name]=options.type}if(options.writeAttribute){if(!Object.prototype.hasOwnProperty.call(self,"propertiesToReflectAsAttributes"))self.propertiesToReflectAsAttributes=self.propertiesToReflectAsAttributes?(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(self.propertiesToReflectAsAttributes):[];if(options.update||self.propertiesToReflectAsAttributes instanceof Map&&!self.propertiesToReflectAsAttributes.has(name)||Array.isArray(self.propertiesToReflectAsAttributes)&&!self.propertiesToReflectAsAttributes.includes(name)||_typeof(self.propertiesToReflectAsAttributes)==="object"&&!Object.prototype.hasOwnProperty.call(self.propertiesToReflectAsAttributes,name)){var result;if(typeof options.writeAttribute==="boolean"){if(options.writeAttribute&&self.propertyTypes&&Object.prototype.hasOwnProperty.call(self.propertyTypes,name))result=self.propertyTypes[name]}else result=options.writeAttribute;if(result!==undefined){if(Array.isArray(self.propertiesToReflectAsAttributes))if(options.writeAttribute===true)self.propertiesToReflectAsAttributes.push(name);else if(self.normalizePropertyTypeList)self.propertiesToReflectAsAttributes=self.normalizePropertyTypeList(self.propertiesToReflectAsAttributes);if(self.propertiesToReflectAsAttributes instanceof Map)self.propertiesToReflectAsAttributes.set(name,result);if(_typeof(self.propertiesToReflectAsAttributes)==="object")self.propertiesToReflectAsAttributes[name]=result}}}if(options.alias){if(!Object.prototype.hasOwnProperty.call(self,"propertyAliases"))self.propertyAliases=self.propertyAliases?_objectSpread({},self.propertyAliases):{};if(self.propertyAliases&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyAliases[name]=options.alias}}}/* harmony default export */ __webpack_exports__.A = (property);
/***/ })
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter/value functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ if(Array.isArray(definition)) {
/******/ var i = 0;
/******/ while(i < definition.length) {
/******/ var key = definition[i++];
/******/ var binding = definition[i++];
/******/ if(!__webpack_require__.o(exports, key)) {
/******/ if(binding === 0) {
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
/******/ } else {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
/******/ }
/******/ } else if(binding === 0) { i++; }
/******/ }
/******/ } else {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ FH: function() { return /* binding */ api; },
/* harmony export */ Hh: function() { return /* binding */ GenericHTMLElement; },
/* harmony export */ Nc: function() { return /* binding */ Web; },
/* harmony export */ Rm: function() { return /* binding */ log; }
/* harmony export */ });
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
/* harmony import */ var _decorator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
// #!/usr/bin/env babel-node
// -*- coding: utf-8 -*-
/** @module web *//* !
region header
[Project page](https://torben.website/web-component-wrapper)
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stands under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
endregion
*/// region imports
var _dec,_class,_descriptor,_Web;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _initializerDefineProperty(e,i,r,l){r&&Object.defineProperty(e,i,{enumerable:r.enumerable,configurable:r.configurable,writable:r.writable,value:r.initializer?r.initializer.call(l):void 0})}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _applyDecoratedDescriptor(i,e,r,n,l){var a={};return Object.keys(n).forEach(function(i){a[i]=n[i]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=r.slice().reverse().reduce(function(r,n){return n(i,e,r)||r},a),l&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(l):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(i,e,a),null):a}function _initializerWarningHelper(r,e){throw Error("Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")};// endregion
var log=new clientnode__WEBPACK_IMPORTED_MODULE_0__.Logger({name:"web-component-wrapper.web"});/*
NOTE: We mock HTMLElement to be able to load this class and derived one
into node environments.
*/var GenericHTMLElement=typeof HTMLElement==="undefined"?/*#__PURE__*/// eslint-disable-next-line @typescript-eslint/no-extraneous-class
_createClass(function HTMLElement(){_classCallCheck(this,HTMLElement)}):HTMLElement;/**
* Generic web component to render a content against instance-specific values.
* @property applyRootBinding - If determined itself as root declarative event
* and property bindings will be applied to itself.
* @property content - Content to render when changes happened.
* @property determineRootBinding - If checked this component determines if it
* is a root component (not wrapped by another web-component).
* @property shadowDOM - Configures if a shadow dom should be used during
* web-component instantiation. Can hold initialize configuration.
* @property observedAttributes - Attribute names to observe for changes.
* @property controllableProperties - A list of controllable property names.
* @property eventToPropertyMapping - Explicitly defined output events (a
* mapping of event names to a potential parameter to properties-transformer).
* @property propertyAliases - A mapping of property names to be treated as
* equal.
* @property propertyTypes - Configuration defining how to convert attributes
* into properties and reflect property changes back to attributes.
* @property propertiesToReflectAsAttributes - An Item, List, or Mapping of
* properties to reflect as attributes.
* @property renderProperties - List of known render properties.
* @property cloneSlots - Indicates whether to clone slot before to transclude
* content into them. If a slot should be used multiple times (for example,
* when it works as a template node.) they should be copied to avoid unexpected
* mutations.
* @property doRender - Configures whether this component instance should
* evaluate its given body content.
* @property evaluateSlots - Indicates whether to evaluate slot content when
* before rendering them.
* @property renderSlots - Indicates whether determined slots should be
* rendered into root node.
* @property trimSlots - Ignore empty text nodes while applying slots.
* @property renderUnsafe - Defines default render behavior.
* @property _name - Name to access instance-evaluated content or used
* to derive default component name. This is also useful for logging.
* @property _propertyAliasIndex - Internal alias index to quickly match
* properties in both directions.
* @property _propertiesToReflectAsAttributes - A mapping of property names to
* set as attributes when they are set/updated. Uses a map to hold order and
* determine if a property exists in constant runtime.
* @property renderState - Holds data about currently running render state.
* @property renderState.promise - Promise resolving when next rendering has
* been finished.
* @property renderState.pending - Indicates whether a rendering task is
* performing.
* @property renderState.resolve - Callback to trigger when rendering has been
* finished.
* @property childComponentInstances - List of direct child components (needed
* to wait for them to finish dom manipulation).
* @property batchAttributeUpdates - Indicates whether to directly update dom
* after each attribute mutation or to wait and batch mutations after current
* queue has been finished.
* @property batchPropertyUpdates - Indicates whether to directly update dom
* after each property mutation or to wait and batch mutations after current
* queue has been finished.
* @property batchUpdates - Indicates whether to directly perform a
* re-rendering after changes on properties have been made.
* @property batchedAttributeUpdateRunning - A boolean indicator to identify if
* an attribute update is currently batched.
* @property batchedPropertyUpdateRunning - A boolean indicator to identify if
* a property update is currently batched.
* @property batchedUpdateRunning - Indicates whether a batched render update
* is currently running.
* @param connectionRegistered - Indicates whether this component is connected
* to DOM and could run its connectedCallback.
* @param pendingAttributeUpdates - Holds pending attribute updates which
* should be performed when the component is connected to DOM.
* @property parentInstance - Parent component instance.
* @property rootInstance - Root component instance.
* @property scope - Render scope.
* @property domNodeEventBindings - Holds a mapping from nodes with registered
* event handlers mapped to their deregistration function.
* @property domNodeTemplateCache - Caches template compilation results.
* @property externalProperties - Holds currently evaluated or seen properties.
* @property ignoreAttributeUpdateObservations - Indicates whether attribute
* updates should be considered (usually only needed internally).
* @property internalProperties - Holds currently evaluated properties which
* are owned by this instance and should always be delegated.
* @property outputEventNames - Set of determined output event names.
* @property instance - Wrapped component instance.
* @property isRoot - Indicates whether their exists another web-derived
* component up the tree or not.
* @property root - Hosting dom node.
* @property runDomConnectionAndRenderingInSameEventQueue - Indicates whether
* we should render initial dom immediately after the component is connected to
* dom. Deactivating this allows wrapped components to detect their parents
* since their parent-connected callback will be called before the children's
* render method.
* @property self - Back-reference to this class.
* @property slots - Grabbed slots that where present in the connecting phase.
*/var Web=(_dec=(0,_decorator_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A)({type:clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.boolean,writeAttribute:true}),_class=(_Web=/*#__PURE__*/function(_GenericHTMLElement){// endregion
// region live cycle hooks
/**
* Initializes host dom content and properties.
* @returns Nothing.
*/function Web(){var _this;_classCallCheck(this,Web);_this=_callSuper(this,Web);_defineProperty(_this,"renderState",{promise:Promise.resolve(""),pending:false,resolve:clientnode__WEBPACK_IMPORTED_MODULE_0__.NOOP});// Constructor might be executed when accessed via child components.
_defineProperty(_this,"childComponentInstances",[]);_defineProperty(_this,"batchAttributeUpdates",true);_defineProperty(_this,"batchPropertyUpdates",true);_defineProperty(_this,"batchUpdates",true);/*
NOTE: We set these properties to true initially since we want to
prevent any updates until the component is connected to dom.
*/_defineProperty(_this,"batchedAttributeUpdateRunning",true);_defineProperty(_this,"batchedPropertyUpdateRunning",true);_defineProperty(_this,"batchedUpdateRunning",true);_defineProperty(_this,"connectionRegistered",false);_defineProperty(_this,"pendingAttributeUpdates",[]);_defineProperty(_this,"parentInstance",null);_defineProperty(_this,"rootInstance",void 0);_defineProperty(_this,"hostDomNode",void 0);_defineProperty(_this,"scope",_objectSpread({},clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE));_defineProperty(_this,"domNodeEventBindings",new Map);_defineProperty(_this,"domNodeTemplateCache",new Map);_defineProperty(_this,"externalProperties",{});_defineProperty(_this,"ignoreAttributeUpdateObservations",false);_defineProperty(_this,"internalProperties",{});_defineProperty(_this,"outputEventNames",new Set);_defineProperty(_this,"instance",null);_initializerDefineProperty(_this,"isRoot",_descriptor,_this);_defineProperty(_this,"runDomConnectionAndRenderingInSameEventQueue",false);_defineProperty(_this,"self",Web);_defineProperty(_this,"slots",{});_this.prepareNewRenderingPromise();/*
NOTE: We cannot use something like "this." e.g. "this.self" to
determine class properties since instance properties like "self"
may not set properly yet because this method is called during
constructing this instance itself.
*/_this.self=_this.constructor;if(!_this.self._propertiesToReflectAsAttributes)_this.self._propertiesToReflectAsAttributes=_this.self.normalizePropertyTypeList(_this.self.propertiesToReflectAsAttributes);_this.generateAliasIndex();// NOTE: Shadow root will be applied when rendering the first time.
_this.hostDomNode=_this;_this.rootInstance=_this;/*
NOTE: We define getter and setter at the end to avoid shadowing
existing property names.
*/_this.defineGetterAndSetterInterface();return _this}/**
* Triggered when ever a given attribute has changed and triggers to update
* configured dom content.
* @param name - Attribute name which was updates.
* @param oldValue - Old attribute value.
* @param newValue - New updated value.
*/_inherits(Web,_GenericHTMLElement);return _createClass(Web,[{key:"attributeChangedCallback",value:function attributeChangedCallback(name,oldValue,newValue){if(this.ignoreAttributeUpdateObservations||oldValue===newValue)return;void this.onUpdateAttribute(name,newValue)}/**
* Updates given attribute representation.
* @param name - Attribute name which was updates.
* @param newValue - New updated value.
* @returns Promise resolving when attribute has been updated.
*/},{key:"onUpdateAttribute",value:function onUpdateAttribute(name,newValue){var _this2=this;var promise=new Promise(function(resolve){return _this2.pendingAttributeUpdates.push(function(){_this2.evaluateStringOrNullAndSetAsProperty(name,newValue);if(_this2.batchAttributeUpdates){if(!(_this2.batchedAttributeUpdateRunning||_this2.batchedUpdateRunning)){_this2.batchedAttributeUpdateRunning=true;_this2.batchedUpdateRunning=true;void (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)(function(){_this2.batchedAttributeUpdateRunning=false;_this2.batchedUpdateRunning=false;void _this2.render("attributeChanged")})}}else void _this2.render("attributeChanged");resolve()})});if(this.connectionRegistered)while(this.pendingAttributeUpdates.length)this.pendingAttributeUpdates.shift()();return promise}/**
* Triggered when this component is mounted into the document.
* Attaches event handler, grabs given slots, reflects external properties,
* and enqueues first rendering.
*/},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;// NOTE: Hack to support IE 11 here.
try{this.isConnected=true}catch(_unused){// Ignore error.
}this.connectionRegistered=true;// NOTE: Can be overwritten during optional root determining.
this.parentInstance=this;this.rootInstance=this;this.attachEventHandler();if(this.self.determineRootBinding){this.determineRootBinding();if(this.parentInstance!==this&&this.parentInstance.childComponentInstances)this.parentInstance.childComponentInstances.push(this)}if(this.self.applyRootBinding&&this.isRoot){this.determineRenderScope();this.applyBinding(this,this.scope)}while(this.pendingAttributeUpdates.length)this.pendingAttributeUpdates.shift()();this.batchedAttributeUpdateRunning=false;this.batchedPropertyUpdateRunning=false;this.batchedUpdateRunning=false;this.grabGivenSlots();this.reflectExternalProperties(this.externalProperties);if(this.runDomConnectionAndRenderingInSameEventQueue)void this.render("connected");else void (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)(function(){void _this3.render("connected")})}/**
* Triggered when this component is unmounted from the document. Event
* handlers will be removed and state updated accordingly.
*/},{key:"disconnectedCallback",value:function disconnectedCallback(){this.unRender("disconnected");this.unregisterConnectionState()}// endregion
// region getter/setter
/**
* Registers needed getter and setter to get notified about changes and
* reflect them.
*/},{key:"defineGetterAndSetterInterface",value:function defineGetterAndSetterInterface(){var _this4=this;var allPropertyNames=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[]));var _iterator=_createForOfIteratorHelper(allPropertyNames),_step;try{var _loop=function _loop(){var propertyName=_step.value;// If there already exists a local value, use them.
if(Object.prototype.hasOwnProperty.call(_this4,propertyName))_this4.setPropertyValue(/* eslint-disable @typescript-eslint/unbound-method */propertyName,_this4[propertyName]/* eslint-enable @typescript-eslint/unbound-method */);Object.defineProperty(_this4,propertyName,{configurable:true,get:function get(){return _this4.getPropertyValue(propertyName)},set:function set(value){_this4.setPropertyValue(propertyName,value);_this4.triggerPropertySpecificRendering(propertyName,value)}})};for(_iterator.s();!(_step=_iterator.n()).done;){_loop()}}catch(err){_iterator.e(err)}finally{_iterator.f()}}/**
* Creates an index to match alias source and target against each other on
* constant runtime.
* @param name - Name to search an alternate name for.
* @returns Found alias or "null".
*/},{key:"getPropertyAlias",value:function getPropertyAlias(name){if(this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,name))return this.self._propertyAliasIndex[name];return null}/**
* Generic property getter. Forwards properties from the "properties"
* field.
* @param name - Property name to retrieve.
* @returns Retrieved property value.
*/},{key:"getPropertyValue",value:function getPropertyValue(name){var _this$instance,_name,_this$instance2;var result=(_this$instance=this.instance)!==null&&_this$instance!==void 0&&(_this$instance=_this$instance.current)!==null&&_this$instance!==void 0&&_this$instance.properties&&(// NOTE: Base properties should not be shadowed.
Object.prototype.hasOwnProperty.call(!Web.propertyTypes,name)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,name))?this.instance.current.properties[name]:(_name=this.internalProperties[name])!==null&&_name!==void 0?_name:this.externalProperties[name];if((_this$instance2=this.instance)!==null&&_this$instance2!==void 0&&(_this$instance2=_this$instance2.current)!==null&&_this$instance2!==void 0&&_this$instance2.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,name))return this.instance.current.state[name];return result}/**
* External property setter. Respects configured aliases.
* @param name - Property name to write.
* @param value - New value to write.
*/},{key:"setExternalPropertyValue",value:function setExternalPropertyValue(name,value){this.externalProperties[name]=value;var alias=this.getPropertyAlias(name);if(alias)this.externalProperties[alias]=value}/**
* Internal property setter. Respects configured aliases.
* @param name - Property name to write.
* @param value - New value to write.
*/},{key:"setInternalPropertyValue",value:function setInternalPropertyValue(name,value){this.internalProperties[name]=value;var alias=this.getPropertyAlias(name);if(alias)this.internalProperties[alias]=value}/**
* Generic property setter. Forwards field writes into internal and
* external property representations.
* @param name - Property name to write.
* @param value - New value to write.
*/},{key:"setPropertyValue",value:function setPropertyValue(name,value){this.reflectProperties(_defineProperty({},name,value));this.setInternalPropertyValue(name,value)}/**
* Triggers a new rendering cycle and respects property-specific state
* connection.
* @param name - Property name to write.
* @param value - New value to write.
*/},{key:"triggerPropertySpecificRendering",value:function triggerPropertySpecificRendering(name,value){var _this5=this;if(this.batchPropertyUpdates){if(!(this.batchedPropertyUpdateRunning||this.batchedUpdateRunning)){this.batchedPropertyUpdateRunning=true;this.batchedUpdateRunning=true;void (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)(function(){if(value!==undefined&&_this5.isStateProperty(name)){void _this5.render("preStatePropertyChanged");void (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)(function(){_this5.setInternalPropertyValue(name,undefined);_this5.batchedPropertyUpdateRunning=false;_this5.batchedUpdateRunning=false;void _this5.render("postStatePropertyChanged");_this5.triggerOutputEvents()})}else{_this5.batchedPropertyUpdateRunning=false;_this5.batchedUpdateRunning=false;void _this5.render("propertyChanged");_this5.triggerOutputEvents()}})}}else{var isStateProperty=this.isStateProperty(name);void this.render(isStateProperty?"preStatePropertyChanged":"propertyChanged");if(value!==undefined&&isStateProperty){this.setInternalPropertyValue(name,undefined);void this.render("postStatePropertyChanged")}this.triggerOutputEvents()}}// endregion
// region helper
/// region utility
},{key:"unregisterConnectionState",value:function unregisterConnectionState(){// NOTE: Hack to support IE 11 here.
try{this.isConnected=false}catch(_unused2){// Ignore error.
}this.connectionRegistered=false;this.slots={}}},{key:"unregisterDomNodeEventBindings",value:function unregisterDomNodeEventBindings(){var _iterator2=_createForOfIteratorHelper(this.domNodeEventBindings.values()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var map=_step2.value;var _iterator3=_createForOfIteratorHelper(map.values()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var deregister=_step3.value;deregister()}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}//// region dom nodes
/**
* Binds properties and event handler to the given dom node.
* @param domNode - Node to start traversing from.
* @param scope - Scope to render property value again.
*/},{key:"applyBinding",value:function applyBinding(domNode,scope){var _this6=this;if(!domNode.getAttributeNames)return;var _iterator4=_createForOfIteratorHelper(domNode.getAttributeNames()),_step4;try{var _loop2=function _loop2(){var attributeName=_step4.value;var name;if(attributeName.startsWith("data-bind-"))name=attributeName.substring("data-bind-".length);else if(attributeName.startsWith("bind-"))name=attributeName.substring("bind-".length);if(name){var value=domNode.getAttribute(attributeName);if(value===null)return 0;// continue
if(name.startsWith("attribute-")||name.startsWith("property-")){var evaluated=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.evaluate)(value,scope,false,true,domNode);if(evaluated.error){log.warn("Error occurred during processing given","attribute binding \"".concat(attributeName,"\" on node:"),domNode,evaluated.error);return 0;// continue
}if(name.startsWith("attribute-"))domNode.setAttribute(name.substring("attribute-".length),evaluated.result);else/*
NOTE: Cast to "textContent" to have a writable
property here.
*/domNode[(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.delimitedToCamelCase)(name.substring("property-".length))]=evaluated.result}else if(name.startsWith("on-")){name=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.delimitedToCamelCase)(name.substring("on-".length));scope=_objectSpread({log:log,event:undefined,parameters:undefined},scope);/*
NOTE: We pre-compile event listener since they should
usually be called more often than binded.
*/var compilation=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.compile)(value,scope,true,true,domNode);if(compilation.error)log.warn("Error occurred during compiling given event","binding \"".concat(attributeName,"\" on node:"),domNode,compilation.error);else _this6.addSecureEventListener(domNode,name,function(){for(var _len=arguments.length,parameters=new Array(_len),_key=0;_key<_len;_key++){parameters[_key]=arguments[_key]}scope.event=parameters[0];scope.parameters=parameters;try{compilation.templateFunction.apply(compilation,_toConsumableArray(compilation.originalScopeNames.map(function(name){return scope[name]})))}catch(error){log.warn("Error occurred during processing","given event binding","\"".concat(attributeName,"\" on node:"),domNode,"Given expression \"".concat(value,"\" could"),"not be evaluated with given scope","names \""+compilation.scopeNames.join("\", \"")+"\": ".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_0__.represent)(error)))}})}}},_ret;for(_iterator4.s();!(_step4=_iterator4.n()).done;){_ret=_loop2();if(_ret===0)continue}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}/**
* Binds properties and event handler to given, sibling, and nested nodes.
* @param domNode - Node to start traversing from.
* @param scope - Scope to render property value again.
* @param renderSlots - Indicates whether to render nested elements of
* slots (determined by an existing corresponding attribute).
*/},{key:"applyBindings",value:function applyBindings(domNode,scope,renderSlots){if(renderSlots===void 0){renderSlots=true}while(domNode){var _attributes;if((_attributes=domNode.attributes)!==null&&_attributes!==void 0&&_attributes.length&&(renderSlots||!domNode.getAttribute("slot")))this.applyBinding(domNode,scope);/*
NOTE: Slots of nested custom components (recognized by their
dash in name) should be rendered by their own.
*/if(!domNode.nodeName.toLowerCase().includes("-"))this.applyBindings(domNode.firstChild,scope);domNode=domNode.nextSibling}}/**
* Compiles given node content and their children. Provides a corresponding
* map of compiled template functions connected to their (sub) nodes and
* expected scope names.
* @param domNode - Node to compile.
* @param scope - Scope to extract names from.
* @param options - Additional compile options.
* @param options.filter - Callback to exclude some node from being
* compiled.
* @param options.ignoreComponents - Indicates if component properties
* should be traversed or not.
* @param options.ignoreNestedComponents - Indicates if nested components
* should be traversed or not.
* @param options.unsafe - Indicates if full HTML generation should be
* allowed.
* @returns Map of compiled templates.
*/},{key:"compileDomNodeTemplate",value:function compileDomNodeTemplate(domNode,scope,options){if(scope===void 0){scope=[]}if(options===void 0){options={}}options=_objectSpread({ignoreComponents:true,ignoreNestedComponents:true,unsafe:this.self.renderUnsafe},options);var nodeName=domNode.nodeName.toLowerCase();/*
NOTE: Slots of nested custom components (recognized by their dash
in name) should be rendered / controlled by them on their own.
*/if(options.ignoreComponents&&nodeName.includes("-"))return null;if(options.unsafe){var _template=domNode.innerHTML;if(!_template&&domNode.template)_template=domNode.template;if(this.self.hasCode(_template)){var _result=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.compile)("`".concat(_template,"`"),scope);return{domNode:domNode,children:[],error:_result.error,scopeNames:_result.scopeNames,template:_template,templateFunction:_result.templateFunction}}return null}var template=null;if(nodeName==="#text"){var content=domNode.textContent;if(content&&this.self.hasCode(content))template=content.replace(/ /g," ").trim()}var children=[];var result={children:children,domNode:domNode};if(template){var compilationResult=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.compile)("`".concat(template,"`"),scope);result.error=compilationResult.error;result.scopeNames=compilationResult.scopeNames;result.template=template;result.templateFunction=compilationResult.templateFunction}// Compile content of each nested node.
var currentDomNode=domNode.firstChild;while(currentDomNode){if(!options.filter||options.filter(currentDomNode)){var _result2=this.compileDomNodeTemplate(currentDomNode,scope,_objectSpread(_objectSpread({},options),{},{ignoreComponents:options.ignoreNestedComponents}));if(_result2)children.push(_result2)}currentDomNode=currentDomNode.nextSibling}return result}/**
* @param options - Evaluation options.
* @param scope - Scope to evaluate against.
* @returns Evaluated string result or null.
*/},{key:"evaluateCompiledDomNodeTemplate",value:function evaluateCompiledDomNodeTemplate(options,scope){var domNode=options.domNode,error=options.error,templateFunction=options.templateFunction,scopeNames=options.scopeNames;if(!(templateFunction&&scopeNames))return null;if(error){log.warn("Error occurred during compiling node content:",error);return null}var output=null;try{output=templateFunction.apply(void 0,_toConsumableArray(scopeNames.map(function(name){return scope[name]})))}catch(error){log.warn(