@twobirds/microcomponents 0.0.54 → 0.0.56

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
- {"version":3,"file":"formValues.d.ts","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AAgN/D,qBAAa,UAAU;gBAErB,YAAY,EAAE,WAAW,EACzB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW,GAAG,UAAU;CAyB9B"}
1
+ {"version":3,"file":"formValues.d.ts","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AA0M/D,qBAAa,UAAU;gBAErB,YAAY,EAAE,WAAW,EACzB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW,GAAG,UAAU;CAyB9B"}
@@ -115,17 +115,13 @@ class SelectHandler extends InputBase {
115
115
  value = typeof value === 'string' ? [value] : value;
116
116
 
117
117
  // set all options
118
- const options = [...that.#e.querySelectorAll('option')].forEach((o) => {
118
+ [...that.#e.querySelectorAll('option')].forEach((o) => {
119
119
  if (value.indexOf(o.value) > -1) {
120
- o.setAttribute('selected', 'selected');
121
120
  o.selected = true;
122
121
  } else {
123
- o.removeAttribute('selected');
124
122
  o.selected = false;
125
123
  }
126
124
  });
127
-
128
- return;
129
125
  }
130
126
  }
131
127
 
@@ -142,7 +138,6 @@ class TextAreaHandler extends InputBase {
142
138
 
143
139
  set val(value: string) {
144
140
  this.#e.value = value;
145
- return;
146
141
  }
147
142
  }
148
143
 
@@ -153,8 +148,7 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
153
148
  handlers: LooseObject = {};
154
149
 
