web-component-wrapper 0.0.601 → 0.0.604
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ReactWeb.d.ts +4 -3
- package/dist/ReactWeb.js +857 -1
- package/dist/Web.d.ts +3 -2
- package/dist/Web.js +615 -1
- package/dist/bundle/ReactWeb.js +23014 -7
- package/dist/bundle/Web.js +5555 -3
- package/dist/bundle/compatible/ReactWeb.js +22994 -7
- package/dist/bundle/compatible/Web.js +5545 -3
- package/dist/bundle/compatible/decorator.js +5038 -3
- package/dist/bundle/compatible/index.js +23048 -7
- package/dist/bundle/compatible/test.js +23079 -7
- package/dist/bundle/compatible/type.js +16 -1
- package/dist/bundle/decorator.js +5039 -3
- package/dist/bundle/index.js +23066 -7
- package/dist/bundle/test.js +23103 -7
- package/dist/bundle/type.js +16 -1
- package/dist/compatible/ReactWeb.js +841 -1
- package/dist/compatible/Web.js +605 -1
- package/dist/compatible/decorator.js +131 -1
- package/dist/compatible/index.js +909 -1
- package/dist/compatible/test.js +941 -1
- package/dist/compatible/type.js +16 -1
- package/dist/decorator.d.ts +1 -1
- package/dist/decorator.js +132 -1
- package/dist/index.js +925 -1
- package/dist/test.js +961 -1
- package/dist/type.d.ts +4 -4
- package/dist/type.js +16 -1
- package/package.json +32 -19
- package/readme.md +37 -15
package/dist/compatible/index.js
CHANGED
|
@@ -1 +1,909 @@
|
|
|
1
|
-
"use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter((function(path){return eval("require.main.paths").includes(path)}))))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("clientnode"),require("clientnode/property-types"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("react"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/extends","@babel/runtime/helpers/inheritsLoose","clientnode","clientnode/property-types","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator","react","react-dom","react-dom/client","@babel/runtime/helpers/initializerDefineProperty","@babel/runtime/helpers/applyDecoratedDescriptor","@babel/runtime/helpers/initializerWarningHelper"],t);else{var r="object"==typeof exports?t(require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/inheritsLoose"),require("clientnode"),require("clientnode/property-types"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("react"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper")):t(e["@babel/runtime/helpers/extends"],e["@babel/runtime/helpers/inheritsLoose"],e.clientnode,e["clientnode/property-types"],e["@babel/runtime/helpers/asyncToGenerator"],e["@babel/runtime/regenerator"],e.react,e["react-dom"],e["react-dom/client"],e["@babel/runtime/helpers/initializerDefineProperty"],e["@babel/runtime/helpers/applyDecoratedDescriptor"],e["@babel/runtime/helpers/initializerWarningHelper"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(function(e,t,r,n,i,o,s,a,p,l,c,u){return function(){var d=[function(t){t.exports=e},function(e){e.exports=r},function(e){e.exports=n},function(e){e.exports=t},function(e){e.exports=i},function(e){e.exports=o},function(e,t,r){var n=r(0),i=r.n(n),o=r(1),s=r(2);t.default=function(e){return void 0===e&&(e={}),e=i()({readAttribute:!0,type:s.string},e),function(t,r){if("string"==typeof r){var n,s=t.self||t.constructor;if(e.readAttribute){Object.prototype.hasOwnProperty.call(s,"observedAttributes")||(s.observedAttributes=s.observedAttributes?[].concat(s.observedAttributes):[]);var a=(0,o.camelCaseToDelimited)(r);s.observedAttributes&&!s.observedAttributes.includes(a)&&s.observedAttributes.push(a)}if(e.type&&(Object.prototype.hasOwnProperty.call(s,"propertyTypes")||(s.propertyTypes=s.propertyTypes?i()({},s.propertyTypes):{}),!s.propertyTypes||!e.update&&Object.prototype.hasOwnProperty.call(s,r)||(s.propertyTypes[r]=e.type)),e.writeAttribute)if(Object.prototype.hasOwnProperty.call(s,"propertiesToReflectAsAttributes")||(s.propertiesToReflectAsAttributes=s.propertiesToReflectAsAttributes?(0,o.copy)(s.propertiesToReflectAsAttributes):[]),e.update||s.propertiesToReflectAsAttributes instanceof Map&&!s.propertiesToReflectAsAttributes.has(r)||Array.isArray(s.propertiesToReflectAsAttributes)&&!s.propertiesToReflectAsAttributes.includes(r)||"object"==typeof s.propertiesToReflectAsAttributes&&!Object.prototype.hasOwnProperty.call(s.propertiesToReflectAsAttributes,r))"boolean"==typeof e.writeAttribute?e.writeAttribute&&s.propertyTypes&&Object.prototype.hasOwnProperty.call(s.propertyTypes,r)&&(n=s.propertyTypes[r]):n=e.writeAttribute,void 0!==n&&(Array.isArray(s.propertiesToReflectAsAttributes)&&(!0===e.writeAttribute?s.propertiesToReflectAsAttributes.push(r):s.normalizePropertyTypeList&&(s.propertiesToReflectAsAttributes=s.normalizePropertyTypeList(s.propertiesToReflectAsAttributes))),s.propertiesToReflectAsAttributes instanceof Map&&s.propertiesToReflectAsAttributes.set(r,n),"object"==typeof s.propertiesToReflectAsAttributes&&(s.propertiesToReflectAsAttributes[r]=n));e.alias&&(Object.prototype.hasOwnProperty.call(s,"propertyAliases")||(s.propertyAliases=s.propertyAliases?i()({},s.propertyAliases):{}),!s.propertyAliases||!e.update&&Object.prototype.hasOwnProperty.call(s,r)||(s.propertyAliases[r]=e.alias))}}}},function(e,t,r){r.d(t,{api:function(){return R}});var n,i,o,s,a=r(4),p=r.n(a),l=r(8),c=r.n(l),u=r(0),d=r.n(u),h=r(3),f=r.n(h),m=r(9),y=r.n(m),b=(r(10),r(5)),v=r.n(b),g=r(1),P=r(2),A=r(6);function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return T(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var O=new g.Logger({name:"web-component-wrapper-web"}),S="undefined"==typeof HTMLElement?function(){}:HTMLElement,C=(n=(0,A.default)({type:P.boolean,writeAttribute:!0}),s=function(e){function t(){var r;return(r=e.call(this)||this).renderState={promise:Promise.resolve(""),pending:!1,resolve:g.NOOP},r.childComponentInstances=[],r.batchAttributeUpdates=!0,r.batchPropertyUpdates=!0,r.batchUpdates=!0,r.batchedAttributeUpdateRunning=!0,r.batchedPropertyUpdateRunning=!0,r.batchedUpdateRunning=!0,r.connectionRegistered=!1,r.pendingAttributeUpdates=[],r.parentInstance=null,r.rootInstance=void 0,r.hostDomNode=void 0,r.scope=d()({},g.UTILITY_SCOPE),r.domNodeEventBindings=new Map,r.domNodeTemplateCache=new Map,r.externalProperties={},r.ignoreAttributeUpdateObservations=!1,r.internalProperties={},r.outputEventNames=new Set,r.instance=null,c()(r,"isRoot",o,r),r.runDomConnectionAndRenderingInSameEventQueue=!1,r.self=t,r.slots={},r.prepareNewRenderingPromise(),r.self=r.constructor,r.self._propertiesToReflectAsAttributes||(r.self._propertiesToReflectAsAttributes=r.self.normalizePropertyTypeList(r.self.propertiesToReflectAsAttributes)),r.generateAliasIndex(),r.hostDomNode=r,r.rootInstance=r,r.defineGetterAndSetterInterface(),r}f()(t,e);var r=t.prototype;return r.attributeChangedCallback=function(e,t,r){this.ignoreAttributeUpdateObservations||t===r||this.onUpdateAttribute(e,r)},r.onUpdateAttribute=function(e,t){var r=this,n=new Promise((function(n){return r.pendingAttributeUpdates.push((function(){r.evaluateStringOrNullAndSetAsProperty(e,t),r.batchAttributeUpdates?r.batchedAttributeUpdateRunning||r.batchedUpdateRunning||(r.batchedAttributeUpdateRunning=!0,r.batchedUpdateRunning=!0,(0,g.timeout)((function(){r.batchedAttributeUpdateRunning=!1,r.batchedUpdateRunning=!1,r.render("attributeChanged")}))):r.render("attributeChanged"),n()}))}));if(this.connectionRegistered)for(;this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();return n},r.connectedCallback=function(){var e=this;try{this.isConnected=!0}catch(e){}for(this.connectionRegistered=!0,this.parentInstance=this,this.rootInstance=this,this.attachEventHandler(),this.self.determineRootBinding&&(this.determineRootBinding(),this.parentInstance!==this&&this.parentInstance.childComponentInstances&&this.parentInstance.childComponentInstances.push(this)),this.self.applyRootBinding&&this.isRoot&&(this.determineRenderScope(),this.applyBinding(this,this.scope));this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();this.batchedAttributeUpdateRunning=!1,this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.grabGivenSlots(),this.reflectExternalProperties(this.externalProperties),this.runDomConnectionAndRenderingInSameEventQueue?this.render("connected"):(0,g.timeout)((function(){e.render("connected")}))},r.disconnectedCallback=function(){this.unRender("disconnected"),this.unregisterConnectionState()},r.defineGetterAndSetterInterface=function(){for(var e,t=this,r=function(){var r=e.value;Object.prototype.hasOwnProperty.call(t,r)&&t.setPropertyValue(r,t[r]),Object.defineProperty(t,r,{configurable:!0,get:function(){return t.getPropertyValue(r)},set:function(e){t.setPropertyValue(r,e),t.triggerPropertySpecificRendering(r,e)}})},n=w((0,g.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[])));!(e=n()).done;)r()},r.getPropertyAlias=function(e){return this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,e)?this.self._propertyAliasIndex[e]:null},r.getPropertyValue=function(e){var r,n,i,o=null!=(r=this.instance)&&null!=(r=r.current)&&r.properties&&(Object.prototype.hasOwnProperty.call(!t.propertyTypes,e)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,e))?this.instance.current.properties[e]:null!==(n=this.internalProperties[e])&&void 0!==n?n:this.externalProperties[e];return null!=(i=this.instance)&&null!=(i=i.current)&&i.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,e)?this.instance.current.state[e]:o},r.setExternalPropertyValue=function(e,t){this.externalProperties[e]=t;var r=this.getPropertyAlias(e);r&&(this.externalProperties[r]=t)},r.setInternalPropertyValue=function(e,t){this.internalProperties[e]=t;var r=this.getPropertyAlias(e);r&&(this.internalProperties[r]=t)},r.setPropertyValue=function(e,t){var r;this.reflectProperties(((r={})[e]=t,r)),this.setInternalPropertyValue(e,t)},r.triggerPropertySpecificRendering=function(e,t){var r=this;if(this.batchPropertyUpdates)this.batchedPropertyUpdateRunning||this.batchedUpdateRunning||(this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,g.timeout)((function(){void 0!==t&&r.isStateProperty(e)?(r.render("preStatePropertyChanged"),(0,g.timeout)((function(){r.setInternalPropertyValue(e,void 0),r.batchedPropertyUpdateRunning=!1,r.batchedUpdateRunning=!1,r.render("postStatePropertyChanged"),r.triggerOutputEvents()}))):(r.batchedPropertyUpdateRunning=!1,r.batchedUpdateRunning=!1,r.render("propertyChanged"),r.triggerOutputEvents())})));else{var n=this.isStateProperty(e);this.render(n?"preStatePropertyChanged":"propertyChanged"),void 0!==t&&n&&(this.setInternalPropertyValue(e,void 0),this.render("postStatePropertyChanged")),this.triggerOutputEvents()}},r.unregisterConnectionState=function(){try{this.isConnected=!1}catch(e){}this.connectionRegistered=!1,this.slots={}},r.unregisterDomNodeEventBindings=function(){for(var e,t=w(this.domNodeEventBindings.values());!(e=t()).done;)for(var r,n=w(e.value.values());!(r=n()).done;){(0,r.value)()}},r.applyBinding=function(e,t){var r=this;if(e.getAttributeNames)for(var n,i=function(){var i,o=n.value;if(o.startsWith("data-bind-")?i=o.substring(10):o.startsWith("bind-")&&(i=o.substring(5)),i){var s=e.getAttribute(o);if(null===s)return 0;if(i.startsWith("attribute-")||i.startsWith("property-")){var a=(0,g.evaluate)(s,t,!1,!0,e);if(a.error)return O.warn("Error occurred during processing given",'attribute binding "'+o+'" on node:',e,a.error),0;i.startsWith("attribute-")?e.setAttribute(i.substring(10),a.result):e[(0,g.delimitedToCamelCase)(i.substring(9))]=a.result}else if(i.startsWith("on-")){i=(0,g.delimitedToCamelCase)(i.substring(3)),t=d()({log:O,event:void 0,parameters:void 0},t);var p=(0,g.compile)(s,t,!0,!0,e);p.error?O.warn("Error occurred during compiling given event",'binding "'+o+'" on node:',e,p.error):r.addSecureEventListener(e,i,(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.event=n[0],t.parameters=n;try{p.templateFunction.apply(p,p.originalScopeNames.map((function(e){return t[e]})))}catch(t){O.warn("Error occurred during processing","given event binding",'"'+o+'" on node:',e,'Given expression "'+s+'" could',"not be evaluated with given scope",'names "'+p.scopeNames.join('", "')+'": '+(0,g.represent)(t))}}))}}},o=w(e.getAttributeNames());!(n=o()).done;)i()},r.applyBindings=function(e,t,r){for(void 0===r&&(r=!0);e;){var n;null==(n=e.attributes)||!n.length||!r&&e.getAttribute("slot")||this.applyBinding(e,t),e.nodeName.toLowerCase().includes("-")||this.applyBindings(e.firstChild,t),e=e.nextSibling}},r.compileDomNodeTemplate=function(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={}),r=d()({ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe},r);var n=e.nodeName.toLowerCase();if(r.ignoreComponents&&n.includes("-"))return null;if(r.unsafe){var i=e.innerHTML;if(!i&&e.template&&(i=e.template),this.self.hasCode(i)){var o=(0,g.compile)("`"+i+"`",t);return{domNode:e,children:[],error:o.error,scopeNames:o.scopeNames,template:i,templateFunction:o.templateFunction}}return null}var s=null;if("#text"===n){var a=e.textContent;a&&this.self.hasCode(a)&&(s=a.replace(/ /g," ").trim())}var p=[],l={children:p,domNode:e};if(s){var c=(0,g.compile)("`"+s+"`",t);l.error=c.error,l.scopeNames=c.scopeNames,l.template=s,l.templateFunction=c.templateFunction}for(var u=e.firstChild;u;){if(!r.filter||r.filter(u)){var h=this.compileDomNodeTemplate(u,t,d()({},r,{ignoreComponents:r.ignoreNestedComponents}));h&&p.push(h)}u=u.nextSibling}return l},r.evaluateCompiledDomNodeTemplate=function(e,t){var r=e.domNode,n=e.error,i=e.templateFunction,o=e.scopeNames;if(!i||!o)return null;if(n)return O.warn("Error occurred during compiling node content:",n),null;var s=null;try{s=i.apply(void 0,o.map((function(e){return t[e]})))}catch(n){O.warn('Error occurred when "'+this.self._name+'" is running','"'+String(i)+'": with bound','names "'+o.join('", "')+'":','"'+n+'". Rendering node:',r)}return s},r.evaluateDomNodeTemplate=function(e,t,r){var n=this;void 0===t&&(t={}),void 0===r&&(r={});var i=(r=d()({domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe},r)).domNodeTemplateCache;if(!i.has(e)){var o={filter:r.filter,ignoreComponents:r.ignoreComponents,ignoreNestedComponents:r.ignoreNestedComponents,unsafe:r.unsafe},s=this.compileDomNodeTemplate(e,t,o);s&&i.set(e,s)}if(i.has(e)){var a=i.get(e),p=this.evaluateCompiledDomNodeTemplate(a,t);if(null!==p&&(r.unsafe&&e.innerHTML?e.innerHTML=p:e.textContent=p),a.children.length){var l=function(e){for(var r,i=w(e);!(r=i()).done;){var o=r.value,s=n.evaluateCompiledDomNodeTemplate(o,t);null!==s&&(o.domNode.textContent=s),o.children.length&&l(o.children)}};l(a.children)}}r.applyBindings&&this.applyBindings(e,t)},r.addSecureEventListener=function(e,t,r,n,i){var o=this;this.domNodeEventBindings.has(e)||this.domNodeEventBindings.set(e,new Map);var s=this.domNodeEventBindings.get(e),a=s.get(t);a&&a!==r&&a();var p=function(){e.removeEventListener(t,r,i),s.delete(t),0===s.size&&o.domNodeEventBindings.delete(e)};return s.set(t,p),e.addEventListener(t,r,n),p},r.determineRootBinding=function(){for(var e=this.parentNode;e;){var r=e instanceof t||e.nodeName.includes("-")&&"#document-fragment"!==e.nodeName,n=null===e.parentNode&&"[object ShadowRoot]"===e.toString();r?(this.rootInstance===this&&(this.parentInstance=e,this.setPropertyValue("isRoot",!1)),this.rootInstance=e):n&&this.setPropertyValue("isRoot",!1),e=e.parentNode}},t.hasCode=function(e){return"string"==typeof e&&e.includes("${")&&e.includes("}")&&/\${[\s\S]+}/.test(e)},t.normalizePropertyTypeList=function(e){if("string"==typeof e&&(e=[e]),Array.isArray(e)){for(var r,n=e,i=new Map,o=w(n);!(r=o()).done;){var s=r.value;Object.prototype.hasOwnProperty.call(t.propertyTypes,s)&&i.set(s,t.propertyTypes[s])}return i}return(0,g.convertPlainObjectToMap)(e)},r.attachEventHandler=function(){if(null!==this.self.eventToPropertyMapping){var e=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!e)}},r.attachExplicitDefinedOutputEventHandler=function(){var e=this;if(!this.self.eventToPropertyMapping)return!1;for(var t=!1,r=function(){var r=i[n];Object.prototype.hasOwnProperty.call(e.internalProperties,r)||(t=!0,e.outputEventNames.add(r),e.setInternalPropertyValue(r,p()(v().mark((function t(){var n,i,o,s,a=arguments;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=a.length,i=new Array(n),o=0;o<n;o++)i[o]=a[o];return t.next=1,e.reflectEventToProperties(r,i);case 1:(s=t.sent)&&(i[0]=s),e.forwardEvent(r,i);case 2:case"end":return t.stop()}}),t)})))))},n=0,i=Object.keys(this.self.eventToPropertyMapping);n<i.length;n++)r();return t},r.attachImplicitDefinedOutputEventHandler=function(e){var t=this;void 0===e&&(e=!0);for(var r=function(){var r=i[n],o=r[0],s=r[1];Object.prototype.hasOwnProperty.call(t.internalProperties,o)||![P.func,"function"].includes(s)||t.self.renderProperties.includes(o)||(t.outputEventNames.add(o),t.setInternalPropertyValue(o,(function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e&&t.reflectEventToProperties(o,n),t.forwardEvent(o,n)})))},n=0,i=Object.entries(this.self.propertyTypes);n<i.length;n++)r()},r.triggerOutputEvents=function(){for(var e,t=w(this.outputEventNames);!(e=t()).done;){var r=e.value;this.forwardEvent(r,[this.externalProperties])}},r.forwardEvent=function(e,t){return e.length>3&&e.startsWith("on")&&(e=(0,g.lowerCase)(e.substring(2))),this.dispatchEvent(new CustomEvent(e,{detail:{parameters:t}}))},r.applySlots=function(e,r){for(var n=this,i=0,o=Array.from(e.querySelectorAll("slot"));i<o.length;i++){var s=o[i],a=s.getAttribute("name");if(null===a||"default"===a)if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots)for(var p,l=w(this.slots.default);!(p=l()).done;){var c=p.value;this.evaluateDomNodeTemplate(c,r)}(0,g.replace)(s,this.slots.default,t.trimSlots)}}else this.slots.default=(0,g.unwrap)(s).map((function(e){return n.grabSlotContent(e)}));else this.slots[a]?this.self.renderSlots&&(this.self.evaluateSlots&&this.evaluateDomNodeTemplate(this.slots[a],r),(0,g.replace)(s,this.slots[a],t.trimSlots)):this.slots[a]=this.grabSlotContent((0,g.unwrap)(s).filter((function(e){return"#text"!==e.nodeName.toLowerCase()}))[0])}},r.grabSlotContent=function(e){var t,r=P.node.firstElementChild?e:null;if(r&&"textarea"===(null==(t=r.firstElementChild)?void 0:t.nodeName.toLowerCase())&&(!r.firstElementChild.hasAttribute("data-no-template")||"false"===r.firstElementChild.getAttribute("data-no-template"))){var n=r.firstElementChild.value;r.classList.remove("web-component-template");var i=r.cloneNode();return r.classList.add("web-component-template"),i.innerHTML="",i.template=n,i}return this.self.cloneSlots?e.cloneNode(!0):e},r.grabGivenSlots=function(){var e=this;this.slots={};for(var t=0,r=Array.from(this.querySelectorAll("[slot]"));t<r.length;t++){for(var n,i=r[t],o=i.parentNode,s=!0;o;){if(o.nodeName.includes("-")){o===this&&(s=!1);break}o=o.parentNode}if(!s){var a=null==(n=i.getAttribute("slot"))?void 0:n.trim();this.slots[null!=a?a:i.nodeName.toLowerCase()]=this.grabSlotContent(i)}}this.slots.default?this.slots.default=[].concat(this.slots.default):this.childNodes.length>0?this.slots.default=Array.from(this.childNodes).map((function(t){return e.grabSlotContent(t)})):this.slots.default=[]},r.isStateProperty=function(e){var t;return Boolean((null==(t=this.instance)||null==(t=t.current)?void 0:t.state)&&(Object.prototype.hasOwnProperty.call(this.instance.current.state,e)||this.instance.current.state.modelState&&Object.prototype.hasOwnProperty.call(this.instance.current.state.modelState,e)))},r.generateAliasIndex=function(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex=d()({},this.self.propertyAliases);for(var e=0,t=Object.entries(this.self._propertyAliasIndex);e<t.length;e++){var r=t[e],n=r[0],i=r[1];Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,i)||(this.self._propertyAliasIndex[i]=n)}}},r.reflectExternalProperties=function(e){this.ignoreAttributeUpdateObservations=!0;for(var t=0,r=Object.entries(e);t<r.length;t++){var n,i=r[t],o=i[0],s=i[1];if(this.setExternalPropertyValue(o,s),this.isConnected){var a=(0,g.camelCaseToDelimited)(o);if(null!=(n=this.self._propertiesToReflectAsAttributes)&&n.has(o))switch(this.self._propertiesToReflectAsAttributes.get(o)){case P.boolean:case"boolean":s?""!==this.getAttribute(a)&&this.setAttribute(a,""):this.hasAttribute(a)&&this.removeAttribute(a);break;case P.func:case"function":break;case"json":if(s){var p=JSON.stringify(s);if(p&&this.getAttribute(a)!==p){this.setAttribute(a,p);break}}this.hasAttribute(a)&&this.removeAttribute(a);break;case P.number:case"number":if("number"!=typeof s||isNaN(s))this.hasAttribute(a)&&this.removeAttribute(a);else{var l=String(s);this.getAttribute(a)!==l&&this.setAttribute(a,l)}break;case P.string:case"string":s?this.getAttribute(a)!==s&&this.setAttribute(a,s):this.hasAttribute(a)&&this.removeAttribute(a);break;case P.any:case P.array:case P.arrayOf:case P.element:case P.elementType:case P.instanceOf:case P.node:case P.object:case"object":case P.objectOf:case P.shape:case P.exact:case P.symbol:default:if(s){var c=(0,g.represent)(s);if(c&&this.getAttribute(a)!==c){this.setAttribute(a,c);break}}this.hasAttribute(a)&&this.removeAttribute(a)}}}this.ignoreAttributeUpdateObservations=!1},r.reflectProperties=function(e){var t,r;if(this.reflectExternalProperties(e),null!=(t=this.instance)&&null!=(t=t.current)&&t.state&&"object"==typeof this.instance.current.state)for(var n,i=w(Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[]));!(n=i()).done;){var o=n.value;Object.prototype.hasOwnProperty.call(this.internalProperties,o)&&this.setInternalPropertyValue(o,void 0)}null!=(r=this.internalProperties.model)&&r.state&&(delete this.internalProperties.model.state,this.setInternalPropertyValue("model",this.internalProperties.model));for(var s,a=w(this.self.controllableProperties);!(s=a()).done;){var p=s.value;Object.prototype.hasOwnProperty.call(e,p)&&this.setInternalPropertyValue(p,e[p])}},r.reflectEventToProperties=function(){var e=p()(v().mark((function e(t,r){var n,i,o,s,a,p,l,c,u,h,f,m,y,b,P,A,T;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.batchUpdates,this.batchUpdates=!1,i=null,o=!1,!(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,t)&&(0,g.isFunction)(this.self.eventToPropertyMapping[t]))){e.next=4;break}if(!((a=(s=this.self.eventToPropertyMapping)[t].apply(s,r.concat([this])))&&"then"in a&&(0,g.isFunction)(a.then))){e.next=2;break}return e.next=1,a;case 1:T=e.sent,e.next=3;break;case 2:T=a;case 3:p=T,o=!0,Array.isArray(p)?(i=p[0],this.reflectProperties(i),(0,g.extend)(!0,this.internalProperties,p[1])):null===p?o=!1:"object"==typeof p&&(i=p,this.reflectProperties(p));case 4:if(!o&&r.length>0&&(0,g.isObject)(r[0])){if(c=r[0],"persist"in r[0]&&(0,g.isFunction)(r[0].persist))for(c={},u=0,h=Object.keys(this.self.propertyTypes);u<h.length;u++)for(f=h[u],m=w([f].concat(null!==(b=this.getPropertyAlias(f))&&void 0!==b?b:[]));!(y=m()).done;)P=y.value,(A=r[0].currentTarget&&Object.prototype.hasOwnProperty.call(r[0].currentTarget,P)?r[0].currentTarget[P]:this.getPropertyValue(P))!==this.externalProperties[P]&&(c[P]=A);else[null,void 0].includes(null==(l=c.detail)?void 0:l.value)||(c=d()({},c.detail));i=c,this.reflectProperties(c)}return this.triggerRender("propertyReflected"),this.batchUpdates=n,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.evaluateStringOrNullAndSetAsProperty=function(e,t){var r=this,n=e.startsWith("-"),i=n?e.substring(1):e,o=(0,g.delimitedToCamelCase)(i),s=this.getPropertyAlias(o);if(s&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,s)&&(o=s),Object.prototype.hasOwnProperty.call(this.self.propertyTypes,o)){var a=this.self.propertyTypes[o];if(n){if(t){var p=(0,g.evaluate)(t,d()({},g.UTILITY_SCOPE),!1,!0,this);p.error?(O.warn("Failed to process pre-evaluation attribute",'"'+e+'": '+p.error+". Will be",'set to "undefined".'),this.setInternalPropertyValue(o,void 0)):(this.setInternalPropertyValue(o,p.result),this.setExternalPropertyValue(o,p.result))}}else switch(a){case P.boolean:case"boolean":var l=![null,"false"].includes(t);this.setInternalPropertyValue(o,l),this.setExternalPropertyValue(o,l);break;case P.func:case"function":var c,u=null,h=["data","event","firstArgument","firstParameter","options"];if(t){var f=(0,g.compile)(t,h.concat("parameters","scope",g.UTILITY_SCOPE_NAMES),!0,!0,this);u=f.error,c=f.templateFunction,u&&O.warn("Failed to compile given handler",'"'+e+'": '+u+".")}this.setInternalPropertyValue(o,(function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];r.outputEventNames.has(o)&&r.reflectEventToProperties(o,i);var a=void 0;if(!u){for(var p=d()({parameters:i},g.UTILITY_SCOPE),l=0,f=h;l<f.length;l++){var m=f[l];p[m]=i[0]}try{a=null==c?void 0:c.apply(void 0,h.map((function(e){return p[e]})).concat([i,p],g.UTILITY_SCOPE_NAMES.map((function(e){return g.UTILITY_SCOPE[e]}))))}catch(r){O.warn("Failed to evaluate function",'"'+e+'" with expression','"'+t+'" and scope',"variables",'"'+h.join('", "')+'" set to','"'+(0,g.represent)(i)+'":',r+". Set property",'to "undefined".')}}return r.self.renderProperties.includes(o)||r.forwardEvent(o,i),a})),u||this.setExternalPropertyValue(o,c);break;case"json":if(t){var m;try{m=JSON.parse(t)}catch(u){O.warn("Error occurred during parsing given json",'attribute "'+e+'":',(0,g.represent)(u));break}this.setInternalPropertyValue(o,m),this.setExternalPropertyValue(o,(0,g.copy)(m,!1,1))}else this.setInternalPropertyValue(o,null),this.setExternalPropertyValue(o,null);break;case P.number:case"number":if(null===t){this.setInternalPropertyValue(o,t),this.setExternalPropertyValue(o,t);break}var y=parseFloat(t);isNaN(y)&&(y=void 0),this.setInternalPropertyValue(o,y),this.setExternalPropertyValue(o,y);break;case P.string:case"string":this.setInternalPropertyValue(o,t),this.setExternalPropertyValue(o,t);break;case P.any:case P.array:case P.arrayOf:case P.element:case P.elementType:case P.instanceOf:case P.node:case P.object:case"object":case P.objectOf:case P.oneOf:case P.oneOfType:case P.shape:case P.exact:case P.symbol:default:if(t){var b=(0,g.evaluate)(t,{},!1,!0,this);if(b.error){O.warn("Error occurred during processing given",'attribute configuration "'+e+'":',b.error);break}this.setInternalPropertyValue(o,b.result),this.setExternalPropertyValue(o,(0,g.copy)(b.result,!1,1))}else this.hasAttribute(e)?(this.setInternalPropertyValue(o,!0),this.setExternalPropertyValue(o,!0)):(this.setInternalPropertyValue(o,null),this.setExternalPropertyValue(o,null))}}},r.waitForNestedComponentRendering=function(){var e=p()(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.childComponentInstances){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,Promise.all(this.childComponentInstances.map((function(e){return e.renderState.pending?e.renderState.promise:Promise.resolve()})));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),r.resolveRenderingPromiseIfSet=function(){var e=p()(v().mark((function e(t,r){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r){e.next=2;break}return e.next=1,this.waitForNestedComponentRendering();case 1:this.renderState.pending=!1,this.renderState.resolve(t),this.prepareNewRenderingPromise();case 2:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.prepareNewRenderingPromise=function(){var e=this;this.renderState.pending||(this.renderState.promise=new Promise((function(t){e.renderState.resolve=function(r){e.renderState.pending=!1,t(r)}})))},r.triggerRender=function(e){var t=this;this.batchUpdates?this.batchedUpdateRunning||(this.batchedUpdateRunning=!0,(0,g.timeout)((function(){t.batchedUpdateRunning=!1,t.render(e)}))):this.render(e)},r.applyShadowRootIfNotExisting=function(){this.self.shadowDOM&&this.hostDomNode===this&&(this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,g.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"}))},r.determineRenderScope=function(e){var t,r;void 0===e&&(e={}),this.scope=d()({},(null==(t=this.parentInstance)?void 0:t.scope)||{},this.scope,this.internalProperties,((r={parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this})[(0,g.lowerCase)(this.self._name)||"instance"]=this,r),e),this.scope.scope=this.scope},r.render=function(){var e=p()(v().mark((function e(t,r){var n,i,o=this;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===t&&(t="unknown"),void 0===r&&(r=!0),this.unRender("reRender",t),this.childComponentInstances=[],this.renderState.pending=!0,!this.isRoot){e.next=3;break}return e.next=1,this.resolveRenderingPromiseIfSet(t,r);case 1:if(!r){e.next=3;break}return e.next=2,Promise.all(this.self.pendingRenderPromises);case 2:this.self.pendingRenderPromises=[];case 3:if(this.self.pendingRenderPromises.push(this.renderState.promise),this.determineRenderScope(),this.self.doRender&&this.dispatchEvent(new CustomEvent("render",{detail:{reason:t,scope:this.scope}}))){e.next=5;break}return e.next=4,this.resolveRenderingPromiseIfSet(t,r);case 4:return e.abrupt("return");case 5:if(!(n=(0,g.evaluate)("`"+this.self.content+"`",this.scope)).error){e.next=7;break}return O.warn("Failed to process template: "+n.error),this.renderState.resolve(t),e.next=6,Promise.all(this.self.pendingRenderPromises);case 6:return e.abrupt("return");case 7:return this.applyShadowRootIfNotExisting(),(i=document.createElement("div")).innerHTML=n.result,this.applySlots(i,d()({},this.scope,{parentInstance:this})),this.hostDomNode.innerHTML=i.innerHTML,e.next=8,(0,g.timeout)();case 8:return this.waitForNestedComponentRendering().then((function(){o.applyBindings(o.hostDomNode.firstChild,o.scope,o.self.renderSlots)})),e.next=9,this.resolveRenderingPromiseIfSet(t,r);case 9:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),r.unRender=function(e,t){void 0===e&&(e="unknown"),this.unregisterDomNodeEventBindings()},t}(S),s.applyRootBinding=!0,s.pendingRenderPromises=[],s.content="<slot>Please provide a template to transclude.</slot>",s.determineRootBinding=!0,s.shadowDOM=null,s.observedAttributes=[],s.controllableProperties=[],s.eventToPropertyMapping={},s.propertyAliases={},s.propertyTypes={onClick:P.func},s.propertiesToReflectAsAttributes=[],s.renderProperties=["children"],s.doRender=!1,s.cloneSlots=!1,s.evaluateSlots=!1,s.renderSlots=!0,s.trimSlots=!0,s.renderUnsafe=!1,s._name="BaseWeb",s._propertyAliasIndex=void 0,s._propertiesToReflectAsAttributes=void 0,i=s,o=y()(i.prototype,"isRoot",[n],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),i),R={component:C,register:function(e){void 0===e&&(e=(0,g.camelCaseToDelimited)(C._name)),customElements.define(e,C)}};t.default=C},function(e){e.exports=l},function(e){e.exports=c},function(e){e.exports=u},function(e){e.exports=s},function(e,t,r){r.d(t,{api:function(){return w}});var n=r(0),i=r.n(n),o=r(4),s=r.n(o),a=r(3),p=r.n(a),l=r(5),c=r.n(l),u=r(1),d=r(2),h=r(11),f=r.n(h),m=r(13),y=r(14),b=r(7);function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return g(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var P=new u.Logger({name:"web-component-wrapper-web"}),A=function(e){function t(){for(var r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(r=e.call.apply(e,[this].concat(i))||this).unmountOnDisconnect=!0,r.compiledSlots={},r.preparedSlots={},r.reactRoot=null,r.rootReactInstance=null,r.self=t,r.wrapMemorizingWrapper=null,r.isWrapped=!1,r.reflectInstanceProperties=function(){var e;null!=(e=r.instance)&&e.current&&r.instance.current.properties&&r.reflectProperties(r.instance.current.properties)},r}p()(t,e);var r=t.prototype;return r.connectedCallback=function(){this.applyComponentWrapper(),this.rootReactInstance=this,e.prototype.connectedCallback.call(this)},r.disconnectedCallback=function(){var e;this.unRender("disconnected"),this.unmountOnDisconnect&&(null==(e=this.reactRoot)||e.unmount()),this.unregisterConnectionState()},r.reflectExternalProperties=function(t){this.isRoot&&e.prototype.reflectExternalProperties.call(this,t)},r.render=function(){var t=s()(c().mark((function t(r,n){var o,s,a,p,l=this;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===r&&(r="unknown"),void 0===n&&(n=!0),e.prototype.unRender.call(this,"reRender",r),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(this.self.pendingRenderPromises=[]),this.self.pendingRenderPromises.push(this.renderState.promise),this.rootReactInstance===this&&this.dispatchEvent(new CustomEvent("render",{detail:{reason:r,scope:this.scope}}))){t.next=1;break}return t.abrupt("return",this.resolveRenderingPromiseIfSet(r,n));case 1:if(this.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&this.preCompileSlots(),this.evaluateSlots(i()({},this.scope,{parentInstance:this})),this.prepareProperties(this.internalProperties),this.applyShadowRootIfNotExisting(),this.rootInstance!==this&&!this.reactRoot)for(o=this.firstChild;o;)s=o.nextSibling,this.removeChild(o),o=s;if(this.reactRoot||(a=this.id||this.internalProperties.id||this.externalProperties.id||this.name||this.internalProperties.name||this.externalProperties.name,p="","string"==typeof a&&(p=a),this.reactRoot=(0,y.createRoot)(this.hostDomNode,{identifierPrefix:p})),(0,m.flushSync)((function(){var e;null==(e=l.reactRoot)||e.render((0,h.createElement)(l.self.content,l.internalProperties)),l.resolveRenderingPromiseIfSet(r,n)})),!n){t.next=2;break}return t.next=2,this.renderState.promise;case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),r.setPropertyValue=function(e,t){var r;this.reflectProperties(((r={})[e]=(0,u.copy)(t,!1,1),r)),this.setInternalPropertyValue(e,(0,u.copy)(t,!1,1))},r.setInternalPropertyValue=function(t,r){null===r?r=d.NullSymbol:void 0===r&&(r=d.UndefinedSymbol),e.prototype.setInternalPropertyValue.call(this,t,r)},r.preCompileDomNodes=function(e,t,r){if(void 0===t&&(t={}),void 0===r&&(r=!1),1===(e=e.filter((function(e){return e.nodeType!==Node.TEXT_NODE||"string"==typeof e.nodeValue&&""!==e.nodeValue.trim()}))).length)return this.preCompileDomNode(e[0],t,r);for(var n,i=1,o=[],s=v(e);!(n=s()).done;){var a=n.value,p=this.preCompileDomNode(a,t,r,i.toString());o.push(p),i+=1}return r?function(e){return function(){for(var t,r=[],n=v(o);!(t=n()).done;){var i=(0,t.value)(e);"function"==typeof i&&r.push(i.apply(void 0,arguments))}return(0,h.createElement)(h.Fragment,{children:r})}}:o},r.preCompileDomNode=function(e,t,r,n){var o=this;if(void 0===t&&(t={}),void 0===r&&(r=!1),r){var s=this.preCompileDomNode(e,i()({},t,{data:void 0,firstArgument:void 0,firstParameter:void 0,options:void 0,scope:void 0,parameters:void 0}),!1,n);return function(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r.length>0?r[0]:null;return s(i()({},e,{data:o,firstArgument:o,firstParameter:o,options:o,scope:o,parameters:r}))}}}if(e.nodeType===Node.TEXT_NODE){var a="string"==typeof e.nodeValue?e.nodeValue.trim():"",p=n&&a?(0,h.createElement)(h.Fragment,{children:a,key:n}):a||null;return function(){return p}}if(!e.getAttributeNames)return function(){return null};var l,c={},d=this.self.isReactComponent(e);d?(e.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&e.preCompileSlots(),n&&!Object.prototype.hasOwnProperty.call(c,"key")&&(c.key=n),l=e.constructor.content):(c.key=n,l=e.tagName.toLowerCase());for(var f,m=Object.keys(t),y={},b=function(){var r,n=f.value,i=e.getAttribute(n);if(null===i)return 0;var s=!1,a="";if(n.startsWith("data-bind-")?a=n.substring(10):n.startsWith("bind-")&&(a=n.substring(5)),a.startsWith("attribute-")||"attributes"===a||a.startsWith("property-")||"properties"===a){var p=(0,u.compile)(i,m),l=p.error,h=p.originalScopeNames,b=p.templateFunction;if(l)return P.warn("Error occurred during compiling given attribute",'binding "'+n+'" on node:',e,l),0;"attributes"===a||"properties"===a?s=!0:a=a.startsWith("attribute-")?a.substring(10):a.substring(9),i={originalScopeNames:h,templateFunction:b.bind(o)}}else if(a.startsWith("on-")){a=(0,u.delimitedToCamelCase)(a),Object.prototype.hasOwnProperty.call(t,"event")||(m=[].concat(m,["event"])),Object.prototype.hasOwnProperty.call(t,"parameters")||(m=[].concat(m,["parameters"]));var v=(0,u.compile)(i,m,!0),g=v.error,A=v.originalScopeNames,w=v.scopeNames,T=v.templateFunction;if(g)return P.warn("Error occurred during compiling given event",'binding "'+n+'" on node:',e,g),0;var O=T.bind(o);i=function(){for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];t.event=o[0],t.parameters=o;try{O.apply(void 0,A.map((function(e){return t[e]})))}catch(t){P.warn("Error occurred during processing given",'event binding "'+n+'" on node: ',e,'Given expression "'+i+'" could',"not be evaluated with given scope names",'"'+w.join('", "')+'":',(0,u.represent)(t))}}}else a=n;var S={class:"className",for:"htmlFor"};Object.prototype.hasOwnProperty.call(S,a)&&(a=S[a]),a=(0,u.delimitedToCamelCase)(a),null!=(r=i)&&r.originalScopeNames?y[s?"":a]=i:d||(c[a]=i)},g=v(e.getAttributeNames());!(f=g()).done;)b();if(!d){var A=Array.from(e.childNodes);A.length&&(c.children=this.preCompileDomNodes(A,t))}return function(r){(r=i()({},t,r)).scope=r;for(var n=i()({},c),s=0,a=Object.entries(y);s<a.length;s++){var p=a[s],u=p[0],f=p[1],m=f.originalScopeNames,b=f.templateFunction.apply(void 0,m.map((function(e){return r[e]})));""===u?n=i()({},n,b):n[u]=b}return Object.prototype.hasOwnProperty.call(n,"innerHTML")&&(n.dangerouslySetInnerHTML={__html:n.innerHTML},delete n.children,delete n.innerHTML),Object.prototype.hasOwnProperty.call(n,"textContent")?(n.children=n.textContent,delete n.textContent):d?(n=i()({},e.internalProperties,n),r=i()({},n,r,{parentInstance:e}),e.evaluateSlots(r),e.prepareProperties(n)):n.children&&(n.children=o.evaluatePreCompiledDomNodes(n.children,r)),(0,h.createElement)(l,n)}},r.evaluatePreCompiledDomNodes=function(e,t){if(void 0===t&&(t={}),!Array.isArray(e))return e(t);if(1===e.length)return e[0](t);for(var r,n=[],i=v(e);!(r=i()).done;){var o=(0,r.value)(t);o&&n.push(o)}return n},r.preCompileSlots=function(){for(var e in this.slots)this.slots[e]&&"default"!==e&&(this.compiledSlots[e]=this.preCompileDomNode(this.slots[e],i()({},this.scope,{parentInstance:this}),[d.func,"function"].includes(this.self.propertyTypes[e])));this.slots.default&&this.slots.default.length>0&&(this.compiledSlots.children=this.preCompileDomNodes(this.slots.default,i()({},this.scope,{parentInstance:this}),[d.func,"function"].includes(this.self.propertyTypes.children)))},r.evaluateSlots=function(e){for(var t in this.preparedSlots={},this.compiledSlots)Object.prototype.hasOwnProperty.call(this.compiledSlots,t)&&("children"===t?this.preparedSlots.children=this.evaluatePreCompiledDomNodes(this.compiledSlots[t],e):this.preparedSlots[t]=this.compiledSlots[t](e))},t.isReactComponent=function(e){var t=e.constructor;return"object"==typeof t.content&&(!t.attachWebComponentAdapterIfNotExists||"react"===t.content.webComponentAdapterWrapped)},r.determineRootBinding=function(){e.prototype.determineRootBinding.call(this);for(var t=this.parentNode;t;){if(this.self.isReactComponent(t)){this.rootReactInstance=t;break}t=t.parentNode}},r.applyComponentWrapper=function(){if("string"!=typeof this.self.content&&!this.isWrapped){this.isWrapped=!0;var e=this.self.content.wrapped||this.self.content;this.self.content.webComponentAdapterWrapped?this.wrapMemorizingWrapper&&(this.self.content=(0,h.memo)(this.self.content),this.self.content.wrapped=e):this.self.attachWebComponentAdapterIfNotExists?(this.self.content.displayName||(this.self.content.displayName=this.self._name),this.self.content=(0,h.forwardRef)((function(t,r){return(0,h.useImperativeHandle)(r,(function(){return{properties:t}}),[t]),(0,h.createElement)(e,t)})),(this.wrapMemorizingWrapper||null===this.wrapMemorizingWrapper)&&(this.self.content=(0,h.memo)(this.self.content)),this.self.content.wrapped=e,this.self.content.webComponentAdapterWrapped="react"):this.wrapMemorizingWrapper&&(this.self.content=(0,h.memo)(this.self.content),this.self.content.wrapped=e)}},r.prepareProperties=function(e){var t=this;(0,u.extend)(e,this.preparedSlots),this.self.removeKnownUnwantedPropertyKeys(this.self,e),e.ref||(this.instance=(0,h.createRef)(),e.ref=function(e){t.instance?t.instance.current=e:t.instance={current:e},t.reflectInstanceProperties()})},t.removeKnownUnwantedPropertyKeys=function(e,t){if("string"!=typeof e.content)for(var r,n=v(["isRoot","isTrusted","__composed"]);!(r=n()).done;){var i=r.value;Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e.content,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.propTypes,i)||Object.prototype.hasOwnProperty.call(e.content,"wrapped")&&Object.prototype.hasOwnProperty.call(e.content.wrapped,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.wrapped.propTypes,i))&&delete t[i]}},t}(b.default);A.attachWebComponentAdapterIfNotExists=!0,A.content="div",A.react=f(),A._name="ReactWebComponent";var w={component:A,register:function(e){void 0===e&&(e=(0,u.camelCaseToDelimited)(A._name)),customElements.define(e,A)}};t.default=A},function(e){e.exports=a},function(e){e.exports=p}],h={};function f(e){var t=h[e];if(void 0!==t)return t.exports;var r=h[e]={exports:{}};return d[e](r,r.exports,f),r.exports}f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var m={};f.r(m),f.d(m,{ReactWeb:function(){return S},Web:function(){return N},property:function(){return O},reactWebAPI:function(){return C},webAPI:function(){return R},wrapAsWebComponent:function(){return x}});var y=f(0),b=f.n(y),v=f(3),g=f.n(v),P=f(1),A=f(6),w=f(12),T=f(7),O=A.default,S=w.default,C=w.api,R=T.api,N=T.default,x=function(e,t,r){var n,i,o;void 0===t&&(t="NoName"),void 0===r&&(r={});var s=e._name||(null==(n=e.___types)||null==(n=n.name)?void 0:n.name)||t.replace(/^(.*\/+)?([^/]+)\.tsx$/,"$2");r.propTypes&&(e.propTypes=r.propTypes);var a=e.propTypes||{},p=r.propertyAliases||e.propertyAliases||{},l=(0,P.unique)(Object.keys(a).concat(Object.keys(p)).concat(Object.values(p))),c=r.propertiesToReflectAsAttributes||e.propertiesToReflectAsAttributes||[];if(S.propertiesToReflectAsAttributes)if(Array.isArray(c))c=[].concat(S.propertiesToReflectAsAttributes,c);else if(c instanceof Map)for(var u=0,d=S.propertiesToReflectAsAttributes;u<d.length;u++){var h=d[u];c.set(h,S.propertyTypes[h])}else if("object"==typeof c)for(var f=0,m=S.propertiesToReflectAsAttributes;f<m.length;f++){var y=m[f];c[y]=S.propertyTypes[y]}var v=l.map((function(e){return(0,P.camelCaseToDelimited)(e)})),A=function(t){function n(){for(var i,o,s=arguments.length,a=new Array(s),p=0;p<s;p++)a[p]=arguments[p];return(o=t.call.apply(t,[this].concat(a))||this).self=n,o.internalProperties=r.internalProperties?b()({},r.internalProperties):e.internalProperties?b()({},e.internalProperties):{},o.unmountOnDisconnect=null===(i=r.unmountOnDisconnect)||void 0===i||i,o}return g()(n,t),n}(S);return A.attachWebComponentAdapterIfNotExists="boolean"!=typeof r.attachWebComponentAdapterIfNotExists||r.attachWebComponentAdapterIfNotExists,A.content=e,A.observedAttributes=S.observedAttributes.concat(v).concat(v.map((function(e){return"-"+e}))),A.controllableProperties=e.controllableProperties||r.controllableProperties||[],A.eventToPropertyMapping=null===r.eventToPropertyMapping?r.eventToPropertyMapping:r.eventToPropertyMapping?b()({},r.eventToPropertyMapping):null===e.eventToPropertyMapping?e.eventToPropertyMapping:e.eventToPropertyMapping?b()({},e.eventToPropertyMapping):{},A.propertyAliases=b()({},S.propertyAliases,p),A.propertiesToReflectAsAttributes=c,A.propertyTypes=b()({},S.propertyTypes,a),A.renderProperties=null!==(i=null!==(o=r.renderProperties)&&void 0!==o?o:e.renderProperties)&&void 0!==i?i:S.renderProperties,A._name=s,{component:A,register:function(e){void 0===e&&(e=(0,P.camelCaseToDelimited)(s)),customElements.define(e,A)}}};return m.default=x,m}()}));
|
|
1
|
+
if(typeof window==='undefined'||window===null)var window=(typeof global==='undefined'||global===null)?{}:global;import { flushSync as __WEBPACK_EXTERNAL_MODULE_react_dom_c0b5c364_flushSync__ } from "react-dom";
|
|
2
|
+
import { createRoot as __WEBPACK_EXTERNAL_MODULE_react_dom_client_82ef521c_createRoot__ } from "react-dom/client";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_clientnode__ from "clientnode";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__ from "clientnode/property-types";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
6
|
+
/******/ var __webpack_modules__ = ([
|
|
7
|
+
/* 0 */
|
|
8
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
9
|
+
|
|
10
|
+
var x = function(y) {
|
|
11
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
12
|
+
}
|
|
13
|
+
var y = function(x) { return function() { return x; }; }
|
|
14
|
+
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; } });
|
|
15
|
+
|
|
16
|
+
/***/ }),
|
|
17
|
+
/* 1 */
|
|
18
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
19
|
+
|
|
20
|
+
var x = function(y) {
|
|
21
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
22
|
+
}
|
|
23
|
+
var y = function(x) { return function() { return x; }; }
|
|
24
|
+
module.exports = x({ ["NullSymbol"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.NullSymbol; }, ["UndefinedSymbol"]: function() { return __WEBPACK_EXTERNAL_MODULE_clientnode_property_types_4789ebe2__.UndefinedSymbol; }, ["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; } });
|
|
25
|
+
|
|
26
|
+
/***/ }),
|
|
27
|
+
/* 2 */
|
|
28
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
29
|
+
|
|
30
|
+
/* unused harmony export property */
|
|
31
|
+
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
32
|
+
/* harmony import */ var clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
33
|
+
// #!/usr/bin/env babel-node
|
|
34
|
+
// -*- coding: utf-8 -*-
|
|
35
|
+
/** @module decorator *//* !
|
|
36
|
+
region header
|
|
37
|
+
[Project page](https://torben.website/web-component-wrapper)
|
|
38
|
+
|
|
39
|
+
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
|
|
40
|
+
|
|
41
|
+
License
|
|
42
|
+
-------
|
|
43
|
+
|
|
44
|
+
This library written by Torben Sickert stands under a creative commons
|
|
45
|
+
naming 3.0 unported license.
|
|
46
|
+
See https://creativecommons.org/licenses/by/3.0/deed.de
|
|
47
|
+
endregion
|
|
48
|
+
*/// region imports
|
|
49
|
+
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
|
|
50
|
+
/**
|
|
51
|
+
* Generates a decorator based on given configuration.
|
|
52
|
+
* @param options - Property configuration to define how to transfer attributes
|
|
53
|
+
* and properties into each other.
|
|
54
|
+
* @param options.alias - Alternate property name.
|
|
55
|
+
* @param options.readAttribute - Indicates whether to read from existing
|
|
56
|
+
* attribute also.
|
|
57
|
+
* @param options.type - Value type to parse value.
|
|
58
|
+
* @param options.update - Indicates whether to overwrite already existing
|
|
59
|
+
* property configurations.
|
|
60
|
+
* @param options.writeAttribute - Indicates whether to sync attribute
|
|
61
|
+
* representation back into dom.
|
|
62
|
+
* @returns Generated decorator.
|
|
63
|
+
*/function property(options){if(options===void 0){options={}}options=_objectSpread({readAttribute:true,type:clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.string},options);/**
|
|
64
|
+
* Registers given property to different property / attribute conversion
|
|
65
|
+
* data structures.
|
|
66
|
+
* NOTE: It is important to set static configuration properties on its
|
|
67
|
+
* "own" properties instead of some inherited one. So we have to check via
|
|
68
|
+
* "hasOwnProperty" for existence in this decorator.
|
|
69
|
+
* @param target - Instance to apply given property to.
|
|
70
|
+
* @param name - Field name to apply.
|
|
71
|
+
*/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);
|
|
72
|
+
|
|
73
|
+
/***/ }),
|
|
74
|
+
/* 3 */
|
|
75
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
76
|
+
|
|
77
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
78
|
+
/* harmony export */ FH: function() { return /* binding */ api; }
|
|
79
|
+
/* harmony export */ });
|
|
80
|
+
/* unused harmony exports log, GenericHTMLElement, Web */
|
|
81
|
+
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
82
|
+
/* harmony import */ var clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
83
|
+
/* harmony import */ var _decorator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
84
|
+
// #!/usr/bin/env babel-node
|
|
85
|
+
// -*- coding: utf-8 -*-
|
|
86
|
+
/** @module web *//* !
|
|
87
|
+
region header
|
|
88
|
+
[Project page](https://torben.website/web-component-wrapper)
|
|
89
|
+
|
|
90
|
+
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
|
|
91
|
+
|
|
92
|
+
License
|
|
93
|
+
-------
|
|
94
|
+
|
|
95
|
+
This library written by Torben Sickert stands under a creative commons
|
|
96
|
+
naming 3.0 unported license.
|
|
97
|
+
See https://creativecommons.org/licenses/by/3.0/deed.de
|
|
98
|
+
endregion
|
|
99
|
+
*/// region imports
|
|
100
|
+
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
|
|
101
|
+
var log=new clientnode__WEBPACK_IMPORTED_MODULE_0__.Logger({name:"web-component-wrapper.web"});/*
|
|
102
|
+
NOTE: We mock HTMLElement to be able to load this class and derived one
|
|
103
|
+
into node environments.
|
|
104
|
+
*/var GenericHTMLElement=typeof HTMLElement==="undefined"?/*#__PURE__*/// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
105
|
+
_createClass(function HTMLElement(){_classCallCheck(this,HTMLElement)}):HTMLElement;/**
|
|
106
|
+
* Generic web component to render a content against instance-specific values.
|
|
107
|
+
* @property applyRootBinding - If determined itself as root declarative event
|
|
108
|
+
* and property bindings will be applied to itself.
|
|
109
|
+
* @property content - Content to render when changes happened.
|
|
110
|
+
* @property determineRootBinding - If checked this component determines if it
|
|
111
|
+
* is a root component (not wrapped by another web-component).
|
|
112
|
+
* @property shadowDOM - Configures if a shadow dom should be used during
|
|
113
|
+
* web-component instantiation. Can hold initialize configuration.
|
|
114
|
+
* @property observedAttributes - Attribute names to observe for changes.
|
|
115
|
+
* @property controllableProperties - A list of controllable property names.
|
|
116
|
+
* @property eventToPropertyMapping - Explicitly defined output events (a
|
|
117
|
+
* mapping of event names to a potential parameter to properties-transformer).
|
|
118
|
+
* @property propertyAliases - A mapping of property names to be treated as
|
|
119
|
+
* equal.
|
|
120
|
+
* @property propertyTypes - Configuration defining how to convert attributes
|
|
121
|
+
* into properties and reflect property changes back to attributes.
|
|
122
|
+
* @property propertiesToReflectAsAttributes - An Item, List, or Mapping of
|
|
123
|
+
* properties to reflect as attributes.
|
|
124
|
+
* @property renderProperties - List of known render properties.
|
|
125
|
+
* @property cloneSlots - Indicates whether to clone slot before to transclude
|
|
126
|
+
* content into them. If a slot should be used multiple times (for example,
|
|
127
|
+
* when it works as a template node.) they should be copied to avoid unexpected
|
|
128
|
+
* mutations.
|
|
129
|
+
* @property doRender - Configures whether this component instance should
|
|
130
|
+
* evaluate its given body content.
|
|
131
|
+
* @property evaluateSlots - Indicates whether to evaluate slot content when
|
|
132
|
+
* before rendering them.
|
|
133
|
+
* @property renderSlots - Indicates whether determined slots should be
|
|
134
|
+
* rendered into root node.
|
|
135
|
+
* @property trimSlots - Ignore empty text nodes while applying slots.
|
|
136
|
+
* @property renderUnsafe - Defines default render behavior.
|
|
137
|
+
* @property _name - Name to access instance-evaluated content or used
|
|
138
|
+
* to derive default component name. This is also useful for logging.
|
|
139
|
+
* @property _propertyAliasIndex - Internal alias index to quickly match
|
|
140
|
+
* properties in both directions.
|
|
141
|
+
* @property _propertiesToReflectAsAttributes - A mapping of property names to
|
|
142
|
+
* set as attributes when they are set/updated. Uses a map to hold order and
|
|
143
|
+
* determine if a property exists in constant runtime.
|
|
144
|
+
* @property renderState - Holds data about currently running render state.
|
|
145
|
+
* @property renderState.promise - Promise resolving when next rendering has
|
|
146
|
+
* been finished.
|
|
147
|
+
* @property renderState.pending - Indicates whether a rendering task is
|
|
148
|
+
* performing.
|
|
149
|
+
* @property renderState.resolve - Callback to trigger when rendering has been
|
|
150
|
+
* finished.
|
|
151
|
+
* @property childComponentInstances - List of direct child components (needed
|
|
152
|
+
* to wait for them to finish dom manipulation).
|
|
153
|
+
* @property batchAttributeUpdates - Indicates whether to directly update dom
|
|
154
|
+
* after each attribute mutation or to wait and batch mutations after current
|
|
155
|
+
* queue has been finished.
|
|
156
|
+
* @property batchPropertyUpdates - Indicates whether to directly update dom
|
|
157
|
+
* after each property mutation or to wait and batch mutations after current
|
|
158
|
+
* queue has been finished.
|
|
159
|
+
* @property batchUpdates - Indicates whether to directly perform a
|
|
160
|
+
* re-rendering after changes on properties have been made.
|
|
161
|
+
* @property batchedAttributeUpdateRunning - A boolean indicator to identify if
|
|
162
|
+
* an attribute update is currently batched.
|
|
163
|
+
* @property batchedPropertyUpdateRunning - A boolean indicator to identify if
|
|
164
|
+
* a property update is currently batched.
|
|
165
|
+
* @property batchedUpdateRunning - Indicates whether a batched render update
|
|
166
|
+
* is currently running.
|
|
167
|
+
* @param connectionRegistered - Indicates whether this component is connected
|
|
168
|
+
* to DOM and could run its connectedCallback.
|
|
169
|
+
* @param pendingAttributeUpdates - Holds pending attribute updates which
|
|
170
|
+
* should be performed when the component is connected to DOM.
|
|
171
|
+
* @property parentInstance - Parent component instance.
|
|
172
|
+
* @property rootInstance - Root component instance.
|
|
173
|
+
* @property scope - Render scope.
|
|
174
|
+
* @property domNodeEventBindings - Holds a mapping from nodes with registered
|
|
175
|
+
* event handlers mapped to their deregistration function.
|
|
176
|
+
* @property domNodeTemplateCache - Caches template compilation results.
|
|
177
|
+
* @property externalProperties - Holds currently evaluated or seen properties.
|
|
178
|
+
* @property ignoreAttributeUpdateObservations - Indicates whether attribute
|
|
179
|
+
* updates should be considered (usually only needed internally).
|
|
180
|
+
* @property internalProperties - Holds currently evaluated properties which
|
|
181
|
+
* are owned by this instance and should always be delegated.
|
|
182
|
+
* @property outputEventNames - Set of determined output event names.
|
|
183
|
+
* @property instance - Wrapped component instance.
|
|
184
|
+
* @property isRoot - Indicates whether their exists another web-derived
|
|
185
|
+
* component up the tree or not.
|
|
186
|
+
* @property root - Hosting dom node.
|
|
187
|
+
* @property runDomConnectionAndRenderingInSameEventQueue - Indicates whether
|
|
188
|
+
* we should render initial dom immediately after the component is connected to
|
|
189
|
+
* dom. Deactivating this allows wrapped components to detect their parents
|
|
190
|
+
* since their parent-connected callback will be called before the children's
|
|
191
|
+
* render method.
|
|
192
|
+
* @property self - Back-reference to this class.
|
|
193
|
+
* @property slots - Grabbed slots that where present in the connecting phase.
|
|
194
|
+
*/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
|
|
195
|
+
// region live cycle hooks
|
|
196
|
+
/**
|
|
197
|
+
* Initializes host dom content and properties.
|
|
198
|
+
* @returns Nothing.
|
|
199
|
+
*/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.
|
|
200
|
+
_defineProperty(_this,"childComponentInstances",[]);_defineProperty(_this,"batchAttributeUpdates",true);_defineProperty(_this,"batchPropertyUpdates",true);_defineProperty(_this,"batchUpdates",true);/*
|
|
201
|
+
NOTE: We set these properties to true initially since we want to
|
|
202
|
+
prevent any updates until the component is connected to dom.
|
|
203
|
+
*/_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();/*
|
|
204
|
+
NOTE: We cannot use something like "this." e.g. "this.self" to
|
|
205
|
+
determine class properties since instance properties like "self"
|
|
206
|
+
may not set properly yet because this method is called during
|
|
207
|
+
constructing this instance itself.
|
|
208
|
+
*/_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.
|
|
209
|
+
_this.hostDomNode=_this;_this.rootInstance=_this;/*
|
|
210
|
+
NOTE: We define getter and setter at the end to avoid shadowing
|
|
211
|
+
existing property names.
|
|
212
|
+
*/_this.defineGetterAndSetterInterface();return _this}/**
|
|
213
|
+
* Triggered when ever a given attribute has changed and triggers to update
|
|
214
|
+
* configured dom content.
|
|
215
|
+
* @param name - Attribute name which was updates.
|
|
216
|
+
* @param oldValue - Old attribute value.
|
|
217
|
+
* @param newValue - New updated value.
|
|
218
|
+
*/_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)}/**
|
|
219
|
+
* Updates given attribute representation.
|
|
220
|
+
* @param name - Attribute name which was updates.
|
|
221
|
+
* @param newValue - New updated value.
|
|
222
|
+
* @returns Promise resolving when attribute has been updated.
|
|
223
|
+
*/},{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}/**
|
|
224
|
+
* Triggered when this component is mounted into the document.
|
|
225
|
+
* Attaches event handler, grabs given slots, reflects external properties,
|
|
226
|
+
* and enqueues first rendering.
|
|
227
|
+
*/},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;// NOTE: Hack to support IE 11 here.
|
|
228
|
+
try{this.isConnected=true}catch(_unused){// Ignore error.
|
|
229
|
+
}this.connectionRegistered=true;// NOTE: Can be overwritten during optional root determining.
|
|
230
|
+
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")})}/**
|
|
231
|
+
* Triggered when this component is unmounted from the document. Event
|
|
232
|
+
* handlers will be removed and state updated accordingly.
|
|
233
|
+
*/},{key:"disconnectedCallback",value:function disconnectedCallback(){this.unRender("disconnected");this.unregisterConnectionState()}// endregion
|
|
234
|
+
// region getter/setter
|
|
235
|
+
/**
|
|
236
|
+
* Registers needed getter and setter to get notified about changes and
|
|
237
|
+
* reflect them.
|
|
238
|
+
*/},{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.
|
|
239
|
+
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()}}/**
|
|
240
|
+
* Creates an index to match alias source and target against each other on
|
|
241
|
+
* constant runtime.
|
|
242
|
+
* @param name - Name to search an alternate name for.
|
|
243
|
+
* @returns Found alias or "null".
|
|
244
|
+
*/},{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}/**
|
|
245
|
+
* Generic property getter. Forwards properties from the "properties"
|
|
246
|
+
* field.
|
|
247
|
+
* @param name - Property name to retrieve.
|
|
248
|
+
* @returns Retrieved property value.
|
|
249
|
+
*/},{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.
|
|
250
|
+
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}/**
|
|
251
|
+
* External property setter. Respects configured aliases.
|
|
252
|
+
* @param name - Property name to write.
|
|
253
|
+
* @param value - New value to write.
|
|
254
|
+
*/},{key:"setExternalPropertyValue",value:function setExternalPropertyValue(name,value){this.externalProperties[name]=value;var alias=this.getPropertyAlias(name);if(alias)this.externalProperties[alias]=value}/**
|
|
255
|
+
* Internal property setter. Respects configured aliases.
|
|
256
|
+
* @param name - Property name to write.
|
|
257
|
+
* @param value - New value to write.
|
|
258
|
+
*/},{key:"setInternalPropertyValue",value:function setInternalPropertyValue(name,value){this.internalProperties[name]=value;var alias=this.getPropertyAlias(name);if(alias)this.internalProperties[alias]=value}/**
|
|
259
|
+
* Generic property setter. Forwards field writes into internal and
|
|
260
|
+
* external property representations.
|
|
261
|
+
* @param name - Property name to write.
|
|
262
|
+
* @param value - New value to write.
|
|
263
|
+
*/},{key:"setPropertyValue",value:function setPropertyValue(name,value){this.reflectProperties(_defineProperty({},name,value));this.setInternalPropertyValue(name,value)}/**
|
|
264
|
+
* Triggers a new rendering cycle and respects property-specific state
|
|
265
|
+
* connection.
|
|
266
|
+
* @param name - Property name to write.
|
|
267
|
+
* @param value - New value to write.
|
|
268
|
+
*/},{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
|
|
269
|
+
// region helper
|
|
270
|
+
/// region utility
|
|
271
|
+
},{key:"unregisterConnectionState",value:function unregisterConnectionState(){// NOTE: Hack to support IE 11 here.
|
|
272
|
+
try{this.isConnected=false}catch(_unused2){// Ignore error.
|
|
273
|
+
}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
|
|
274
|
+
/**
|
|
275
|
+
* Binds properties and event handler to the given dom node.
|
|
276
|
+
* @param domNode - Node to start traversing from.
|
|
277
|
+
* @param scope - Scope to render property value again.
|
|
278
|
+
*/},{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
|
|
279
|
+
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
|
|
280
|
+
}if(name.startsWith("attribute-"))domNode.setAttribute(name.substring("attribute-".length),evaluated.result);else/*
|
|
281
|
+
NOTE: Cast to "textContent" to have a writable
|
|
282
|
+
property here.
|
|
283
|
+
*/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);/*
|
|
284
|
+
NOTE: We pre-compile event listener since they should
|
|
285
|
+
usually be called more often than binded.
|
|
286
|
+
*/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()}}/**
|
|
287
|
+
* Binds properties and event handler to given, sibling, and nested nodes.
|
|
288
|
+
* @param domNode - Node to start traversing from.
|
|
289
|
+
* @param scope - Scope to render property value again.
|
|
290
|
+
* @param renderSlots - Indicates whether to render nested elements of
|
|
291
|
+
* slots (determined by an existing corresponding attribute).
|
|
292
|
+
*/},{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);/*
|
|
293
|
+
NOTE: Slots of nested custom components (recognized by their
|
|
294
|
+
dash in name) should be rendered by their own.
|
|
295
|
+
*/if(!domNode.nodeName.toLowerCase().includes("-"))this.applyBindings(domNode.firstChild,scope);domNode=domNode.nextSibling}}/**
|
|
296
|
+
* Compiles given node content and their children. Provides a corresponding
|
|
297
|
+
* map of compiled template functions connected to their (sub) nodes and
|
|
298
|
+
* expected scope names.
|
|
299
|
+
* @param domNode - Node to compile.
|
|
300
|
+
* @param scope - Scope to extract names from.
|
|
301
|
+
* @param options - Additional compile options.
|
|
302
|
+
* @param options.filter - Callback to exclude some node from being
|
|
303
|
+
* compiled.
|
|
304
|
+
* @param options.ignoreComponents - Indicates if component properties
|
|
305
|
+
* should be traversed or not.
|
|
306
|
+
* @param options.ignoreNestedComponents - Indicates if nested components
|
|
307
|
+
* should be traversed or not.
|
|
308
|
+
* @param options.unsafe - Indicates if full HTML generation should be
|
|
309
|
+
* allowed.
|
|
310
|
+
* @returns Map of compiled templates.
|
|
311
|
+
*/},{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();/*
|
|
312
|
+
NOTE: Slots of nested custom components (recognized by their dash
|
|
313
|
+
in name) should be rendered / controlled by them on their own.
|
|
314
|
+
*/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.
|
|
315
|
+
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}/**
|
|
316
|
+
* @param options - Evaluation options.
|
|
317
|
+
* @param scope - Scope to evaluate against.
|
|
318
|
+
* @returns Evaluated string result or null.
|
|
319
|
+
*/},{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("Error occurred when \"".concat(this.self._name,"\" is running"),"\"".concat(String(templateFunction),"\": with bound"),"names \"".concat(scopeNames.join("\", \""),"\":"),"\"".concat(error,"\". Rendering node:"),domNode)}return output}/**
|
|
320
|
+
* Compiles and evaluates given node content and their children. Replaces
|
|
321
|
+
* each node content with their evaluated representation.
|
|
322
|
+
* @param domNode - Node to evaluate.
|
|
323
|
+
* @param scope - Scope to render against.
|
|
324
|
+
* @param options - Compile options.
|
|
325
|
+
* @param options.applyBindings - Indicates whether to apply bindings to
|
|
326
|
+
* given dom nodes.
|
|
327
|
+
* @param options.filter - Callback to exclude some node from being
|
|
328
|
+
* compiled.
|
|
329
|
+
* @param options.ignoreComponents - Indicates if component properties
|
|
330
|
+
* should be traversed or not.
|
|
331
|
+
* @param options.ignoreNestedComponents - Indicates if nested components
|
|
332
|
+
* should be traversed or not.
|
|
333
|
+
* @param options.domNodeTemplateCache - Yet compiled dom nodes to just
|
|
334
|
+
* reference instead of recompiling.
|
|
335
|
+
* @param options.unsafe - Indicates if full HTML generation should be
|
|
336
|
+
* allowed.
|
|
337
|
+
*/},{key:"evaluateDomNodeTemplate",value:function evaluateDomNodeTemplate(domNode,scope,options){var _this7=this;if(scope===void 0){scope={}}if(options===void 0){options={}}options=_objectSpread({domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:true,ignoreNestedComponents:true,unsafe:this.self.renderUnsafe},options);var domNodeTemplateCache=options.domNodeTemplateCache;if(!domNodeTemplateCache.has(domNode)){var compilerOptions={filter:options.filter,ignoreComponents:options.ignoreComponents,ignoreNestedComponents:options.ignoreNestedComponents,unsafe:options.unsafe};var compiledDomNode=this.compileDomNodeTemplate(domNode,scope,compilerOptions);if(compiledDomNode)domNodeTemplateCache.set(domNode,compiledDomNode)}if(domNodeTemplateCache.has(domNode)){var _compiledDomNode=domNodeTemplateCache.get(domNode);var output=this.evaluateCompiledDomNodeTemplate(_compiledDomNode,scope);if(output!==null)if(options.unsafe&&domNode.innerHTML)domNode.innerHTML=output;else domNode.textContent=output;if(_compiledDomNode.children.length){var _evaluateChildDomNode=function evaluateChildDomNode(children){var _iterator5=_createForOfIteratorHelper(children),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var childCompiledDomNode=_step5.value;var _output=_this7.evaluateCompiledDomNodeTemplate(childCompiledDomNode,scope);if(_output!==null)childCompiledDomNode.domNode.textContent=_output;if(childCompiledDomNode.children.length)_evaluateChildDomNode(childCompiledDomNode.children)}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}};_evaluateChildDomNode(_compiledDomNode.children)}}if(options.applyBindings)this.applyBindings(domNode,scope)}/**
|
|
338
|
+
* Adds an event listener to the given dom node so that it will be
|
|
339
|
+
* deregistered when the component instance is destroyed.
|
|
340
|
+
* @param domNode - Node to assign event handler to.
|
|
341
|
+
* @param name - Event name.
|
|
342
|
+
* @param handler - Callback to trigger when given event occurs.
|
|
343
|
+
* @param options - Add event listener options.
|
|
344
|
+
* @param removeOptions - Remove event listener options.
|
|
345
|
+
* @returns Deregister function.
|
|
346
|
+
*/},{key:"addSecureEventListener",value:function addSecureEventListener(domNode,name,handler,options,removeOptions){var _this8=this;if(!this.domNodeEventBindings.has(domNode))this.domNodeEventBindings.set(// eslint-disable-next-line func-call-spacing
|
|
347
|
+
domNode,new Map);var eventMap=this.domNodeEventBindings.get(domNode);var oldHandler=eventMap.get(name);if(oldHandler&&oldHandler!==handler)oldHandler();var deregister=function deregister(){domNode.removeEventListener(name,handler,removeOptions);eventMap.delete(name);if(eventMap.size===0)_this8.domNodeEventBindings.delete(domNode)};eventMap.set(name,deregister);domNode.addEventListener(name,handler,options);return deregister}//// endregion
|
|
348
|
+
/**
|
|
349
|
+
* Determines initial root which initializes rendering digest.
|
|
350
|
+
*/},{key:"determineRootBinding",value:function determineRootBinding(){/*
|
|
351
|
+
If this component is the root component, we have to trigger
|
|
352
|
+
nested event handler by our own in global context since there is no
|
|
353
|
+
parent doing that for us.
|
|
354
|
+
*/var currentElement=this.parentNode;while(currentElement){var isComponent=currentElement instanceof Web||currentElement.nodeName.includes("-")&¤tElement.nodeName!=="#document-fragment";var isInShadowDOM=currentElement.parentNode===null&&/* eslint-disable @typescript-eslint/no-base-to-string */currentElement.toString()==="[object ShadowRoot]";/* eslint-enable @typescript-eslint/no-base-to-string */if(isComponent){// Check whether we found the first parent component.
|
|
355
|
+
if(this.rootInstance===this){this.parentInstance=currentElement;/*
|
|
356
|
+
NOTE: There is at least one parent, so we can set
|
|
357
|
+
"isRoot" to "false".
|
|
358
|
+
*/this.setPropertyValue("isRoot",false)}this.rootInstance=currentElement}else if(isInShadowDOM)/*
|
|
359
|
+
NOTE: Assume none root if determined a wrapped closed
|
|
360
|
+
shadow DOM.
|
|
361
|
+
*/this.setPropertyValue("isRoot",false);currentElement=currentElement.parentNode}}/**
|
|
362
|
+
* Checks if given content hast code (to compile and render).
|
|
363
|
+
* @param content - Potential string with code inside.
|
|
364
|
+
* @returns A boolean indicating whether given content has code.
|
|
365
|
+
*/},{key:"attachEventHandler",value:/// endregion
|
|
366
|
+
/// region events
|
|
367
|
+
/**
|
|
368
|
+
* Attaches event handler to keep in sync with nested components properties
|
|
369
|
+
* states.
|
|
370
|
+
*/function attachEventHandler(){if(this.self.eventToPropertyMapping===null)return;/*
|
|
371
|
+
NOTE: We only reflect properties by implicit determined events if
|
|
372
|
+
their where no explicitly defined.
|
|
373
|
+
*/var somethingDefined=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!somethingDefined)}/**
|
|
374
|
+
* Attach explicitly defined event handler to synchronize internal and
|
|
375
|
+
* external property states.
|
|
376
|
+
* @returns Returns "true" if there are some defined and "false" otherwise.
|
|
377
|
+
*/},{key:"attachExplicitDefinedOutputEventHandler",value:function attachExplicitDefinedOutputEventHandler(){var _this9=this;if(!this.self.eventToPropertyMapping)return false;// Grab all existing output to property definitions
|
|
378
|
+
var result=false;var _loop3=function _loop3(){var name=_Object$keys[_i];if(!Object.prototype.hasOwnProperty.call(_this9.internalProperties,name)){result=true;_this9.outputEventNames.add(name);_this9.setInternalPropertyValue(name,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var _len2,parameters,_key2,result,_args=arguments;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:for(_len2=_args.length,parameters=new Array(_len2),_key2=0;_key2<_len2;_key2++){parameters[_key2]=_args[_key2]}_context.n=1;return _this9.reflectEventToProperties(name,parameters);case 1:result=_context.v;if(result)parameters[0]=result;_this9.forwardEvent(name,parameters);case 2:return _context.a(2)}},_callee)})))}};for(var _i=0,_Object$keys=Object.keys(this.self.eventToPropertyMapping);_i<_Object$keys.length;_i++){_loop3()}return result}/**
|
|
379
|
+
* Attach implicitly defined event handler to synchronize internal and
|
|
380
|
+
* external property states.
|
|
381
|
+
* @param reflectProperties - Indicates whether implicitly determined
|
|
382
|
+
* properties should be reflected.
|
|
383
|
+
*/},{key:"attachImplicitDefinedOutputEventHandler",value:function attachImplicitDefinedOutputEventHandler(reflectProperties){var _this0=this;if(reflectProperties===void 0){reflectProperties=true}var _loop4=function _loop4(){var _Object$entries$_i=_slicedToArray(_Object$entries[_i2],2),name=_Object$entries$_i[0],type=_Object$entries$_i[1];if(!Object.prototype.hasOwnProperty.call(_this0.internalProperties,name)&&[clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.func,"function"].includes(type)&&!_this0.self.renderProperties.includes(name)){_this0.outputEventNames.add(name);_this0.setInternalPropertyValue(name,function(){for(var _len3=arguments.length,parameters=new Array(_len3),_key3=0;_key3<_len3;_key3++){parameters[_key3]=arguments[_key3]}if(reflectProperties)void _this0.reflectEventToProperties(name,parameters);_this0.forwardEvent(name,parameters)})}};// Determine all event handlers to inject
|
|
384
|
+
for(var _i2=0,_Object$entries=Object.entries(this.self.propertyTypes);_i2<_Object$entries.length;_i2++){_loop4()}}/**
|
|
385
|
+
* Triggers all identified events to communicate internal property / state
|
|
386
|
+
* changes.
|
|
387
|
+
*/},{key:"triggerOutputEvents",value:function triggerOutputEvents(){var _iterator6=_createForOfIteratorHelper(this.outputEventNames),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var name=_step6.value;this.forwardEvent(name,[this.externalProperties])}}catch(err){_iterator6.e(err)}finally{_iterator6.f()}}/**
|
|
388
|
+
* Forwards given event as the native web event.
|
|
389
|
+
* @param name - Event name.
|
|
390
|
+
* @param parameters - Event parameters.
|
|
391
|
+
* @returns False if event is cancelable, and at least one of the event
|
|
392
|
+
* handlers which received event called "Event.preventDefault()",
|
|
393
|
+
* otherwise true will be returned.
|
|
394
|
+
*/},{key:"forwardEvent",value:function forwardEvent(name,parameters){if(name.length>"onX".length&&name.startsWith("on"))name=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.lowerCase)(name.substring(2));return this.dispatchEvent(new CustomEvent(name,{detail:{parameters:parameters}}))}/// endregion
|
|
395
|
+
/// region slots
|
|
396
|
+
/**
|
|
397
|
+
* Renders component given slot contents into the given dom node. If
|
|
398
|
+
* expected slots are not given but a fallback is specified, they will be
|
|
399
|
+
* loaded into internal slot mapping.
|
|
400
|
+
* @param targetDomNode - Target dom node to render slots into.
|
|
401
|
+
* @param scope - Environment to render slots again if specified.
|
|
402
|
+
*/},{key:"applySlots",value:function applySlots(targetDomNode,scope){var _this1=this;for(var _i3=0,_Array$from=Array.from(targetDomNode.querySelectorAll("slot"));_i3<_Array$from.length;_i3++){var domNode=_Array$from[_i3];var name=domNode.getAttribute("name");if(name===null||name==="default"){if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots){var _iterator7=_createForOfIteratorHelper(this.slots.default),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _domNode=_step7.value;this.evaluateDomNodeTemplate(_domNode,scope)}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}}(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.replace)(domNode,this.slots.default,Web.trimSlots)}}else this.slots.default=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.unwrap)(domNode).map(function(domNode){return _this1.grabSlotContent(domNode)});}else if(this.slots[name]){if(this.self.renderSlots){if(this.self.evaluateSlots)this.evaluateDomNodeTemplate(this.slots[name],scope);(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.replace)(domNode,this.slots[name],Web.trimSlots)}}else this.slots[name]=this.grabSlotContent((0,clientnode__WEBPACK_IMPORTED_MODULE_0__.unwrap)(domNode).filter(function(domNode){return domNode.nodeName.toLowerCase()!=="#text"})[0])}}/**
|
|
403
|
+
* Determines slot content from the given node.
|
|
404
|
+
* @param slot - Node to grab slot content from.
|
|
405
|
+
* @returns Determined slot.
|
|
406
|
+
*/},{key:"grabSlotContent",value:function grabSlotContent(slot){var _element$firstElement;/*
|
|
407
|
+
If real (template) code is wrapped in a "textarea" tag, unwrap it
|
|
408
|
+
now. This extra wrapping can be used to avoid first dom rendering
|
|
409
|
+
before template code has been evaluated.
|
|
410
|
+
*/var element=clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.node.firstElementChild?slot:null;if(element&&((_element$firstElement=element.firstElementChild)===null||_element$firstElement===void 0?void 0:_element$firstElement.nodeName.toLowerCase())==="textarea"&&(!element.firstElementChild.hasAttribute("data-no-template")||element.firstElementChild.getAttribute("data-no-template")==="false")){var content=element.firstElementChild.value;/*
|
|
411
|
+
NOTE: These kinds of slots are always used as a template and
|
|
412
|
+
should therefore be copied in every case.
|
|
413
|
+
NOTE: A flat copy should suffice since we will replace nested
|
|
414
|
+
content.
|
|
415
|
+
NOTE: Remove template content in copied node to avoid rendering
|
|
416
|
+
them before being evaluated. We cannot remove template code
|
|
417
|
+
from the source node since this would make it impossible to
|
|
418
|
+
re-instantiate this slot during whole component
|
|
419
|
+
re-instantiation.
|
|
420
|
+
*/element.classList.remove("web-component-template");var newSlot=element.cloneNode();element.classList.add("web-component-template");newSlot.innerHTML="";newSlot.template=content;return newSlot}return this.self.cloneSlots?slot.cloneNode(true):slot}/**
|
|
421
|
+
* Saves given slots.
|
|
422
|
+
*/},{key:"grabGivenSlots",value:function grabGivenSlots(){var _this10=this;this.slots={};for(var _i4=0,_Array$from2=Array.from(this.querySelectorAll("[slot]"));_i4<_Array$from2.length;_i4++){var _slot$getAttribute;var slot=_Array$from2[_i4];// NOTE: This is how we avoid grabbing slots from nested components.
|
|
423
|
+
var currentElement=slot.parentNode;var skip=true;while(currentElement){if(currentElement.nodeName.includes("-")){if(currentElement===this)skip=false;break}currentElement=currentElement.parentNode}if(skip)continue;var slotValue=(_slot$getAttribute=slot.getAttribute("slot"))===null||_slot$getAttribute===void 0?void 0:_slot$getAttribute.trim();this.slots[slotValue!==null&&slotValue!==void 0?slotValue:slot.nodeName.toLowerCase()]=this.grabSlotContent(slot)}if(this.slots.default)this.slots.default=[].concat(this.slots.default);else if(this.childNodes.length>0)this.slots.default=Array.from(this.childNodes).map(function(domNode){return _this10.grabSlotContent(domNode)});else this.slots.default=[]}/// endregion
|
|
424
|
+
/// region properties
|
|
425
|
+
/**
|
|
426
|
+
* Determines if a given property name exists in wrapped component state.
|
|
427
|
+
* @param name - Property name to check if exists in state.
|
|
428
|
+
* @returns Boolean result.
|
|
429
|
+
*/},{key:"isStateProperty",value:function isStateProperty(name){var _this$instance3;return Boolean(((_this$instance3=this.instance)===null||_this$instance3===void 0||(_this$instance3=_this$instance3.current)===null||_this$instance3===void 0?void 0:_this$instance3.state)&&(Object.prototype.hasOwnProperty.call(this.instance.current.state,name)||this.instance.current.state.modelState&&Object.prototype.hasOwnProperty.call(this.instance.current.state.modelState,name)))}/**
|
|
430
|
+
* Generates an alias to name and the other way around mapping if not
|
|
431
|
+
* exists.
|
|
432
|
+
*/},{key:"generateAliasIndex",value:function generateAliasIndex(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex=_objectSpread({},this.self.propertyAliases);// Align alias mapping for better performance while mapping them.
|
|
433
|
+
for(var _i5=0,_Object$entries2=Object.entries(this.self._propertyAliasIndex);_i5<_Object$entries2.length;_i5++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i5],2),name=_Object$entries2$_i[0],value=_Object$entries2$_i[1];if(!Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,value))this.self._propertyAliasIndex[value]=name}}}/**
|
|
434
|
+
* Reflects wrapped component state back to web-component's attributes.
|
|
435
|
+
* @param properties - Properties to update in reflected attribute state.
|
|
436
|
+
*/},{key:"reflectExternalProperties",value:function reflectExternalProperties(properties){/*
|
|
437
|
+
NOTE: We can avoid an additional attribute parsing for
|
|
438
|
+
reflections.
|
|
439
|
+
*/this.ignoreAttributeUpdateObservations=true;for(var _i6=0,_Object$entries3=Object.entries(properties);_i6<_Object$entries3.length;_i6++){var _this$self$_propertie;var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i6],2),name=_Object$entries3$_i[0],value=_Object$entries3$_i[1];this.setExternalPropertyValue(name,value);if(!this.isConnected)continue;var attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if((_this$self$_propertie=this.self._propertiesToReflectAsAttributes)!==null&&_this$self$_propertie!==void 0&&_this$self$_propertie.has(name))switch(this.self._propertiesToReflectAsAttributes.get(name)){case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.boolean:case"boolean":if(value){if(this.getAttribute(attributeName)!=="")this.setAttribute(attributeName,"")}else if(this.hasAttribute(attributeName))this.removeAttribute(attributeName);break;case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.func:case"function":break;case"json":if(value){var representation=JSON.stringify(value);if(representation&&this.getAttribute(attributeName)!==representation){this.setAttribute(attributeName,representation);break}}if(this.hasAttribute(attributeName))this.removeAttribute(attributeName);break;case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.number:case"number":if(typeof value==="number"&&!isNaN(value)){var valueAsString=String(value);if(this.getAttribute(attributeName)!==valueAsString)this.setAttribute(attributeName,valueAsString)}else if(this.hasAttribute(attributeName))this.removeAttribute(attributeName);break;case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.string:case"string":if(value){if(this.getAttribute(attributeName)!==value)this.setAttribute(attributeName,value)}else if(this.hasAttribute(attributeName))this.removeAttribute(attributeName);break;case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.any:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.array:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.arrayOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.element:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.elementType:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.instanceOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.node:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.object:case"object":case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.objectOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.shape:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.exact:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.symbol:default:if(value){var _representation=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.represent)(value);if(_representation&&this.getAttribute(attributeName)!==_representation){this.setAttribute(attributeName,_representation);break}}if(this.hasAttribute(attributeName))this.removeAttribute(attributeName);break}}this.ignoreAttributeUpdateObservations=false}/**
|
|
440
|
+
* Reflects wrapped component state back to web-component's attributes and
|
|
441
|
+
* properties.
|
|
442
|
+
* @param properties - Properties to update in reflected property state.
|
|
443
|
+
*/},{key:"reflectProperties",value:function reflectProperties(properties){var _this$instance4,_this$internalPropert;this.reflectExternalProperties(properties);/*
|
|
444
|
+
NOTE: Do not reflect properties which are hold in state. These
|
|
445
|
+
values are only set once when they are explicitly set
|
|
446
|
+
(see "setPropertyValue").
|
|
447
|
+
*/if((_this$instance4=this.instance)!==null&&_this$instance4!==void 0&&(_this$instance4=_this$instance4.current)!==null&&_this$instance4!==void 0&&_this$instance4.state&&_typeof(this.instance.current.state)==="object"){var _iterator8=_createForOfIteratorHelper(Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[])),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var name=_step8.value;if(Object.prototype.hasOwnProperty.call(this.internalProperties,name))/*
|
|
448
|
+
We want to avoid fully deleting this property to know
|
|
449
|
+
which properties exist in the underlying instance.
|
|
450
|
+
*/this.setInternalPropertyValue(name,undefined)}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}if((_this$internalPropert=this.internalProperties.model)!==null&&_this$internalPropert!==void 0&&_this$internalPropert.state){delete this.internalProperties.model.state;this.setInternalPropertyValue("model",this.internalProperties.model)}var _iterator9=_createForOfIteratorHelper(this.self.controllableProperties),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _name2=_step9.value;if(Object.prototype.hasOwnProperty.call(properties,_name2))this.setInternalPropertyValue(_name2,properties[_name2])}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}}/**
|
|
451
|
+
* Reflect the given event handler call with the given parameter back to
|
|
452
|
+
* current properties state.
|
|
453
|
+
* @param name - Event name.
|
|
454
|
+
* @param parameters - List of parameter to given event handler call.
|
|
455
|
+
* @returns Mapped properties or null if nothing could be mapped.
|
|
456
|
+
*/},{key:"reflectEventToProperties",value:(function(){var _reflectEventToProperties=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(name,parameters){var oldBatchUpdatesConfiguration,result,handled,_this$self$eventToPro,wrappedMapping,mapping,_newProperties$detail,newProperties,_i7,_Object$keys2,_this$getPropertyAlia,propertyName,_iterator0,_step0,_name3,currentValue,_t;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:/*
|
|
457
|
+
NOTE: We enforce to update component state immediately after an
|
|
458
|
+
event occurs since batching usually does not make sense here. An
|
|
459
|
+
event runs within its own context.
|
|
460
|
+
On the other hand, it can be necessary to immediately reflect a
|
|
461
|
+
property change to the component internal state to avoid
|
|
462
|
+
contradicting internal render cycles.
|
|
463
|
+
*/oldBatchUpdatesConfiguration=this.batchUpdates;this.batchUpdates=false;result=null;handled=false;// region check if there exists an explicit mapper
|
|
464
|
+
if(!(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,name)&&(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.isFunction)(this.self.eventToPropertyMapping[name]))){_context2.n=4;break}wrappedMapping=(_this$self$eventToPro=this.self.eventToPropertyMapping)[name].apply(_this$self$eventToPro,_toConsumableArray(parameters).concat([this]));if(!(wrappedMapping&&"then"in wrappedMapping&&(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.isFunction)(wrappedMapping.then))){_context2.n=2;break}_context2.n=1;return wrappedMapping;case 1:_t=_context2.v;_context2.n=3;break;case 2:_t=wrappedMapping;case 3:mapping=_t;handled=true;if(Array.isArray(mapping)){result=mapping[0];this.reflectProperties(result);(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.extend)(true,this.internalProperties,mapping[1])}else if(mapping===null)handled=false;else if(_typeof(mapping)==="object"){result=mapping;this.reflectProperties(mapping)}case 4:// endregion
|
|
465
|
+
if(!handled&¶meters.length>0&&(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.isObject)(parameters[0])){/*
|
|
466
|
+
Identified as somehow throw data back event (no synthetic
|
|
467
|
+
event; derived from a user-triggered one) when following
|
|
468
|
+
condition does not hold.
|
|
469
|
+
*/newProperties=parameters[0];if("persist"in parameters[0]&&(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.isFunction)(parameters[0].persist)){newProperties={};for(_i7=0,_Object$keys2=Object.keys(this.self.propertyTypes);_i7<_Object$keys2.length;_i7++){propertyName=_Object$keys2[_i7];_iterator0=_createForOfIteratorHelper([propertyName].concat((_this$getPropertyAlia=this.getPropertyAlias(propertyName))!==null&&_this$getPropertyAlia!==void 0?_this$getPropertyAlia:[]));try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){_name3=_step0.value;currentValue=parameters[0].currentTarget&&Object.prototype.hasOwnProperty.call(parameters[0].currentTarget,_name3)?/*
|
|
470
|
+
Update all known properties from event
|
|
471
|
+
target instance.
|
|
472
|
+
*/parameters[0].currentTarget[_name3]:/*
|
|
473
|
+
Update all known properties from adapter
|
|
474
|
+
instance.
|
|
475
|
+
*/this.getPropertyValue(_name3);if(currentValue!==this.externalProperties[_name3])newProperties[_name3]=currentValue}}catch(err){_iterator0.e(err)}finally{_iterator0.f()}}}else if(![null,undefined].includes((_newProperties$detail=newProperties.detail)===null||_newProperties$detail===void 0?void 0:_newProperties$detail.value))newProperties=_objectSpread({},newProperties.detail);result=newProperties;this.reflectProperties(newProperties)}this.triggerRender("propertyReflected");this.batchUpdates=oldBatchUpdatesConfiguration;return _context2.a(2,result)}},_callee2,this)}));function reflectEventToProperties(_x,_x2){return _reflectEventToProperties.apply(this,arguments)}return reflectEventToProperties}()/**
|
|
476
|
+
* Evaluates the given property value depending on its property definition
|
|
477
|
+
* and registers in a property mapping object.
|
|
478
|
+
* @param attributeName - Name of given value.
|
|
479
|
+
* @param value - Value to evaluate.
|
|
480
|
+
*/)},{key:"evaluateStringOrNullAndSetAsProperty",value:function evaluateStringOrNullAndSetAsProperty(attributeName,value){var _this11=this;var preEvaluate=attributeName.startsWith("-");var effectiveAttributeName=preEvaluate?attributeName.substring(1):attributeName;var name=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.delimitedToCamelCase)(effectiveAttributeName);var alias=this.getPropertyAlias(name);if(alias&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,alias))name=alias;if(Object.prototype.hasOwnProperty.call(this.self.propertyTypes,name)){var type=this.self.propertyTypes[name];if(preEvaluate){if(value){var result=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.evaluate)(value,_objectSpread({},clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE),false,true,this);if(result.error){log.warn("Failed to process pre-evaluation attribute","\"".concat(attributeName,"\": ").concat(result.error,". Will be"),"set to \"undefined\".");this.setInternalPropertyValue(name,undefined)}else{this.setInternalPropertyValue(name,result.result);this.setExternalPropertyValue(name,result.result)}}}else switch(type){case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.boolean:case"boolean":{var booleanValue=![null,"false"].includes(value);this.setInternalPropertyValue(name,booleanValue);this.setExternalPropertyValue(name,booleanValue);break}case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.func:case"function":{var error=null;var templateFunction;var scopeNames=["data","event","firstArgument","firstParameter","options"];if(value){var _result3=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.compile)(value,scopeNames.concat("parameters","scope",clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE_NAMES),true,true,this);error=_result3.error;templateFunction=_result3.templateFunction;if(error)log.warn("Failed to compile given handler","\"".concat(attributeName,"\": ").concat(error,"."))}this.setInternalPropertyValue(name,function(){for(var _len4=arguments.length,parameters=new Array(_len4),_key4=0;_key4<_len4;_key4++){parameters[_key4]=arguments[_key4]}if(_this11.outputEventNames.has(name))void _this11.reflectEventToProperties(name,parameters);var result=undefined;if(!error){var scope=_objectSpread({parameters:parameters},clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE);for(var _i8=0,_scopeNames=scopeNames;_i8<_scopeNames.length;_i8++){var _name4=_scopeNames[_i8];scope[_name4]=parameters[0]}try{var _templateFunction;result=(_templateFunction=templateFunction)===null||_templateFunction===void 0?void 0:_templateFunction.apply(void 0,_toConsumableArray(scopeNames.map(function(name){return scope[name]})).concat([parameters,scope],_toConsumableArray(clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE_NAMES.map(function(name){return clientnode__WEBPACK_IMPORTED_MODULE_0__.UTILITY_SCOPE[name]}))))}catch(error){log.warn("Failed to evaluate function","\"".concat(attributeName,"\" with expression"),"\"".concat(value,"\" and scope"),"variables","\"".concat(scopeNames.join("\", \""),"\" set to"),"\"".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_0__.represent)(parameters),"\":"),"".concat(error,". Set property"),"to \"undefined\".")}}if(!_this11.self.renderProperties.includes(name))_this11.forwardEvent(name,parameters);return result});if(!error)this.setExternalPropertyValue(name,templateFunction);break}case"json":{if(value){var evaluated;try{evaluated=JSON.parse(value)}catch(error){log.warn("Error occurred during parsing given json","attribute \"".concat(attributeName,"\":"),(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.represent)(error));break}// NOTE: That both values do have to be avoided.
|
|
481
|
+
this.setInternalPropertyValue(name,evaluated);this.setExternalPropertyValue(name,(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(evaluated,false,1))}else{this.setInternalPropertyValue(name,null);this.setExternalPropertyValue(name,null)}break}case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.number:case"number":{if(value===null){this.setInternalPropertyValue(name,value);this.setExternalPropertyValue(name,value);break}/*
|
|
482
|
+
NOTE: You should not name this variable "number" since
|
|
483
|
+
babel gets confused caused by existing module wide
|
|
484
|
+
property type variable "number".
|
|
485
|
+
*/var numberValue=parseFloat(value);if(isNaN(numberValue))numberValue=undefined;this.setInternalPropertyValue(name,numberValue);this.setExternalPropertyValue(name,numberValue);break}case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.string:case"string":{this.setInternalPropertyValue(name,value);this.setExternalPropertyValue(name,value);break}case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.any:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.array:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.arrayOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.element:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.elementType:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.instanceOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.node:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.object:case"object":case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.objectOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.oneOf:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.oneOfType:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.shape:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.exact:case clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.symbol:default:{if(value){var _evaluated=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.evaluate)(value,{},false,true,this);if(_evaluated.error){log.warn("Error occurred during processing given","attribute configuration \"".concat(attributeName,"\":"),_evaluated.error);break}// NOTE: That both values do have to be avoided.
|
|
486
|
+
this.setInternalPropertyValue(name,_evaluated.result);this.setExternalPropertyValue(name,(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(_evaluated.result,false,1))}else if(this.hasAttribute(attributeName)){this.setInternalPropertyValue(name,true);this.setExternalPropertyValue(name,true)}else{this.setInternalPropertyValue(name,null);this.setExternalPropertyValue(name,null)}break}}}}/// endregion
|
|
487
|
+
/// region render
|
|
488
|
+
/**
|
|
489
|
+
* Produces a promise resolving when all nested rendering promises have
|
|
490
|
+
* been resolved. This only waits for registered nested components. That
|
|
491
|
+
* means that nested components which where connected before the parent
|
|
492
|
+
* component got initialized will not be waited for. That might happen
|
|
493
|
+
* when nested component types got registered before the parent ones.
|
|
494
|
+
*/},{key:"waitForNestedComponentRendering",value:function(){var _waitForNestedComponentRendering=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(){return _regenerator().w(function(_context3){while(1)switch(_context3.n){case 0:if(this.childComponentInstances){_context3.n=1;break}return _context3.a(2);case 1:_context3.n=2;return Promise.all(this.childComponentInstances.map(function(component){return component.renderState.pending?component.renderState.promise:Promise.resolve()}));case 2:return _context3.a(2)}},_callee3,this)}));function waitForNestedComponentRendering(){return _waitForNestedComponentRendering.apply(this,arguments)}return waitForNestedComponentRendering}()/**
|
|
495
|
+
* Resolves the rendering promise.
|
|
496
|
+
* @param reason - Rendering reason description.
|
|
497
|
+
* @param resolveRendering - Indicates whether to resolve the rendering or
|
|
498
|
+
* just return a resolving promise directly.
|
|
499
|
+
* @returns A promise resolving when all nested render promises have been
|
|
500
|
+
* resolved.
|
|
501
|
+
*/},{key:"resolveRenderingPromiseIfSet",value:(function(){var _resolveRenderingPromiseIfSet=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(reason,resolveRendering){return _regenerator().w(function(_context4){while(1)switch(_context4.n){case 0:if(!resolveRendering){_context4.n=2;break}_context4.n=1;return this.waitForNestedComponentRendering();case 1:this.renderState.pending=false;this.renderState.resolve(reason);this.prepareNewRenderingPromise();case 2:return _context4.a(2)}},_callee4,this)}));function resolveRenderingPromiseIfSet(_x3,_x4){return _resolveRenderingPromiseIfSet.apply(this,arguments)}return resolveRenderingPromiseIfSet}()/**
|
|
502
|
+
* Sets up a new rendering cycle representing promise.
|
|
503
|
+
*/)},{key:"prepareNewRenderingPromise",value:function prepareNewRenderingPromise(){var _this12=this;if(!this.renderState.pending)this.renderState.promise=new Promise(function(resolve){_this12.renderState.resolve=function(reason){_this12.renderState.pending=false;resolve(reason)}})}/**
|
|
504
|
+
* Triggers a new rendering cycle by respecting batch configuration.
|
|
505
|
+
* @param reason - A description why rendering should be triggered.
|
|
506
|
+
*/},{key:"triggerRender",value:function triggerRender(reason){var _this13=this;if(this.batchUpdates){if(!this.batchedUpdateRunning){this.batchedUpdateRunning=true;void (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)(function(){_this13.batchedUpdateRunning=false;void _this13.render(reason)})}}else void this.render(reason)}/**
|
|
507
|
+
* Creates shadow root if not created yet and assigns to the current root
|
|
508
|
+
* property.
|
|
509
|
+
*/},{key:"applyShadowRootIfNotExisting",value:function applyShadowRootIfNotExisting(){if(this.self.shadowDOM&&this.hostDomNode===this)this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,clientnode__WEBPACK_IMPORTED_MODULE_0__.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"})}/**
|
|
510
|
+
* Determines a new scope object with a useful default set of environment
|
|
511
|
+
* values.
|
|
512
|
+
* @param scope - To apply to generated scope.
|
|
513
|
+
*/},{key:"determineRenderScope",value:function determineRenderScope(scope){var _this$parentInstance;if(scope===void 0){scope={}}this.scope=_objectSpread(_objectSpread(_objectSpread(_objectSpread({},((_this$parentInstance=this.parentInstance)===null||_this$parentInstance===void 0?void 0:_this$parentInstance.scope)||{}),this.scope),this.internalProperties),{},_defineProperty({parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this},(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.lowerCase)(this.self._name)||"instance",this),scope);this.scope.scope=this.scope}/**
|
|
514
|
+
* Does the rendering job. Should be called when ever state changes should
|
|
515
|
+
* be projected to the hosts dom content.
|
|
516
|
+
* @param reason - Description why rendering is necessary.
|
|
517
|
+
* @param resolveRendering - Indicates whether rendering should be resolved
|
|
518
|
+
* finally. Should be set to "false" via super calls in inherited render
|
|
519
|
+
* methods which do further dom manipulations afterward and resolve the
|
|
520
|
+
* rendering process by their own.
|
|
521
|
+
* @returns A promise resolving when rendering has been finished. A promise
|
|
522
|
+
* may be needed for classes inheriting from this class.
|
|
523
|
+
*/},{key:"render",value:(function(){var _render=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(reason,resolveRendering){var _this14=this;var evaluated,renderTargetDomNode;return _regenerator().w(function(_context5){while(1)switch(_context5.n){case 0:if(reason===void 0){reason="unknown"}if(resolveRendering===void 0){resolveRendering=true}this.unRender("reRender",reason);this.childComponentInstances=[];this.renderState.pending=true;if(!this.isRoot){_context5.n=3;break}_context5.n=1;return this.resolveRenderingPromiseIfSet(reason,resolveRendering);case 1:if(!resolveRendering){_context5.n=3;break}_context5.n=2;return Promise.all(this.self.pendingRenderPromises);case 2:this.self.pendingRenderPromises=[];case 3:this.self.pendingRenderPromises.push(this.renderState.promise);this.determineRenderScope();if(this.self.doRender&&this.dispatchEvent(new CustomEvent("render",{detail:{reason:reason,scope:this.scope}}))){_context5.n=5;break}_context5.n=4;return this.resolveRenderingPromiseIfSet(reason,resolveRendering);case 4:return _context5.a(2);case 5:evaluated=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.evaluate)("`".concat(this.self.content,"`"),this.scope);if(!evaluated.error){_context5.n=7;break}log.warn("Failed to process template: ".concat(evaluated.error));this.renderState.resolve(reason);_context5.n=6;return Promise.all(this.self.pendingRenderPromises);case 6:return _context5.a(2);case 7:this.applyShadowRootIfNotExisting();/*
|
|
524
|
+
NOTE: We first render into an intermediate render target and apply
|
|
525
|
+
slot content until we finally publish everything to the document.
|
|
526
|
+
This avoids painting twice and internetexplorer bugs with an empty
|
|
527
|
+
node after first overwriting the content of "this.rootInstance".
|
|
528
|
+
*/renderTargetDomNode=document.createElement("div");renderTargetDomNode.innerHTML=evaluated.result;this.applySlots(renderTargetDomNode,_objectSpread(_objectSpread({},this.scope),{},{parentInstance:this}));this.hostDomNode.innerHTML=renderTargetDomNode.innerHTML;/*
|
|
529
|
+
NOTE: Wait until nested components have registered themselves to be
|
|
530
|
+
able to wait for their rendering.
|
|
531
|
+
*/_context5.n=8;return (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.timeout)();case 8:void this.waitForNestedComponentRendering().then(function(){_this14.applyBindings(_this14.hostDomNode.firstChild,_this14.scope,_this14.self.renderSlots)});_context5.n=9;return this.resolveRenderingPromiseIfSet(reason,resolveRendering);case 9:return _context5.a(2)}},_callee5,this)}));function render(_x5,_x6){return _render.apply(this,arguments)}return render}()/**
|
|
532
|
+
* Should free up memory listeners related to deprecated HTML.
|
|
533
|
+
* @param _reason - Description why rendering is necessary.
|
|
534
|
+
* @param _reRenderReason - Description why a re-rendering is necessary.
|
|
535
|
+
*/)},{key:"unRender",value:function unRender(_reason,_reRenderReason){if(_reason===void 0){_reason="unknown"}this.unregisterDomNodeEventBindings()}/// endregion
|
|
536
|
+
// endregion
|
|
537
|
+
}],[{key:"hasCode",value:function hasCode(content){return(// NOTE: First three conditions are only for performance.
|
|
538
|
+
typeof content==="string"&&content.includes("${")&&content.includes("}")&&/\${[\s\S]+}/.test(content))}/**
|
|
539
|
+
* Converts given the list, item, or map to a map (with ordering).
|
|
540
|
+
* @param value - Attribute reflection configuration.
|
|
541
|
+
* @returns Generated map.
|
|
542
|
+
*/},{key:"normalizePropertyTypeList",value:function normalizePropertyTypeList(value){if(typeof value==="string")value=[value];if(Array.isArray(value)){var givenValue=value;var newValue=new Map;var _iterator1=_createForOfIteratorHelper(givenValue),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var name=_step1.value;if(Object.prototype.hasOwnProperty.call(Web.propertyTypes,name))newValue.set(name,Web.propertyTypes[name])}}catch(err){_iterator1.e(err)}finally{_iterator1.f()}return newValue}return (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.convertPlainObjectToMap)(value)}}])}(GenericHTMLElement),_defineProperty(_Web,"applyRootBinding",true),_defineProperty(_Web,"pendingRenderPromises",[]),_defineProperty(_Web,"content","<slot>Please provide a template to transclude.</slot>"),_defineProperty(_Web,"determineRootBinding",true),_defineProperty(_Web,"shadowDOM",null),_defineProperty(_Web,"observedAttributes",[]),_defineProperty(_Web,"controllableProperties",[]),_defineProperty(_Web,"eventToPropertyMapping",{}),_defineProperty(_Web,"propertyAliases",{}),_defineProperty(_Web,"propertyTypes",{onClick:clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.func}),_defineProperty(_Web,"propertiesToReflectAsAttributes",[]),_defineProperty(_Web,"renderProperties",["children"]),_defineProperty(_Web,"doRender",false),_defineProperty(_Web,"cloneSlots",false),_defineProperty(_Web,"evaluateSlots",false),_defineProperty(_Web,"renderSlots",true),_defineProperty(_Web,"trimSlots",true),_defineProperty(_Web,"renderUnsafe",false),_defineProperty(_Web,"_name","BaseWeb"),_defineProperty(_Web,"_propertyAliasIndex",void 0),_defineProperty(_Web,"_propertiesToReflectAsAttributes",void 0),_Web),_descriptor=_applyDecoratedDescriptor(_class.prototype,"isRoot",[_dec],{configurable:true,enumerable:true,writable:true,initializer:function initializer(){return true}}),_class);var api={component:Web,register:function register(tagName){if(tagName===void 0){tagName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(Web._name)}customElements.define(tagName,Web)}};/* harmony default export */ __webpack_exports__.Ay = (Web);
|
|
543
|
+
|
|
544
|
+
/***/ }),
|
|
545
|
+
/* 4 */
|
|
546
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
// EXPORTS
|
|
550
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
551
|
+
FH: function() { return /* binding */ api; },
|
|
552
|
+
Ay: function() { return /* binding */ src_ReactWeb; }
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// UNUSED EXPORTS: ReactWeb, log
|
|
556
|
+
|
|
557
|
+
// EXTERNAL MODULE: external "clientnode"
|
|
558
|
+
var external_clientnode_ = __webpack_require__(0);
|
|
559
|
+
// EXTERNAL MODULE: external "clientnode/property-types"
|
|
560
|
+
var property_types_ = __webpack_require__(1);
|
|
561
|
+
// EXTERNAL MODULE: external "react"
|
|
562
|
+
var external_react_ = __webpack_require__(6);
|
|
563
|
+
;// external "react-dom"
|
|
564
|
+
|
|
565
|
+
;// external "react-dom/client"
|
|
566
|
+
|
|
567
|
+
// EXTERNAL MODULE: ./src/Web.ts
|
|
568
|
+
var Web = __webpack_require__(3);
|
|
569
|
+
;// ./src/ReactWeb.ts
|
|
570
|
+
// #!/usr/bin/env babel-node
|
|
571
|
+
// -*- coding: utf-8 -*-
|
|
572
|
+
/** @module react *//* !
|
|
573
|
+
region header
|
|
574
|
+
[Project page](https://torben.website/web-component-wrapper)
|
|
575
|
+
|
|
576
|
+
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
|
|
577
|
+
|
|
578
|
+
License
|
|
579
|
+
-------
|
|
580
|
+
|
|
581
|
+
This library written by Torben Sickert stands under a creative commons
|
|
582
|
+
naming 3.0 unported license.
|
|
583
|
+
See https://creativecommons.org/licenses/by/3.0/deed.de
|
|
584
|
+
endregion
|
|
585
|
+
*/// region imports
|
|
586
|
+
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 _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 _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 _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 _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 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 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 _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}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 _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 _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},_get.apply(null,arguments)}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););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 _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
|
|
587
|
+
var log=new external_clientnode_.Logger({name:"web-component-wrapper.react-web"});/*
|
|
588
|
+
Live cycle:
|
|
589
|
+
|
|
590
|
+
1. Render the React component with properties (defined in a web-component)
|
|
591
|
+
and start listing to "onChange" events.
|
|
592
|
+
2. Reflect component properties to web-component properties and
|
|
593
|
+
attributes (with prevented re-rendering caused by new properties).
|
|
594
|
+
3. Component triggers an "onChange" event (caused by some react event)
|
|
595
|
+
which delivers updated properties to the web-component.
|
|
596
|
+
-> Starting with the first step.
|
|
597
|
+
*//**
|
|
598
|
+
* Adapter for exposing a React component as a web-component.
|
|
599
|
+
* @property attachWebComponentAdapterIfNotExists - Indicates whether to wrap
|
|
600
|
+
* with a reference wrapper to get updated about internal state changes.
|
|
601
|
+
* @property content - React component to wrap.
|
|
602
|
+
* @property react - React namespace.
|
|
603
|
+
* @property compiledSlots - Cache of yet pre-compiled slot elements.
|
|
604
|
+
* @property preparedSlots - Cache of yet evaluated slot react elements.
|
|
605
|
+
* @property rootReactInstance - Saves determined root react instance.
|
|
606
|
+
* @property self - Back-reference to this class.
|
|
607
|
+
* @property wrapMemorizingWrapper - Determines whether to wrap component with
|
|
608
|
+
* React's memorizing wrapper to cache component render results.
|
|
609
|
+
* @property isWrapped - Indicates whether a React component is wrapped
|
|
610
|
+
* already.
|
|
611
|
+
*/var ReactWeb=/*#__PURE__*/function(_Web){function ReactWeb(){var _this;_classCallCheck(this,ReactWeb);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,ReactWeb,[].concat(args));_defineProperty(_this,"unmountOnDisconnect",true);_defineProperty(_this,"compiledSlots",{});_defineProperty(_this,"preparedSlots",{});_defineProperty(_this,"reactRoot",null);_defineProperty(_this,"rootReactInstance",null);_defineProperty(_this,"self",ReactWeb);_defineProperty(_this,"wrapMemorizingWrapper",null);_defineProperty(_this,"isWrapped",false);/**
|
|
612
|
+
* Updates the current component instance and reflects newly determined
|
|
613
|
+
* properties.
|
|
614
|
+
*/_defineProperty(_this,"reflectInstanceProperties",function(){var _this$instance;if((_this$instance=_this.instance)!==null&&_this$instance!==void 0&&_this$instance.current&&_this.instance.current.properties)_this.reflectProperties(_this.instance.current.properties)});return _this}_inherits(ReactWeb,_Web);return _createClass(ReactWeb,[{key:"connectedCallback",value:// region live-cycle
|
|
615
|
+
/**
|
|
616
|
+
* Triggered when this component is mounted into the document. Event
|
|
617
|
+
* handlers will be attached and the final render proceeds.
|
|
618
|
+
*/function connectedCallback(){this.applyComponentWrapper();// NOTE: Can be overwritten during optional root determining.
|
|
619
|
+
this.rootReactInstance=this;/*
|
|
620
|
+
Attaches event handler, grabs given slots, reflects external
|
|
621
|
+
properties and enqueues first rendering.
|
|
622
|
+
*/_superPropGet(ReactWeb,"connectedCallback",this,3)([])}/**
|
|
623
|
+
* Triggered when this component is unmounted from the document. Event
|
|
624
|
+
* handlers will be removed and state updated accordingly.
|
|
625
|
+
*/},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$reactRoot;this.unRender("disconnected");if(this.unmountOnDisconnect)(_this$reactRoot=this.reactRoot)===null||_this$reactRoot===void 0||_this$reactRoot.unmount();this.unregisterConnectionState()}/**
|
|
626
|
+
* Reflects wrapped component state back to web-component's attributes.
|
|
627
|
+
* @param properties - Properties to update in reflected attribute state.
|
|
628
|
+
*/},{key:"reflectExternalProperties",value:function reflectExternalProperties(properties){if(this.isRoot)_superPropGet(ReactWeb,"reflectExternalProperties",this,3)([properties])}/**
|
|
629
|
+
* Method that does the rendering job. Should be called when ever state
|
|
630
|
+
* changes should be projected to the hosts dom content.
|
|
631
|
+
* @param reason - Description why rendering is necessary.
|
|
632
|
+
* @param resolveRendering - Indicates whether rendering should be resolved
|
|
633
|
+
* finally. Should be set to "false" via super calls in inherited render
|
|
634
|
+
* methods which do further dom manipulations afterward and resolve the
|
|
635
|
+
* rendering process by their own.
|
|
636
|
+
* @returns A promise resolving when rendering has finished. A promise may
|
|
637
|
+
* be needed for classes inheriting from this class.
|
|
638
|
+
*/},{key:"render",value:(function(){var _render=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(reason,resolveRendering){var _this2=this;var domNode,nextDomNode,identifierPrefixCandidate,identifierPrefix;return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:if(reason===void 0){reason="unknown"}if(resolveRendering===void 0){resolveRendering=true}_superPropGet(ReactWeb,"unRender",this,3)(["reRender",reason]);this.childComponentInstances=[];this.renderState.pending=true;if(this.isRoot)this.self.pendingRenderPromises=[];this.self.pendingRenderPromises.push(this.renderState.promise);/*
|
|
639
|
+
NOTE: We prevent a nested React component from self-rendering since
|
|
640
|
+
they will be rendered by highest react parent.
|
|
641
|
+
*/if(!(this.rootReactInstance!==this||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:reason,scope:this.scope}})))){_context.n=1;break}return _context.a(2,this.resolveRenderingPromiseIfSet(reason,resolveRendering));case 1:this.determineRenderScope();if(Object.keys(this.compiledSlots).length===0)this.preCompileSlots();this.evaluateSlots(_objectSpread(_objectSpread({},this.scope),{},{parentInstance:this}));this.prepareProperties(this.internalProperties);this.applyShadowRootIfNotExisting();if(this.rootInstance!==this&&!this.reactRoot){/*
|
|
642
|
+
Remove template nodes since they will be replaced by reacts
|
|
643
|
+
render result (only necessary when having a dedicated rendering
|
|
644
|
+
target like shadow root and only on first render before React
|
|
645
|
+
takes over DOM management).
|
|
646
|
+
*/domNode=this.firstChild;while(domNode){nextDomNode=domNode.nextSibling;this.removeChild(domNode);domNode=nextDomNode}}if(!this.reactRoot){identifierPrefixCandidate=this.id||this.internalProperties.id||this.externalProperties.id||this.name||this.internalProperties.name||this.externalProperties.name;identifierPrefix="";if(typeof identifierPrefixCandidate==="string")identifierPrefix=identifierPrefixCandidate;this.reactRoot=__WEBPACK_EXTERNAL_MODULE_react_dom_client_82ef521c_createRoot__(this.hostDomNode,{identifierPrefix:identifierPrefix})}__WEBPACK_EXTERNAL_MODULE_react_dom_c0b5c364_flushSync__(function(){var _this2$reactRoot;(_this2$reactRoot=_this2.reactRoot)===null||_this2$reactRoot===void 0||_this2$reactRoot.render((0,external_react_.createElement)(_this2.self.content,_this2.internalProperties));void _this2.resolveRenderingPromiseIfSet(reason,resolveRendering)});if(!resolveRendering){_context.n=2;break}_context.n=2;return this.renderState.promise;case 2:return _context.a(2)}},_callee,this)}));function render(_x,_x2){return _render.apply(this,arguments)}return render}()// endregion
|
|
647
|
+
// region property handling
|
|
648
|
+
/**
|
|
649
|
+
* Generic property setter. Forwards field writes into internal and
|
|
650
|
+
* external property representations.
|
|
651
|
+
*
|
|
652
|
+
* In general, it is a bad idea to write properties which shadow state
|
|
653
|
+
* properties (move to a controlled component instance) and re-set the
|
|
654
|
+
* property to "undefined" later to lose control.
|
|
655
|
+
*
|
|
656
|
+
* The reason causes in avoiding this scenario:
|
|
657
|
+
*
|
|
658
|
+
* 1. Property overwrites the state.
|
|
659
|
+
* 2. State changes but is shadowed by recent changes in property.
|
|
660
|
+
*
|
|
661
|
+
* So the following will be ensured:
|
|
662
|
+
*
|
|
663
|
+
* 1. Property overwrites the state.
|
|
664
|
+
* 2. Property is overwritten to "undefined" to lose control over the
|
|
665
|
+
* state.
|
|
666
|
+
* 3. Now a state change can be represented back after property adaptions.
|
|
667
|
+
* (Converts reacts declarative nature into an imperative web-component
|
|
668
|
+
* style).
|
|
669
|
+
* 4. Further state changes should be communicated back via output events.
|
|
670
|
+
* @param name - Property name to write.
|
|
671
|
+
* @param value - New value to write.
|
|
672
|
+
*/)},{key:"setPropertyValue",value:function setPropertyValue(name,value){this.reflectProperties(_defineProperty({},name,(0,external_clientnode_.copy)(value,false,1)));this.setInternalPropertyValue(name,(0,external_clientnode_.copy)(value,false,1))}/**
|
|
673
|
+
* Internal property setter. Respects configured aliases.
|
|
674
|
+
* @param name - Property name to write.
|
|
675
|
+
* @param value - New value to write.
|
|
676
|
+
*/},{key:"setInternalPropertyValue",value:function setInternalPropertyValue(name,value){if(value===null)value=property_types_.NullSymbol;else if(value===undefined)value=property_types_.UndefinedSymbol;_superPropGet(ReactWeb,"setInternalPropertyValue",this,3)([name,value])}// endregion
|
|
677
|
+
// region handle slots
|
|
678
|
+
/**
|
|
679
|
+
* Converts given html dom nodes into a compiled function to generate a
|
|
680
|
+
* react-element or a react-element list.
|
|
681
|
+
* @param domNodes - Nodes to convert.
|
|
682
|
+
* @param scope - Additional scope to render subcomponents against.
|
|
683
|
+
* Necessary to bound necessary environment variables into compiled context.
|
|
684
|
+
* @param isFunction - Indicates whether a given render result should be
|
|
685
|
+
* provided as function (render property) with bound parameters environment
|
|
686
|
+
* variable name.
|
|
687
|
+
* @returns Transformed react elements.
|
|
688
|
+
*/},{key:"preCompileDomNodes",value:function preCompileDomNodes(domNodes,scope,isFunction){if(scope===void 0){scope={}}if(isFunction===void 0){isFunction=false}// NOTE: We ignore empty text nodes (like React's jsx does).
|
|
689
|
+
domNodes=domNodes.filter(function(domNode){return domNode.nodeType!==Node.TEXT_NODE||typeof domNode.nodeValue==="string"&&domNode.nodeValue.trim()!==""});if(domNodes.length===1)return this.preCompileDomNode(domNodes[0],scope,isFunction);var index=1;var result=[];var _iterator=_createForOfIteratorHelper(domNodes),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var node=_step.value;var element=this.preCompileDomNode(node,scope,isFunction,index.toString());result.push(element);index+=1}}catch(err){_iterator.e(err)}finally{_iterator.f()}if(isFunction)return function(scope){return function(){var renderResult=[];var _iterator2=_createForOfIteratorHelper(result),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var factory=_step2.value;var renderItem=factory(scope);if(typeof renderItem==="function")renderResult.push(renderItem.apply(void 0,arguments))}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}return (0,external_react_.createElement)(external_react_.Fragment,{children:renderResult})}};return result}/**
|
|
690
|
+
* Converts a given html dom node into a react-element.
|
|
691
|
+
* @param domNode - Node to convert.
|
|
692
|
+
* @param scope - Additional scope to render subcomponents against.
|
|
693
|
+
* @param isFunction - Indicates whether given nodes should be provided as
|
|
694
|
+
* function (render property).
|
|
695
|
+
* @param key - Optional key to add to component properties.
|
|
696
|
+
* @returns Transformed react element.
|
|
697
|
+
*/},{key:"preCompileDomNode",value:function preCompileDomNode(domNode,scope,isFunction,key){var _this3=this;if(scope===void 0){scope={}}if(isFunction===void 0){isFunction=false}// region render property
|
|
698
|
+
if(isFunction){var node=this.preCompileDomNode(domNode,_objectSpread(_objectSpread({},scope),{},{data:undefined,firstArgument:undefined,firstParameter:undefined,options:undefined,scope:undefined,parameters:undefined}),false,key);return function(scope){return function(){for(var _len2=arguments.length,parameters=new Array(_len2),_key2=0;_key2<_len2;_key2++){parameters[_key2]=arguments[_key2]}var firstArgument=parameters.length>0?parameters[0]:null;return node(_objectSpread(_objectSpread({},scope),{},{data:firstArgument,firstArgument:firstArgument,firstParameter:firstArgument,options:firstArgument,scope:firstArgument,parameters:parameters}))}}}// endregion
|
|
699
|
+
// region text node
|
|
700
|
+
if(domNode.nodeType===Node.TEXT_NODE){var value=typeof domNode.nodeValue==="string"?domNode.nodeValue.trim():"";var result=key&&value?(0,external_react_.createElement)(external_react_.Fragment,{children:value,key:key}):value?value:null;return function(){return result}}// endregion
|
|
701
|
+
if(!domNode.getAttributeNames)return function(){return null};// region native elements and wrapped react components
|
|
702
|
+
/// region prepare type and static properties
|
|
703
|
+
var staticProperties={};var target;var isComponent=this.self.isReactComponent(domNode);if(isComponent){// region pre-compile nested render context
|
|
704
|
+
domNode.determineRenderScope();if(Object.keys(this.compiledSlots).length===0)domNode.preCompileSlots();// endregion
|
|
705
|
+
/*
|
|
706
|
+
NOTE: Nested components are already instantiated and connected,
|
|
707
|
+
so use their initialized properties. We need to merge them when
|
|
708
|
+
actually rendering the nested component.
|
|
709
|
+
*/if(key&&!Object.prototype.hasOwnProperty.call(staticProperties,"key"))staticProperties.key=key;target=domNode.constructor.content}else{staticProperties.key=key;target=domNode.tagName.toLowerCase()}/// endregion
|
|
710
|
+
/// region pre-compile dynamic properties
|
|
711
|
+
var knownScopeNames=Object.keys(scope);var compiledProperties={};var _iterator3=_createForOfIteratorHelper(domNode.getAttributeNames()),_step3;try{var _loop=function _loop(){var _value3;var attributeName=_step3.value;var _value2=domNode.getAttribute(attributeName);if(_value2===null)return 0;// continue
|
|
712
|
+
var extend=false;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.startsWith("attribute-")||name==="attributes"||name.startsWith("property-")||name==="properties"){var _compile=(0,external_clientnode_.compile)(_value2,knownScopeNames),error=_compile.error,originalScopeNames=_compile.originalScopeNames,templateFunction=_compile.templateFunction;if(error){log.warn("Error occurred during compiling given attribute","binding \"".concat(attributeName,"\" on node:"),domNode,error);return 0;// continue
|
|
713
|
+
}if(name==="attributes"||name==="properties")extend=true;else name=name.startsWith("attribute-")?name.substring("attribute-".length):name.substring("property-".length);_value2={originalScopeNames:originalScopeNames,templateFunction:templateFunction.bind(_this3)}}else if(name.startsWith("on-")){name=(0,external_clientnode_.delimitedToCamelCase)(name);if(!Object.prototype.hasOwnProperty.call(scope,"event"))knownScopeNames=[].concat(_toConsumableArray(knownScopeNames),["event"]);if(!Object.prototype.hasOwnProperty.call(scope,"parameters"))knownScopeNames=[].concat(_toConsumableArray(knownScopeNames),["parameters"]);/*
|
|
714
|
+
NOTE: We pre-compile event listener since they should
|
|
715
|
+
usually be called more than it would be re-rendered.
|
|
716
|
+
*/var _compile2=(0,external_clientnode_.compile)(_value2,knownScopeNames,true),_error=_compile2.error,_originalScopeNames=_compile2.originalScopeNames,scopeNames=_compile2.scopeNames,_templateFunction=_compile2.templateFunction;if(_error){log.warn("Error occurred during compiling given event","binding \"".concat(attributeName,"\" on node:"),domNode,_error);return 0;// continue
|
|
717
|
+
}var eventHandler=_templateFunction.bind(_this3);_value2=function value(){for(var _len3=arguments.length,parameters=new Array(_len3),_key3=0;_key3<_len3;_key3++){parameters[_key3]=arguments[_key3]}scope.event=parameters[0];scope.parameters=parameters;try{eventHandler.apply(void 0,_toConsumableArray(_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(_value2,"\" could"),"not be evaluated with given scope names","\"".concat(scopeNames.join("\", \""),"\":"),(0,external_clientnode_.represent)(error))}}}else name=attributeName;var mapping={class:"className",for:"htmlFor"};if(Object.prototype.hasOwnProperty.call(mapping,name))name=mapping[name];name=(0,external_clientnode_.delimitedToCamelCase)(name);if((_value3=_value2)!==null&&_value3!==void 0&&_value3.originalScopeNames)// NOTE: "''" marks a property set like in JSX "{...props}".
|
|
718
|
+
compiledProperties[extend?"":name]=_value2;else if(!isComponent)/*
|
|
719
|
+
NOTE: Properties of components are evaluated already by
|
|
720
|
+
them self and set as "internalProperties". Those
|
|
721
|
+
properties, which need to be evaluated against the parent
|
|
722
|
+
scope, should be marked via the "bind-property-" prefix.
|
|
723
|
+
That's why they are omitted here.
|
|
724
|
+
*/staticProperties[name]=_value2},_ret;for(_iterator3.s();!(_step3=_iterator3.n()).done;){_ret=_loop();if(_ret===0)continue}/// endregion
|
|
725
|
+
/// region pre-compiled nested nodes of native elements
|
|
726
|
+
}catch(err){_iterator3.e(err)}finally{_iterator3.f()}if(!isComponent){var childNodes=Array.from(domNode.childNodes);if(childNodes.length)staticProperties.children=this.preCompileDomNodes(childNodes,scope)}/// endregion
|
|
727
|
+
/// region create evaluable render function
|
|
728
|
+
return function(runtimeScope){// region prepare scope
|
|
729
|
+
runtimeScope=_objectSpread(_objectSpread({},scope),runtimeScope);runtimeScope.scope=runtimeScope;// endregion
|
|
730
|
+
var properties=_objectSpread({},staticProperties);// region evaluate dynamic properties
|
|
731
|
+
for(var _i=0,_Object$entries=Object.entries(compiledProperties);_i<_Object$entries.length;_i++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i],2),name=_Object$entries$_i[0],_Object$entries$_i$=_Object$entries$_i[1],originalScopeNames=_Object$entries$_i$.originalScopeNames,templateFunction=_Object$entries$_i$.templateFunction;var _value=templateFunction.apply(void 0,_toConsumableArray(originalScopeNames.map(function(name){return runtimeScope[name]})));if(name==="")properties=_objectSpread(_objectSpread({},properties),_value);else properties[name]=_value}// endregion
|
|
732
|
+
// region prepare react specific element property handling
|
|
733
|
+
if(Object.prototype.hasOwnProperty.call(properties,"innerHTML")){properties.dangerouslySetInnerHTML={__html:properties.innerHTML};delete properties.children;delete properties.innerHTML}if(Object.prototype.hasOwnProperty.call(properties,"textContent")){properties.children=properties.textContent;delete properties.textContent}else if(isComponent){// region evaluate nested render contexts
|
|
734
|
+
/*
|
|
735
|
+
NOTE: Properties of components are evaluated already by
|
|
736
|
+
them self and set as "internalProperties". Those
|
|
737
|
+
properties, which need to be evaluated against the parent
|
|
738
|
+
scope, should be marked via the "bind-property-" prefix.
|
|
739
|
+
*/properties=_objectSpread(_objectSpread({},domNode.internalProperties),properties);runtimeScope=_objectSpread(_objectSpread(_objectSpread({},properties),runtimeScope),{},{parentInstance:domNode});domNode.evaluateSlots(runtimeScope);domNode.prepareProperties(properties);// endregion
|
|
740
|
+
}else if(properties.children)properties.children=_this3.evaluatePreCompiledDomNodes(properties.children,runtimeScope);// endregion
|
|
741
|
+
return (0,external_react_.createElement)(target,properties)};/// endregion
|
|
742
|
+
// endregion
|
|
743
|
+
}/**
|
|
744
|
+
* Evaluates given pre-compiled nodes into a single react element or a
|
|
745
|
+
* React element list.
|
|
746
|
+
* @param nodes - Pre-compiled nodes.
|
|
747
|
+
* @param scope - Additional scope to render subcomponents against.
|
|
748
|
+
* @returns Transformed react elements.
|
|
749
|
+
*/},{key:"evaluatePreCompiledDomNodes",value:function evaluatePreCompiledDomNodes(nodes,scope){if(scope===void 0){scope={}}if(!Array.isArray(nodes))return nodes(scope);if(nodes.length===1)return nodes[0](scope);var result=[];var _iterator4=_createForOfIteratorHelper(nodes),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var node=_step4.value;var element=node(scope);if(element)result.push(element)}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}return result}/**
|
|
750
|
+
* Pre compiles and caches determined slots.
|
|
751
|
+
*/},{key:"preCompileSlots",value:function preCompileSlots(){for(var name in this.slots)if(this.slots[name]&&name!=="default")this.compiledSlots[name]=this.preCompileDomNode(this.slots[name],_objectSpread(_objectSpread({},this.scope),{},{parentInstance:this}),[property_types_.func,"function"].includes(this.self.propertyTypes[name]));if(this.slots.default&&this.slots.default.length>0)this.compiledSlots.children=this.preCompileDomNodes(this.slots.default,_objectSpread(_objectSpread({},this.scope),{},{parentInstance:this}),[property_types_.func,"function"].includes(this.self.propertyTypes.children))}/**
|
|
752
|
+
* Evaluates pre-compiled slots.
|
|
753
|
+
* @param scope - To render again.
|
|
754
|
+
*/},{key:"evaluateSlots",value:function evaluateSlots(scope){this.preparedSlots={};for(var name in this.compiledSlots)if(Object.prototype.hasOwnProperty.call(this.compiledSlots,name))if(name==="children")this.preparedSlots.children=this.evaluatePreCompiledDomNodes(this.compiledSlots[name],scope);else this.preparedSlots[name]=this.compiledSlots[name](scope)}// endregion
|
|
755
|
+
// region helper
|
|
756
|
+
/**
|
|
757
|
+
* Determines if the given element type is a react-wrapped component.
|
|
758
|
+
* @param domNode - Node to determine from.
|
|
759
|
+
* @returns Boolean indicator.
|
|
760
|
+
*/},{key:"determineRootBinding",value:/**
|
|
761
|
+
* Determines initial root and react root who initializes their rendering
|
|
762
|
+
* digests.
|
|
763
|
+
*/function determineRootBinding(){_superPropGet(ReactWeb,"determineRootBinding",this,3)([]);var currentElement=this.parentNode;while(currentElement){if(this.self.isReactComponent(currentElement)){this.rootReactInstance=currentElement;break}currentElement=currentElement.parentNode}}/**
|
|
764
|
+
* Applies missing forward ref and or memorizing wrapper to a current react
|
|
765
|
+
* component.
|
|
766
|
+
*/},{key:"applyComponentWrapper",value:function applyComponentWrapper(){if(typeof this.self.content==="string"||this.isWrapped)return;this.isWrapped=true;var wrapped=this.self.content.wrapped||this.self.content;if(this.self.content.webComponentAdapterWrapped){if(this.wrapMemorizingWrapper){this.self.content=(0,external_react_.memo)(this.self.content);this.self.content.wrapped=wrapped}}else if(this.self.attachWebComponentAdapterIfNotExists){if(!this.self.content.displayName)this.self.content.displayName=this.self._name;this.self.content=(0,external_react_.forwardRef)(function(properties,reference){(0,external_react_.useImperativeHandle)(reference,function(){return{properties:properties}},[properties]);return (0,external_react_.createElement)(wrapped,properties)});if(this.wrapMemorizingWrapper||this.wrapMemorizingWrapper===null)this.self.content=(0,external_react_.memo)(this.self.content);this.self.content.wrapped=wrapped;this.self.content.webComponentAdapterWrapped="react"}else if(this.wrapMemorizingWrapper){this.self.content=(0,external_react_.memo)(this.self.content);this.self.content.wrapped=wrapped}}/**
|
|
767
|
+
* Prepares a given properties object to render against the current
|
|
768
|
+
* component. Creates a reference for being recognized of reacts internal
|
|
769
|
+
* state updates.
|
|
770
|
+
* @param properties - Properties to prepare.
|
|
771
|
+
*/},{key:"prepareProperties",value:function prepareProperties(properties){var _this4=this;(0,external_clientnode_.extend)(properties,this.preparedSlots);this.self.removeKnownUnwantedPropertyKeys(this.self,properties);/*
|
|
772
|
+
NOTE: Provide instance if and only if not explicitly requested from
|
|
773
|
+
parent via properties.
|
|
774
|
+
*/if(!properties.ref){this.instance=(0,external_react_.createRef)();properties.ref=function(reference){if(_this4.instance)_this4.instance.current=reference;else _this4.instance={current:reference};_this4.reflectInstanceProperties()}}}}],[{key:"isReactComponent",value:function isReactComponent(domNode){var type=domNode.constructor;return _typeof(type.content)==="object"&&(!type.attachWebComponentAdapterIfNotExists||type.content.webComponentAdapterWrapped==="react")}},{key:"removeKnownUnwantedPropertyKeys",value:/**
|
|
775
|
+
* Removes unwanted known and not specified properties from a given
|
|
776
|
+
* properties object (usually added by dev-tools).
|
|
777
|
+
* @param target - ReactElement where properties belong to.
|
|
778
|
+
* @param properties - Properties object to trim.
|
|
779
|
+
*/function removeKnownUnwantedPropertyKeys(target,properties){if(typeof target.content==="string")return;// NOTE: Known root of errors caused by browser dev-tools.
|
|
780
|
+
var _iterator5=_createForOfIteratorHelper(["isRoot","isTrusted","__composed"]),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var name=_step5.value;if(Object.prototype.hasOwnProperty.call(properties,name)&&(Object.prototype.hasOwnProperty.call(target.content,"propTypes")&&!Object.prototype.hasOwnProperty.call(target.content.propTypes,name)||Object.prototype.hasOwnProperty.call(target.content,"wrapped")&&Object.prototype.hasOwnProperty.call(target.content.wrapped,"propTypes")&&!Object.prototype.hasOwnProperty.call(target.content.wrapped.propTypes,name)))delete properties[name]}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}// endregion
|
|
781
|
+
}])}(Web/* default */.Ay);_defineProperty(ReactWeb,"attachWebComponentAdapterIfNotExists",true);_defineProperty(ReactWeb,"content","div");_defineProperty(ReactWeb,"react",external_react_["default"]);_defineProperty(ReactWeb,"_name","ReactWebComponent");var api={component:ReactWeb,register:function register(tagName){if(tagName===void 0){tagName=(0,external_clientnode_.camelCaseToDelimited)(ReactWeb._name)}customElements.define(tagName,ReactWeb)}};/* harmony default export */ var src_ReactWeb = (ReactWeb);
|
|
782
|
+
|
|
783
|
+
/***/ }),
|
|
784
|
+
/* 5 */,
|
|
785
|
+
/* 6 */
|
|
786
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
787
|
+
|
|
788
|
+
var x = function(y) {
|
|
789
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
790
|
+
}
|
|
791
|
+
var y = function(x) { return function() { return x; }; }
|
|
792
|
+
module.exports = x({ ["Fragment"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.Fragment; }, ["createElement"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.createElement; }, ["createRef"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.createRef; }, ["default"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__["default"]; }, ["forwardRef"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.forwardRef; }, ["memo"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.memo; }, ["useImperativeHandle"]: function() { return __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle; } });
|
|
793
|
+
|
|
794
|
+
/***/ })
|
|
795
|
+
/******/ ]);
|
|
796
|
+
/************************************************************************/
|
|
797
|
+
/******/ // The module cache
|
|
798
|
+
/******/ var __webpack_module_cache__ = {};
|
|
799
|
+
/******/
|
|
800
|
+
/******/ // The require function
|
|
801
|
+
/******/ function __webpack_require__(moduleId) {
|
|
802
|
+
/******/ // Check if module is in cache
|
|
803
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
804
|
+
/******/ if (cachedModule !== undefined) {
|
|
805
|
+
/******/ return cachedModule.exports;
|
|
806
|
+
/******/ }
|
|
807
|
+
/******/ // Create a new module (and put it into the cache)
|
|
808
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
809
|
+
/******/ // no module.id needed
|
|
810
|
+
/******/ // no module.loaded needed
|
|
811
|
+
/******/ exports: {}
|
|
812
|
+
/******/ };
|
|
813
|
+
/******/
|
|
814
|
+
/******/ // Execute the module function
|
|
815
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
816
|
+
/******/
|
|
817
|
+
/******/ // Return the exports of the module
|
|
818
|
+
/******/ return module.exports;
|
|
819
|
+
/******/ }
|
|
820
|
+
/******/
|
|
821
|
+
/************************************************************************/
|
|
822
|
+
/******/ /* webpack/runtime/define property getters */
|
|
823
|
+
/******/ !function() {
|
|
824
|
+
/******/ // define getter/value functions for harmony exports
|
|
825
|
+
/******/ __webpack_require__.d = function(exports, definition) {
|
|
826
|
+
/******/ if(Array.isArray(definition)) {
|
|
827
|
+
/******/ var i = 0;
|
|
828
|
+
/******/ while(i < definition.length) {
|
|
829
|
+
/******/ var key = definition[i++];
|
|
830
|
+
/******/ var binding = definition[i++];
|
|
831
|
+
/******/ if(!__webpack_require__.o(exports, key)) {
|
|
832
|
+
/******/ if(binding === 0) {
|
|
833
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
|
|
834
|
+
/******/ } else {
|
|
835
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
|
|
836
|
+
/******/ }
|
|
837
|
+
/******/ } else if(binding === 0) { i++; }
|
|
838
|
+
/******/ }
|
|
839
|
+
/******/ } else {
|
|
840
|
+
/******/ for(var key in definition) {
|
|
841
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
842
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
843
|
+
/******/ }
|
|
844
|
+
/******/ }
|
|
845
|
+
/******/ }
|
|
846
|
+
/******/ };
|
|
847
|
+
/******/ }();
|
|
848
|
+
/******/
|
|
849
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
850
|
+
/******/ !function() {
|
|
851
|
+
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
|
852
|
+
/******/ }();
|
|
853
|
+
/******/
|
|
854
|
+
/************************************************************************/
|
|
855
|
+
var __webpack_exports__ = {};
|
|
856
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
857
|
+
/* harmony export */ MZ: function() { return /* binding */ property; },
|
|
858
|
+
/* harmony export */ Nc: function() { return /* binding */ Web; },
|
|
859
|
+
/* harmony export */ YF: function() { return /* binding */ wrapAsWebComponent; },
|
|
860
|
+
/* harmony export */ Z1: function() { return /* binding */ webAPI; },
|
|
861
|
+
/* harmony export */ g0: function() { return /* binding */ ReactWeb; },
|
|
862
|
+
/* harmony export */ mT: function() { return /* binding */ reactWebAPI; }
|
|
863
|
+
/* harmony export */ });
|
|
864
|
+
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
865
|
+
/* harmony import */ var _decorator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
866
|
+
/* harmony import */ var _ReactWeb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
|
867
|
+
/* harmony import */ var _Web_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
|
868
|
+
// #!/usr/bin/env babel-node
|
|
869
|
+
// -*- coding: utf-8 -*-
|
|
870
|
+
/** @module index *//* !
|
|
871
|
+
region header
|
|
872
|
+
[Project page](https://torben.website/web-component-wrapper)
|
|
873
|
+
|
|
874
|
+
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
|
|
875
|
+
|
|
876
|
+
License
|
|
877
|
+
-------
|
|
878
|
+
|
|
879
|
+
This library written by Torben Sickert stands under a creative commons
|
|
880
|
+
naming 3.0 unported license.
|
|
881
|
+
See https://creativecommons.org/licenses/by/3.0/deed.de
|
|
882
|
+
endregion
|
|
883
|
+
*/// region imports
|
|
884
|
+
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 _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 _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}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 _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 _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}// endregion
|
|
885
|
+
var property=_decorator_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A;var ReactWeb=_ReactWeb_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Ay;var reactWebAPI=_ReactWeb_js__WEBPACK_IMPORTED_MODULE_2__/* .api */ .FH;var webAPI=_Web_js__WEBPACK_IMPORTED_MODULE_3__/* .api */ .FH;var Web=_Web_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Ay;/**
|
|
886
|
+
* Wraps given react component as web component.
|
|
887
|
+
* @param component - React component to wrap.
|
|
888
|
+
* @param nameHint - A name to set as property in runtime generated web
|
|
889
|
+
* component class.
|
|
890
|
+
* @param configuration - Additional web component configurations.
|
|
891
|
+
* @returns Generated object to register and retrieve generated web component.
|
|
892
|
+
*/var wrapAsWebComponent=function wrapAsWebComponent(component,nameHint,configuration){var _component$___types,_ref,_configuration$render;if(nameHint===void 0){nameHint="NoName"}if(configuration===void 0){configuration={}}// Determine class / function name.
|
|
893
|
+
var name=component._name||(// NOTE: Not minifyable save: "component.name ||"
|
|
894
|
+
/*
|
|
895
|
+
NOTE: There exists babel plugins which reflects component name and
|
|
896
|
+
member variables under this property. Try to respect these.
|
|
897
|
+
*/(_component$___types=component.___types)===null||_component$___types===void 0||(_component$___types=_component$___types.name)===null||_component$___types===void 0?void 0:_component$___types.name)||nameHint.replace(/^(.*\/+)?([^/]+)\.tsx$/,"$2");if(configuration.propTypes)component.propTypes=configuration.propTypes;var propertyTypes=component.propTypes||{};var propertyAliases=configuration.propertyAliases||component.propertyAliases||{};var allPropertyNames=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.unique)(Object.keys(propertyTypes).concat(Object.keys(propertyAliases)).concat(Object.values(propertyAliases)));// NOTE: We extend given configuration properties by base class defined.
|
|
898
|
+
var propertiesToReflectAsAttributes=configuration.propertiesToReflectAsAttributes||component.propertiesToReflectAsAttributes||[];if(ReactWeb.propertiesToReflectAsAttributes)if(Array.isArray(propertiesToReflectAsAttributes))propertiesToReflectAsAttributes=[].concat(_toConsumableArray(ReactWeb.propertiesToReflectAsAttributes),_toConsumableArray(propertiesToReflectAsAttributes));else if(propertiesToReflectAsAttributes instanceof Map)for(var _i=0,_arr=ReactWeb.propertiesToReflectAsAttributes;_i<_arr.length;_i++){var _name=_arr[_i];propertiesToReflectAsAttributes.set(_name,ReactWeb.propertyTypes[_name])}else if(_typeof(propertiesToReflectAsAttributes)==="object")for(var _i2=0,_arr2=ReactWeb.propertiesToReflectAsAttributes;_i2<_arr2.length;_i2++){var _name2=_arr2[_i2];propertiesToReflectAsAttributes[_name2]=ReactWeb.propertyTypes[_name2]}var attributeNames=allPropertyNames.map(function(name){return (0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name)});/**
|
|
899
|
+
* Runtime generated web component.
|
|
900
|
+
*/var ConcreteComponent=/*#__PURE__*/function(_ReactWeb){function ConcreteComponent(){var _configuration$unmoun;var _this;_classCallCheck(this,ConcreteComponent);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,ConcreteComponent,[].concat(args));_defineProperty(_this,"self",ConcreteComponent);_defineProperty(_this,"internalProperties",configuration.internalProperties?_objectSpread({},configuration.internalProperties):component.internalProperties?_objectSpread({},component.internalProperties):{});_defineProperty(_this,"unmountOnDisconnect",(_configuration$unmoun=configuration.unmountOnDisconnect)!==null&&_configuration$unmoun!==void 0?_configuration$unmoun:true);return _this}_inherits(ConcreteComponent,_ReactWeb);return _createClass(ConcreteComponent)}(ReactWeb);_defineProperty(ConcreteComponent,"attachWebComponentAdapterIfNotExists",typeof configuration.attachWebComponentAdapterIfNotExists==="boolean"?configuration.attachWebComponentAdapterIfNotExists:true);_defineProperty(ConcreteComponent,"content",component);_defineProperty(ConcreteComponent,"observedAttributes",ReactWeb.observedAttributes.concat(attributeNames)// NOTE: Respect pre-evaluation indicator attributes.
|
|
901
|
+
.concat(attributeNames.map(function(name){return"-".concat(name)})));_defineProperty(ConcreteComponent,"controllableProperties",component.controllableProperties||configuration.controllableProperties||[]);_defineProperty(ConcreteComponent,"eventToPropertyMapping",configuration.eventToPropertyMapping===null?configuration.eventToPropertyMapping:configuration.eventToPropertyMapping?_objectSpread({},configuration.eventToPropertyMapping):component.eventToPropertyMapping===null?component.eventToPropertyMapping:component.eventToPropertyMapping?_objectSpread({},component.eventToPropertyMapping):{});_defineProperty(ConcreteComponent,"propertyAliases",_objectSpread(_objectSpread({},ReactWeb.propertyAliases),propertyAliases));_defineProperty(ConcreteComponent,"propertiesToReflectAsAttributes",propertiesToReflectAsAttributes);_defineProperty(ConcreteComponent,"propertyTypes",_objectSpread(_objectSpread({},ReactWeb.propertyTypes),propertyTypes));_defineProperty(ConcreteComponent,"renderProperties",(_ref=(_configuration$render=configuration.renderProperties)!==null&&_configuration$render!==void 0?_configuration$render:component.renderProperties)!==null&&_ref!==void 0?_ref:ReactWeb.renderProperties);_defineProperty(ConcreteComponent,"_name",name);var webComponentAPI={component:ConcreteComponent,register:function register(tagName){if(tagName===void 0){tagName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name)}customElements.define(tagName,ConcreteComponent)}};return webComponentAPI};/* harmony default export */ __webpack_exports__.Ay = (wrapAsWebComponent);
|
|
902
|
+
var __webpack_exports__ReactWeb = __webpack_exports__.g0;
|
|
903
|
+
var __webpack_exports__Web = __webpack_exports__.Nc;
|
|
904
|
+
var __webpack_exports__default = __webpack_exports__.Ay;
|
|
905
|
+
var __webpack_exports__property = __webpack_exports__.MZ;
|
|
906
|
+
var __webpack_exports__reactWebAPI = __webpack_exports__.mT;
|
|
907
|
+
var __webpack_exports__webAPI = __webpack_exports__.Z1;
|
|
908
|
+
var __webpack_exports__wrapAsWebComponent = __webpack_exports__.YF;
|
|
909
|
+
export { __webpack_exports__ReactWeb as ReactWeb, __webpack_exports__Web as Web, __webpack_exports__default as default, __webpack_exports__property as property, __webpack_exports__reactWebAPI as reactWebAPI, __webpack_exports__webAPI as webAPI, __webpack_exports__wrapAsWebComponent as wrapAsWebComponent };
|