web-component-wrapper 0.0.598 → 0.0.600

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.
@@ -1 +1 @@
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,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("webComponentWrapper",[],n):"object"==typeof exports?exports.webComponentWrapper=n():e.webComponentWrapper=n()}(this,(function(){return{r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}.r(e={}),e;var e}));
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,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var i=n();for(var l in i)("object"==typeof exports?exports:e)[l]=i[l]}}(this,(function(){return{r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}.r(e={}),e;var e}));
@@ -0,0 +1,23 @@
1
+ import { PropertyConfiguration } from './type';
2
+ /**
3
+ * Generates a decorator based on given configuration.
4
+ * @param options - Property configuration to define how to transfer attributes
5
+ * and properties into each other.
6
+ * @param options.alias - Alternate property name.
7
+ * @param options.readAttribute - Indicates whether to read from existing
8
+ * attribute also.
9
+ * @param options.type - Value type to parse value.
10
+ * @param options.update - Indicates whether to overwrite already existing
11
+ * property configurations.
12
+ * @param options.writeAttribute - Indicates whether to sync attribute
13
+ * representation back into dom.
14
+ * @returns Generated decorator.
15
+ */
16
+ export declare function property(options?: {
17
+ alias?: string;
18
+ readAttribute?: boolean;
19
+ type?: PropertyConfiguration;
20
+ update?: boolean;
21
+ writeAttribute?: boolean | PropertyConfiguration;
22
+ }): PropertyDecorator;
23
+ export default property;
@@ -0,0 +1,20 @@
1
+ import { Mapping } from 'clientnode';
2
+ import propertyImport from './decorator';
3
+ import ReactWebImport from './ReactWeb';
4
+ import WebImport from './Web';
5
+ import { ComponentType, WebComponentAPI, WebComponentConfiguration } from './type';
6
+ export declare const property: typeof propertyImport;
7
+ export declare const ReactWeb: typeof ReactWebImport;
8
+ export declare const reactWebAPI: WebComponentAPI<HTMLElement, Mapping<unknown>, import("./type").ReactComponentBaseProperties, typeof ReactWebImport>;
9
+ export declare const webAPI: WebComponentAPI<HTMLElement, Mapping<unknown>, Mapping<unknown>, typeof WebImport>;
10
+ export declare const Web: typeof WebImport;
11
+ /**
12
+ * Wraps given react component as web component.
13
+ * @param component - React component to wrap.
14
+ * @param nameHint - A name to set as property in runtime generated web
15
+ * component class.
16
+ * @param configuration - Additional web component configurations.
17
+ * @returns Generated object to register and retrieve generated web component.
18
+ */
19
+ export declare const wrapAsWebComponent: <Type extends ComponentType = ComponentType, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, EventParameters extends Array<unknown> = Array<unknown>>(component: Type, nameHint?: string, configuration?: WebComponentConfiguration<ExternalProperties, InternalProperties, EventParameters>) => WebComponentAPI<Type, ExternalProperties, InternalProperties, typeof ReactWeb<Type, ExternalProperties, InternalProperties>>;
20
+ export default wrapAsWebComponent;
package/dist/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/test.js CHANGED
@@ -1 +1 @@
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("clientnode"),require("clientnode/property-types"),require("react"),require("@jest/globals"),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(["clientnode","clientnode/property-types","react","@jest/globals","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("clientnode"),require("clientnode/property-types"),require("react"),require("@jest/globals"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper")):t(e.clientnode,e["clientnode/property-types"],e.react,e["@jest/globals"],e["react-dom"],e["react-dom/client"],e["@babel/runtime/helpers/initializerDefineProperty"],e["@babel/runtime/helpers/applyDecoratedDescriptor"],e["@babel/runtime/helpers/initializerWarningHelper"]);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,((e,t,r,s,n,o,i,a,p)=>(()=>{var l=[t=>{t.exports=e},e=>{e.exports=t},(e,t,r)=>{r.d(t,{default:()=>o});var s=r(0),n=r(1);const o=function(e={}){return e={readAttribute:!0,type:n.string,...e},function(t,r){if("string"!=typeof r)return;const n=t.self||t.constructor;if(e.readAttribute){Object.prototype.hasOwnProperty.call(n,"observedAttributes")||(n.observedAttributes=n.observedAttributes?[...n.observedAttributes]:[]);const e=(0,s.camelCaseToDelimited)(r);n.observedAttributes&&!n.observedAttributes.includes(e)&&n.observedAttributes.push(e)}if(e.type&&(Object.prototype.hasOwnProperty.call(n,"propertyTypes")||(n.propertyTypes=n.propertyTypes?{...n.propertyTypes}:{}),!n.propertyTypes||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyTypes[r]=e.type)),e.writeAttribute&&(Object.prototype.hasOwnProperty.call(n,"propertiesToReflectAsAttributes")||(n.propertiesToReflectAsAttributes=n.propertiesToReflectAsAttributes?(0,s.copy)(n.propertiesToReflectAsAttributes):[]),e.update||n.propertiesToReflectAsAttributes instanceof Map&&!n.propertiesToReflectAsAttributes.has(r)||Array.isArray(n.propertiesToReflectAsAttributes)&&!n.propertiesToReflectAsAttributes.includes(r)||"object"==typeof n.propertiesToReflectAsAttributes&&!Object.prototype.hasOwnProperty.call(n.propertiesToReflectAsAttributes,r))){let t;"boolean"==typeof e.writeAttribute?e.writeAttribute&&n.propertyTypes&&Object.prototype.hasOwnProperty.call(n.propertyTypes,r)&&(t=n.propertyTypes[r]):t=e.writeAttribute,void 0!==t&&(Array.isArray(n.propertiesToReflectAsAttributes)&&(!0===e.writeAttribute?n.propertiesToReflectAsAttributes.push(r):n.normalizePropertyTypeList&&(n.propertiesToReflectAsAttributes=n.normalizePropertyTypeList(n.propertiesToReflectAsAttributes))),n.propertiesToReflectAsAttributes instanceof Map&&n.propertiesToReflectAsAttributes.set(r,t),"object"==typeof n.propertiesToReflectAsAttributes&&(n.propertiesToReflectAsAttributes[r]=t))}e.alias&&(Object.prototype.hasOwnProperty.call(n,"propertyAliases")||(n.propertyAliases=n.propertyAliases?{...n.propertyAliases}:{}),!n.propertyAliases||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyAliases[r]=e.alias))}}},(e,t,r)=>{r.d(t,{default:()=>b});var s,n,o,i,a=r(4),p=r.n(a),l=r(5),c=r.n(l),d=(r(6),r(0)),h=r(1),u=r(2);const f=new d.Logger({name:"web-component-wrapper-web"}),m="undefined"==typeof HTMLElement?class{}:HTMLElement;let y=(s=(0,u.default)({type:h.boolean,writeAttribute:!0}),i=class e extends m{constructor(){super(),this.renderState={promise:Promise.resolve(""),pending:!1,resolve:d.NOOP},this.childComponentInstances=[],this.batchAttributeUpdates=!0,this.batchPropertyUpdates=!0,this.batchUpdates=!0,this.batchedAttributeUpdateRunning=!0,this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,this.connectionRegistered=!1,this.pendingAttributeUpdates=[],this.parentInstance=null,this.rootInstance=void 0,this.hostDomNode=void 0,this.scope={...d.UTILITY_SCOPE},this.domNodeEventBindings=new Map,this.domNodeTemplateCache=new Map,this.externalProperties={},this.ignoreAttributeUpdateObservations=!1,this.internalProperties={},this.outputEventNames=new Set,this.instance=null,p()(this,"isRoot",o,this),this.runDomConnectionAndRenderingInSameEventQueue=!1,this.self=e,this.slots={},this.prepareNewRenderingPromise(),this.self=this.constructor,this.self._propertiesToReflectAsAttributes||(this.self._propertiesToReflectAsAttributes=this.self.normalizePropertyTypeList(this.self.propertiesToReflectAsAttributes)),this.generateAliasIndex(),this.hostDomNode=this,this.rootInstance=this,this.defineGetterAndSetterInterface()}attributeChangedCallback(e,t,r){this.ignoreAttributeUpdateObservations||t===r||this.onUpdateAttribute(e,r)}onUpdateAttribute(e,t){const r=new Promise((r=>this.pendingAttributeUpdates.push((()=>{this.evaluateStringOrNullAndSetAsProperty(e,t),this.batchAttributeUpdates?this.batchedAttributeUpdateRunning||this.batchedUpdateRunning||(this.batchedAttributeUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{this.batchedAttributeUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("attributeChanged")}))):this.render("attributeChanged"),r()}))));if(this.connectionRegistered)for(;this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();return r}connectedCallback(){try{this.isConnected=!0}catch{}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,d.timeout)((()=>{this.render("connected")}))}disconnectedCallback(){this.unRender("disconnected"),this.unregisterConnectionState()}defineGetterAndSetterInterface(){const e=(0,d.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[]));for(const t of e)Object.prototype.hasOwnProperty.call(this,t)&&this.setPropertyValue(t,this[t]),Object.defineProperty(this,t,{configurable:!0,get:()=>this.getPropertyValue(t),set:e=>{this.setPropertyValue(t,e),this.triggerPropertySpecificRendering(t,e)}})}getPropertyAlias(e){return this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,e)?this.self._propertyAliasIndex[e]:null}getPropertyValue(t){var r;const s=this.instance?.current?.properties&&(Object.prototype.hasOwnProperty.call(!e.propertyTypes,t)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,t))?this.instance.current.properties[t]:null!==(r=this.internalProperties[t])&&void 0!==r?r:this.externalProperties[t];return this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,t)?this.instance.current.state[t]:s}setExternalPropertyValue(e,t){this.externalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.externalProperties[r]=t)}setInternalPropertyValue(e,t){this.internalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.internalProperties[r]=t)}setPropertyValue(e,t){this.reflectProperties({[e]:t}),this.setInternalPropertyValue(e,t)}triggerPropertySpecificRendering(e,t){if(this.batchPropertyUpdates)this.batchedPropertyUpdateRunning||this.batchedUpdateRunning||(this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{void 0!==t&&this.isStateProperty(e)?(this.render("preStatePropertyChanged"),(0,d.timeout)((()=>{this.setInternalPropertyValue(e,void 0),this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("postStatePropertyChanged"),this.triggerOutputEvents()}))):(this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("propertyChanged"),this.triggerOutputEvents())})));else{const r=this.isStateProperty(e);this.render(r?"preStatePropertyChanged":"propertyChanged"),void 0!==t&&r&&(this.setInternalPropertyValue(e,void 0),this.render("postStatePropertyChanged")),this.triggerOutputEvents()}}unregisterConnectionState(){try{this.isConnected=!1}catch{}this.connectionRegistered=!1,this.slots={}}unregisterDomNodeEventBindings(){for(const e of this.domNodeEventBindings.values())for(const t of e.values())t()}applyBinding(e,t){if(e.getAttributeNames)for(const r of e.getAttributeNames()){let s;if(r.startsWith("data-bind-")?s=r.substring(10):r.startsWith("bind-")&&(s=r.substring(5)),s){const n=e.getAttribute(r);if(null===n)continue;if(s.startsWith("attribute-")||s.startsWith("property-")){const o=(0,d.evaluate)(n,t,!1,!0,e);if(o.error){f.warn("Error occurred during processing given",`attribute binding "${r}" on node:`,e,o.error);continue}s.startsWith("attribute-")?e.setAttribute(s.substring(10),o.result):e[(0,d.delimitedToCamelCase)(s.substring(9))]=o.result}else if(s.startsWith("on-")){s=(0,d.delimitedToCamelCase)(s.substring(3)),t={log:f,event:void 0,parameters:void 0,...t};const o=(0,d.compile)(n,t,!0,!0,e);o.error?f.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,o.error):this.addSecureEventListener(e,s,((...s)=>{t.event=s[0],t.parameters=s;try{o.templateFunction(...o.originalScopeNames.map((e=>t[e])))}catch(t){f.warn("Error occurred during processing","given event binding",`"${r}" on node:`,e,`Given expression "${n}" could`,"not be evaluated with given scope",'names "'+o.scopeNames.join('", "')+`": ${(0,d.represent)(t)}`)}}))}}}}applyBindings(e,t,r=!0){for(;e;)!e.attributes?.length||!r&&e.getAttribute("slot")||this.applyBinding(e,t),e.nodeName.toLowerCase().includes("-")||this.applyBindings(e.firstChild,t),e=e.nextSibling}compileDomNodeTemplate(e,t=[],r={}){r={ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r};const s=e.nodeName.toLowerCase();if(r.ignoreComponents&&s.includes("-"))return null;if(r.unsafe){let r=e.innerHTML;if(!r&&e.template&&(r=e.template),this.self.hasCode(r)){const s=(0,d.compile)(`\`${r}\``,t);return{domNode:e,children:[],error:s.error,scopeNames:s.scopeNames,template:r,templateFunction:s.templateFunction}}return null}let n=null;if("#text"===s){const t=e.textContent;t&&this.self.hasCode(t)&&(n=t.replace(/&nbsp;/g," ").trim())}const o=[],i={children:o,domNode:e};if(n){const e=(0,d.compile)(`\`${n}\``,t);i.error=e.error,i.scopeNames=e.scopeNames,i.template=n,i.templateFunction=e.templateFunction}let a=e.firstChild;for(;a;){if(!r.filter||r.filter(a)){const e=this.compileDomNodeTemplate(a,t,{...r,ignoreComponents:r.ignoreNestedComponents});e&&o.push(e)}a=a.nextSibling}return i}evaluateCompiledDomNodeTemplate(e,t){const{domNode:r,error:s,templateFunction:n,scopeNames:o}=e;if(!n||!o)return null;if(s)return f.warn("Error occurred during compiling node content:",s),null;let i=null;try{i=n(...o.map((e=>t[e])))}catch(s){f.warn(`Error occurred when "${this.self._name}" is running`,`"${String(n)}": with bound`,`names "${o.join('", "')}":`,`"${s}". Rendering node:`,r)}return i}evaluateDomNodeTemplate(e,t={},r={}){const s=(r={domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r}).domNodeTemplateCache;if(!s.has(e)){const n={filter:r.filter,ignoreComponents:r.ignoreComponents,ignoreNestedComponents:r.ignoreNestedComponents,unsafe:r.unsafe},o=this.compileDomNodeTemplate(e,t,n);o&&s.set(e,o)}if(s.has(e)){const n=s.get(e),o=this.evaluateCompiledDomNodeTemplate(n,t);if(null!==o&&(r.unsafe&&e.innerHTML?e.innerHTML=o:e.textContent=o),n.children.length){const e=r=>{for(const s of r){const r=this.evaluateCompiledDomNodeTemplate(s,t);null!==r&&(s.domNode.textContent=r),s.children.length&&e(s.children)}};e(n.children)}}r.applyBindings&&this.applyBindings(e,t)}addSecureEventListener(e,t,r,s,n){this.domNodeEventBindings.has(e)||this.domNodeEventBindings.set(e,new Map);const o=this.domNodeEventBindings.get(e),i=o.get(t);i&&i!==r&&i();const a=()=>{e.removeEventListener(t,r,n),o.delete(t),0===o.size&&this.domNodeEventBindings.delete(e)};return o.set(t,a),e.addEventListener(t,r,s),a}determineRootBinding(){let t=this.parentNode;for(;t;){const r=t instanceof e||t.nodeName.includes("-")&&"#document-fragment"!==t.nodeName,s=null===t.parentNode&&"[object ShadowRoot]"===t.toString();r?(this.rootInstance===this&&(this.parentInstance=t,this.setPropertyValue("isRoot",!1)),this.rootInstance=t):s&&this.setPropertyValue("isRoot",!1),t=t.parentNode}}static hasCode(e){return"string"==typeof e&&e.includes("${")&&e.includes("}")&&/\${[\s\S]+}/.test(e)}static normalizePropertyTypeList(t){if("string"==typeof t&&(t=[t]),Array.isArray(t)){const r=t,s=new Map;for(const t of r)Object.prototype.hasOwnProperty.call(e.propertyTypes,t)&&s.set(t,e.propertyTypes[t]);return s}return(0,d.convertPlainObjectToMap)(t)}attachEventHandler(){if(null===this.self.eventToPropertyMapping)return;const e=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!e)}attachExplicitDefinedOutputEventHandler(){if(!this.self.eventToPropertyMapping)return!1;let e=!1;for(const t of Object.keys(this.self.eventToPropertyMapping))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||(e=!0,this.outputEventNames.add(t),this.setInternalPropertyValue(t,(async(...e)=>{const r=await this.reflectEventToProperties(t,e);r&&(e[0]=r),this.forwardEvent(t,e)})));return e}attachImplicitDefinedOutputEventHandler(e=!0){for(const[t,r]of Object.entries(this.self.propertyTypes))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||![h.func,"function"].includes(r)||this.self.renderProperties.includes(t)||(this.outputEventNames.add(t),this.setInternalPropertyValue(t,((...r)=>{e&&this.reflectEventToProperties(t,r),this.forwardEvent(t,r)})))}triggerOutputEvents(){for(const e of this.outputEventNames)this.forwardEvent(e,[this.externalProperties])}forwardEvent(e,t){return e.length>3&&e.startsWith("on")&&(e=(0,d.lowerCase)(e.substring(2))),this.dispatchEvent(new CustomEvent(e,{detail:{parameters:t}}))}applySlots(t,r){for(const s of Array.from(t.querySelectorAll("slot"))){const t=s.getAttribute("name");if(null===t||"default"===t)if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots)for(const e of this.slots.default)this.evaluateDomNodeTemplate(e,r);(0,d.replace)(s,this.slots.default,e.trimSlots)}}else this.slots.default=(0,d.unwrap)(s).map((e=>this.grabSlotContent(e)));else this.slots[t]?this.self.renderSlots&&(this.self.evaluateSlots&&this.evaluateDomNodeTemplate(this.slots[t],r),(0,d.replace)(s,this.slots[t],e.trimSlots)):this.slots[t]=this.grabSlotContent((0,d.unwrap)(s).filter((e=>"#text"!==e.nodeName.toLowerCase()))[0])}}grabSlotContent(e){const t=h.node.firstElementChild?e:null;if(t&&"textarea"===t.firstElementChild?.nodeName.toLowerCase()&&(!t.firstElementChild.hasAttribute("data-no-template")||"false"===t.firstElementChild.getAttribute("data-no-template"))){const e=t.firstElementChild.value;t.classList.remove("web-component-template");const r=t.cloneNode();return t.classList.add("web-component-template"),r.innerHTML="",r.template=e,r}return this.self.cloneSlots?e.cloneNode(!0):e}grabGivenSlots(){this.slots={};for(const e of Array.from(this.querySelectorAll("[slot]"))){let t=e.parentNode,r=!0;for(;t;){if(t.nodeName.includes("-")){t===this&&(r=!1);break}t=t.parentNode}if(r)continue;const s=e.getAttribute("slot")?.trim();this.slots[null!=s?s:e.nodeName.toLowerCase()]=this.grabSlotContent(e)}this.slots.default?this.slots.default=[].concat(this.slots.default):this.childNodes.length>0?this.slots.default=Array.from(this.childNodes).map((e=>this.grabSlotContent(e))):this.slots.default=[]}isStateProperty(e){return Boolean(this.instance?.current?.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)))}generateAliasIndex(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex={...this.self.propertyAliases};for(const[e,t]of Object.entries(this.self._propertyAliasIndex))Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,t)||(this.self._propertyAliasIndex[t]=e)}}reflectExternalProperties(e){this.ignoreAttributeUpdateObservations=!0;for(const[t,r]of Object.entries(e)){if(this.setExternalPropertyValue(t,r),!this.isConnected)continue;const e=(0,d.camelCaseToDelimited)(t);if(this.self._propertiesToReflectAsAttributes?.has(t))switch(this.self._propertiesToReflectAsAttributes.get(t)){case h.boolean:case"boolean":r?""!==this.getAttribute(e)&&this.setAttribute(e,""):this.hasAttribute(e)&&this.removeAttribute(e);break;case h.func:case"function":break;case"json":if(r){const t=JSON.stringify(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e);break;case h.number:case"number":if("number"!=typeof r||isNaN(r))this.hasAttribute(e)&&this.removeAttribute(e);else{const t=String(r);this.getAttribute(e)!==t&&this.setAttribute(e,t)}break;case h.string:case"string":r?this.getAttribute(e)!==r&&this.setAttribute(e,r):this.hasAttribute(e)&&this.removeAttribute(e);break;case h.any:case h.array:case h.arrayOf:case h.element:case h.elementType:case h.instanceOf:case h.node:case h.object:case"object":case h.objectOf:case h.shape:case h.exact:case h.symbol:default:if(r){const t=(0,d.represent)(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e)}}this.ignoreAttributeUpdateObservations=!1}reflectProperties(e){if(this.reflectExternalProperties(e),this.instance?.current?.state&&"object"==typeof this.instance.current.state)for(const e of Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[]))Object.prototype.hasOwnProperty.call(this.internalProperties,e)&&this.setInternalPropertyValue(e,void 0);this.internalProperties.model?.state&&(delete this.internalProperties.model.state,this.setInternalPropertyValue("model",this.internalProperties.model));for(const t of this.self.controllableProperties)Object.prototype.hasOwnProperty.call(e,t)&&this.setInternalPropertyValue(t,e[t])}async reflectEventToProperties(e,t){const r=this.batchUpdates;this.batchUpdates=!1;let s=null,n=!1;if(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,e)&&(0,d.isFunction)(this.self.eventToPropertyMapping[e])){const r=this.self.eventToPropertyMapping[e](...t,this),o=r&&"then"in r&&(0,d.isFunction)(r.then)?await r:r;n=!0,Array.isArray(o)?(s=o[0],this.reflectProperties(s),(0,d.extend)(!0,this.internalProperties,o[1])):null===o?n=!1:"object"==typeof o&&(s=o,this.reflectProperties(o))}if(!n&&t.length>0&&(0,d.isObject)(t[0])){let e=t[0];if("persist"in t[0]&&(0,d.isFunction)(t[0].persist)){e={};for(const r of Object.keys(this.self.propertyTypes))for(const s of[r].concat(null!==(o=this.getPropertyAlias(r))&&void 0!==o?o:[])){var o;const r=t[0].currentTarget&&Object.prototype.hasOwnProperty.call(t[0].currentTarget,s)?t[0].currentTarget[s]:this.getPropertyValue(s);r!==this.externalProperties[s]&&(e[s]=r)}}else[null,void 0].includes(e.detail?.value)||(e={...e.detail});s=e,this.reflectProperties(e)}return this.triggerRender("propertyReflected"),this.batchUpdates=r,s}evaluateStringOrNullAndSetAsProperty(e,t){const r=e.startsWith("-"),s=r?e.substring(1):e;let n=(0,d.delimitedToCamelCase)(s);const o=this.getPropertyAlias(n);if(o&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,o)&&(n=o),Object.prototype.hasOwnProperty.call(this.self.propertyTypes,n)){const s=this.self.propertyTypes[n];if(r){if(t){const r=(0,d.evaluate)(t,{...d.UTILITY_SCOPE},!1,!0,this);r.error?(f.warn("Failed to process pre-evaluation attribute",`"${e}": ${r.error}. Will be`,'set to "undefined".'),this.setInternalPropertyValue(n,void 0)):(this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,r.result))}}else switch(s){case h.boolean:case"boolean":{const e=![null,"false"].includes(t);this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case h.func:case"function":{let r,s=null;const o=["data","event","firstArgument","firstParameter","options"];if(t){const n=(0,d.compile)(t,o.concat("parameters","scope",d.UTILITY_SCOPE_NAMES),!0,!0,this);s=n.error,r=n.templateFunction,s&&f.warn("Failed to compile given handler",`"${e}": ${s}.`)}this.setInternalPropertyValue(n,((...i)=>{let a;if(this.outputEventNames.has(n)&&this.reflectEventToProperties(n,i),!s){const s={parameters:i,...d.UTILITY_SCOPE};for(const e of o)s[e]=i[0];try{a=r?.(...o.map((e=>s[e])),i,s,...d.UTILITY_SCOPE_NAMES.map((e=>d.UTILITY_SCOPE[e])))}catch(r){f.warn("Failed to evaluate function",`"${e}" with expression`,`"${t}" and scope`,"variables",`"${o.join('", "')}" set to`,`"${(0,d.represent)(i)}":`,`${r}. Set property`,'to "undefined".')}}return this.self.renderProperties.includes(n)||this.forwardEvent(n,i),a})),s||this.setExternalPropertyValue(n,r);break}case"json":if(t){let r;try{r=JSON.parse(t)}catch(t){f.warn("Error occurred during parsing given json",`attribute "${e}":`,(0,d.represent)(t));break}this.setInternalPropertyValue(n,r),this.setExternalPropertyValue(n,(0,d.copy)(r,!1,1))}else this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null);break;case h.number:case"number":{if(null===t){this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break}let e=parseFloat(t);isNaN(e)&&(e=void 0),this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case h.string:case"string":this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break;case h.any:case h.array:case h.arrayOf:case h.element:case h.elementType:case h.instanceOf:case h.node:case h.object:case"object":case h.objectOf:case h.oneOf:case h.oneOfType:case h.shape:case h.exact:case h.symbol:default:if(t){const r=(0,d.evaluate)(t,{},!1,!0,this);if(r.error){f.warn("Error occurred during processing given",`attribute configuration "${e}":`,r.error);break}this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,(0,d.copy)(r.result,!1,1))}else this.hasAttribute(e)?(this.setInternalPropertyValue(n,!0),this.setExternalPropertyValue(n,!0)):(this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null))}}}async waitForNestedComponentRendering(){this.childComponentInstances&&await Promise.all(this.childComponentInstances.map((e=>e.renderState.pending?e.renderState.promise:Promise.resolve())))}async resolveRenderingPromiseIfSet(e,t){t&&(await this.waitForNestedComponentRendering(),this.renderState.pending=!1,this.renderState.resolve(e),this.prepareNewRenderingPromise())}prepareNewRenderingPromise(){this.renderState.pending||(this.renderState.promise=new Promise((e=>{this.renderState.resolve=t=>{this.renderState.pending=!1,e(t)}})))}triggerRender(e){this.batchUpdates?this.batchedUpdateRunning||(this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{this.batchedUpdateRunning=!1,this.render(e)}))):this.render(e)}applyShadowRootIfNotExisting(){this.self.shadowDOM&&this.hostDomNode===this&&(this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,d.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"}))}determineRenderScope(e={}){this.scope={...this.parentInstance?.scope||{},...this.scope,...this.internalProperties,parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this,[(0,d.lowerCase)(this.self._name)||"instance"]:this,...e},this.scope.scope=this.scope}async render(e="unknown",t=!0){if(this.unRender("reRender",e),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(await this.resolveRenderingPromiseIfSet(e,t),t&&(await Promise.all(this.self.pendingRenderPromises),this.self.pendingRenderPromises=[])),this.self.pendingRenderPromises.push(this.renderState.promise),this.determineRenderScope(),!this.self.doRender||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:e,scope:this.scope}})))return void await this.resolveRenderingPromiseIfSet(e,t);const r=(0,d.evaluate)(`\`${this.self.content}\``,this.scope);if(r.error)return f.warn(`Failed to process template: ${r.error}`),this.renderState.resolve(e),void await Promise.all(this.self.pendingRenderPromises);this.applyShadowRootIfNotExisting();const s=document.createElement("div");s.innerHTML=r.result,this.applySlots(s,{...this.scope,parentInstance:this}),this.hostDomNode.innerHTML=s.innerHTML,await(0,d.timeout)(),this.waitForNestedComponentRendering().then((()=>{this.applyBindings(this.hostDomNode.firstChild,this.scope,this.self.renderSlots)})),await this.resolveRenderingPromiseIfSet(e,t)}unRender(e="unknown",t){this.unregisterDomNodeEventBindings()}},i.applyRootBinding=!0,i.pendingRenderPromises=[],i.content="<slot>Please provide a template to transclude.</slot>",i.determineRootBinding=!0,i.shadowDOM=null,i.observedAttributes=[],i.controllableProperties=[],i.eventToPropertyMapping={},i.propertyAliases={},i.propertyTypes={onClick:h.func},i.propertiesToReflectAsAttributes=[],i.renderProperties=["children"],i.doRender=!1,i.cloneSlots=!1,i.evaluateSlots=!1,i.renderSlots=!0,i.trimSlots=!0,i.renderUnsafe=!1,i._name="BaseWeb",i._propertyAliasIndex=void 0,i._propertiesToReflectAsAttributes=void 0,n=i,o=c()(n.prototype,"isRoot",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),n);const b=y},e=>{e.exports=i},e=>{e.exports=a},e=>{e.exports=p},e=>{e.exports=r},(e,t,r)=>{r.d(t,{default:()=>h});var s=r(0),n=r(1),o=r(7),i=r.n(o),a=r(9),p=r(10),l=r(3);const c=new s.Logger({name:"web-component-wrapper-web"});class d extends l.default{constructor(...e){super(...e),this.unmountOnDisconnect=!0,this.compiledSlots={},this.preparedSlots={},this.reactRoot=null,this.rootReactInstance=null,this.self=d,this.wrapMemorizingWrapper=null,this.isWrapped=!1,this.reflectInstanceProperties=()=>{this.instance?.current&&this.instance.current.properties&&this.reflectProperties(this.instance.current.properties)}}connectedCallback(){this.applyComponentWrapper(),this.rootReactInstance=this,super.connectedCallback()}disconnectedCallback(){this.unRender("disconnected"),this.unmountOnDisconnect&&this.reactRoot?.unmount(),this.unregisterConnectionState()}reflectExternalProperties(e){this.isRoot&&super.reflectExternalProperties(e)}async render(e="unknown",t=!0){if(super.unRender("reRender",e),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:e,scope:this.scope}})))return this.resolveRenderingPromiseIfSet(e,t);if(this.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&this.preCompileSlots(),this.evaluateSlots({...this.scope,parentInstance:this}),this.prepareProperties(this.internalProperties),this.applyShadowRootIfNotExisting(),this.rootInstance!==this&&!this.reactRoot){let e=this.firstChild;for(;e;){const t=e.nextSibling;this.removeChild(e),e=t}}if(!this.reactRoot){const e=this.id||this.internalProperties.id||this.externalProperties.id||this.name||this.internalProperties.name||this.externalProperties.name;let t="";"string"==typeof e&&(t=e),this.reactRoot=(0,p.createRoot)(this.hostDomNode,{identifierPrefix:t})}(0,a.flushSync)((()=>{this.reactRoot?.render((0,o.createElement)(this.self.content,this.internalProperties)),this.resolveRenderingPromiseIfSet(e,t)})),t&&await this.renderState.promise}setPropertyValue(e,t){this.reflectProperties({[e]:(0,s.copy)(t,!1,1)}),this.setInternalPropertyValue(e,(0,s.copy)(t,!1,1))}setInternalPropertyValue(e,t){null===t?t=n.NullSymbol:void 0===t&&(t=n.UndefinedSymbol),super.setInternalPropertyValue(e,t)}preCompileDomNodes(e,t={},r=!1){if(1===(e=e.filter((e=>e.nodeType!==Node.TEXT_NODE||"string"==typeof e.nodeValue&&""!==e.nodeValue.trim()))).length)return this.preCompileDomNode(e[0],t,r);let s=1;const n=[];for(const o of e){const e=this.preCompileDomNode(o,t,r,s.toString());n.push(e),s+=1}return r?e=>(...t)=>{const r=[];for(const s of n){const n=s(e);"function"==typeof n&&r.push(n(...t))}return(0,o.createElement)(o.Fragment,{children:r})}:n}preCompileDomNode(e,t={},r=!1,n){if(r){const r=this.preCompileDomNode(e,{...t,data:void 0,firstArgument:void 0,firstParameter:void 0,options:void 0,scope:void 0,parameters:void 0},!1,n);return e=>(...t)=>{const s=t.length>0?t[0]:null;return r({...e,data:s,firstArgument:s,firstParameter:s,options:s,scope:s,parameters:t})}}if(e.nodeType===Node.TEXT_NODE){const t="string"==typeof e.nodeValue?e.nodeValue.trim():"",r=n&&t?(0,o.createElement)(o.Fragment,{children:t,key:n}):t||null;return()=>r}if(!e.getAttributeNames)return()=>null;const i={};let a;const p=this.self.isReactComponent(e);p?(e.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&e.preCompileSlots(),n&&!Object.prototype.hasOwnProperty.call(i,"key")&&(i.key=n),a=e.constructor.content):(i.key=n,a=e.tagName.toLowerCase());let l=Object.keys(t);const d={};for(const r of e.getAttributeNames()){let n=e.getAttribute(r);if(null===n)continue;let o=!1,a="";if(r.startsWith("data-bind-")?a=r.substring(10):r.startsWith("bind-")&&(a=r.substring(5)),a.startsWith("attribute-")||"attributes"===a||a.startsWith("property-")||"properties"===a){const{error:t,originalScopeNames:i,templateFunction:p}=(0,s.compile)(n,l);if(t){c.warn("Error occurred during compiling given attribute",`binding "${r}" on node:`,e,t);continue}"attributes"===a||"properties"===a?o=!0:a=a.startsWith("attribute-")?a.substring(10):a.substring(9),n={originalScopeNames:i,templateFunction:p.bind(this)}}else if(a.startsWith("on-")){a=(0,s.delimitedToCamelCase)(a),Object.prototype.hasOwnProperty.call(t,"event")||(l=[...l,"event"]),Object.prototype.hasOwnProperty.call(t,"parameters")||(l=[...l,"parameters"]);const{error:o,originalScopeNames:i,scopeNames:p,templateFunction:d}=(0,s.compile)(n,l,!0);if(o){c.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,o);continue}const h=d.bind(this);n=(...o)=>{t.event=o[0],t.parameters=o;try{h(...i.map((e=>t[e])))}catch(t){c.warn("Error occurred during processing given",`event binding "${r}" on node: `,e,`Given expression "${n}" could`,"not be evaluated with given scope names",`"${p.join('", "')}":`,(0,s.represent)(t))}}}else a=r;const h={class:"className",for:"htmlFor"};Object.prototype.hasOwnProperty.call(h,a)&&(a=h[a]),a=(0,s.delimitedToCamelCase)(a),n?.originalScopeNames?d[o?"":a]=n:p||(i[a]=n)}if(!p){const r=Array.from(e.childNodes);r.length&&(i.children=this.preCompileDomNodes(r,t))}return r=>{(r={...t,...r}).scope=r;let s={...i};for(const[e,{originalScopeNames:t,templateFunction:n}]of Object.entries(d)){const o=n(...t.map((e=>r[e])));""===e?s={...s,...o}:s[e]=o}return Object.prototype.hasOwnProperty.call(s,"innerHTML")&&(s.dangerouslySetInnerHTML={__html:s.innerHTML},delete s.children,delete s.innerHTML),Object.prototype.hasOwnProperty.call(s,"textContent")?(s.children=s.textContent,delete s.textContent):p?(s={...e.internalProperties,...s},r={...s,...r,parentInstance:e},e.evaluateSlots(r),e.prepareProperties(s)):s.children&&(s.children=this.evaluatePreCompiledDomNodes(s.children,r)),(0,o.createElement)(a,s)}}evaluatePreCompiledDomNodes(e,t={}){if(!Array.isArray(e))return e(t);if(1===e.length)return e[0](t);const r=[];for(const s of e){const e=s(t);e&&r.push(e)}return r}preCompileSlots(){for(const e in this.slots)this.slots[e]&&"default"!==e&&(this.compiledSlots[e]=this.preCompileDomNode(this.slots[e],{...this.scope,parentInstance:this},[n.func,"function"].includes(this.self.propertyTypes[e])));this.slots.default&&this.slots.default.length>0&&(this.compiledSlots.children=this.preCompileDomNodes(this.slots.default,{...this.scope,parentInstance:this},[n.func,"function"].includes(this.self.propertyTypes.children)))}evaluateSlots(e){this.preparedSlots={};for(const t in 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))}static isReactComponent(e){const t=e.constructor;return"object"==typeof t.content&&(!t.attachWebComponentAdapterIfNotExists||"react"===t.content.webComponentAdapterWrapped)}determineRootBinding(){super.determineRootBinding();let e=this.parentNode;for(;e;){if(this.self.isReactComponent(e)){this.rootReactInstance=e;break}e=e.parentNode}}applyComponentWrapper(){if("string"==typeof this.self.content||this.isWrapped)return;this.isWrapped=!0;const e=this.self.content.wrapped||this.self.content;this.self.content.webComponentAdapterWrapped?this.wrapMemorizingWrapper&&(this.self.content=(0,o.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,o.forwardRef)(((t,r)=>((0,o.useImperativeHandle)(r,(()=>({properties:t})),[t]),(0,o.createElement)(e,t)))),(this.wrapMemorizingWrapper||null===this.wrapMemorizingWrapper)&&(this.self.content=(0,o.memo)(this.self.content)),this.self.content.wrapped=e,this.self.content.webComponentAdapterWrapped="react"):this.wrapMemorizingWrapper&&(this.self.content=(0,o.memo)(this.self.content),this.self.content.wrapped=e)}prepareProperties(e){(0,s.extend)(e,this.preparedSlots),this.self.removeKnownUnwantedPropertyKeys(this.self,e),e.ref||(this.instance=(0,o.createRef)(),e.ref=e=>{this.instance?this.instance.current=e:this.instance={current:e},this.reflectInstanceProperties()})}static removeKnownUnwantedPropertyKeys(e,t){if("string"!=typeof e.content)for(const r of["isRoot","isTrusted","__composed"])Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e.content,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.propTypes,r)||Object.prototype.hasOwnProperty.call(e.content,"wrapped")&&Object.prototype.hasOwnProperty.call(e.content.wrapped,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.wrapped.propTypes,r))&&delete t[r]}}d.attachWebComponentAdapterIfNotExists=!0,d.content="div",d.react=i(),d._name="ReactWebComponent";const h=d},e=>{e.exports=n},e=>{e.exports=o},(e,t,r)=>{r.d(t,{default:()=>o});var s=r(0);const n=r(8).default,o=(e,t="NoName",r={})=>{var o,i;const a=e._name||e.___types?.name?.name||t.replace(/^(.*\/+)?([^/]+)\.tsx$/,"$2");r.propTypes&&(e.propTypes=r.propTypes);const p=e.propTypes||{},l=r.propertyAliases||e.propertyAliases||{},c=(0,s.unique)(Object.keys(p).concat(Object.keys(l)).concat(Object.values(l)));let d=r.propertiesToReflectAsAttributes||e.propertiesToReflectAsAttributes||[];if(n.propertiesToReflectAsAttributes)if(Array.isArray(d))d=[...n.propertiesToReflectAsAttributes,...d];else if(d instanceof Map)for(const e of n.propertiesToReflectAsAttributes)d.set(e,n.propertyTypes[e]);else if("object"==typeof d)for(const e of n.propertiesToReflectAsAttributes)d[e]=n.propertyTypes[e];const h=c.map((e=>(0,s.camelCaseToDelimited)(e)));class u extends n{constructor(...t){var s;super(...t),this.self=u,this.internalProperties=r.internalProperties?{...r.internalProperties}:e.internalProperties?{...e.internalProperties}:{},this.unmountOnDisconnect=null===(s=r.unmountOnDisconnect)||void 0===s||s}}u.attachWebComponentAdapterIfNotExists="boolean"!=typeof r.attachWebComponentAdapterIfNotExists||r.attachWebComponentAdapterIfNotExists,u.content=e,u.observedAttributes=n.observedAttributes.concat(h).concat(h.map((e=>`-${e}`))),u.controllableProperties=e.controllableProperties||r.controllableProperties||[],u.eventToPropertyMapping=null===r.eventToPropertyMapping?r.eventToPropertyMapping:r.eventToPropertyMapping?{...r.eventToPropertyMapping}:null===e.eventToPropertyMapping?e.eventToPropertyMapping:e.eventToPropertyMapping?{...e.eventToPropertyMapping}:{},u.propertyAliases={...n.propertyAliases,...l},u.propertiesToReflectAsAttributes=d,u.propertyTypes={...n.propertyTypes,...p},u.renderProperties=null!==(o=null!==(i=r.renderProperties)&&void 0!==i?i:e.renderProperties)&&void 0!==o?o:n.renderProperties,u._name=a;return{component:u,register:(e=(0,s.camelCaseToDelimited)(a))=>{customElements.define(e,u)}}}},,e=>{e.exports=s}],c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var h={};d.r(h);var u=d(0),f=d(1),m=d(7),y=d(13),b=d(11),g=d(8),v=d(3);return(0,y.describe)("Web",(()=>{(0,y.test)("constructor",(()=>{class e extends v.default{constructor(...e){super(...e),this.onClick=void 0}}e.observedAttributes=["is-root","on-click","on-event"],(0,y.expect)(e).toHaveProperty("content"),(0,y.expect)(e).toHaveProperty("observedAttributes"),customElements.define("test-web",e);const t=document.createElement("test-web");(0,y.expect)(t).not.toHaveProperty("clicked"),t.setAttribute("on-click","this.clicked = true"),(0,y.expect)(t).not.toHaveProperty("clicked"),document.body.appendChild(t),(0,y.expect)(t).toHaveProperty("rootInstance",t),(0,y.expect)(t).not.toHaveProperty("clicked"),t.onClick(),(0,y.expect)(t).toHaveProperty("clicked",!0);const r=y.jest.fn();t.addEventListener("click",r),(0,y.expect)(r).not.toHaveBeenCalled(),t.onClick(),(0,y.expect)(r).toHaveBeenCalled()}))})),(0,y.describe)("ReactWeb",(()=>{(0,y.test)("constructor",(async()=>{let e,t="initial";class r extends g.default{constructor(...e){super(...e),this.self=r,this.onClick=void 0,this.onEvent=void 0}}r._name="Test",r.content=({onEvent:r,property:s=t})=>(e=r,t=s,(0,m.createElement)("div",{className:s})),r.observedAttributes=["is-root","on-click","on-event"],r.propertyTypes={...v.default.propertyTypes,onEvent:f.func,property:f.string},(0,y.expect)(r).toHaveProperty("content"),(0,y.expect)(r).toHaveProperty("observedAttributes"),customElements.define("test-react",r);const s=document.createElement("test-react");(0,y.expect)(s).not.toHaveProperty("clicked"),s.setAttribute("on-click","this.clicked = true"),(0,y.expect)(s).toHaveProperty("onClick"),(0,y.expect)(s).not.toHaveProperty("clicked"),s.setAttribute("on-event","this.eventHappened = true"),(0,y.expect)(s).toHaveProperty("onEvent"),(0,y.expect)(e).not.toBeDefined(),document.body.appendChild(s),(0,y.expect)(s).toHaveProperty("rootInstance",s),(0,y.expect)(s).toHaveProperty("reactRoot"),(0,y.expect)(e).not.toBeDefined(),await(0,u.timeout)(),(0,y.expect)(e).toBeDefined(),(0,y.expect)(s).not.toHaveProperty("eventHappened"),e&&e(),(0,y.expect)(s).toHaveProperty("eventHappened",!0);const n=y.jest.fn();s.addEventListener("event",n),(0,y.expect)(n).not.toHaveBeenCalled(),e&&e(),(0,y.expect)(n).toHaveBeenCalled(),(0,y.expect)(s).not.toHaveProperty("clicked"),s.onClick(),(0,y.expect)(s).toHaveProperty("clicked",!0);const o=y.jest.fn();s.addEventListener("click",o),(0,y.expect)(o).not.toHaveBeenCalled(),s.onClick(),(0,y.expect)(o).toHaveBeenCalled(),(0,y.expect)(t).toStrictEqual("initial"),(0,y.expect)(document.querySelector("div")?.className).toStrictEqual("initial"),s.property="test",await(0,u.timeout)(),(0,y.expect)(s).toHaveProperty("property","test"),(0,y.expect)(document.querySelector("div")?.className).toStrictEqual("test")}))})),(0,y.describe)("index",(()=>{(0,y.test)("wrapAsWebComponent",(()=>{const e=(0,b.default)((()=>(0,m.createElement)("div")),"TestComponent",{eventToPropertyMapping:{},propertyAliases:{alternateName:"name"},propertiesToReflectAsAttributes:[],propTypes:{name:"string"}});(0,y.expect)(e).toHaveProperty("component"),(0,y.expect)(e).toHaveProperty("register"),(0,y.expect)(e.component).toHaveProperty("_name","TestComponent"),(0,y.expect)(e.component).toHaveProperty("propertyTypes.name","string"),(0,y.expect)(e.component).toHaveProperty("propertiesToReflectAsAttributes",["isRoot"]),(0,y.expect)(e.component).toHaveProperty("eventToPropertyMapping",{})}))})),h})()));
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("clientnode"),require("clientnode/property-types"),require("react"),require("@jest/globals"),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(["clientnode","clientnode/property-types","react","@jest/globals","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("clientnode"),require("clientnode/property-types"),require("react"),require("@jest/globals"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper")):t(e.clientnode,e["clientnode/property-types"],e.react,e["@jest/globals"],e["react-dom"],e["react-dom/client"],e["@babel/runtime/helpers/initializerDefineProperty"],e["@babel/runtime/helpers/applyDecoratedDescriptor"],e["@babel/runtime/helpers/initializerWarningHelper"]);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,((e,t,r,s,n,o,i,a,p)=>(()=>{var l=[t=>{t.exports=e},e=>{e.exports=t},(e,t,r)=>{r.d(t,{default:()=>o});var s=r(0),n=r(1);const o=function(e={}){return e={readAttribute:!0,type:n.string,...e},function(t,r){if("string"!=typeof r)return;const n=t.self||t.constructor;if(e.readAttribute){Object.prototype.hasOwnProperty.call(n,"observedAttributes")||(n.observedAttributes=n.observedAttributes?[...n.observedAttributes]:[]);const e=(0,s.camelCaseToDelimited)(r);n.observedAttributes&&!n.observedAttributes.includes(e)&&n.observedAttributes.push(e)}if(e.type&&(Object.prototype.hasOwnProperty.call(n,"propertyTypes")||(n.propertyTypes=n.propertyTypes?{...n.propertyTypes}:{}),!n.propertyTypes||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyTypes[r]=e.type)),e.writeAttribute&&(Object.prototype.hasOwnProperty.call(n,"propertiesToReflectAsAttributes")||(n.propertiesToReflectAsAttributes=n.propertiesToReflectAsAttributes?(0,s.copy)(n.propertiesToReflectAsAttributes):[]),e.update||n.propertiesToReflectAsAttributes instanceof Map&&!n.propertiesToReflectAsAttributes.has(r)||Array.isArray(n.propertiesToReflectAsAttributes)&&!n.propertiesToReflectAsAttributes.includes(r)||"object"==typeof n.propertiesToReflectAsAttributes&&!Object.prototype.hasOwnProperty.call(n.propertiesToReflectAsAttributes,r))){let t;"boolean"==typeof e.writeAttribute?e.writeAttribute&&n.propertyTypes&&Object.prototype.hasOwnProperty.call(n.propertyTypes,r)&&(t=n.propertyTypes[r]):t=e.writeAttribute,void 0!==t&&(Array.isArray(n.propertiesToReflectAsAttributes)&&(!0===e.writeAttribute?n.propertiesToReflectAsAttributes.push(r):n.normalizePropertyTypeList&&(n.propertiesToReflectAsAttributes=n.normalizePropertyTypeList(n.propertiesToReflectAsAttributes))),n.propertiesToReflectAsAttributes instanceof Map&&n.propertiesToReflectAsAttributes.set(r,t),"object"==typeof n.propertiesToReflectAsAttributes&&(n.propertiesToReflectAsAttributes[r]=t))}e.alias&&(Object.prototype.hasOwnProperty.call(n,"propertyAliases")||(n.propertyAliases=n.propertyAliases?{...n.propertyAliases}:{}),!n.propertyAliases||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyAliases[r]=e.alias))}}},(e,t,r)=>{r.d(t,{default:()=>b});var s,n,o,i,a=r(4),p=r.n(a),l=r(5),c=r.n(l),d=(r(6),r(0)),h=r(1),u=r(2);const f=new d.Logger({name:"web-component-wrapper-web"}),m="undefined"==typeof HTMLElement?class{}:HTMLElement;let y=(s=(0,u.default)({type:h.boolean,writeAttribute:!0}),i=class e extends m{constructor(){super(),this.renderState={promise:Promise.resolve(""),pending:!1,resolve:d.NOOP},this.childComponentInstances=[],this.batchAttributeUpdates=!0,this.batchPropertyUpdates=!0,this.batchUpdates=!0,this.batchedAttributeUpdateRunning=!0,this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,this.connectionRegistered=!1,this.pendingAttributeUpdates=[],this.parentInstance=null,this.rootInstance=void 0,this.hostDomNode=void 0,this.scope={...d.UTILITY_SCOPE},this.domNodeEventBindings=new Map,this.domNodeTemplateCache=new Map,this.externalProperties={},this.ignoreAttributeUpdateObservations=!1,this.internalProperties={},this.outputEventNames=new Set,this.instance=null,p()(this,"isRoot",o,this),this.runDomConnectionAndRenderingInSameEventQueue=!1,this.self=e,this.slots={},this.prepareNewRenderingPromise(),this.self=this.constructor,this.self._propertiesToReflectAsAttributes||(this.self._propertiesToReflectAsAttributes=this.self.normalizePropertyTypeList(this.self.propertiesToReflectAsAttributes)),this.generateAliasIndex(),this.hostDomNode=this,this.rootInstance=this,this.defineGetterAndSetterInterface()}attributeChangedCallback(e,t,r){this.ignoreAttributeUpdateObservations||t===r||this.onUpdateAttribute(e,r)}onUpdateAttribute(e,t){const r=new Promise((r=>this.pendingAttributeUpdates.push((()=>{this.evaluateStringOrNullAndSetAsProperty(e,t),this.batchAttributeUpdates?this.batchedAttributeUpdateRunning||this.batchedUpdateRunning||(this.batchedAttributeUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{this.batchedAttributeUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("attributeChanged")}))):this.render("attributeChanged"),r()}))));if(this.connectionRegistered)for(;this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();return r}connectedCallback(){try{this.isConnected=!0}catch{}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,d.timeout)((()=>{this.render("connected")}))}disconnectedCallback(){this.unRender("disconnected"),this.unregisterConnectionState()}defineGetterAndSetterInterface(){const e=(0,d.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[]));for(const t of e)Object.prototype.hasOwnProperty.call(this,t)&&this.setPropertyValue(t,this[t]),Object.defineProperty(this,t,{configurable:!0,get:()=>this.getPropertyValue(t),set:e=>{this.setPropertyValue(t,e),this.triggerPropertySpecificRendering(t,e)}})}getPropertyAlias(e){return this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,e)?this.self._propertyAliasIndex[e]:null}getPropertyValue(t){var r;const s=this.instance?.current?.properties&&(Object.prototype.hasOwnProperty.call(!e.propertyTypes,t)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,t))?this.instance.current.properties[t]:null!==(r=this.internalProperties[t])&&void 0!==r?r:this.externalProperties[t];return this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,t)?this.instance.current.state[t]:s}setExternalPropertyValue(e,t){this.externalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.externalProperties[r]=t)}setInternalPropertyValue(e,t){this.internalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.internalProperties[r]=t)}setPropertyValue(e,t){this.reflectProperties({[e]:t}),this.setInternalPropertyValue(e,t)}triggerPropertySpecificRendering(e,t){if(this.batchPropertyUpdates)this.batchedPropertyUpdateRunning||this.batchedUpdateRunning||(this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{void 0!==t&&this.isStateProperty(e)?(this.render("preStatePropertyChanged"),(0,d.timeout)((()=>{this.setInternalPropertyValue(e,void 0),this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("postStatePropertyChanged"),this.triggerOutputEvents()}))):(this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("propertyChanged"),this.triggerOutputEvents())})));else{const r=this.isStateProperty(e);this.render(r?"preStatePropertyChanged":"propertyChanged"),void 0!==t&&r&&(this.setInternalPropertyValue(e,void 0),this.render("postStatePropertyChanged")),this.triggerOutputEvents()}}unregisterConnectionState(){try{this.isConnected=!1}catch{}this.connectionRegistered=!1,this.slots={}}unregisterDomNodeEventBindings(){for(const e of this.domNodeEventBindings.values())for(const t of e.values())t()}applyBinding(e,t){if(e.getAttributeNames)for(const r of e.getAttributeNames()){let s;if(r.startsWith("data-bind-")?s=r.substring(10):r.startsWith("bind-")&&(s=r.substring(5)),s){const n=e.getAttribute(r);if(null===n)continue;if(s.startsWith("attribute-")||s.startsWith("property-")){const o=(0,d.evaluate)(n,t,!1,!0,e);if(o.error){f.warn("Error occurred during processing given",`attribute binding "${r}" on node:`,e,o.error);continue}s.startsWith("attribute-")?e.setAttribute(s.substring(10),o.result):e[(0,d.delimitedToCamelCase)(s.substring(9))]=o.result}else if(s.startsWith("on-")){s=(0,d.delimitedToCamelCase)(s.substring(3)),t={log:f,event:void 0,parameters:void 0,...t};const o=(0,d.compile)(n,t,!0,!0,e);o.error?f.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,o.error):this.addSecureEventListener(e,s,((...s)=>{t.event=s[0],t.parameters=s;try{o.templateFunction(...o.originalScopeNames.map((e=>t[e])))}catch(t){f.warn("Error occurred during processing","given event binding",`"${r}" on node:`,e,`Given expression "${n}" could`,"not be evaluated with given scope",'names "'+o.scopeNames.join('", "')+`": ${(0,d.represent)(t)}`)}}))}}}}applyBindings(e,t,r=!0){for(;e;)!e.attributes?.length||!r&&e.getAttribute("slot")||this.applyBinding(e,t),e.nodeName.toLowerCase().includes("-")||this.applyBindings(e.firstChild,t),e=e.nextSibling}compileDomNodeTemplate(e,t=[],r={}){r={ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r};const s=e.nodeName.toLowerCase();if(r.ignoreComponents&&s.includes("-"))return null;if(r.unsafe){let r=e.innerHTML;if(!r&&e.template&&(r=e.template),this.self.hasCode(r)){const s=(0,d.compile)(`\`${r}\``,t);return{domNode:e,children:[],error:s.error,scopeNames:s.scopeNames,template:r,templateFunction:s.templateFunction}}return null}let n=null;if("#text"===s){const t=e.textContent;t&&this.self.hasCode(t)&&(n=t.replace(/&nbsp;/g," ").trim())}const o=[],i={children:o,domNode:e};if(n){const e=(0,d.compile)(`\`${n}\``,t);i.error=e.error,i.scopeNames=e.scopeNames,i.template=n,i.templateFunction=e.templateFunction}let a=e.firstChild;for(;a;){if(!r.filter||r.filter(a)){const e=this.compileDomNodeTemplate(a,t,{...r,ignoreComponents:r.ignoreNestedComponents});e&&o.push(e)}a=a.nextSibling}return i}evaluateCompiledDomNodeTemplate(e,t){const{domNode:r,error:s,templateFunction:n,scopeNames:o}=e;if(!n||!o)return null;if(s)return f.warn("Error occurred during compiling node content:",s),null;let i=null;try{i=n(...o.map((e=>t[e])))}catch(s){f.warn(`Error occurred when "${this.self._name}" is running`,`"${String(n)}": with bound`,`names "${o.join('", "')}":`,`"${s}". Rendering node:`,r)}return i}evaluateDomNodeTemplate(e,t={},r={}){const s=(r={domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r}).domNodeTemplateCache;if(!s.has(e)){const n={filter:r.filter,ignoreComponents:r.ignoreComponents,ignoreNestedComponents:r.ignoreNestedComponents,unsafe:r.unsafe},o=this.compileDomNodeTemplate(e,t,n);o&&s.set(e,o)}if(s.has(e)){const n=s.get(e),o=this.evaluateCompiledDomNodeTemplate(n,t);if(null!==o&&(r.unsafe&&e.innerHTML?e.innerHTML=o:e.textContent=o),n.children.length){const e=r=>{for(const s of r){const r=this.evaluateCompiledDomNodeTemplate(s,t);null!==r&&(s.domNode.textContent=r),s.children.length&&e(s.children)}};e(n.children)}}r.applyBindings&&this.applyBindings(e,t)}addSecureEventListener(e,t,r,s,n){this.domNodeEventBindings.has(e)||this.domNodeEventBindings.set(e,new Map);const o=this.domNodeEventBindings.get(e),i=o.get(t);i&&i!==r&&i();const a=()=>{e.removeEventListener(t,r,n),o.delete(t),0===o.size&&this.domNodeEventBindings.delete(e)};return o.set(t,a),e.addEventListener(t,r,s),a}determineRootBinding(){let t=this.parentNode;for(;t;){const r=t instanceof e||t.nodeName.includes("-")&&"#document-fragment"!==t.nodeName,s=null===t.parentNode&&"[object ShadowRoot]"===t.toString();r?(this.rootInstance===this&&(this.parentInstance=t,this.setPropertyValue("isRoot",!1)),this.rootInstance=t):s&&this.setPropertyValue("isRoot",!1),t=t.parentNode}}static hasCode(e){return"string"==typeof e&&e.includes("${")&&e.includes("}")&&/\${[\s\S]+}/.test(e)}static normalizePropertyTypeList(t){if("string"==typeof t&&(t=[t]),Array.isArray(t)){const r=t,s=new Map;for(const t of r)Object.prototype.hasOwnProperty.call(e.propertyTypes,t)&&s.set(t,e.propertyTypes[t]);return s}return(0,d.convertPlainObjectToMap)(t)}attachEventHandler(){if(null===this.self.eventToPropertyMapping)return;const e=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!e)}attachExplicitDefinedOutputEventHandler(){if(!this.self.eventToPropertyMapping)return!1;let e=!1;for(const t of Object.keys(this.self.eventToPropertyMapping))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||(e=!0,this.outputEventNames.add(t),this.setInternalPropertyValue(t,(async(...e)=>{const r=await this.reflectEventToProperties(t,e);r&&(e[0]=r),this.forwardEvent(t,e)})));return e}attachImplicitDefinedOutputEventHandler(e=!0){for(const[t,r]of Object.entries(this.self.propertyTypes))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||![h.func,"function"].includes(r)||this.self.renderProperties.includes(t)||(this.outputEventNames.add(t),this.setInternalPropertyValue(t,((...r)=>{e&&this.reflectEventToProperties(t,r),this.forwardEvent(t,r)})))}triggerOutputEvents(){for(const e of this.outputEventNames)this.forwardEvent(e,[this.externalProperties])}forwardEvent(e,t){return e.length>3&&e.startsWith("on")&&(e=(0,d.lowerCase)(e.substring(2))),this.dispatchEvent(new CustomEvent(e,{detail:{parameters:t}}))}applySlots(t,r){for(const s of Array.from(t.querySelectorAll("slot"))){const t=s.getAttribute("name");if(null===t||"default"===t)if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots)for(const e of this.slots.default)this.evaluateDomNodeTemplate(e,r);(0,d.replace)(s,this.slots.default,e.trimSlots)}}else this.slots.default=(0,d.unwrap)(s).map((e=>this.grabSlotContent(e)));else this.slots[t]?this.self.renderSlots&&(this.self.evaluateSlots&&this.evaluateDomNodeTemplate(this.slots[t],r),(0,d.replace)(s,this.slots[t],e.trimSlots)):this.slots[t]=this.grabSlotContent((0,d.unwrap)(s).filter((e=>"#text"!==e.nodeName.toLowerCase()))[0])}}grabSlotContent(e){const t=h.node.firstElementChild?e:null;if(t&&"textarea"===t.firstElementChild?.nodeName.toLowerCase()&&(!t.firstElementChild.hasAttribute("data-no-template")||"false"===t.firstElementChild.getAttribute("data-no-template"))){const e=t.firstElementChild.value;t.classList.remove("web-component-template");const r=t.cloneNode();return t.classList.add("web-component-template"),r.innerHTML="",r.template=e,r}return this.self.cloneSlots?e.cloneNode(!0):e}grabGivenSlots(){this.slots={};for(const e of Array.from(this.querySelectorAll("[slot]"))){let t=e.parentNode,r=!0;for(;t;){if(t.nodeName.includes("-")){t===this&&(r=!1);break}t=t.parentNode}if(r)continue;const s=e.getAttribute("slot")?.trim();this.slots[null!=s?s:e.nodeName.toLowerCase()]=this.grabSlotContent(e)}this.slots.default?this.slots.default=[].concat(this.slots.default):this.childNodes.length>0?this.slots.default=Array.from(this.childNodes).map((e=>this.grabSlotContent(e))):this.slots.default=[]}isStateProperty(e){return Boolean(this.instance?.current?.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)))}generateAliasIndex(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex={...this.self.propertyAliases};for(const[e,t]of Object.entries(this.self._propertyAliasIndex))Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,t)||(this.self._propertyAliasIndex[t]=e)}}reflectExternalProperties(e){this.ignoreAttributeUpdateObservations=!0;for(const[t,r]of Object.entries(e)){if(this.setExternalPropertyValue(t,r),!this.isConnected)continue;const e=(0,d.camelCaseToDelimited)(t);if(this.self._propertiesToReflectAsAttributes?.has(t))switch(this.self._propertiesToReflectAsAttributes.get(t)){case h.boolean:case"boolean":r?""!==this.getAttribute(e)&&this.setAttribute(e,""):this.hasAttribute(e)&&this.removeAttribute(e);break;case h.func:case"function":break;case"json":if(r){const t=JSON.stringify(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e);break;case h.number:case"number":if("number"!=typeof r||isNaN(r))this.hasAttribute(e)&&this.removeAttribute(e);else{const t=String(r);this.getAttribute(e)!==t&&this.setAttribute(e,t)}break;case h.string:case"string":r?this.getAttribute(e)!==r&&this.setAttribute(e,r):this.hasAttribute(e)&&this.removeAttribute(e);break;case h.any:case h.array:case h.arrayOf:case h.element:case h.elementType:case h.instanceOf:case h.node:case h.object:case"object":case h.objectOf:case h.shape:case h.exact:case h.symbol:default:if(r){const t=(0,d.represent)(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e)}}this.ignoreAttributeUpdateObservations=!1}reflectProperties(e){if(this.reflectExternalProperties(e),this.instance?.current?.state&&"object"==typeof this.instance.current.state)for(const e of Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[]))Object.prototype.hasOwnProperty.call(this.internalProperties,e)&&this.setInternalPropertyValue(e,void 0);this.internalProperties.model?.state&&(delete this.internalProperties.model.state,this.setInternalPropertyValue("model",this.internalProperties.model));for(const t of this.self.controllableProperties)Object.prototype.hasOwnProperty.call(e,t)&&this.setInternalPropertyValue(t,e[t])}async reflectEventToProperties(e,t){const r=this.batchUpdates;this.batchUpdates=!1;let s=null,n=!1;if(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,e)&&(0,d.isFunction)(this.self.eventToPropertyMapping[e])){const r=this.self.eventToPropertyMapping[e](...t,this),o=r&&"then"in r&&(0,d.isFunction)(r.then)?await r:r;n=!0,Array.isArray(o)?(s=o[0],this.reflectProperties(s),(0,d.extend)(!0,this.internalProperties,o[1])):null===o?n=!1:"object"==typeof o&&(s=o,this.reflectProperties(o))}if(!n&&t.length>0&&(0,d.isObject)(t[0])){let e=t[0];if("persist"in t[0]&&(0,d.isFunction)(t[0].persist)){e={};for(const r of Object.keys(this.self.propertyTypes))for(const s of[r].concat(null!==(o=this.getPropertyAlias(r))&&void 0!==o?o:[])){var o;const r=t[0].currentTarget&&Object.prototype.hasOwnProperty.call(t[0].currentTarget,s)?t[0].currentTarget[s]:this.getPropertyValue(s);r!==this.externalProperties[s]&&(e[s]=r)}}else[null,void 0].includes(e.detail?.value)||(e={...e.detail});s=e,this.reflectProperties(e)}return this.triggerRender("propertyReflected"),this.batchUpdates=r,s}evaluateStringOrNullAndSetAsProperty(e,t){const r=e.startsWith("-"),s=r?e.substring(1):e;let n=(0,d.delimitedToCamelCase)(s);const o=this.getPropertyAlias(n);if(o&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,o)&&(n=o),Object.prototype.hasOwnProperty.call(this.self.propertyTypes,n)){const s=this.self.propertyTypes[n];if(r){if(t){const r=(0,d.evaluate)(t,{...d.UTILITY_SCOPE},!1,!0,this);r.error?(f.warn("Failed to process pre-evaluation attribute",`"${e}": ${r.error}. Will be`,'set to "undefined".'),this.setInternalPropertyValue(n,void 0)):(this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,r.result))}}else switch(s){case h.boolean:case"boolean":{const e=![null,"false"].includes(t);this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case h.func:case"function":{let r,s=null;const o=["data","event","firstArgument","firstParameter","options"];if(t){const n=(0,d.compile)(t,o.concat("parameters","scope",d.UTILITY_SCOPE_NAMES),!0,!0,this);s=n.error,r=n.templateFunction,s&&f.warn("Failed to compile given handler",`"${e}": ${s}.`)}this.setInternalPropertyValue(n,((...i)=>{let a;if(this.outputEventNames.has(n)&&this.reflectEventToProperties(n,i),!s){const s={parameters:i,...d.UTILITY_SCOPE};for(const e of o)s[e]=i[0];try{a=r?.(...o.map((e=>s[e])),i,s,...d.UTILITY_SCOPE_NAMES.map((e=>d.UTILITY_SCOPE[e])))}catch(r){f.warn("Failed to evaluate function",`"${e}" with expression`,`"${t}" and scope`,"variables",`"${o.join('", "')}" set to`,`"${(0,d.represent)(i)}":`,`${r}. Set property`,'to "undefined".')}}return this.self.renderProperties.includes(n)||this.forwardEvent(n,i),a})),s||this.setExternalPropertyValue(n,r);break}case"json":if(t){let r;try{r=JSON.parse(t)}catch(t){f.warn("Error occurred during parsing given json",`attribute "${e}":`,(0,d.represent)(t));break}this.setInternalPropertyValue(n,r),this.setExternalPropertyValue(n,(0,d.copy)(r,!1,1))}else this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null);break;case h.number:case"number":{if(null===t){this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break}let e=parseFloat(t);isNaN(e)&&(e=void 0),this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case h.string:case"string":this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break;case h.any:case h.array:case h.arrayOf:case h.element:case h.elementType:case h.instanceOf:case h.node:case h.object:case"object":case h.objectOf:case h.oneOf:case h.oneOfType:case h.shape:case h.exact:case h.symbol:default:if(t){const r=(0,d.evaluate)(t,{},!1,!0,this);if(r.error){f.warn("Error occurred during processing given",`attribute configuration "${e}":`,r.error);break}this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,(0,d.copy)(r.result,!1,1))}else this.hasAttribute(e)?(this.setInternalPropertyValue(n,!0),this.setExternalPropertyValue(n,!0)):(this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null))}}}async waitForNestedComponentRendering(){this.childComponentInstances&&await Promise.all(this.childComponentInstances.map((e=>e.renderState.pending?e.renderState.promise:Promise.resolve())))}async resolveRenderingPromiseIfSet(e,t){t&&(await this.waitForNestedComponentRendering(),this.renderState.pending=!1,this.renderState.resolve(e),this.prepareNewRenderingPromise())}prepareNewRenderingPromise(){this.renderState.pending||(this.renderState.promise=new Promise((e=>{this.renderState.resolve=t=>{this.renderState.pending=!1,e(t)}})))}triggerRender(e){this.batchUpdates?this.batchedUpdateRunning||(this.batchedUpdateRunning=!0,(0,d.timeout)((()=>{this.batchedUpdateRunning=!1,this.render(e)}))):this.render(e)}applyShadowRootIfNotExisting(){this.self.shadowDOM&&this.hostDomNode===this&&(this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,d.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"}))}determineRenderScope(e={}){this.scope={...this.parentInstance?.scope||{},...this.scope,...this.internalProperties,parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this,[(0,d.lowerCase)(this.self._name)||"instance"]:this,...e},this.scope.scope=this.scope}async render(e="unknown",t=!0){if(this.unRender("reRender",e),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(await this.resolveRenderingPromiseIfSet(e,t),t&&(await Promise.all(this.self.pendingRenderPromises),this.self.pendingRenderPromises=[])),this.self.pendingRenderPromises.push(this.renderState.promise),this.determineRenderScope(),!this.self.doRender||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:e,scope:this.scope}})))return void await this.resolveRenderingPromiseIfSet(e,t);const r=(0,d.evaluate)(`\`${this.self.content}\``,this.scope);if(r.error)return f.warn(`Failed to process template: ${r.error}`),this.renderState.resolve(e),void await Promise.all(this.self.pendingRenderPromises);this.applyShadowRootIfNotExisting();const s=document.createElement("div");s.innerHTML=r.result,this.applySlots(s,{...this.scope,parentInstance:this}),this.hostDomNode.innerHTML=s.innerHTML,await(0,d.timeout)(),this.waitForNestedComponentRendering().then((()=>{this.applyBindings(this.hostDomNode.firstChild,this.scope,this.self.renderSlots)})),await this.resolveRenderingPromiseIfSet(e,t)}unRender(e="unknown",t){this.unregisterDomNodeEventBindings()}},i.applyRootBinding=!0,i.pendingRenderPromises=[],i.content="<slot>Please provide a template to transclude.</slot>",i.determineRootBinding=!0,i.shadowDOM=null,i.observedAttributes=[],i.controllableProperties=[],i.eventToPropertyMapping={},i.propertyAliases={},i.propertyTypes={onClick:h.func},i.propertiesToReflectAsAttributes=[],i.renderProperties=["children"],i.doRender=!1,i.cloneSlots=!1,i.evaluateSlots=!1,i.renderSlots=!0,i.trimSlots=!0,i.renderUnsafe=!1,i._name="BaseWeb",i._propertyAliasIndex=void 0,i._propertiesToReflectAsAttributes=void 0,n=i,o=c()(n.prototype,"isRoot",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),n);const b=y},e=>{e.exports=i},e=>{e.exports=a},e=>{e.exports=p},e=>{e.exports=r},(e,t,r)=>{r.d(t,{default:()=>h});var s=r(0),n=r(1),o=r(7),i=r.n(o),a=r(9),p=r(10),l=r(3);const c=new s.Logger({name:"web-component-wrapper-web"});class d extends l.default{constructor(...e){super(...e),this.unmountOnDisconnect=!0,this.compiledSlots={},this.preparedSlots={},this.reactRoot=null,this.rootReactInstance=null,this.self=d,this.wrapMemorizingWrapper=null,this.isWrapped=!1,this.reflectInstanceProperties=()=>{this.instance?.current&&this.instance.current.properties&&this.reflectProperties(this.instance.current.properties)}}connectedCallback(){this.applyComponentWrapper(),this.rootReactInstance=this,super.connectedCallback()}disconnectedCallback(){this.unRender("disconnected"),this.unmountOnDisconnect&&this.reactRoot?.unmount(),this.unregisterConnectionState()}reflectExternalProperties(e){this.isRoot&&super.reflectExternalProperties(e)}async render(e="unknown",t=!0){if(super.unRender("reRender",e),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:e,scope:this.scope}})))return this.resolveRenderingPromiseIfSet(e,t);if(this.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&this.preCompileSlots(),this.evaluateSlots({...this.scope,parentInstance:this}),this.prepareProperties(this.internalProperties),this.applyShadowRootIfNotExisting(),this.rootInstance!==this&&!this.reactRoot){let e=this.firstChild;for(;e;){const t=e.nextSibling;this.removeChild(e),e=t}}if(!this.reactRoot){const e=this.id||this.internalProperties.id||this.externalProperties.id||this.name||this.internalProperties.name||this.externalProperties.name;let t="";"string"==typeof e&&(t=e),this.reactRoot=(0,p.createRoot)(this.hostDomNode,{identifierPrefix:t})}(0,a.flushSync)((()=>{this.reactRoot?.render((0,o.createElement)(this.self.content,this.internalProperties)),this.resolveRenderingPromiseIfSet(e,t)})),t&&await this.renderState.promise}setPropertyValue(e,t){this.reflectProperties({[e]:(0,s.copy)(t,!1,1)}),this.setInternalPropertyValue(e,(0,s.copy)(t,!1,1))}setInternalPropertyValue(e,t){null===t?t=n.NullSymbol:void 0===t&&(t=n.UndefinedSymbol),super.setInternalPropertyValue(e,t)}preCompileDomNodes(e,t={},r=!1){if(1===(e=e.filter((e=>e.nodeType!==Node.TEXT_NODE||"string"==typeof e.nodeValue&&""!==e.nodeValue.trim()))).length)return this.preCompileDomNode(e[0],t,r);let s=1;const n=[];for(const o of e){const e=this.preCompileDomNode(o,t,r,s.toString());n.push(e),s+=1}return r?e=>(...t)=>{const r=[];for(const s of n){const n=s(e);"function"==typeof n&&r.push(n(...t))}return(0,o.createElement)(o.Fragment,{children:r})}:n}preCompileDomNode(e,t={},r=!1,n){if(r){const r=this.preCompileDomNode(e,{...t,data:void 0,firstArgument:void 0,firstParameter:void 0,options:void 0,scope:void 0,parameters:void 0},!1,n);return e=>(...t)=>{const s=t.length>0?t[0]:null;return r({...e,data:s,firstArgument:s,firstParameter:s,options:s,scope:s,parameters:t})}}if(e.nodeType===Node.TEXT_NODE){const t="string"==typeof e.nodeValue?e.nodeValue.trim():"",r=n&&t?(0,o.createElement)(o.Fragment,{children:t,key:n}):t||null;return()=>r}if(!e.getAttributeNames)return()=>null;const i={};let a;const p=this.self.isReactComponent(e);p?(e.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&e.preCompileSlots(),n&&!Object.prototype.hasOwnProperty.call(i,"key")&&(i.key=n),a=e.constructor.content):(i.key=n,a=e.tagName.toLowerCase());let l=Object.keys(t);const d={};for(const r of e.getAttributeNames()){let n=e.getAttribute(r);if(null===n)continue;let o=!1,a="";if(r.startsWith("data-bind-")?a=r.substring(10):r.startsWith("bind-")&&(a=r.substring(5)),a.startsWith("attribute-")||"attributes"===a||a.startsWith("property-")||"properties"===a){const{error:t,originalScopeNames:i,templateFunction:p}=(0,s.compile)(n,l);if(t){c.warn("Error occurred during compiling given attribute",`binding "${r}" on node:`,e,t);continue}"attributes"===a||"properties"===a?o=!0:a=a.startsWith("attribute-")?a.substring(10):a.substring(9),n={originalScopeNames:i,templateFunction:p.bind(this)}}else if(a.startsWith("on-")){a=(0,s.delimitedToCamelCase)(a),Object.prototype.hasOwnProperty.call(t,"event")||(l=[...l,"event"]),Object.prototype.hasOwnProperty.call(t,"parameters")||(l=[...l,"parameters"]);const{error:o,originalScopeNames:i,scopeNames:p,templateFunction:d}=(0,s.compile)(n,l,!0);if(o){c.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,o);continue}const h=d.bind(this);n=(...o)=>{t.event=o[0],t.parameters=o;try{h(...i.map((e=>t[e])))}catch(t){c.warn("Error occurred during processing given",`event binding "${r}" on node: `,e,`Given expression "${n}" could`,"not be evaluated with given scope names",`"${p.join('", "')}":`,(0,s.represent)(t))}}}else a=r;const h={class:"className",for:"htmlFor"};Object.prototype.hasOwnProperty.call(h,a)&&(a=h[a]),a=(0,s.delimitedToCamelCase)(a),n?.originalScopeNames?d[o?"":a]=n:p||(i[a]=n)}if(!p){const r=Array.from(e.childNodes);r.length&&(i.children=this.preCompileDomNodes(r,t))}return r=>{(r={...t,...r}).scope=r;let s={...i};for(const[e,{originalScopeNames:t,templateFunction:n}]of Object.entries(d)){const o=n(...t.map((e=>r[e])));""===e?s={...s,...o}:s[e]=o}return Object.prototype.hasOwnProperty.call(s,"innerHTML")&&(s.dangerouslySetInnerHTML={__html:s.innerHTML},delete s.children,delete s.innerHTML),Object.prototype.hasOwnProperty.call(s,"textContent")?(s.children=s.textContent,delete s.textContent):p?(s={...e.internalProperties,...s},r={...s,...r,parentInstance:e},e.evaluateSlots(r),e.prepareProperties(s)):s.children&&(s.children=this.evaluatePreCompiledDomNodes(s.children,r)),(0,o.createElement)(a,s)}}evaluatePreCompiledDomNodes(e,t={}){if(!Array.isArray(e))return e(t);if(1===e.length)return e[0](t);const r=[];for(const s of e){const e=s(t);e&&r.push(e)}return r}preCompileSlots(){for(const e in this.slots)this.slots[e]&&"default"!==e&&(this.compiledSlots[e]=this.preCompileDomNode(this.slots[e],{...this.scope,parentInstance:this},[n.func,"function"].includes(this.self.propertyTypes[e])));this.slots.default&&this.slots.default.length>0&&(this.compiledSlots.children=this.preCompileDomNodes(this.slots.default,{...this.scope,parentInstance:this},[n.func,"function"].includes(this.self.propertyTypes.children)))}evaluateSlots(e){this.preparedSlots={};for(const t in 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))}static isReactComponent(e){const t=e.constructor;return"object"==typeof t.content&&(!t.attachWebComponentAdapterIfNotExists||"react"===t.content.webComponentAdapterWrapped)}determineRootBinding(){super.determineRootBinding();let e=this.parentNode;for(;e;){if(this.self.isReactComponent(e)){this.rootReactInstance=e;break}e=e.parentNode}}applyComponentWrapper(){if("string"==typeof this.self.content||this.isWrapped)return;this.isWrapped=!0;const e=this.self.content.wrapped||this.self.content;this.self.content.webComponentAdapterWrapped?this.wrapMemorizingWrapper&&(this.self.content=(0,o.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,o.forwardRef)(((t,r)=>((0,o.useImperativeHandle)(r,(()=>({properties:t})),[t]),(0,o.createElement)(e,t)))),(this.wrapMemorizingWrapper||null===this.wrapMemorizingWrapper)&&(this.self.content=(0,o.memo)(this.self.content)),this.self.content.wrapped=e,this.self.content.webComponentAdapterWrapped="react"):this.wrapMemorizingWrapper&&(this.self.content=(0,o.memo)(this.self.content),this.self.content.wrapped=e)}prepareProperties(e){(0,s.extend)(e,this.preparedSlots),this.self.removeKnownUnwantedPropertyKeys(this.self,e),e.ref||(this.instance=(0,o.createRef)(),e.ref=e=>{this.instance?this.instance.current=e:this.instance={current:e},this.reflectInstanceProperties()})}static removeKnownUnwantedPropertyKeys(e,t){if("string"!=typeof e.content)for(const r of["isRoot","isTrusted","__composed"])Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e.content,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.propTypes,r)||Object.prototype.hasOwnProperty.call(e.content,"wrapped")&&Object.prototype.hasOwnProperty.call(e.content.wrapped,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.wrapped.propTypes,r))&&delete t[r]}}d.attachWebComponentAdapterIfNotExists=!0,d.content="div",d.react=i(),d._name="ReactWebComponent";const h=d},e=>{e.exports=n},e=>{e.exports=o},(e,t,r)=>{r.d(t,{default:()=>o});var s=r(0);const n=r(8).default,o=(e,t="NoName",r={})=>{var o,i;const a=e._name||e.___types?.name?.name||t.replace(/^(.*\/+)?([^/]+)\.tsx$/,"$2");r.propTypes&&(e.propTypes=r.propTypes);const p=e.propTypes||{},l=r.propertyAliases||e.propertyAliases||{},c=(0,s.unique)(Object.keys(p).concat(Object.keys(l)).concat(Object.values(l)));let d=r.propertiesToReflectAsAttributes||e.propertiesToReflectAsAttributes||[];if(n.propertiesToReflectAsAttributes)if(Array.isArray(d))d=[...n.propertiesToReflectAsAttributes,...d];else if(d instanceof Map)for(const e of n.propertiesToReflectAsAttributes)d.set(e,n.propertyTypes[e]);else if("object"==typeof d)for(const e of n.propertiesToReflectAsAttributes)d[e]=n.propertyTypes[e];const h=c.map((e=>(0,s.camelCaseToDelimited)(e)));class u extends n{constructor(...t){var s;super(...t),this.self=u,this.internalProperties=r.internalProperties?{...r.internalProperties}:e.internalProperties?{...e.internalProperties}:{},this.unmountOnDisconnect=null===(s=r.unmountOnDisconnect)||void 0===s||s}}u.attachWebComponentAdapterIfNotExists="boolean"!=typeof r.attachWebComponentAdapterIfNotExists||r.attachWebComponentAdapterIfNotExists,u.content=e,u.observedAttributes=n.observedAttributes.concat(h).concat(h.map((e=>`-${e}`))),u.controllableProperties=e.controllableProperties||r.controllableProperties||[],u.eventToPropertyMapping=null===r.eventToPropertyMapping?r.eventToPropertyMapping:r.eventToPropertyMapping?{...r.eventToPropertyMapping}:null===e.eventToPropertyMapping?e.eventToPropertyMapping:e.eventToPropertyMapping?{...e.eventToPropertyMapping}:{},u.propertyAliases={...n.propertyAliases,...l},u.propertiesToReflectAsAttributes=d,u.propertyTypes={...n.propertyTypes,...p},u.renderProperties=null!==(o=null!==(i=r.renderProperties)&&void 0!==i?i:e.renderProperties)&&void 0!==o?o:n.renderProperties,u._name=a;return{component:u,register:(e=(0,s.camelCaseToDelimited)(a))=>{customElements.define(e,u)}}}},,e=>{e.exports=s}],c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return l[e](r,r.exports,d),r.exports}d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var h={};d.r(h);var u=d(0),f=d(1),m=d(7),y=d(13),b=d(11),g=d(8),v=d(3);return(0,y.describe)("Web",(()=>{(0,y.test)("constructor",(()=>{class e extends v.default{constructor(...e){super(...e),this.onClick=y.jest.fn()}}e.observedAttributes=["is-root","on-click","on-event"],(0,y.expect)(e).toHaveProperty("content"),(0,y.expect)(e).toHaveProperty("observedAttributes"),customElements.define("test-web",e);const t=document.createElement("test-web");(0,y.expect)(t).not.toHaveProperty("clicked"),t.setAttribute("on-click","this.clicked = true"),(0,y.expect)(t).not.toHaveProperty("clicked"),document.body.appendChild(t),(0,y.expect)(t).toHaveProperty("rootInstance",t),(0,y.expect)(t).not.toHaveProperty("clicked"),t.onClick(),(0,y.expect)(t).toHaveProperty("clicked",!0);const r=y.jest.fn();t.addEventListener("click",r),(0,y.expect)(r).not.toHaveBeenCalled(),t.onClick(),(0,y.expect)(r).toHaveBeenCalled()}))})),(0,y.describe)("ReactWeb",(()=>{(0,y.test)("constructor",(async()=>{let e,t="initial";class r extends g.default{constructor(...e){super(...e),this.self=r,this.onClick=y.jest.fn(),this.onEvent=y.jest.fn()}}r._name="Test",r.content=({onEvent:r,property:s=t})=>(e=r,t=s,(0,m.createElement)("div",{className:s})),r.observedAttributes=["is-root","on-click","on-event"],r.propertyTypes={...v.default.propertyTypes,onEvent:f.func,property:f.string},(0,y.expect)(r).toHaveProperty("content"),(0,y.expect)(r).toHaveProperty("observedAttributes"),customElements.define("test-react",r);const s=document.createElement("test-react");(0,y.expect)(s).not.toHaveProperty("clicked"),s.setAttribute("on-click","this.clicked = true"),(0,y.expect)(s).toHaveProperty("onClick"),(0,y.expect)(s).not.toHaveProperty("clicked"),s.setAttribute("on-event","this.eventHappened = true"),(0,y.expect)(s).toHaveProperty("onEvent"),(0,y.expect)(e).not.toBeDefined(),document.body.appendChild(s),(0,y.expect)(s).toHaveProperty("rootInstance",s),(0,y.expect)(s).toHaveProperty("reactRoot"),(0,y.expect)(e).not.toBeDefined(),await(0,u.timeout)(),(0,y.expect)(e).toBeDefined(),(0,y.expect)(s).not.toHaveProperty("eventHappened"),e&&e(),(0,y.expect)(s).toHaveProperty("eventHappened",!0);const n=y.jest.fn();s.addEventListener("event",n),(0,y.expect)(n).not.toHaveBeenCalled(),e&&e(),(0,y.expect)(n).toHaveBeenCalled(),(0,y.expect)(s).not.toHaveProperty("clicked"),s.onClick(),(0,y.expect)(s).toHaveProperty("clicked",!0);const o=y.jest.fn();s.addEventListener("click",o),(0,y.expect)(o).not.toHaveBeenCalled(),s.onClick(),(0,y.expect)(o).toHaveBeenCalled(),(0,y.expect)(t).toStrictEqual("initial"),(0,y.expect)(document.querySelector("div")?.className).toStrictEqual("initial"),s.property="test",await(0,u.timeout)(),(0,y.expect)(s).toHaveProperty("property","test"),(0,y.expect)(document.querySelector("div")?.className).toStrictEqual("test")}))})),(0,y.describe)("index",(()=>{(0,y.test)("wrapAsWebComponent",(()=>{const e=(0,b.default)((()=>(0,m.createElement)("div")),"TestComponent",{eventToPropertyMapping:{},propertyAliases:{alternateName:"name"},propertiesToReflectAsAttributes:[],propTypes:{name:"string"}});(0,y.expect)(e).toHaveProperty("component"),(0,y.expect)(e).toHaveProperty("register"),(0,y.expect)(e.component).toHaveProperty("_name","TestComponent"),(0,y.expect)(e.component).toHaveProperty("propertyTypes.name","string"),(0,y.expect)(e.component).toHaveProperty("propertiesToReflectAsAttributes",["isRoot"]),(0,y.expect)(e.component).toHaveProperty("eventToPropertyMapping",{})}))})),h})()));
package/dist/type.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import { Mapping, TemplateFunction, UTILITY_SCOPE, ValueOf } from 'clientnode';
2
+ import PropertyTypes, { ValidationMap } from 'clientnode/property-types';
3
+ import React, { ComponentType as ReactComponentType, HTMLAttributes, ReactElement } from 'react';
4
+ import Web from './Web';
5
+ export interface RenderState {
6
+ promise: Promise<string>;
7
+ pending: boolean;
8
+ resolve: (reason: string) => void;
9
+ }
10
+ export interface CompilerOptions {
11
+ filter?: (domNode: Node) => boolean;
12
+ ignoreComponents?: boolean;
13
+ ignoreNestedComponents?: boolean;
14
+ unsafe?: boolean;
15
+ }
16
+ export interface CompiledDomNodeTemplateItem {
17
+ domNode: Node;
18
+ children: Array<CompiledDomNodeTemplateItem>;
19
+ error?: null | string;
20
+ scopeNames?: Array<string>;
21
+ template?: string;
22
+ templateFunction?: TemplateFunction;
23
+ }
24
+ export type DomNodeToCompiledTemplateMap<NodeType = Node> = Map<NodeType, CompiledDomNodeTemplateItem>;
25
+ export type EventCallbackMapping = Map<string, () => void>;
26
+ export type EventMapping<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>> = (null | [
27
+ Partial<ExternalProperties>,
28
+ Partial<InternalProperties>
29
+ ] | Partial<ExternalProperties>);
30
+ export type EventMapper<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>, P extends Array<unknown> = Array<unknown>> = (...parameters: P) => EventMapping<E, I> | Promise<EventMapping<E, I>>;
31
+ export type EventToPropertyMapping<E extends Mapping<unknown> = Mapping<unknown>, I extends Mapping<unknown> = Mapping<unknown>, P extends Array<unknown> = Array<unknown>> = Mapping<true | EventMapper<E, I, P>>;
32
+ export type PropertyType = string | ValueOf<typeof PropertyTypes>;
33
+ export type PropertyConfiguration = PropertyType;
34
+ export type ValidationMapping = ValidationMap<ValueOf<typeof PropertyTypes>>;
35
+ export type PropertiesValidationMap = Mapping<ValueOf<typeof PropertyTypes>>;
36
+ export type PropertiesConfiguration = Mapping | PropertiesValidationMap;
37
+ export type NormalizedAttributesReflectionConfiguration = Map<string, PropertyConfiguration>;
38
+ export type AttributesReflectionConfiguration = (string | Array<string> | PropertiesConfiguration | NormalizedAttributesReflectionConfiguration);
39
+ export type ReadonlyScope = typeof UTILITY_SCOPE;
40
+ export type Scope = {
41
+ -readonly [key in keyof ReadonlyScope]: ReadonlyScope[key];
42
+ };
43
+ export type CallbackScope<Type = unknown> = Scope & {
44
+ data: Type;
45
+ event: Type;
46
+ firstArgument: Type;
47
+ firstParameter: Type;
48
+ options: Type;
49
+ parameters: Type;
50
+ scope: CallbackScope<Type>;
51
+ };
52
+ export type ScopeDeclaration = Array<string> | Mapping<unknown>;
53
+ export interface PreCompiledItem {
54
+ originalScopeNames: Array<string>;
55
+ templateFunction: TemplateFunction;
56
+ }
57
+ export type ReactComponentBaseProperties<TElement = HTMLElement> = Mapping<unknown> & {
58
+ children?: Array<React.ReactNode> | React.ReactNode;
59
+ dangerouslySetInnerHTML?: HTMLAttributes<TElement>['dangerouslySetInnerHTML'];
60
+ key?: string;
61
+ ref?: (null | {
62
+ current?: ComponentAdapter;
63
+ } | ((reference: ComponentAdapter) => void));
64
+ };
65
+ export type ReactRenderBaseItemFactory = (scope: Mapping<unknown>) => ReactRenderBaseItem;
66
+ export type ReactRenderItemFactory = (scope: Mapping<unknown>) => ReactRenderItem;
67
+ export type ReactRenderItemsFactory = Array<ReactRenderItemFactory> | ReactRenderItemFactory;
68
+ export type ReactRenderBaseItem = ReactElement | string | null;
69
+ export type ReactRenderItem = ((...parameters: Array<unknown>) => ReactRenderBaseItem) | ReactRenderBaseItem;
70
+ export type ReactRenderItems = Array<ReactRenderItem> | ReactRenderItem;
71
+ export interface WebComponentConfiguration<ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, EventParameters extends Array<unknown> = Array<unknown>> {
72
+ attachWebComponentAdapterIfNotExists?: boolean;
73
+ controllableProperties?: Array<string>;
74
+ eventToPropertyMapping?: (EventToPropertyMapping<ExternalProperties, InternalProperties, EventParameters> | null);
75
+ internalProperties?: InternalProperties;
76
+ propertiesToReflectAsAttributes?: AttributesReflectionConfiguration;
77
+ propertyAliases?: Mapping;
78
+ propTypes?: PropertiesConfiguration;
79
+ renderProperties?: Array<string>;
80
+ unmountOnDisconnect?: boolean;
81
+ }
82
+ export interface StaticWebComponent<ComponentType = unknown, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, EventParameters extends Array<unknown> = Array<unknown>> extends WebComponentConfiguration<ExternalProperties, InternalProperties, EventParameters> {
83
+ webComponentAdapterWrapped?: string;
84
+ wrapped?: ComponentType;
85
+ _name?: string;
86
+ ___types?: {
87
+ name?: {
88
+ name?: string;
89
+ };
90
+ };
91
+ }
92
+ export type ComponentType<PropertyTypes = Mapping<unknown>> = Omit<ReactComponentType<PropertyTypes>, 'propTypes'> & StaticWebComponent;
93
+ export interface ComponentAdapter<Properties = Mapping<unknown>, State = Mapping<unknown>> {
94
+ properties?: Properties;
95
+ state?: State;
96
+ }
97
+ export interface WebComponentAPI<TElement = HTMLElement, ExternalProperties extends Mapping<unknown> = Mapping<unknown>, InternalProperties extends Mapping<unknown> = Mapping<unknown>, Type extends typeof Web<TElement, ExternalProperties, InternalProperties> = typeof Web<TElement, ExternalProperties, InternalProperties>> {
98
+ component: Type;
99
+ register: (tagName?: string) => void;
100
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-wrapper",
3
- "version": "0.0.598",
3
+ "version": "0.0.600",
4
4
  "description": "Generic web-component base class and framework specific wrapper.",
5
5
  "keywords": [
6
6
  "component",
@@ -24,6 +24,20 @@
24
24
  "url": "https://torben.website"
25
25
  },
26
26
  "main": "dist/index.js",
27
+ "exports": {
28
+ ".": "./dist/index.js",
29
+ "./decorator": "./dist/decorator.js",
30
+ "./ReactWeb": "./dist/ReactWeb.js",
31
+ "./Web": "./dist/Web.js",
32
+ "./type": "./dist/type.js"
33
+ },
34
+ "typesVersions": {
35
+ "*": {
36
+ "type": [
37
+ "./dist/type.d.ts"
38
+ ]
39
+ }
40
+ },
27
41
  "files": [
28
42
  "dist"
29
43
  ],
@@ -32,10 +46,9 @@
32
46
  "url": "https://github.com/thaibault/web-component-wrapper"
33
47
  },
34
48
  "scripts": {
35
- "build": "yarn build:types; yarn build:plain; yarn build:compatible; yarn build:bundle",
36
- "build:bundle": "yarn build:types; yarn build:bundle:plain; yarn build:bundle:compatible",
37
- "build:bundle:plain": "weboptimizer build '{__reference__: \"target:bundle\"}'",
38
- "build:bundle:compatible": "weboptimizer build '{__reference__: [\"target:bundle\", \"target:compatible\"]}'",
49
+ "build": "yarn build:types; yarn build:plain; yarn build:compatible; yarn build:bundle; yarn build:bundle:compatible",
50
+ "build:bundle": "weboptimizer build '{__reference__: \"target:bundle\"}'",
51
+ "build:bundle:compatible": "weboptimizer build '{__reference__: [\"target:bundle\", \"target:compatible\", \"target:bundle:compatible\"]}'",
39
52
  "build:plain": "weboptimizer build",
40
53
  "build:compatible": "weboptimizer build '{__reference__: \"target:compatible\"}'",
41
54
  "build:types": "weboptimizer build:types",
@@ -69,7 +82,7 @@
69
82
  "@typescript-eslint/eslint-plugin": "^8.61.0",
70
83
  "@typescript-eslint/parser": "^8.61.0",
71
84
  "@webcomponents/webcomponentsjs": "^2.8.0",
72
- "clientnode": "^4.0.1422",
85
+ "clientnode": "^4.0.1423",
73
86
  "eslint": "^10.5.0",
74
87
  "eslint-config-google": "^0.14.0",
75
88
  "eslint-plugin-jsdoc": "^63.0.2",
@@ -79,7 +92,7 @@
79
92
  "react": "^19.2.7",
80
93
  "react-dom": "^19.2.7",
81
94
  "typescript-eslint": "^8.61.0",
82
- "web-documentation": "^1.0.37",
95
+ "web-documentation": "^1.0.38",
83
96
  "weboptimizer": "^3.0.24",
84
97
  "webpack-dev-server": "^5.2.5"
85
98
  },
@@ -200,6 +213,13 @@
200
213
  "base": "dist/compatible/"
201
214
  }
202
215
  }
216
+ },
217
+ "target:bundle:compatible": {
218
+ "path": {
219
+ "target": {
220
+ "base": "dist/bundle/compatible/"
221
+ }
222
+ }
203
223
  }
204
224
  },
205
225
  "packageManager": "yarn@4.14.1+sha512.64df448055b2d37ba269d7db535a469b8da93f8ef1140c25fd7a83c00a8fbaacb214ca0e02553b92a2c54cef78bb67d0b4817fab02001df0e24fac0faccc3b42"