web-component-wrapper 0.0.619 → 0.0.620

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ReactWeb.js CHANGED
@@ -50,7 +50,15 @@ module.exports = x({ ["NullSymbol"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode
50
50
  endregion
51
51
  */// region imports
52
52
  // endregion
53
- /**
53
+ /*
54
+ NOTE: Every class owns these members, so they do not indicate an existing
55
+ static configuration.
56
+ */const INTRINSIC_CLASS_MEMBER_NAMES=["length","name","prototype"];/**
57
+ * Checks if given class defines an own static member with given name.
58
+ * @param self - Class to check.
59
+ * @param name - Member name to check.
60
+ * @returns A boolean indicating whether given member exists.
61
+ */const hasOwnStaticMember=(self,name)=>Object.prototype.hasOwnProperty.call(self,name)&&!INTRINSIC_CLASS_MEMBER_NAMES.includes(name);/**
54
62
  * Generates a decorator based on given configuration.
55
63
  * @param options - Property configuration to define how to transfer attributes
56
64
  * and properties into each other.
@@ -71,7 +79,7 @@ module.exports = x({ ["NullSymbol"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode
71
79
  * "hasOwnProperty" for existence in this decorator.
72
80
  * @param target - Instance to apply given property to.
73
81
  * @param name - Field name to apply.
74
- */return function(target,name){if(typeof name!=="string")return;const self=target.self||target.constructor;if(options.readAttribute){if(!Object.prototype.hasOwnProperty.call(self,"observedAttributes"))self.observedAttributes=self.observedAttributes?[...self.observedAttributes]:[];const attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if(self.observedAttributes&&!self.observedAttributes.includes(attributeName))self.observedAttributes.push(attributeName)}if(options.type){if(!Object.prototype.hasOwnProperty.call(self,"propertyTypes"))self.propertyTypes=self.propertyTypes?{...self.propertyTypes}:{};if(self.propertyTypes&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyTypes[name]=options.type}if(options.writeAttribute){if(!Object.prototype.hasOwnProperty.call(self,"propertiesToReflectAsAttributes"))self.propertiesToReflectAsAttributes=self.propertiesToReflectAsAttributes?(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(self.propertiesToReflectAsAttributes):[];if(options.update||self.propertiesToReflectAsAttributes instanceof Map&&!self.propertiesToReflectAsAttributes.has(name)||Array.isArray(self.propertiesToReflectAsAttributes)&&!self.propertiesToReflectAsAttributes.includes(name)||typeof self.propertiesToReflectAsAttributes==="object"&&!Object.prototype.hasOwnProperty.call(self.propertiesToReflectAsAttributes,name)){let result;if(typeof options.writeAttribute==="boolean"){if(options.writeAttribute&&self.propertyTypes&&Object.prototype.hasOwnProperty.call(self.propertyTypes,name))result=self.propertyTypes[name]}else result=options.writeAttribute;if(result!==undefined){if(Array.isArray(self.propertiesToReflectAsAttributes))if(options.writeAttribute===true)self.propertiesToReflectAsAttributes.push(name);else if(self.normalizePropertyTypeList)self.propertiesToReflectAsAttributes=self.normalizePropertyTypeList(self.propertiesToReflectAsAttributes);if(self.propertiesToReflectAsAttributes instanceof Map)self.propertiesToReflectAsAttributes.set(name,result);if(typeof self.propertiesToReflectAsAttributes==="object")self.propertiesToReflectAsAttributes[name]=result}}}if(options.alias){if(!Object.prototype.hasOwnProperty.call(self,"propertyAliases"))self.propertyAliases=self.propertyAliases?{...self.propertyAliases}:{};if(self.propertyAliases&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyAliases[name]=options.alias}}}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (property);
82
+ */return function(target,name){if(typeof name!=="string")return;const self=target.self||target.constructor;if(options.readAttribute){if(!Object.prototype.hasOwnProperty.call(self,"observedAttributes"))self.observedAttributes=self.observedAttributes?[...self.observedAttributes]:[];const attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if(self.observedAttributes&&!self.observedAttributes.includes(attributeName))self.observedAttributes.push(attributeName)}if(options.type){if(!Object.prototype.hasOwnProperty.call(self,"propertyTypes"))self.propertyTypes=self.propertyTypes?{...self.propertyTypes}:{};if(self.propertyTypes&&(options.update||!hasOwnStaticMember(self,name)))self.propertyTypes[name]=options.type}if(options.writeAttribute){if(!Object.prototype.hasOwnProperty.call(self,"propertiesToReflectAsAttributes"))self.propertiesToReflectAsAttributes=self.propertiesToReflectAsAttributes?(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(self.propertiesToReflectAsAttributes):[];const reflectionConfiguration=self.propertiesToReflectAsAttributes;if(options.update||(reflectionConfiguration instanceof Map?!reflectionConfiguration.has(name):Array.isArray(reflectionConfiguration)?!reflectionConfiguration.includes(name):typeof reflectionConfiguration==="object"&&!Object.prototype.hasOwnProperty.call(reflectionConfiguration,name))){let result;if(typeof options.writeAttribute==="boolean"){if(options.writeAttribute&&self.propertyTypes&&Object.prototype.hasOwnProperty.call(self.propertyTypes,name))result=self.propertyTypes[name]}else result=options.writeAttribute;if(result!==undefined){if(Array.isArray(self.propertiesToReflectAsAttributes))if(options.writeAttribute===true){if(!self.propertiesToReflectAsAttributes.includes(name))self.propertiesToReflectAsAttributes.push(name)}else if(self.normalizePropertyTypeList)self.propertiesToReflectAsAttributes=self.normalizePropertyTypeList(self.propertiesToReflectAsAttributes);if(self.propertiesToReflectAsAttributes instanceof Map)self.propertiesToReflectAsAttributes.set(name,result);else if(!Array.isArray(self.propertiesToReflectAsAttributes)&&typeof self.propertiesToReflectAsAttributes==="object")self.propertiesToReflectAsAttributes[name]=result}}}if(options.alias){if(!Object.prototype.hasOwnProperty.call(self,"propertyAliases"))self.propertyAliases=self.propertyAliases?{...self.propertyAliases}:{};if(self.propertyAliases&&(options.update||!hasOwnStaticMember(self,name)))self.propertyAliases[name]=options.alias}}}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (property);
75
83
 
76
84
  /***/ }),
77
85
  /* 3 */
@@ -251,7 +259,7 @@ if(Object.prototype.hasOwnProperty.call(this,propertyName))this.setPropertyValue
251
259
  * @param name - Property name to retrieve.
252
260
  * @returns Retrieved property value.
253
261
  */getPropertyValue(name){const result=this.instance?.current?.properties&&(// NOTE: Base properties should not be shadowed.
254
- Object.prototype.hasOwnProperty.call(!Web.propertyTypes,name)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,name))?this.instance.current.properties[name]:this.internalProperties[name]??this.externalProperties[name];if(this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,name))return this.instance.current.state[name];return result}/**
262
+ !Object.prototype.hasOwnProperty.call(Web.propertyTypes,name)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,name))?this.instance.current.properties[name]:this.internalProperties[name]??this.externalProperties[name];if(this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,name))return this.instance.current.state[name];return result}/**
255
263
  * External property setter. Respects configured aliases.
256
264
  * @param name - Property name to write.
257
265
  * @param value - New value to write.
@@ -353,8 +361,12 @@ let currentDomNode=domNode.firstChild;while(currentDomNode){if(!options.filter||
353
361
  * @param options - Add event listener options.
354
362
  * @param removeOptions - Remove event listener options.
355
363
  * @returns Deregister function.
356
- */addSecureEventListener(domNode,name,handler,options,removeOptions){if(!this.domNodeEventBindings.has(domNode))this.domNodeEventBindings.set(// eslint-disable-next-line func-call-spacing
357
- domNode,new Map);const eventMap=this.domNodeEventBindings.get(domNode);const oldHandler=eventMap.get(name);if(oldHandler&&oldHandler!==handler)oldHandler();const deregister=()=>{domNode.removeEventListener(name,handler,removeOptions);eventMap.delete(name);if(eventMap.size===0)this.domNodeEventBindings.delete(domNode)};eventMap.set(name,deregister);domNode.addEventListener(name,handler,options);return deregister}//// endregion
364
+ */addSecureEventListener(domNode,name,handler,options,removeOptions){/*
365
+ NOTE: Has to be done before retrieving the event map since it may
366
+ be removed when the old handler was the last one registered.
367
+ */this.domNodeEventBindings.get(domNode)?.get(name)?.();if(!this.domNodeEventBindings.has(domNode))this.domNodeEventBindings.set(// eslint-disable-next-line func-call-spacing
368
+ domNode,new Map);const eventMap=this.domNodeEventBindings.get(domNode);const deregister=()=>{domNode.removeEventListener(name,handler,removeOptions);// NOTE: An outdated deregister should not remove its successor.
369
+ if(eventMap.get(name)===deregister)eventMap.delete(name);if(eventMap.size===0&&this.domNodeEventBindings.get(domNode)===eventMap)this.domNodeEventBindings.delete(domNode)};eventMap.set(name,deregister);domNode.addEventListener(name,handler,options);return deregister}//// endregion
358
370
  /**
359
371
  * Determines initial root which initializes rendering digest.
360
372
  */determineRootBinding(){/*
@@ -422,7 +434,7 @@ for(const[name,type]of Object.entries(this.self.propertyTypes))if(!Object.protot
422
434
  If real (template) code is wrapped in a "textarea" tag, unwrap it
423
435
  now. This extra wrapping can be used to avoid first dom rendering
424
436
  before template code has been evaluated.
425
- */const element=clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.node.firstElementChild?slot:null;if(element&&element.firstElementChild?.nodeName.toLowerCase()==="textarea"&&(!element.firstElementChild.hasAttribute("data-no-template")||element.firstElementChild.getAttribute("data-no-template")==="false")){const content=element.firstElementChild.value;/*
437
+ */const element=slot.firstElementChild?slot:null;if(element&&element.firstElementChild?.nodeName.toLowerCase()==="textarea"&&(!element.firstElementChild.hasAttribute("data-no-template")||element.firstElementChild.getAttribute("data-no-template")==="false")){const content=element.firstElementChild.value;/*
426
438
  NOTE: These kinds of slots are always used as a template and
427
439
  should therefore be copied in every case.
428
440
  NOTE: A flat copy should suffice since we will replace nested
package/dist/Web.js CHANGED
@@ -47,7 +47,15 @@ module.exports = x({ ["any"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode_proper
47
47
  endregion
48
48
  */// region imports
49
49
  // endregion
50
- /**
50
+ /*
51
+ NOTE: Every class owns these members, so they do not indicate an existing
52
+ static configuration.
53
+ */const INTRINSIC_CLASS_MEMBER_NAMES=["length","name","prototype"];/**
54
+ * Checks if given class defines an own static member with given name.
55
+ * @param self - Class to check.
56
+ * @param name - Member name to check.
57
+ * @returns A boolean indicating whether given member exists.
58
+ */const hasOwnStaticMember=(self,name)=>Object.prototype.hasOwnProperty.call(self,name)&&!INTRINSIC_CLASS_MEMBER_NAMES.includes(name);/**
51
59
  * Generates a decorator based on given configuration.
52
60
  * @param options - Property configuration to define how to transfer attributes
53
61
  * and properties into each other.
@@ -68,7 +76,7 @@ module.exports = x({ ["any"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode_proper
68
76
  * "hasOwnProperty" for existence in this decorator.
69
77
  * @param target - Instance to apply given property to.
70
78
  * @param name - Field name to apply.
71
- */return function(target,name){if(typeof name!=="string")return;const self=target.self||target.constructor;if(options.readAttribute){if(!Object.prototype.hasOwnProperty.call(self,"observedAttributes"))self.observedAttributes=self.observedAttributes?[...self.observedAttributes]:[];const attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if(self.observedAttributes&&!self.observedAttributes.includes(attributeName))self.observedAttributes.push(attributeName)}if(options.type){if(!Object.prototype.hasOwnProperty.call(self,"propertyTypes"))self.propertyTypes=self.propertyTypes?{...self.propertyTypes}:{};if(self.propertyTypes&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyTypes[name]=options.type}if(options.writeAttribute){if(!Object.prototype.hasOwnProperty.call(self,"propertiesToReflectAsAttributes"))self.propertiesToReflectAsAttributes=self.propertiesToReflectAsAttributes?(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(self.propertiesToReflectAsAttributes):[];if(options.update||self.propertiesToReflectAsAttributes instanceof Map&&!self.propertiesToReflectAsAttributes.has(name)||Array.isArray(self.propertiesToReflectAsAttributes)&&!self.propertiesToReflectAsAttributes.includes(name)||typeof self.propertiesToReflectAsAttributes==="object"&&!Object.prototype.hasOwnProperty.call(self.propertiesToReflectAsAttributes,name)){let result;if(typeof options.writeAttribute==="boolean"){if(options.writeAttribute&&self.propertyTypes&&Object.prototype.hasOwnProperty.call(self.propertyTypes,name))result=self.propertyTypes[name]}else result=options.writeAttribute;if(result!==undefined){if(Array.isArray(self.propertiesToReflectAsAttributes))if(options.writeAttribute===true)self.propertiesToReflectAsAttributes.push(name);else if(self.normalizePropertyTypeList)self.propertiesToReflectAsAttributes=self.normalizePropertyTypeList(self.propertiesToReflectAsAttributes);if(self.propertiesToReflectAsAttributes instanceof Map)self.propertiesToReflectAsAttributes.set(name,result);if(typeof self.propertiesToReflectAsAttributes==="object")self.propertiesToReflectAsAttributes[name]=result}}}if(options.alias){if(!Object.prototype.hasOwnProperty.call(self,"propertyAliases"))self.propertyAliases=self.propertyAliases?{...self.propertyAliases}:{};if(self.propertyAliases&&(options.update||!Object.prototype.hasOwnProperty.call(self,name)))self.propertyAliases[name]=options.alias}}}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (property);
79
+ */return function(target,name){if(typeof name!=="string")return;const self=target.self||target.constructor;if(options.readAttribute){if(!Object.prototype.hasOwnProperty.call(self,"observedAttributes"))self.observedAttributes=self.observedAttributes?[...self.observedAttributes]:[];const attributeName=(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.camelCaseToDelimited)(name);if(self.observedAttributes&&!self.observedAttributes.includes(attributeName))self.observedAttributes.push(attributeName)}if(options.type){if(!Object.prototype.hasOwnProperty.call(self,"propertyTypes"))self.propertyTypes=self.propertyTypes?{...self.propertyTypes}:{};if(self.propertyTypes&&(options.update||!hasOwnStaticMember(self,name)))self.propertyTypes[name]=options.type}if(options.writeAttribute){if(!Object.prototype.hasOwnProperty.call(self,"propertiesToReflectAsAttributes"))self.propertiesToReflectAsAttributes=self.propertiesToReflectAsAttributes?(0,clientnode__WEBPACK_IMPORTED_MODULE_0__.copy)(self.propertiesToReflectAsAttributes):[];const reflectionConfiguration=self.propertiesToReflectAsAttributes;if(options.update||(reflectionConfiguration instanceof Map?!reflectionConfiguration.has(name):Array.isArray(reflectionConfiguration)?!reflectionConfiguration.includes(name):typeof reflectionConfiguration==="object"&&!Object.prototype.hasOwnProperty.call(reflectionConfiguration,name))){let result;if(typeof options.writeAttribute==="boolean"){if(options.writeAttribute&&self.propertyTypes&&Object.prototype.hasOwnProperty.call(self.propertyTypes,name))result=self.propertyTypes[name]}else result=options.writeAttribute;if(result!==undefined){if(Array.isArray(self.propertiesToReflectAsAttributes))if(options.writeAttribute===true){if(!self.propertiesToReflectAsAttributes.includes(name))self.propertiesToReflectAsAttributes.push(name)}else if(self.normalizePropertyTypeList)self.propertiesToReflectAsAttributes=self.normalizePropertyTypeList(self.propertiesToReflectAsAttributes);if(self.propertiesToReflectAsAttributes instanceof Map)self.propertiesToReflectAsAttributes.set(name,result);else if(!Array.isArray(self.propertiesToReflectAsAttributes)&&typeof self.propertiesToReflectAsAttributes==="object")self.propertiesToReflectAsAttributes[name]=result}}}if(options.alias){if(!Object.prototype.hasOwnProperty.call(self,"propertyAliases"))self.propertyAliases=self.propertyAliases?{...self.propertyAliases}:{};if(self.propertyAliases&&(options.update||!hasOwnStaticMember(self,name)))self.propertyAliases[name]=options.alias}}}/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (property);
72
80
 
73
81
  /***/ })
74
82
  /******/ ]);