155
150
  inputList.forEach((i) => {
156
- const name: string = (i as inputTypes).getAttribute('name') || 'undefined';
157
- // console.log(name);
151
+ const name: string | null = (i as inputTypes).getAttribute('name');
158
152
  if (name) {
159
153
  let handler: any = false;
160
154
  switch (getInputName(i as inputTypes)) {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{FormValues:()=>C});var a=new Function("try {return this===window;}catch(e){ return false;}");let i=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>i.add(e)));class l{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function p(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function b(e){return e&&e instanceof HTMLElement}function g(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function h(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function m(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof l?new l(t.type,t.data,"l"):new l(t,r,"l"),s="string"!=typeof t?t:new l(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=p(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&g(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof l?new l(e.type,e.data,"l"):new l(e,t,"l"),c="string"!=typeof e?e:new l(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new l(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=h;static remove=m;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return b(t)?p(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return b(t)?p(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!b(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return b(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}function j(e){return null!=e&&"object"==typeof e}function S(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}new Map;const _=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;S(e).forEach((e=>t.data[e]="")),k(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!_.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const k=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let i=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],j(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(j(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!S(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new A(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=j(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},l=new i(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(j(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(c((function(){o(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(j(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof i==0&&(l=new i(structuredClone(Object.assign({},e))),s(e,l),l.seal()),Object.assign(l,e),setTimeout(c((function(){o(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class N{constructor(e){}}class T extends N{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class x extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class P extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class L extends N{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class M extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}class C{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name")||"undefined";if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new T(e);break;case"checkbox":n=new x(e);break;default:n=new P(e)}break;case"select":n=new L(e);break;case"textarea":n=new M(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),k(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{g(r,"keyup",(r=>{e[t].notify()})),g(r,"change",(r=>{e[t].notify()})),g(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function a(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{FormValues:()=>C});var s=new Function("try {return this===window;}catch(e){ return false;}");let i=new Set;s()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>i.add(e)));class l{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function p(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function b(e){return e&&e instanceof HTMLElement}function g(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function h(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function m(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof l?new l(t.type,t.data,"l"):new l(t,r,"l"),a="string"!=typeof t?t:new l(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&O(e,a)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=p(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+a)&&g(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof l?new l(e.type,e.data,"l"):new l(e,t,"l"),c="string"!=typeof e?e:new l(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new l(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=h;static remove=m;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return b(t)?p(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return b(t)?p(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!b(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return b(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}function j(e){return null!=e&&"object"==typeof e}function S(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}new Map;const _=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;S(e).forEach((e=>t.data[e]="")),k(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!_.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const k=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,s=e[t];if(!s.prototype)switch(typeof s){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=s instanceof Array?Array:Object;break;default:return}let i=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],j(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(j(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!S(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new A(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=j(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},l=new i(s);Object.defineProperty(e,t,{enumerable:!0,get(){if(j(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(c((function(){o(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(j(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof i==0&&(l=new i(structuredClone(Object.assign({},e))),a(e,l),l.seal()),Object.assign(l,e),setTimeout(c((function(){o(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=s})),e);class N{constructor(e){}}class T extends N{#a;constructor(e){super(e),this.#a=e}get val(){return new FormData(this.#a.form).get(this.#a.name)}set val(e){[...this.#a.form.querySelectorAll(`input[type="radio][name="${this.#a.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class x extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class P extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class L extends N{#a;#s=!1;constructor(e){super(e),this.#a=e,this.#s=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#s?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#a.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class M extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}class C{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new T(e);break;case"checkbox":n=new x(e);break;default:n=new P(e)}break;case"select":n=new L(e);break;case"textarea":n=new M(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),k(e,t),a(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{g(r,"keyup",(r=>{e[t].notify()})),g(r,"change",(r=>{e[t].notify()})),g(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function h(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Y,$t:()=>K,DC:()=>N,FormValues:()=>ae,MC:()=>k,McBase:()=>x,McEvent:()=>p,addListener:()=>v,autoload:()=>M,copyGettersSetters:()=>h,debounce:()=>l,deepEqual:()=>s,defineCE:()=>$,flattenObject:()=>a,getCE:()=>H,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>V,parse:()=>c,removeListener:()=>O,sortObject:()=>n});var f=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;f()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let b=new Set;function g(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function O(e,t,r){e.removeEventListener(t,r)}function w(e,t,r={}){let n=e;if(!n._mc){let t=N?.debug;N.debug=!1,n._mc=new N(e),N.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function S(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function A(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&N.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&N.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>b.add(e)));class x{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==N&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===N)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),b.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class k extends x{_mc={};constructor(e){super(e)}static trigger=A;trigger(e,t={},r="l"){let n=this;if(n.constructor===k||n.constructor===N){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof k||n instanceof N){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class N extends x{_mc={};constructor(e,t=!1){super(e)}static add=w;static remove=S;static trigger=A;trigger(e,t={},r){k.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=g([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?g([...t.querySelectorAll("*[_mc]")],e):[]}}let _=null;const T=new Map;function C(){document.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])').forEach((e=>{(e.tagName.includes("-")?[e.tagName.toLowerCase()]:e.getAttribute("_mc").trim().split(" ")).forEach((t=>{let r=t.toLowerCase().split("-"),n=r[r.length-1],a=n[0].toUpperCase()+n.slice(1);if(r[r.length-1]=a,r=r.join("/")+".js",e.tagName.includes("-")&&!T.has(e.tagName.toLowerCase())){const e=document.createElement("script");T.set(t,r),e.setAttribute("src",r),e.setAttribute("blocking","render"),e.setAttribute("type","module"),e.onload=()=>{T.delete(t)},document.head.append(e)}}))}))}let L=!1;function M(e=!0){return e?(L=e,_=new MutationObserver(C),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),C()}),5),L):(_?.disconnect(),_=null,L)}class P extends HTMLElement{constructor(){super()}connectedCallback(){N.trigger(this,"Connected")}disconnectedCallback(){N.trigger(this,"Disconnected")}adoptedCallback(){N.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){N.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function $(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends P{instance;constructor(e){super();let r=new t(this,e);N.add(this,n,r)}static get observedAttributes(){return r}}))}function H(e){return customElements.get(e)}function q(e){return null!=e&&"object"==typeof e}function D(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const I=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class B extends N{data={};oldDisplay="";constructor(e){super(e);let t=this;D(e).forEach((e=>t.data[e]="")),V(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!I.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const V=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],q(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(q(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!D(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||N.add(e,"_placeholders",new B(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=q(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(q(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(q(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),h(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),z=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},F=e=>{let t=Y("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new G(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new R(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class J{constructor(e){}}class G extends J{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Y(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Y(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class R extends J{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Y(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Y(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends J{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class W{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new Z;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Y(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=z(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Y(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Y(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Y(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Y([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=z(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){O(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=z(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=z(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=F(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=F(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Y(this.array.at(e))}concat(e){let t=this;return(e instanceof W?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Y(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Y(n)}}class Z{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Y(e,t).forEach((e=>{K(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new W,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Y(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);K([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){O(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);K([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return K(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return K(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return K(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return K(n)}}const Y=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Y(e,t).forEach((e=>{r.add(e)}))})),new W([...r])):new W(e,t)},K=(e,t=document)=>Y(e,t).$t();class Q{constructor(e){}}class X extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class ee extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class te extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class re extends Q{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class ne extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class ae{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name")||"undefined";if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new X(e);break;case"checkbox":n=new ee(e);break;default:n=new te(e)}break;case"select":n=new re(e);break;case"textarea":n=new ne(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(N.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),V(e,t),h(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function h(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Y,$t:()=>K,DC:()=>N,FormValues:()=>ae,MC:()=>k,McBase:()=>x,McEvent:()=>p,addListener:()=>v,autoload:()=>M,copyGettersSetters:()=>h,debounce:()=>l,deepEqual:()=>s,defineCE:()=>$,flattenObject:()=>a,getCE:()=>H,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>V,parse:()=>c,removeListener:()=>O,sortObject:()=>n});var f=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;f()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function O(e,t,r){e.removeEventListener(t,r)}function w(e,t,r={}){let n=e;if(!n._mc){let t=N?.debug;N.debug=!1,n._mc=new N(e),N.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function S(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function A(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&N.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&N.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class x{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==N&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===N)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class k extends x{_mc={};constructor(e){super(e)}static trigger=A;trigger(e,t={},r="l"){let n=this;if(n.constructor===k||n.constructor===N){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof k||n instanceof N){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class N extends x{_mc={};constructor(e,t=!1){super(e)}static add=w;static remove=S;static trigger=A;trigger(e,t={},r){k.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}let _=null;const T=new Map;function C(){document.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])').forEach((e=>{(e.tagName.includes("-")?[e.tagName.toLowerCase()]:e.getAttribute("_mc").trim().split(" ")).forEach((t=>{let r=t.toLowerCase().split("-"),n=r[r.length-1],a=n[0].toUpperCase()+n.slice(1);if(r[r.length-1]=a,r=r.join("/")+".js",e.tagName.includes("-")&&!T.has(e.tagName.toLowerCase())){const e=document.createElement("script");T.set(t,r),e.setAttribute("src",r),e.setAttribute("blocking","render"),e.setAttribute("type","module"),e.onload=()=>{T.delete(t)},document.head.append(e)}}))}))}let L=!1;function M(e=!0){return e?(L=e,_=new MutationObserver(C),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),C()}),5),L):(_?.disconnect(),_=null,L)}class P extends HTMLElement{constructor(){super()}connectedCallback(){N.trigger(this,"Connected")}disconnectedCallback(){N.trigger(this,"Disconnected")}adoptedCallback(){N.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){N.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function $(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends P{instance;constructor(e){super();let r=new t(this,e);N.add(this,n,r)}static get observedAttributes(){return r}}))}function H(e){return customElements.get(e)}function q(e){return null!=e&&"object"==typeof e}function D(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const I=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class B extends N{data={};oldDisplay="";constructor(e){super(e);let t=this;D(e).forEach((e=>t.data[e]="")),V(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!I.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const V=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],q(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(q(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!D(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||N.add(e,"_placeholders",new B(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=q(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(q(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(q(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),h(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),z=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},F=e=>{let t=Y("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new G(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new R(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class J{constructor(e){}}class G extends J{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Y(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Y(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class R extends J{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Y(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Y(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends J{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class W{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new Z;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Y(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=z(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Y(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Y(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Y(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Y([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=z(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){O(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=z(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=z(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=F(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=F(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Y(this.array.at(e))}concat(e){let t=this;return(e instanceof W?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Y(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Y(n)}}class Z{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Y(e,t).forEach((e=>{K(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new W,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Y(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);K([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){O(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);K([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return K(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return K(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return K(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return K(n)}}const Y=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Y(e,t).forEach((e=>{r.add(e)}))})),new W([...r])):new W(e,t)},K=(e,t=document)=>Y(e,t).$t();class Q{constructor(e){}}class X extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class ee extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class te extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class re extends Q{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class ne extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class ae{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new X(e);break;case"checkbox":n=new ee(e);break;default:n=new te(e)}break;case"select":n=new re(e);break;case"textarea":n=new ne(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(N.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),V(e,t),h(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twobirds/microcomponents",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "Micro Components Organization Class",
5
5
  "main": "./dist/microcomponents.ts",
6
6
  "types": "./dist/microcomponents.d.ts",
@@ -75,17 +75,14 @@ class SelectHandler extends InputBase {
75
75
  set val(value) {
76
76
  const that = this;
77
77
  value = typeof value === 'string' ? [value] : value;
78
- const options = [...that.#e.querySelectorAll('option')].forEach((o) => {
78
+ [...that.#e.querySelectorAll('option')].forEach((o) => {
79
79
  if (value.indexOf(o.value) > -1) {
80
- o.setAttribute('selected', 'selected');
81
80
  o.selected = true;
82
81
  }
83
82
  else {
84
- o.removeAttribute('selected');
85
83
  o.selected = false;
86
84
  }
87
85
  });
88
- return;
89
86
  }
90
87
  }
91
88
  class TextAreaHandler extends InputBase {
@@ -99,7 +96,6 @@ class TextAreaHandler extends InputBase {
99
96
  }
100
97
  set val(value) {
101
98
  this.#e.value = value;
102
- return;
103
99
  }
104
100
  }
105
101
  const getInputHandlers = (e) => {
@@ -107,7 +103,7 @@ const getInputHandlers = (e) => {
107
103
  ...(e || document).querySelectorAll('input,select,textarea'),
108
104
  ], handlers = {};
109
105
  inputList.forEach((i) => {
110
- const name = i.getAttribute('name') || 'undefined';
106
+ const name = i.getAttribute('name');
111
107
  if (name) {
112
108
  let handler = false;
113
109
  switch (getInputName(i)) {
@@ -1 +1 @@
1
- {"version":3,"file":"formValues.js","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"formValues.js","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{FormValues:()=>C});var a=new Function("try {return this===window;}catch(e){ return false;}");let i=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>i.add(e)));class l{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function p(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function b(e){return e&&e instanceof HTMLElement}function g(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function h(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function m(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof l?new l(t.type,t.data,"l"):new l(t,r,"l"),s="string"!=typeof t?t:new l(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=p(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&g(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof l?new l(e.type,e.data,"l"):new l(e,t,"l"),c="string"!=typeof e?e:new l(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new l(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=h;static remove=m;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return b(t)?p(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return b(t)?p(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!b(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return b(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}function j(e){return null!=e&&"object"==typeof e}function S(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}new Map;const _=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;S(e).forEach((e=>t.data[e]="")),k(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!_.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const k=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let i=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],j(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(j(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!S(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new A(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=j(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},l=new i(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(j(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(c((function(){o(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(j(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof i==0&&(l=new i(structuredClone(Object.assign({},e))),s(e,l),l.seal()),Object.assign(l,e),setTimeout(c((function(){o(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class N{constructor(e){}}class T extends N{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class x extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class P extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class L extends N{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class M extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}class C{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name")||"undefined";if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new T(e);break;case"checkbox":n=new x(e);break;default:n=new P(e)}break;case"select":n=new L(e);break;case"textarea":n=new M(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),k(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{g(r,"keyup",(r=>{e[t].notify()})),g(r,"change",(r=>{e[t].notify()})),g(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function a(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{FormValues:()=>C});var s=new Function("try {return this===window;}catch(e){ return false;}");let i=new Set;s()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>i.add(e)));class l{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function p(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function b(e){return e&&e instanceof HTMLElement}function g(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function h(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function m(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof l?new l(t.type,t.data,"l"):new l(t,r,"l"),a="string"!=typeof t?t:new l(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&O(e,a)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=p(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+a)&&g(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof l?new l(e.type,e.data,"l"):new l(e,t,"l"),c="string"!=typeof e?e:new l(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new l(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=h;static remove=m;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return b(t)?p(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return b(t)?p(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!b(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return b(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}function j(e){return null!=e&&"object"==typeof e}function S(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}new Map;const _=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;S(e).forEach((e=>t.data[e]="")),k(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!_.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const k=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,s=e[t];if(!s.prototype)switch(typeof s){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=s instanceof Array?Array:Object;break;default:return}let i=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],j(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(j(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!S(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new A(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=j(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},l=new i(s);Object.defineProperty(e,t,{enumerable:!0,get(){if(j(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(c((function(){o(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(j(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof i==0&&(l=new i(structuredClone(Object.assign({},e))),a(e,l),l.seal()),Object.assign(l,e),setTimeout(c((function(){o(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=s})),e);class N{constructor(e){}}class T extends N{#a;constructor(e){super(e),this.#a=e}get val(){return new FormData(this.#a.form).get(this.#a.name)}set val(e){[...this.#a.form.querySelectorAll(`input[type="radio][name="${this.#a.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class x extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class P extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class L extends N{#a;#s=!1;constructor(e){super(e),this.#a=e,this.#s=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#s?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#a.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class M extends N{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}class C{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new T(e);break;case"checkbox":n=new x(e);break;default:n=new P(e)}break;case"select":n=new L(e);break;case"textarea":n=new M(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),k(e,t),a(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{g(r,"keyup",(r=>{e[t].notify()})),g(r,"change",(r=>{e[t].notify()})),g(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function h(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Y,$t:()=>K,DC:()=>N,FormValues:()=>ae,MC:()=>k,McBase:()=>x,McEvent:()=>p,addListener:()=>v,autoload:()=>M,copyGettersSetters:()=>h,debounce:()=>l,deepEqual:()=>s,defineCE:()=>$,flattenObject:()=>a,getCE:()=>H,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>V,parse:()=>c,removeListener:()=>O,sortObject:()=>n});var f=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;f()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let b=new Set;function g(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function O(e,t,r){e.removeEventListener(t,r)}function w(e,t,r={}){let n=e;if(!n._mc){let t=N?.debug;N.debug=!1,n._mc=new N(e),N.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function S(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function A(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&N.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&N.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>b.add(e)));class x{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==N&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===N)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),b.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class k extends x{_mc={};constructor(e){super(e)}static trigger=A;trigger(e,t={},r="l"){let n=this;if(n.constructor===k||n.constructor===N){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof k||n instanceof N){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class N extends x{_mc={};constructor(e,t=!1){super(e)}static add=w;static remove=S;static trigger=A;trigger(e,t={},r){k.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=g([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?g([...t.querySelectorAll("*[_mc]")],e):[]}}let _=null;const T=new Map;function C(){document.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])').forEach((e=>{(e.tagName.includes("-")?[e.tagName.toLowerCase()]:e.getAttribute("_mc").trim().split(" ")).forEach((t=>{let r=t.toLowerCase().split("-"),n=r[r.length-1],a=n[0].toUpperCase()+n.slice(1);if(r[r.length-1]=a,r=r.join("/")+".js",e.tagName.includes("-")&&!T.has(e.tagName.toLowerCase())){const e=document.createElement("script");T.set(t,r),e.setAttribute("src",r),e.setAttribute("blocking","render"),e.setAttribute("type","module"),e.onload=()=>{T.delete(t)},document.head.append(e)}}))}))}let L=!1;function M(e=!0){return e?(L=e,_=new MutationObserver(C),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),C()}),5),L):(_?.disconnect(),_=null,L)}class P extends HTMLElement{constructor(){super()}connectedCallback(){N.trigger(this,"Connected")}disconnectedCallback(){N.trigger(this,"Disconnected")}adoptedCallback(){N.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){N.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function $(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends P{instance;constructor(e){super();let r=new t(this,e);N.add(this,n,r)}static get observedAttributes(){return r}}))}function H(e){return customElements.get(e)}function q(e){return null!=e&&"object"==typeof e}function D(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const I=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class B extends N{data={};oldDisplay="";constructor(e){super(e);let t=this;D(e).forEach((e=>t.data[e]="")),V(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!I.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const V=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],q(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(q(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!D(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||N.add(e,"_placeholders",new B(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=q(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(q(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(q(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),h(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),z=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},F=e=>{let t=Y("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new G(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new R(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class J{constructor(e){}}class G extends J{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Y(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Y(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class R extends J{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Y(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Y(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends J{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class W{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new Z;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Y(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=z(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Y(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Y(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Y(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Y([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=z(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){O(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=z(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=z(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=F(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=F(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Y(this.array.at(e))}concat(e){let t=this;return(e instanceof W?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Y(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Y(n)}}class Z{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Y(e,t).forEach((e=>{K(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new W,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Y(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);K([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){O(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);K([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return K(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return K(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return K(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return K(n)}}const Y=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Y(e,t).forEach((e=>{r.add(e)}))})),new W([...r])):new W(e,t)},K=(e,t=document)=>Y(e,t).$t();class Q{constructor(e){}}class X extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class ee extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class te extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class re extends Q{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class ne extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class ae{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name")||"undefined";if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new X(e);break;case"checkbox":n=new ee(e);break;default:n=new te(e)}break;case"select":n=new re(e);break;case"textarea":n=new ne(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(N.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),V(e,t),h(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function h(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Y,$t:()=>K,DC:()=>N,FormValues:()=>ae,MC:()=>k,McBase:()=>x,McEvent:()=>p,addListener:()=>v,autoload:()=>M,copyGettersSetters:()=>h,debounce:()=>l,deepEqual:()=>s,defineCE:()=>$,flattenObject:()=>a,getCE:()=>H,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>V,parse:()=>c,removeListener:()=>O,sortObject:()=>n});var f=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;f()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function O(e,t,r){e.removeEventListener(t,r)}function w(e,t,r={}){let n=e;if(!n._mc){let t=N?.debug;N.debug=!1,n._mc=new N(e),N.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function S(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function A(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&N.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&N.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class x{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==N&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===N)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class k extends x{_mc={};constructor(e){super(e)}static trigger=A;trigger(e,t={},r="l"){let n=this;if(n.constructor===k||n.constructor===N){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof k||n instanceof N){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class N extends x{_mc={};constructor(e,t=!1){super(e)}static add=w;static remove=S;static trigger=A;trigger(e,t={},r){k.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}let _=null;const T=new Map;function C(){document.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])').forEach((e=>{(e.tagName.includes("-")?[e.tagName.toLowerCase()]:e.getAttribute("_mc").trim().split(" ")).forEach((t=>{let r=t.toLowerCase().split("-"),n=r[r.length-1],a=n[0].toUpperCase()+n.slice(1);if(r[r.length-1]=a,r=r.join("/")+".js",e.tagName.includes("-")&&!T.has(e.tagName.toLowerCase())){const e=document.createElement("script");T.set(t,r),e.setAttribute("src",r),e.setAttribute("blocking","render"),e.setAttribute("type","module"),e.onload=()=>{T.delete(t)},document.head.append(e)}}))}))}let L=!1;function M(e=!0){return e?(L=e,_=new MutationObserver(C),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),C()}),5),L):(_?.disconnect(),_=null,L)}class P extends HTMLElement{constructor(){super()}connectedCallback(){N.trigger(this,"Connected")}disconnectedCallback(){N.trigger(this,"Disconnected")}adoptedCallback(){N.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){N.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function $(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends P{instance;constructor(e){super();let r=new t(this,e);N.add(this,n,r)}static get observedAttributes(){return r}}))}function H(e){return customElements.get(e)}function q(e){return null!=e&&"object"==typeof e}function D(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const I=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class B extends N{data={};oldDisplay="";constructor(e){super(e);let t=this;D(e).forEach((e=>t.data[e]="")),V(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!I.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const V=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],q(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(q(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!D(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||N.add(e,"_placeholders",new B(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=q(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(q(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(q(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),h(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),z=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},F=e=>{let t=Y("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new G(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new R(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class J{constructor(e){}}class G extends J{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Y(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Y(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class R extends J{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Y(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Y(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends J{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class W{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new Z;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Y(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=z(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Y(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Y(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Y(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Y(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Y([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=z(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){O(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Y(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Y([...n]),e){let n=Y(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=z(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=z(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=F(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=F(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Y(this.array.at(e))}concat(e){let t=this;return(e instanceof W?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Y(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Y(n)}}class Z{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Y(e,t).forEach((e=>{K(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new W,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Y(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);K([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){O(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);K([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return K(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return K(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return K(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return K(n)}}const Y=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Y(e,t).forEach((e=>{r.add(e)}))})),new W([...r])):new W(e,t)},K=(e,t=document)=>Y(e,t).$t();class Q{constructor(e){}}class X extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class ee extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class te extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class re extends Q{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class ne extends Q{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class ae{constructor(e,t,r){let n=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new X(e);break;case"checkbox":n=new ee(e);break;default:n=new te(e)}break;case"select":n=new re(e);break;case"textarea":n=new ne(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(N.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r})(r);e[t]=Object.assign({},n),V(e,t),h(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}}return t})()));
@@ -115,17 +115,13 @@ class SelectHandler extends InputBase {
115
115
  value = typeof value === 'string' ? [value] : value;
116
116
 
117
117
  // set all options
118
- const options = [...that.#e.querySelectorAll('option')].forEach((o) => {
118
+ [...that.#e.querySelectorAll('option')].forEach((o) => {
119
119
  if (value.indexOf(o.value) > -1) {
120
- o.setAttribute('selected', 'selected');
121
120
  o.selected = true;
122
121
  } else {
123
- o.removeAttribute('selected');
124
122
  o.selected = false;
125
123
  }
126
124
  });
127
-
128
- return;
129
125
  }
130
126
  }
131
127
 
@@ -142,7 +138,6 @@ class TextAreaHandler extends InputBase {
142
138
 
143
139
  set val(value: string) {
144
140
  this.#e.value = value;
145
- return;
146
141
  }
147
142
  }
148
143
 
@@ -153,8 +148,7 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
153
148
  handlers: LooseObject = {};
154
149
 
155
150
  inputList.forEach((i) => {
156
- const name: string = (i as inputTypes).getAttribute('name') || 'undefined';
157
- // console.log(name);
151
+ const name: string | null = (i as inputTypes).getAttribute('name');
158
152
  if (name) {
159
153
  let handler: any = false;
160
154
  switch (getInputName(i as inputTypes)) {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TestTestform=t():e.TestTestform=t()}(self,(()=>(()=>{"use strict";var e=new Function("try {return this===window;}catch(e){ return false;}");let t=new Set;e()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>t.add(e)));class n{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;function l(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const a=e?._mc;!t&&a?n=n.concat(Object.values(e._mc)):t&&a&&a[t]&&n.push(a[t])}})),n}function o(e,t,n=!0){let a=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&a.push(e._mc[t]):a=a.concat(Object.values(e._mc)),n))return a;e=e.parentNode}return a}function i(e){return e&&e instanceof HTMLElement}function s(e,t,n,a=!1,r=!1){let l={once:!1};a&&(l.capture=a),r&&(l.once=r),e.addEventListener(t,n,l)}function c(e,t,n={}){let a=e;if(!a._mc){let t=m?.debug;m.debug=!1,a._mc=new m(e),m.debug=t,delete a._mc._mc}const r=a._mc;return t.length&&!r[t]&&(r[t]=n,e instanceof HTMLElement&&e.setAttribute("_mc","")),n}function u(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,a={},r="l"){let l=e?._mc;if(!l)return;let o=t instanceof n?new n(t.type,t.data,"l"):new n(t,a,"l"),i="string"!=typeof t?t:new n(t,a,r);[...Object.values(l)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&d(e,i)}function d(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=o(e,"",!0)?.[0].target;n&&m.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&m.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class b{#a;constructor(e,t=!1){var n;this.#a=new WeakRef(e||{}),(n=this).constructor!==m&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!a()||e.constructor===m)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((a=>{let l=/^one/.test(a),o=a.replace(/^on[e]{0,1}/,""),i=o.toLowerCase();l&&Object.defineProperty(e,"on"+o,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[a].bind(n)(e)}}),r.has("on"+i)&&s(t,i,(e=>{n.trigger(o,e)}),!1,l)}))}}(this)}get target(){return this.#a.deref()}}class f extends b{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},a="l"){let r=this;if(r.constructor===f||r.constructor===m){let l=e instanceof n?new n(e.type,e.data,"l"):new n(e,t,"l"),o="string"!=typeof e?e:new n(e,t,a);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(l)})),void(/[ud]/.test(o.bubble)&&d(r.target,o))}if(r instanceof f||r instanceof m){const r=this,l="string"!=typeof e?e:new n(e,t,a),o="on"+l.type[0].toUpperCase()+l.type.slice(1);if(l.bubble.indexOf("l")>-1&&(l.immediateStopped||"function"!=typeof r[o]||(r[o](l),r.hasOwnProperty(o)&&delete r[o])),l.stopped||"l"===l.bubble)return r;/[ud]/.test(l.bubble)&&d(r.target,l)}}}class m extends b{_mc={};constructor(e,t=!1){super(e)}static add=c;static remove=u;static trigger=p;trigger(e,t={},n){f.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return i(t)?o(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return i(t)?o(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!i(t))return[];const n=Math.random().toString().replace(".",""),a='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const r=l([...t.querySelectorAll(a)],e);return t.removeAttribute("temp_id"),r}descendants(e=""){let t=this?.target;return i(t)?l([...t.querySelectorAll("*[_mc]")],e):[]}}function g(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=g(e[n]):t[n]=e[n]})),t}function h(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=h(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?g(n):n}function y(e,t){return JSON.stringify(h(e))===JSON.stringify(h(t))}function v(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function O(e,t){const n=Object.getOwnPropertyDescriptors(e);for(const[e,a]of Object.entries(n))("get"in a||"set"in a)&&Object.defineProperty(t,e,a)}new Map;class w extends HTMLElement{constructor(){super()}connectedCallback(){m.trigger(this,"Connected")}disconnectedCallback(){m.trigger(this,"Disconnected")}adoptedCallback(){m.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){m.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function x(e){return null!=e&&"object"==typeof e}function E(e){let t=new Set,n=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(n))).forEach((a=>{new Set(e.getAttribute(a)?.match(n)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(n))).forEach((e=>{(e.nodeValue||"").match(n).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const k=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends m{data={};oldDisplay="";constructor(e){super(e);let t=this;E(e).forEach((e=>t.data[e]="")),j(t),t.#r(),delete t._mc}#r(){let e=this,t=e.target,n=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((n=>{let a=new Set(t.getAttribute(n)?.match(/\{[^\{\}]*\}/g));var r;e.data.observe((r=t.getAttribute(n),e=>{let l=r;a.forEach((t=>{l=l.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(n,l)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((a=>{n=!0;let r=new Set(a.nodeValue.match(/\{[^\{\}]*\}/g));var l;e.data.observe((l=a.nodeValue,n=>{let o=l;r.forEach((e=>{o=o.replace(e,n[e.replace(/[\{\}]/g,"")])})),Object.keys(n).some((e=>!!n[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),a.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",n&&!k.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,n={};Object.keys(e.data).forEach((a=>{t.data.hasOwnProperty(a)&&(n[a]=e.data[a])})),JSON.stringify(n)!==JSON.stringify(t.data)&&Object.assign(t.data,n)}}const j=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let n,a=e[t];if(!a.prototype)switch(typeof a){case"string":n=String;break;case"number":n=Number;break;case"boolean":n=Boolean;break;case"object":n=a instanceof Array?Array:Object;break;default:return}let r=class extends n{#l=!0;constructor(e){super(e),this.constructor.callbacks=[],x(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(x(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!E(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||m.add(e,"_placeholders",new A(e))}))}(e);const n=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),a=function(e){let t=h(e);n.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(a),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,n=x(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#l=e),t.constructor.callbacks.forEach((e=>{e(n)})),t}},l=new r(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(x(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(v((function(){y(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(x(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof r==0&&(l=new r(structuredClone(Object.assign({},e))),O(e,l),l.seal()),Object.assign(l,e),setTimeout(v((function(){y(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),n=l.constructor.callbacks;l=new r(e),l.constructor.callbacks=n,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class S{constructor(e){}}class _ extends S{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class T extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class N extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class C extends S{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class I extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class L{constructor(e,t,n){let a=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],n={};return t.forEach((e=>{const t=e.getAttribute("name")||"undefined";if(t){let a=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":a=new _(e);break;case"checkbox":a=new T(e);break;default:a=new N(e)}break;case"select":a=new C(e);break;case"textarea":a=new I(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(m.add(e,t,a),Object.defineProperty(n,t,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val!==e&&(a.val=e)}}))}})),n})(n);e[t]=Object.assign({},a),j(e,t),O(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{s(n,"keyup",(n=>{e[t].notify()})),s(n,"change",(n=>{e[t].notify()})),s(n,"select",(n=>{e[t].notify()}))}))}}return function(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let a=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends w{instance;constructor(e){super();let n=new t(this,e);m.add(this,a,n)}static get observedAttributes(){return n}}))}("test-testform",class extends m{data;constructor(e){super(e);const t=this;delete this._mc;let n=t.target.attachShadow({mode:"open"});n.innerHTML=`<style>${this.css}</style>${this.template}`,new L(t,"data",n),t.data.bind(n)}onConnected(){}oneInit(){}get template(){return'\n <form>\n \x3c!-- sample form to start with --\x3e\n <fieldset>\n <legend>Inputs</legend>\n <label>text</label><input type="text" name="textInput" value="Hallo" />&nbsp;<strong>2wB:&nbsp;</strong>{textInput}\n <label>color</label><input type="color" name="colorInput" value="" />\n <label>date</label><input type="date" name="dateInput" value="" />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" />\n <label>email</label><input type="email" name="email" value="" />\n <label>file</label><input type="file" name="fileInput" value="" />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" />\n <label>month</label><input type="month" name="month" value="" />\n <label>number</label><input type="number" name="number" value="" />\n <label>password</label><input type="password" name="passInput" value="" />\n <label>range</label><input type="range" name="rangeInput" value="" />\n <label>search</label><input type="search" name="searchInput" value="" />\n <label>tel</label><input type="tel" name="telInput" value="" />\n <label>time</label><input type="time" name="timeInput" value="" />\n <label>url</label><input type="url" name="urlInput" value="" />\n <label>week</label><input type="week" name="weekInput" value="" />\n </fieldset>\n\n <fieldset>\n <legend>Selects</legend>\n\n <label>singleSelect</label>\n <select name="singleSelect">\n <option disabled selected value> -- select -- </option>\n <option value="1">Option 1</option>\n <option value="2">Option 2</option>\n <option value="3">Option 3</option>\n <option value="4">Option 4</option>\n </select>\n\n <label>multiSelect</label>\n <select name="multiSelect" multiple="multiple" type="select-multiple">\n <option value="1">Option 1</option>\n <option value="2" selected=true>Option 2</option>\n <option value="3">Option 3</option>\n <option value="4" selected=true>Option 4</option>\n </select>\n\n </fieldset>\n\n <fieldset>\n <legend>Radiobuttons&nbsp;<strong>2wB:&nbsp;</strong><span>{myRadio}</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1">\n <label>radio2</label><input type="radio" name="myRadio" value="radio2">\n <label>radio3</label><input type="radio" name="myRadio" value="radio3">\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1">\n <label>cb2</label><input type="checkbox" name="cb2">\n <label>cb3</label><input type="checkbox" name="cb3">\n <label>cb4</label><input type="checkbox" name="cb4">\n <label>cb5</label><input type="checkbox" name="cb5">\n\n </fieldset>\n\n <fieldset>\n <legend>TextArea</legend>\n <label>textArea</label>\n <textarea name="textArea">abc</textarea>\n </fieldset>\n\n </form>\n '}get css(){return"\nlegend {\n display: inherit;\n margin: inherit;\n vertical-align: inherit;\n}\n\nlabel {\n display: inline;\n margin-top: 5px;\n margin-left: 5px;\n vertical-align: top;\n width: 10em;\n text-align: right;\n}\n\nlabel::before {\n content: ' ';\n display: block;\n}\n\nform input,\nform select,\nform textarea {\n margin-left: 5px;\n margin-top: 0px;\n display: inline;\n}\n\nform label + textarea {\n display: inline-block;\n margin-top: 3px;\n}\n\nform input + label {\n width: inherit;\n margin-top: 3px;\n text-align: left;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid darkslategrey;\n border-radius: 3px;\n margin: 0.5em 0;\n}\n "}}),{}})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TestTestform=t():e.TestTestform=t()}(self,(()=>(()=>{"use strict";var e=new Function("try {return this===window;}catch(e){ return false;}");let t=new Set;e()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>t.add(e)));class n{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;function l(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const a=e?._mc;!t&&a?n=n.concat(Object.values(e._mc)):t&&a&&a[t]&&n.push(a[t])}})),n}function o(e,t,n=!0){let a=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&a.push(e._mc[t]):a=a.concat(Object.values(e._mc)),n))return a;e=e.parentNode}return a}function i(e){return e&&e instanceof HTMLElement}function s(e,t,n,a=!1,r=!1){let l={once:!1};a&&(l.capture=a),r&&(l.once=r),e.addEventListener(t,n,l)}function c(e,t,n={}){let a=e;if(!a._mc){let t=m?.debug;m.debug=!1,a._mc=new m(e),m.debug=t,delete a._mc._mc}const r=a._mc;return t.length&&!r[t]&&(r[t]=n,e instanceof HTMLElement&&e.setAttribute("_mc","")),n}function u(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,a={},r="l"){let l=e?._mc;if(!l)return;let o=t instanceof n?new n(t.type,t.data,"l"):new n(t,a,"l"),i="string"!=typeof t?t:new n(t,a,r);[...Object.values(l)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&d(e,i)}function d(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=o(e,"",!0)?.[0].target;n&&m.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&m.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class b{#a;constructor(e,t=!1){var n;this.#a=new WeakRef(e||{}),(n=this).constructor!==m&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!a()||e.constructor===m)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((a=>{let l=/^one/.test(a),o=a.replace(/^on[e]{0,1}/,""),i=o.toLowerCase();l&&Object.defineProperty(e,"on"+o,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[a].bind(n)(e)}}),r.has("on"+i)&&s(t,i,(e=>{n.trigger(o,e)}),!1,l)}))}}(this)}get target(){return this.#a.deref()}}class f extends b{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},a="l"){let r=this;if(r.constructor===f||r.constructor===m){let l=e instanceof n?new n(e.type,e.data,"l"):new n(e,t,"l"),o="string"!=typeof e?e:new n(e,t,a);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(l)})),void(/[ud]/.test(o.bubble)&&d(r.target,o))}if(r instanceof f||r instanceof m){const r=this,l="string"!=typeof e?e:new n(e,t,a),o="on"+l.type[0].toUpperCase()+l.type.slice(1);if(l.bubble.indexOf("l")>-1&&(l.immediateStopped||"function"!=typeof r[o]||(r[o](l),r.hasOwnProperty(o)&&delete r[o])),l.stopped||"l"===l.bubble)return r;/[ud]/.test(l.bubble)&&d(r.target,l)}}}class m extends b{_mc={};constructor(e,t=!1){super(e)}static add=c;static remove=u;static trigger=p;trigger(e,t={},n){f.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return i(t)?o(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return i(t)?o(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!i(t))return[];const n=Math.random().toString().replace(".",""),a='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const r=l([...t.querySelectorAll(a)],e);return t.removeAttribute("temp_id"),r}descendants(e=""){let t=this?.target;return i(t)?l([...t.querySelectorAll("*[_mc]")],e):[]}}function g(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=g(e[n]):t[n]=e[n]})),t}function h(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=h(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?g(n):n}function y(e,t){return JSON.stringify(h(e))===JSON.stringify(h(t))}function v(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function O(e,t){const n=Object.getOwnPropertyDescriptors(e);for(const[e,a]of Object.entries(n))("get"in a||"set"in a)&&Object.defineProperty(t,e,a)}new Map;class w extends HTMLElement{constructor(){super()}connectedCallback(){m.trigger(this,"Connected")}disconnectedCallback(){m.trigger(this,"Disconnected")}adoptedCallback(){m.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){m.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function x(e){return null!=e&&"object"==typeof e}function E(e){let t=new Set,n=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(n))).forEach((a=>{new Set(e.getAttribute(a)?.match(n)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(n))).forEach((e=>{(e.nodeValue||"").match(n).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,""))),[...t]}const k=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class A extends m{data={};oldDisplay="";constructor(e){super(e);let t=this;E(e).forEach((e=>t.data[e]="")),j(t),t.#r(),delete t._mc}#r(){let e=this,t=e.target,n=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((n=>{let a=new Set(t.getAttribute(n)?.match(/\{[^\{\}]*\}/g));var r;e.data.observe((r=t.getAttribute(n),e=>{let l=r;a.forEach((t=>{l=l.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(n,l)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((a=>{n=!0;let r=new Set(a.nodeValue.match(/\{[^\{\}]*\}/g));var l;e.data.observe((l=a.nodeValue,n=>{let o=l;r.forEach((e=>{o=o.replace(e,n[e.replace(/[\{\}]/g,"")])})),Object.keys(n).some((e=>!!n[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),a.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",n&&!k.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,n={};Object.keys(e.data).forEach((a=>{t.data.hasOwnProperty(a)&&(n[a]=e.data[a])})),JSON.stringify(n)!==JSON.stringify(t.data)&&Object.assign(t.data,n)}}const j=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let n,a=e[t];if(!a.prototype)switch(typeof a){case"string":n=String;break;case"number":n=Number;break;case"boolean":n=Boolean;break;case"object":n=a instanceof Array?Array:Object;break;default:return}let r=class extends n{#l=!0;constructor(e){super(e),this.constructor.callbacks=[],x(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(x(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!E(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||m.add(e,"_placeholders",new A(e))}))}(e);const n=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),a=function(e){let t=h(e);n.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(a),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,n=x(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#l=e),t.constructor.callbacks.forEach((e=>{e(n)})),t}},l=new r(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(x(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(v((function(){y(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(x(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));l instanceof r==0&&(l=new r(structuredClone(Object.assign({},e))),O(e,l),l.seal()),Object.assign(l,e),setTimeout(v((function(){y(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),n=l.constructor.callbacks;l=new r(e),l.constructor.callbacks=n,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),l,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class S{constructor(e){}}class _ extends S{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class T extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class N extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class C extends S{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class I extends S{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}class L{constructor(e,t,n){let a=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],n={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let a=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":a=new _(e);break;case"checkbox":a=new T(e);break;default:a=new N(e)}break;case"select":a=new C(e);break;case"textarea":a=new I(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(m.add(e,t,a),Object.defineProperty(n,t,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val!==e&&(a.val=e)}}))}})),n})(n);e[t]=Object.assign({},a),j(e,t),O(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{s(n,"keyup",(n=>{e[t].notify()})),s(n,"change",(n=>{e[t].notify()})),s(n,"select",(n=>{e[t].notify()}))}))}}return function(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let a=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends w{instance;constructor(e){super();let n=new t(this,e);m.add(this,a,n)}static get observedAttributes(){return n}}))}("test-testform",class extends m{data;constructor(e){super(e);const t=this;delete this._mc;let n=t.target.attachShadow({mode:"open"});n.innerHTML=`<style>${this.css}</style>${this.template}`,new L(t,"data",n),t.data.bind(n)}onConnected(){}oneInit(){}get template(){return'\n <form>\n \x3c!-- sample form to start with --\x3e\n <fieldset>\n <legend>Inputs</legend>\n <label>text</label><input type="text" name="textInput" value="Hallo" />&nbsp;<strong>2wB:&nbsp;</strong>{textInput}\n <label>color</label><input type="color" name="colorInput" value="" />\n <label>date</label><input type="date" name="dateInput" value="" />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" />\n <label>email</label><input type="email" name="email" value="" />\n <label>file</label><input type="file" name="fileInput" value="" />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" />\n <label>month</label><input type="month" name="month" value="" />\n <label>number</label><input type="number" name="number" value="" />\n <label>password</label><input type="password" name="passInput" value="" />\n <label>range</label><input type="range" name="rangeInput" value="" />\n <label>search</label><input type="search" name="searchInput" value="" />\n <label>tel</label><input type="tel" name="telInput" value="" />\n <label>time</label><input type="time" name="timeInput" value="" />\n <label>url</label><input type="url" name="urlInput" value="" />\n <label>week</label><input type="week" name="weekInput" value="" />\n </fieldset>\n\n <fieldset>\n <legend>Selects</legend>\n\n <label>singleSelect</label>\n <select name="singleSelect">\n <option disabled selected value> -- select -- </option>\n <option value="1">Option 1</option>\n <option value="2">Option 2</option>\n <option value="3">Option 3</option>\n <option value="4">Option 4</option>\n </select>\n\n <label>multiSelect</label>\n <select name="multiSelect" multiple="multiple" type="select-multiple">\n <option value="1">Option 1</option>\n <option value="2" selected=true>Option 2</option>\n <option value="3">Option 3</option>\n <option value="4" selected=true>Option 4</option>\n </select>\n\n </fieldset>\n\n <fieldset>\n <legend>Radiobuttons&nbsp;<strong>2wB:&nbsp;</strong><span>{myRadio}</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1">\n <label>radio2</label><input type="radio" name="myRadio" value="radio2">\n <label>radio3</label><input type="radio" name="myRadio" value="radio3">\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1">\n <label>cb2</label><input type="checkbox" name="cb2">\n <label>cb3</label><input type="checkbox" name="cb3">\n <label>cb4</label><input type="checkbox" name="cb4">\n <label>cb5</label><input type="checkbox" name="cb5">\n\n </fieldset>\n\n <fieldset>\n <legend>TextArea</legend>\n <label>textArea</label>\n <textarea name="textArea">abc</textarea>\n </fieldset>\n\n </form>\n '}get css(){return"\nlegend {\n display: inherit;\n margin: inherit;\n vertical-align: inherit;\n}\n\nlabel {\n display: inline;\n margin-top: 5px;\n margin-left: 5px;\n vertical-align: top;\n width: 10em;\n text-align: right;\n}\n\nlabel::before {\n content: ' ';\n display: block;\n}\n\nform input,\nform select,\nform textarea {\n margin-left: 5px;\n margin-top: 0px;\n display: inline;\n}\n\nform label + textarea {\n display: inline-block;\n margin-top: 3px;\n}\n\nform input + label {\n width: inherit;\n margin-top: 3px;\n text-align: left;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid darkslategrey;\n border-radius: 3px;\n margin: 0.5em 0;\n}\n "}}),{}})()));
package/src/formValues.ts CHANGED
@@ -115,17 +115,13 @@ class SelectHandler extends InputBase {
115
115
  value = typeof value === 'string' ? [value] : value;
116
116
 
117
117
  // set all options
118
- const options = [...that.#e.querySelectorAll('option')].forEach((o) => {
118
+ [...that.#e.querySelectorAll('option')].forEach((o) => {
119
119
  if (value.indexOf(o.value) > -1) {
120
- o.setAttribute('selected', 'selected');
121
120
  o.selected = true;
122
121
  } else {
123
- o.removeAttribute('selected');
124
122
  o.selected = false;
125
123
  }
126
124
  });
127
-
128
- return;
129
125
  }
130
126
  }
131
127
 
@@ -142,7 +138,6 @@ class TextAreaHandler extends InputBase {
142
138
 
143
139
  set val(value: string) {
144
140
  this.#e.value = value;
145
- return;
146
141
  }
147
142
  }
148
143
 
@@ -153,8 +148,7 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
153
148
  handlers: LooseObject = {};
154
149
 
155
150
  inputList.forEach((i) => {
156
- const name: string = (i as inputTypes).getAttribute('name') || 'undefined';
157
- // console.log(name);
151
+ const name: string | null = (i as inputTypes).getAttribute('name');
158
152
  if (name) {
159
153
  let handler: any = false;
160
154
  switch (getInputName(i as inputTypes)) {