@@ -281,7 +289,7 @@ if(Object.prototype.hasOwnProperty.call(this,propertyName))this.setPropertyValue
281
289
  * @param name - Property name to retrieve.
282
290
  * @returns Retrieved property value.
283
291
  */getPropertyValue(name){const result=this.instance?.current?.properties&&(// NOTE: Base properties should not be shadowed.
284
- Object.prototype.hasOwnProperty.call(!Web.propertyTypes,name)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,name))?this.instance.current.properties[name]:this.internalProperties[name]??this.externalProperties[name];if(this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,name))return this.instance.current.state[name];return result}/**
292
+ !Object.prototype.hasOwnProperty.call(Web.propertyTypes,name)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,name))?this.instance.current.properties[name]:this.internalProperties[name]??this.externalProperties[name];if(this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,name))return this.instance.current.state[name];return result}/**
285
293
  * External property setter. Respects configured aliases.
286
294
  * @param name - Property name to write.
287
295
  * @param value - New value to write.
@@ -383,8 +391,12 @@ let currentDomNode=domNode.firstChild;while(currentDomNode){if(!options.filter||
383
391
  * @param options - Add event listener options.
384
392
  * @param removeOptions - Remove event listener options.
385
393
  * @returns Deregister function.
386
- */addSecureEventListener(domNode,name,handler,options,removeOptions){if(!this.domNodeEventBindings.has(domNode))this.domNodeEventBindings.set(// eslint-disable-next-line func-call-spacing
387
- domNode,new Map);const eventMap=this.domNodeEventBindings.get(domNode);const oldHandler=eventMap.get(name);if(oldHandler&&oldHandler!==handler)oldHandler();const deregister=()=>{domNode.removeEventListener(name,handler,removeOptions);eventMap.delete(name);if(eventMap.size===0)this.domNodeEventBindings.delete(domNode)};eventMap.set(name,deregister);domNode.addEventListener(name,handler,options);return deregister}//// endregion
394
+ */addSecureEventListener(domNode,name,handler,options,removeOptions){/*
395
+ NOTE: Has to be done before retrieving the event map since it may
396
+ be removed when the old handler was the last one registered.
397
+ */this.domNodeEventBindings.get(domNode)?.get(name)?.();if(!this.domNodeEventBindings.has(domNode))this.domNodeEventBindings.set(// eslint-disable-next-line func-call-spacing
398
+ domNode,new Map);const eventMap=this.domNodeEventBindings.get(domNode);const deregister=()=>{domNode.removeEventListener(name,handler,removeOptions);// NOTE: An outdated deregister should not remove its successor.
399
+ if(eventMap.get(name)===deregister)eventMap.delete(name);if(eventMap.size===0&&this.domNodeEventBindings.get(domNode)===eventMap)this.domNodeEventBindings.delete(domNode)};eventMap.set(name,deregister);domNode.addEventListener(name,handler,options);return deregister}//// endregion
388
400
  /**
389
401
  * Determines initial root which initializes rendering digest.
390
402
  */determineRootBinding(){/*
@@ -452,7 +464,7 @@ for(const[name,type]of Object.entries(this.self.propertyTypes))if(!Object.protot
452
464
  If real (template) code is wrapped in a "textarea" tag, unwrap it
453
465
  now. This extra wrapping can be used to avoid first dom rendering
454
466
  before template code has been evaluated.
455
- */const element=clientnode_property_types__WEBPACK_IMPORTED_MODULE_1__.node.firstElementChild?slot:null;if(element&&element.firstElementChild?.nodeName.toLowerCase()==="textarea"&&(!element.firstElementChild.hasAttribute("data-no-template")||element.firstElementChild.getAttribute("data-no-template")==="false")){const content=element.firstElementChild.value;/*
467
+ */const element=slot.firstElementChild?slot:null;if(element&&element.firstElementChild?.nodeName.toLowerCase()==="textarea"&&(!element.firstElementChild.hasAttribute("data-no-template")||element.firstElementChild.getAttribute("data-no-template")==="false")){const content=element.firstElementChild.value;/*
456
468
  NOTE: These kinds of slots are always used as a template and
457
469
  should therefore be copied in every case.
458
470
  NOTE: A flat copy should suffice since we will replace nested