@twobirds/microcomponents 0.0.100 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MC.js +1 -1
- package/dist/MC.min.js +1 -1
- package/dist/MC.ts +3 -3
- package/dist/elements.min.js +1 -1
- package/dist/formValues.min.js +1 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.min.js +1 -1
- package/package.json +1 -1
- package/public/MC.js +1 -1
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +1 -1
- package/public/MC.ts +3 -3
- package/public/elements.min.js +1 -1
- package/public/formValues.min.js +1 -1
- package/public/microcomponents.min.js +1 -1
- package/public/observables.min.js +1 -1
- package/public/src/MC.js +1 -1
- package/public/src/MC.js.map +1 -1
- package/public/src/MC.ts +3 -3
- package/public/src/test/test/grandparent.js +1 -1
- package/public/src/test/test/testform.js +1 -1
- package/public/test/MC.js +1 -1
- package/public/test/MC.min.js +1 -1
- package/public/test/MC.ts +3 -3
- package/public/test/elements.min.js +1 -1
- package/public/test/formValues.min.js +1 -1
- package/public/test/microcomponents.min.js +1 -1
- package/public/test/observables.min.js +1 -1
- package/public/test/test/grandparent.js +1 -1
- package/public/test/test/testform.js +1 -1
- package/public/typedoc/classes/MC.DC.html +2 -2
- package/public/typedoc/classes/MC.MC.html +2 -2
- package/public/typedoc/classes/MC.McBase.html +2 -2
- package/public/typedoc/functions/MC.autoload.html +1 -1
- package/public/typedoc/functions/MC.off.html +1 -1
- package/public/typedoc/functions/MC.on.html +1 -1
- package/public/typedoc/functions/MC.one.html +1 -1
- package/public/typedoc/functions/MC.trigger.html +1 -1
- package/public/typedoc/functions/elements.defineCE.html +1 -1
- package/public/typedoc/functions/elements.getCE.html +1 -1
- package/public/typedoc/functions/formValues.formValues.html +1 -1
- package/public/typedoc/functions/observables.observe.html +1 -1
- package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/typedoc/modules/MC.html +1 -1
- package/public/typedoc/modules/elements.html +1 -1
- package/public/typedoc/modules/formValues.html +1 -1
- package/public/typedoc/modules/observables.html +1 -1
- package/public/typedoc/types/observables.Observable.html +1 -1
- package/src/MC.ts +3 -3
package/public/src/MC.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MC.js","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,MAAM,SAAS,GAAG,IAAI,QAAQ,CAC7B,qDAAqD,CACrD,CAAC;AAMF,SAAS,KAAK,CAAC,OAA+B;IAC7C,OAAO,OAAO,IAAI,OAAO,YAAY,WAAW,CAAC;AAClD,CAAC;AAGD,SAAS,GAAG,CAAE,MAAmB,EAAE,GAAW,EAAE,UAAe,EAAE;IAChE,IAAI,IAAI,GAAG,MAAuB,CAAC;IAGnC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,IAAK,EAAU,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IAGrB,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QAEnB,IAAI,MAAM,YAAY,WAAW,IAAI,CAAE,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,EAAG,CAAC;YACxE,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAGD,SAAS,MAAM,CAAC,MAAmB,EAAE,GAAW;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,MAAM,GAAG,GAAI,MAAmC,EAAE,GAAG,IAAI,EAAE,CAAC;IAG5D,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACr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package/public/src/MC.ts
CHANGED
|
@@ -129,7 +129,7 @@ function trigger(
|
|
|
129
129
|
setTimeout(
|
|
130
130
|
() => {
|
|
131
131
|
|
|
132
|
-
// bubble up towards
|
|
132
|
+
// bubble up towards document.body
|
|
133
133
|
if ( bubble.indexOf('u') > -1 ) {
|
|
134
134
|
let parentMc: HTMLMcElement | null | undefined = domNode.parentElement?.closest('[data-mc]') ;
|
|
135
135
|
if ( !!parentMc ){
|
|
@@ -137,11 +137,11 @@ function trigger(
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
// bubble down
|
|
140
|
+
// bubble down towards DOM children
|
|
141
141
|
if (bubble.indexOf('d') > -1) {
|
|
142
142
|
let childNodes: DC[] | null = ( domNode as HTMLMcElement)._mc.children();
|
|
143
143
|
if( !!childNodes ){
|
|
144
|
-
childNodes.forEach( (_mc: DC) => _mc.trigger( eventName, data, bubble
|
|
144
|
+
childNodes.forEach( (_mc: DC) => _mc.trigger( eventName, data, bubble ) ); // event multiplex - dont carry bubble controller
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grandparent=e():t.grandparent=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{GrandParent:()=>w});const n=new Function("try {return this===window;}catch(e){ return false;}");function o(t){return t&&t instanceof HTMLElement}function r(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function s(t,e,n,o=!1){return t.addEventListener(r(e),n,{capture:!1,once:o}),n}class c{stopped=!1;constructor(){}stop(){this.stopped=!0}}class a{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==l&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===l)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let o=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),c=r.toLowerCase();if("on"+c in e){let o=e=>{n[t](e)};e.addEventListener(c,o)}else s(e,r,(e=>{n[t](e)}),o)}))}}(this)}get target(){return this._target.deref()}}class l extends a{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let o=t;o._mc||(o._mc=new l(t));const r=o._mc;return e.length&&!r[e]&&(r[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),o}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(r(e),n)}(this.target,t,e)}on(t,e){return s(this.target,t,e)}one(t,e){return function(t,e,n){return s(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",o){!function(t,e,n={},o="l",s){const a=/^_mc/.test(e)?e:r(e),l=s||new c,i=new CustomEvent(a,{detail:{data:n,control:l},bubbles:!1});l.stopped||(t.dispatchEvent(i),i.stopImmediatePropagation(),l.stopped||/[ud]/.test(o)&&(-1===o.indexOf("l")&&(o+="l"),setTimeout((()=>{if(o.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(a,n,o,l)}if(o.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(a,n,o
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grandparent=e():t.grandparent=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{GrandParent:()=>w});const n=new Function("try {return this===window;}catch(e){ return false;}");function o(t){return t&&t instanceof HTMLElement}function r(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function s(t,e,n,o=!1){return t.addEventListener(r(e),n,{capture:!1,once:o}),n}class c{stopped=!1;constructor(){}stop(){this.stopped=!0}}class a{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==l&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===l)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let o=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),c=r.toLowerCase();if("on"+c in e){let o=e=>{n[t](e)};e.addEventListener(c,o)}else s(e,r,(e=>{n[t](e)}),o)}))}}(this)}get target(){return this._target.deref()}}class l extends a{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let o=t;o._mc||(o._mc=new l(t));const r=o._mc;return e.length&&!r[e]&&(r[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),o}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(r(e),n)}(this.target,t,e)}on(t,e){return s(this.target,t,e)}one(t,e){return function(t,e,n){return s(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",o){!function(t,e,n={},o="l",s){const a=/^_mc/.test(e)?e:r(e),l=s||new c,i=new CustomEvent(a,{detail:{data:n,control:l},bubbles:!1});l.stopped||(t.dispatchEvent(i),i.stopImmediatePropagation(),l.stopped||/[ud]/.test(o)&&(-1===o.indexOf("l")&&(o+="l"),setTimeout((()=>{if(o.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(a,n,o,l)}if(o.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(a,n,o)))}}),0)))}(this.target,t,e,n,o)}ancestors(){let t=this?.target,e=[];if(!o(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return o(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return o(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const o=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),o.length?o:null}(t):null}descendants(){const t=this?.target;if(!o(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}new Set;class i extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function d(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function u(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let o=t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("");d(e.prototype.constructor)&&e.prototype instanceof a?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(o,class extends i{instance;constructor(t){super();const n=d(e)?new e(this,t):e;l.add(this,o,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function p(t){return customElements.get(t)}function m(t,e){return Math.floor(Math.random()*(e-t+1)+t)}u("test-greatgrandchild",class extends l{constructor(t){super(t)}onConnected(){this.updateStyle()}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('greatgrandchild "Up" handler')}updateStyle(){this.target.setAttribute("style","border-color:rgb("+m(0,255)+","+m(0,255)+","+m(0,255)+")")}});const g=p("test-greatgrandchild");u("test-grandchild",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<2;e++)t.target.append(new g)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('grandchild "Up" handler')}});const h=p("test-grandchild");u("test-child",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<10;e++)t.target.append(new h)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('child "Up" handler'),t.detail.control.stop()}onDown(t){console.log('child "Down" handler')}});const f=p("test-child");u("test-parent",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<5;e++)t.target.append(new f)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('parent "Up" handler')}onDown(t){console.log('parent "Down" handler')}});const b=p("test-parent");u("test-grandparent",class extends l{constructor(t){super(t)}onConnected(t){for(let t=0;t<5;t++)this.target.append(new b)}onDisconnected(t){}onAdopted(t){}onAttributeChanged(t){}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('grandparent "Up" handler'),this.trigger("Down",{},"ld")}onDown(t){console.log('grandparent "Down" handler')}});const w=p("test-grandparent");return e})()));
|
|
@@ -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";const e=new Function("try {return this===window;}catch(e){ return false;}");function t(e){return e&&e instanceof HTMLElement}function n(e){return"_mc"+e[0].toUpperCase()+e.substring(1)}function a(e,t,a,l=!1){return e.addEventListener(n(t),a,{capture:!1,once:l}),a}class l{stopped=!1;constructor(){}stop(){this.stopped=!0}}function r(e,t,a={},r="l",s){const o=/^_mc/.test(t)?t:n(t),i=s||new l,c=new CustomEvent(o,{detail:{data:a,control:i},bubbles:!1});i.stopped||(e.dispatchEvent(c),c.stopImmediatePropagation(),i.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let t=e.parentElement?.closest("[data-mc]");t&&t?._mc.trigger(o,a,r,i)}if(r.indexOf("d")>-1){let t=e._mc.children();t&&t.forEach((e=>e.trigger(o,a,r,i)))}}),0)))}class s{_target;constructor(t){var n;this._target=new WeakRef(t||{}),n=this,setTimeout((()=>{n.constructor!==o&&n.trigger("Init")}),0),function(t){if(!e()||t.constructor===o)return;const n=t.target;if(n instanceof HTMLElement){let e=t;Object.getOwnPropertyNames(e.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof e.constructor.prototype[t])).forEach((t=>{let l=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),s=r.toLowerCase();if("on"+s in n){let a=n=>{e[t](n)};n.addEventListener(s,a)}else a(n,r,(n=>{e[t](n)}),l)}))}}(this)}get target(){return this._target.deref()}}class o extends s{constructor(e){super(e)}static add(e,t,n={}){return function(e,t,n={}){let a=e;a._mc||(a._mc=new o(e));const l=a._mc;return t.length&&!l[t]&&(l[t]=n,e instanceof HTMLElement&&!e.getAttribute("data-mc")&&e.setAttribute("data-mc","")),a}(e,t,n)}static remove(e,t){!function(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("data-mc")&&e.removeAttribute("data-mc")}(e,t)}off(e,t){!function(e,t,a){e.removeEventListener(n(t),a)}(this.target,e,t)}on(e,t){return a(this.target,e,t)}one(e,t){return function(e,t,n){return a(e,t,n,!0),n}(this.target,e,t)}trigger(e,t={},n="l",a){r(this.target,e,t,n,a)}ancestors(){let e=this?.target,n=[];if(!t(e))return[];for(;e=e.closest("[data-mc]");)e?._mc&&n.push(e?._mc);return n.length?n:null}closest(){let e=this.target;return t(e)&&e.closest("[data-mc]")?._mc||null}children(){let e=this?.target;return t(e)?function(e){const t=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+t+'"] [data-mc] [data-mc])';e.setAttribute("temp_id",t);const a=[...e.querySelectorAll(n)].filter((e=>!!e._mc)).map((e=>e._mc));return e.removeAttribute("temp_id"),a.length?a:null}(e):null}descendants(){const e=this?.target;if(!t(e))return[];const n=[...e.querySelectorAll("[data-mc]")].filter((e=>!!e._mc)).map((e=>e._mc));return n.length?n:null}}function i(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=i(e[n]):t[n]=e[n]})),t}function c(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=c(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?i(n):n}function u(e,t){return JSON.stringify(c(e))===JSON.stringify(c(t))}function p(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function d(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 Set;class b extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(e,t,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:e,oldValue:t,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function m(e){return"function"==typeof e&&/^class\s/.test(Function.prototype.toString.call(e))}function f(e){return null!=e&&"object"==typeof e}function h(e){let t=new Set,n=/\{[^\{\}]*\}/g;return(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(n))).forEach((t=>{let a=new Set(e.getAttribute(t)?.match(n));a.forEach((e=>a.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,"")))}const g=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends o{data={};oldDisplay="";constructor(e){super(e),h(e).forEach((e=>this.data[e]="")),E(this),this.#e()}#e(){let e=this.target,t=!1;(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(/\{[^\{\}]*\}/g))).forEach((t=>{let n=new Set(e.getAttribute(t)?.match(/\{[^\{\}]*\}/g));var a;this.data.observe((a=e.getAttribute(t),l=>{let r=a;n.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),e.setAttribute(t,r)}))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{t=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((t=>l=>{let r=t;a.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),this.oldDisplay?e.style=this.oldDisplay:e.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=r})(n.nodeValue)),this.oldDisplay=e.getAttribute("style")||"",t&&!g.includes(e.constructor)&&"FIELDSET"!==e.tagName&&(e.style.display="none")}))}onData(e){let t={};Object.keys(e.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(t[n]=e.detail.data[n])})),JSON.stringify(t)!==JSON.stringify(this.data)&&Object.assign(this.data,t)}}const v={};function O(e){let t=e.constructor.name;return v[t]||function(e){const t=e.constructor,n=t.name;let a=class extends t{#t=!0;#n=[];constructor(e){super(e),this.constructor.callbacks=[],f(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}get callbacks(){return this.#n}set callbacks(e){this.#n=e}observe(e){return this.#n.push(e),this}bind(e){if(f(this.valueOf())){!function(e){var t;(t=e,[t].concat([...t.querySelectorAll("*")]).filter((e=>!!h(e).length)).filter((e=>"STYLE"!==e?.tagName)).reverse()).forEach((e=>{e?._mc?._placeholders||o.add(e,"_placeholders",new y(e))}))}(e);const t=[e,...e.querySelectorAll("[data-mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let n=c(e);t.forEach((e=>{e&&r(e,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(e){let t=f(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==e&&(this.#t=e),this.#n.forEach((e=>{e(t)})),this}};return v[n]=a,a}(e)}const E=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if(e.hasOwnProperty(t)&&"function"!=typeof e[t]&&!e?.[t]?.constructor?.prototype?.observe){if("_"===t[0]||void 0===e?.[t])return e;let n=e[t],a=new(O(n))(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(f(a.valueOf())){let e=structuredClone(Object.assign({},a));setTimeout(p((function(){u(structuredClone(Object.assign({},a)),e)||a.notify()}),0),0)}return a},set(e){if(typeof e==typeof a.valueOf())if(f(a.valueOf())&&a.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},a));void 0===a?.constructor?.prototype?.observe&&(a=new(O(e))(structuredClone(Object.assign({},e))),d(e,a),a.seal()),Object.assign(a,e),setTimeout(p((function(){u(structuredClone(Object.assign({},a)),t)||a.notify()}),0),0)}else{let t=a.valueOf(),n=a.callbacks;e!==t&&(a=new(O(e))(e),a.callbacks=n,a.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof a.valueOf(),a,"- CANNOT BECOME:",typeof e)}}),e[t]=n}})),e);class w{constructor(e){}}class x extends w{#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 k extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class A extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class C extends w{#a;#l=!1;constructor(e){super(e),this.#a=e,this.#l=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#l?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 S extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}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("");m(t.prototype.constructor)&&t.prototype instanceof s?customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends b{instance;constructor(e){super();const n=m(t)?new t(this,e):t;o.add(this,a,n)}static get observedAttributes(){return n}})):customElements.define(e,t)}("test-testform",class extends o{data;constructor(e){super(e);let t=this.target.attachShadow({mode:"open"});t.innerHTML=`<style>${this.css}</style>${this.template}`,function(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 x(e);break;case"checkbox":a=new k(e);break;default:a=new A(e)}break;case"select":a=new C(e);break;case"textarea":a=new S(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(o.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),E(e,t),d(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{e[t].notify()}))}))}(this,"data",t),this.data.bind(t),fetch("./testform.json").then((e=>e.json())).then((e=>{this.data=e}))}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" /> <strong>2wB: </strong>{textInput}<br />\n <label>color</label><input type="color" name="colorInput" value="#000000" /><br />\n <label>date</label><input type="date" name="dateInput" value="" /><br />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" /><br />\n <label>email</label><input type="email" name="email" value="" /><br />\n <label>file</label><input type="file" name="fileInput" value="" /><br />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" /><br />\n <label>month</label><input type="month" name="month" value="" /><br />\n <label>number</label><input type="number" name="number" value="" /><br />\n <label>password</label><input type="password" name="passInput" value="" /><br />\n <label>range</label><input type="range" name="rangeInput" value="" /><br />\n <label>search</label><input type="search" name="searchInput" value="" /><br />\n <label>tel</label><input type="tel" name="telInput" value="" /><br />\n <label>time</label><input type="time" name="timeInput" value="" /><br />\n <label>url</label><input type="url" name="urlInput" value="" /><br />\n <label>week</label><input type="week" name="weekInput" value="" /><br />\n </fieldset>\n\n <fieldset>\n <legend>Selects <strong>2wB: </strong> <span>"{singleSelect}"</span> <span>[{multiSelect}]</span></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><br />\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 <strong>2wB: </strong><span>"{myRadio}"</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1"><br />\n <label>radio2</label><input type="radio" name="myRadio" value="radio2"><br />\n <label>radio3</label><input type="radio" name="myRadio" value="radio3"><br />\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1"><br />\n <label>cb2</label><input type="checkbox" name="cb2"><br />\n <label>cb3</label><input type="checkbox" name="cb3"><br />\n <label>cb4</label><input type="checkbox" name="cb4"><br />\n <label>cb5</label><input type="checkbox" name="cb5"><br />\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 font-weight: bold;\n}\n\nlabel {\n display: inline-block;\n margin-top: 1em;\n margin-left: 5px;\n vertical-align: top;\n min-width:10em;\n text-align: right;\n}\n\nform input,\nform select,\nform textarea {\n display: inline-block;\n margin-left: 5px;\n margin-top: 1.1em;\n}\n\ninput[type="radio"],\ninput[type="checkbox"] {\n margin-top: 1.3em;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid #aaaaaa;\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";const e=new Function("try {return this===window;}catch(e){ return false;}");function t(e){return e&&e instanceof HTMLElement}function n(e){return"_mc"+e[0].toUpperCase()+e.substring(1)}function a(e,t,a,l=!1){return e.addEventListener(n(t),a,{capture:!1,once:l}),a}class l{stopped=!1;constructor(){}stop(){this.stopped=!0}}function r(e,t,a={},r="l",s){const o=/^_mc/.test(t)?t:n(t),i=s||new l,c=new CustomEvent(o,{detail:{data:a,control:i},bubbles:!1});i.stopped||(e.dispatchEvent(c),c.stopImmediatePropagation(),i.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let t=e.parentElement?.closest("[data-mc]");t&&t?._mc.trigger(o,a,r,i)}if(r.indexOf("d")>-1){let t=e._mc.children();t&&t.forEach((e=>e.trigger(o,a,r)))}}),0)))}class s{_target;constructor(t){var n;this._target=new WeakRef(t||{}),n=this,setTimeout((()=>{n.constructor!==o&&n.trigger("Init")}),0),function(t){if(!e()||t.constructor===o)return;const n=t.target;if(n instanceof HTMLElement){let e=t;Object.getOwnPropertyNames(e.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof e.constructor.prototype[t])).forEach((t=>{let l=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),s=r.toLowerCase();if("on"+s in n){let a=n=>{e[t](n)};n.addEventListener(s,a)}else a(n,r,(n=>{e[t](n)}),l)}))}}(this)}get target(){return this._target.deref()}}class o extends s{constructor(e){super(e)}static add(e,t,n={}){return function(e,t,n={}){let a=e;a._mc||(a._mc=new o(e));const l=a._mc;return t.length&&!l[t]&&(l[t]=n,e instanceof HTMLElement&&!e.getAttribute("data-mc")&&e.setAttribute("data-mc","")),a}(e,t,n)}static remove(e,t){!function(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("data-mc")&&e.removeAttribute("data-mc")}(e,t)}off(e,t){!function(e,t,a){e.removeEventListener(n(t),a)}(this.target,e,t)}on(e,t){return a(this.target,e,t)}one(e,t){return function(e,t,n){return a(e,t,n,!0),n}(this.target,e,t)}trigger(e,t={},n="l",a){r(this.target,e,t,n,a)}ancestors(){let e=this?.target,n=[];if(!t(e))return[];for(;e=e.closest("[data-mc]");)e?._mc&&n.push(e?._mc);return n.length?n:null}closest(){let e=this.target;return t(e)&&e.closest("[data-mc]")?._mc||null}children(){let e=this?.target;return t(e)?function(e){const t=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+t+'"] [data-mc] [data-mc])';e.setAttribute("temp_id",t);const a=[...e.querySelectorAll(n)].filter((e=>!!e._mc)).map((e=>e._mc));return e.removeAttribute("temp_id"),a.length?a:null}(e):null}descendants(){const e=this?.target;if(!t(e))return[];const n=[...e.querySelectorAll("[data-mc]")].filter((e=>!!e._mc)).map((e=>e._mc));return n.length?n:null}}function i(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=i(e[n]):t[n]=e[n]})),t}function c(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=c(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?i(n):n}function u(e,t){return JSON.stringify(c(e))===JSON.stringify(c(t))}function p(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function d(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 Set;class b extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(e,t,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:e,oldValue:t,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function m(e){return"function"==typeof e&&/^class\s/.test(Function.prototype.toString.call(e))}function f(e){return null!=e&&"object"==typeof e}function h(e){let t=new Set,n=/\{[^\{\}]*\}/g;return(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(n))).forEach((t=>{let a=new Set(e.getAttribute(t)?.match(n));a.forEach((e=>a.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,"")))}const g=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends o{data={};oldDisplay="";constructor(e){super(e),h(e).forEach((e=>this.data[e]="")),E(this),this.#e()}#e(){let e=this.target,t=!1;(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(/\{[^\{\}]*\}/g))).forEach((t=>{let n=new Set(e.getAttribute(t)?.match(/\{[^\{\}]*\}/g));var a;this.data.observe((a=e.getAttribute(t),l=>{let r=a;n.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),e.setAttribute(t,r)}))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{t=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((t=>l=>{let r=t;a.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),this.oldDisplay?e.style=this.oldDisplay:e.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=r})(n.nodeValue)),this.oldDisplay=e.getAttribute("style")||"",t&&!g.includes(e.constructor)&&"FIELDSET"!==e.tagName&&(e.style.display="none")}))}onData(e){let t={};Object.keys(e.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(t[n]=e.detail.data[n])})),JSON.stringify(t)!==JSON.stringify(this.data)&&Object.assign(this.data,t)}}const v={};function O(e){let t=e.constructor.name;return v[t]||function(e){const t=e.constructor,n=t.name;let a=class extends t{#t=!0;#n=[];constructor(e){super(e),this.constructor.callbacks=[],f(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}get callbacks(){return this.#n}set callbacks(e){this.#n=e}observe(e){return this.#n.push(e),this}bind(e){if(f(this.valueOf())){!function(e){var t;(t=e,[t].concat([...t.querySelectorAll("*")]).filter((e=>!!h(e).length)).filter((e=>"STYLE"!==e?.tagName)).reverse()).forEach((e=>{e?._mc?._placeholders||o.add(e,"_placeholders",new y(e))}))}(e);const t=[e,...e.querySelectorAll("[data-mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let n=c(e);t.forEach((e=>{e&&r(e,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(e){let t=f(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==e&&(this.#t=e),this.#n.forEach((e=>{e(t)})),this}};return v[n]=a,a}(e)}const E=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if(e.hasOwnProperty(t)&&"function"!=typeof e[t]&&!e?.[t]?.constructor?.prototype?.observe){if("_"===t[0]||void 0===e?.[t])return e;let n=e[t],a=new(O(n))(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(f(a.valueOf())){let e=structuredClone(Object.assign({},a));setTimeout(p((function(){u(structuredClone(Object.assign({},a)),e)||a.notify()}),0),0)}return a},set(e){if(typeof e==typeof a.valueOf())if(f(a.valueOf())&&a.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},a));void 0===a?.constructor?.prototype?.observe&&(a=new(O(e))(structuredClone(Object.assign({},e))),d(e,a),a.seal()),Object.assign(a,e),setTimeout(p((function(){u(structuredClone(Object.assign({},a)),t)||a.notify()}),0),0)}else{let t=a.valueOf(),n=a.callbacks;e!==t&&(a=new(O(e))(e),a.callbacks=n,a.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof a.valueOf(),a,"- CANNOT BECOME:",typeof e)}}),e[t]=n}})),e);class w{constructor(e){}}class x extends w{#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 k extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class A extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class C extends w{#a;#l=!1;constructor(e){super(e),this.#a=e,this.#l=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#l?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 S extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}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("");m(t.prototype.constructor)&&t.prototype instanceof s?customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends b{instance;constructor(e){super();const n=m(t)?new t(this,e):t;o.add(this,a,n)}static get observedAttributes(){return n}})):customElements.define(e,t)}("test-testform",class extends o{data;constructor(e){super(e);let t=this.target.attachShadow({mode:"open"});t.innerHTML=`<style>${this.css}</style>${this.template}`,function(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 x(e);break;case"checkbox":a=new k(e);break;default:a=new A(e)}break;case"select":a=new C(e);break;case"textarea":a=new S(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(o.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),E(e,t),d(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{e[t].notify()}))}))}(this,"data",t),this.data.bind(t),fetch("./testform.json").then((e=>e.json())).then((e=>{this.data=e}))}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" /> <strong>2wB: </strong>{textInput}<br />\n <label>color</label><input type="color" name="colorInput" value="#000000" /><br />\n <label>date</label><input type="date" name="dateInput" value="" /><br />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" /><br />\n <label>email</label><input type="email" name="email" value="" /><br />\n <label>file</label><input type="file" name="fileInput" value="" /><br />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" /><br />\n <label>month</label><input type="month" name="month" value="" /><br />\n <label>number</label><input type="number" name="number" value="" /><br />\n <label>password</label><input type="password" name="passInput" value="" /><br />\n <label>range</label><input type="range" name="rangeInput" value="" /><br />\n <label>search</label><input type="search" name="searchInput" value="" /><br />\n <label>tel</label><input type="tel" name="telInput" value="" /><br />\n <label>time</label><input type="time" name="timeInput" value="" /><br />\n <label>url</label><input type="url" name="urlInput" value="" /><br />\n <label>week</label><input type="week" name="weekInput" value="" /><br />\n </fieldset>\n\n <fieldset>\n <legend>Selects <strong>2wB: </strong> <span>"{singleSelect}"</span> <span>[{multiSelect}]</span></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><br />\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 <strong>2wB: </strong><span>"{myRadio}"</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1"><br />\n <label>radio2</label><input type="radio" name="myRadio" value="radio2"><br />\n <label>radio3</label><input type="radio" name="myRadio" value="radio3"><br />\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1"><br />\n <label>cb2</label><input type="checkbox" name="cb2"><br />\n <label>cb3</label><input type="checkbox" name="cb3"><br />\n <label>cb4</label><input type="checkbox" name="cb4"><br />\n <label>cb5</label><input type="checkbox" name="cb5"><br />\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 font-weight: bold;\n}\n\nlabel {\n display: inline-block;\n margin-top: 1em;\n margin-left: 5px;\n vertical-align: top;\n min-width:10em;\n text-align: right;\n}\n\nform input,\nform select,\nform textarea {\n display: inline-block;\n margin-left: 5px;\n margin-top: 1.1em;\n}\n\ninput[type="radio"],\ninput[type="checkbox"] {\n margin-top: 1.3em;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid #aaaaaa;\n border-radius: 3px;\n margin: 0.5em 0;\n}\n '}}),{}})()));
|
package/public/test/MC.js
CHANGED
|
@@ -82,7 +82,7 @@ function trigger(domNode, event, data = {}, bubble = 'l', controller) {
|
|
|
82
82
|
if (bubble.indexOf('d') > -1) {
|
|
83
83
|
let childNodes = domNode._mc.children();
|
|
84
84
|
if (!!childNodes) {
|
|
85
|
-
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble
|
|
85
|
+
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}, 0);
|
package/public/test/MC.min.js
CHANGED
|
@@ -139,7 +139,7 @@ function trigger(domNode, event, data = {}, bubble = 'l', controller) {
|
|
|
139
139
|
if (bubble.indexOf('d') > -1) {
|
|
140
140
|
let childNodes = domNode._mc.children();
|
|
141
141
|
if (!!childNodes) {
|
|
142
|
-
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble
|
|
142
|
+
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}, 0);
|
package/public/test/MC.ts
CHANGED
|
@@ -129,7 +129,7 @@ function trigger(
|
|
|
129
129
|
setTimeout(
|
|
130
130
|
() => {
|
|
131
131
|
|
|
132
|
-
// bubble up towards
|
|
132
|
+
// bubble up towards document.body
|
|
133
133
|
if ( bubble.indexOf('u') > -1 ) {
|
|
134
134
|
let parentMc: HTMLMcElement | null | undefined = domNode.parentElement?.closest('[data-mc]') ;
|
|
135
135
|
if ( !!parentMc ){
|
|
@@ -137,11 +137,11 @@ function trigger(
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
// bubble down
|
|
140
|
+
// bubble down towards DOM children
|
|
141
141
|
if (bubble.indexOf('d') > -1) {
|
|
142
142
|
let childNodes: DC[] | null = ( domNode as HTMLMcElement)._mc.children();
|
|
143
143
|
if( !!childNodes ){
|
|
144
|
-
childNodes.forEach( (_mc: DC) => _mc.trigger( eventName, data, bubble
|
|
144
|
+
childNodes.forEach( (_mc: DC) => _mc.trigger( eventName, data, bubble ) ); // event multiplex - dont carry bubble controller
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elements=e():t.elements=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{defineCE:()=>d,getCE:()=>m});const n=new Function("try {return this===window;}catch(e){ return false;}");function r(t){return t&&t instanceof HTMLElement}function o(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function c(t,e,n,r=!1){return t.addEventListener(o(e),n,{capture:!1,once:r}),n}class s{stopped=!1;constructor(){}stop(){this.stopped=!0}}class i{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==a&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===a)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else c(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class a extends i{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new a(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(o(e),n)}(this.target,t,e)}on(t,e){return c(this.target,t,e)}one(t,e){return function(t,e,n){return c(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",r){!function(t,e,n={},r="l",c){const i=/^_mc/.test(e)?e:o(e),a=c||new s,u=new CustomEvent(i,{detail:{data:n,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(u),u.stopImmediatePropagation(),a.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(i,n,r,a)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(i,n,r
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elements=e():t.elements=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{defineCE:()=>d,getCE:()=>m});const n=new Function("try {return this===window;}catch(e){ return false;}");function r(t){return t&&t instanceof HTMLElement}function o(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function c(t,e,n,r=!1){return t.addEventListener(o(e),n,{capture:!1,once:r}),n}class s{stopped=!1;constructor(){}stop(){this.stopped=!0}}class i{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==a&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===a)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else c(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class a extends i{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new a(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(o(e),n)}(this.target,t,e)}on(t,e){return c(this.target,t,e)}one(t,e){return function(t,e,n){return c(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",r){!function(t,e,n={},r="l",c){const i=/^_mc/.test(e)?e:o(e),a=c||new s,u=new CustomEvent(i,{detail:{data:n,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(u),u.stopImmediatePropagation(),a.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(i,n,r,a)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(i,n,r)))}}),0)))}(this.target,t,e,n,r)}ancestors(){let t=this?.target,e=[];if(!r(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return r(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return r(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!r(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}new Set;class u extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function l(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function d(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("");l(e.prototype.constructor)&&e.prototype instanceof i?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends u{instance;constructor(t){super();const n=l(e)?new e(this,t):e;a.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function m(t){return customElements.get(t)}return e})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formValues=e():t.formValues=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var s;(s=t[n])&&s.constructor&&s.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let s={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)s[e+"."+t]=r[t]}else s[e]=t[e]})),e?r(s):s}function s(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function o(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}function a(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}t.r(e),t.d(e,{formValues:()=>x});const c=new Function("try {return this===window;}catch(e){ return false;}");function l(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function u(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class f{stopped=!1;constructor(){}stop(){this.stopped=!0}}function d(t,e,r={},n="l",s){const o=/^_mc/.test(e)?e:i(e),a=s||new f,c=new CustomEvent(o,{detail:{data:r,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(c),c.stopImmediatePropagation(),a.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(o,r,n,a)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(o,r,n
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formValues=e():t.formValues=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var s;(s=t[n])&&s.constructor&&s.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let s={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)s[e+"."+t]=r[t]}else s[e]=t[e]})),e?r(s):s}function s(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function o(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}function a(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}t.r(e),t.d(e,{formValues:()=>x});const c=new Function("try {return this===window;}catch(e){ return false;}");function l(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function u(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class f{stopped=!1;constructor(){}stop(){this.stopped=!0}}function d(t,e,r={},n="l",s){const o=/^_mc/.test(e)?e:i(e),a=s||new f,c=new CustomEvent(o,{detail:{data:r,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(c),c.stopImmediatePropagation(),a.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(o,r,n,a)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(o,r,n)))}}),0)))}class h{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==p&&e.trigger("Init")}),0),function(t){if(!c()||t.constructor===p)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),s=t.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();if("on"+o in e){let n=e=>{r[t](e)};e.addEventListener(o,n)}else u(e,s,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class p extends h{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new p(t));const s=n._mc;return e.length&&!s[e]&&(s[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return u(this.target,t,e)}one(t,e){return function(t,e,r){return u(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l",n){d(this.target,t,e,r,n)}ancestors(){let t=this?.target,e=[];if(!l(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return l(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return l(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!l(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function m(t){return null!=t&&"object"==typeof t}function g(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const b=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends p{data={};oldDisplay="";constructor(t){super(t),g(t).forEach((t=>this.data[t]="")),E(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),s=>{let o=n;r.forEach((t=>{o=o.replace(t,s[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,o)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>s=>{let o=e;n.forEach((t=>{o=o.replace(t,s[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=o})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!b.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const v={};function O(t){let e=t.constructor.name;return v[e]||function(t){const e=t.constructor,r=e.name;let s=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],m(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(m(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!g(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||p.add(t,"_placeholders",new y(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&d(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=m(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return v[r]=s,s}(t)}const E=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(O(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(m(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(o((function(){s(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(m(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(O(t))(structuredClone(Object.assign({},t))),a(t,n),n.seal()),Object.assign(n,t),setTimeout(o((function(){s(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(O(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);class w{constructor(t){}}class A extends w{#n;constructor(t){super(t),this.#n=t}get val(){return new FormData(this.#n.form).get(this.#n.name)}set val(t){[...this.#n.form.querySelectorAll(`input[type="radio"][name="${this.#n.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class j extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.checked}set val(t){this.#n.checked=t}}class S extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value}set val(t){this.#n.value=t}}class _ extends w{#n;#s=!1;constructor(t){super(t),this.#n=t,this.#s=t.multiple}get val(){const t=[];return[...this.#n.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#s?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#n.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class k extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value||""}set val(t){this.#n.value=t}}const N=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],r={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let n=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":n=new A(t);break;case"checkbox":n=new j(t);break;default:n=new S(t)}break;case"select":n=new _(t);break;case"textarea":n=new k(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}n&&(p.add(t,e,n),Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>n.val,set:t=>{n.val!==t&&(n.val=t)}}))}})),r};function x(t,e,r){let n=N(r);t[e]=Object.assign({},n),E(t,e),a(n,t[e]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{r.addEventListener("input",(r=>{t[e].notify()}))}))}return e})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.microcomponents=e():t.microcomponents=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return t&&t.constructor&&t.constructor===Object}function r(t){let e={};return[...Object.keys(t)].sort().forEach((o=>{n(t[o])?e[o]=r(t[o]):e[o]=t[o]})),e}function o(t,e=!0){let n={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=o(t[e],!1);for(const t in r)n[e+"."+t]=r[t]}else n[e]=t[e]})),e?r(n):n}function s(t,e){return JSON.stringify(o(t))===JSON.stringify(o(e))}function c(t,e={}){let n=t.constructor===String?t.split("."):t;if(e&&n[0]&&e[n[0]])return e[n[0]].constructor===Object&&n.length>1?c(n.splice(1),e[n[0]]):e[n[0]];console.warn("ns",n[0],"not in",e)}function a(t,e){var r=Array.from(arguments);if(r.length>2){for(;r.length>1;)r[0]=a(r[0],r[1]),r.splice(1,1);return r[0]}if("string"==typeof t)t.match(/\{[^\{\}]*\}/g)?.forEach((function(n){var r=c(n.substring(1,n.length-1),e);void 0!==r&&(t=t.replace(n,r))}));else if(n(t))switch(t.constructor){case Object:Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&(t[n]=a(t[n],e))}));break;case Array:t.forEach((function(n,r,o){o[r]=a(t[r],e)}))}return t}function i(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function l(t,e){let n;return()=>{clearTimeout(n),n=setTimeout((function(){t(...arguments)}),e)}}function u(t){let e=document.createElement("template");return t=t.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),e.innerHTML=t,e.content.normalize(),Array.from(e.content.childNodes)}function d(t,e){const n=Object.getOwnPropertyDescriptors(t);for(const[t,r]of Object.entries(n))("get"in r||"set"in r)&&Object.defineProperty(e,t,r)}t.r(e),t.d(e,{DC:()=>w,MC:()=>O,McBase:()=>E,autoload:()=>N,copyGettersSetters:()=>d,debounce:()=>l,deepEqual:()=>s,defineCE:()=>x,flattenObject:()=>o,formValues:()=>U,getCE:()=>M,htmlToElements:()=>u,isNativeObject:()=>n,kebabToPascal:()=>i,nameSpace:()=>c,observe:()=>$,off:()=>p,on:()=>b,one:()=>g,parse:()=>a,sortObject:()=>r,trigger:()=>v});const f=new Function("try {return this===window;}catch(e){ return false;}");function m(t){return t&&t instanceof HTMLElement}function h(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function p(t,e,n){t.removeEventListener(h(e),n)}function b(t,e,n,r=!1){return t.addEventListener(h(e),n,{capture:!1,once:r}),n}function g(t,e,n){return b(t,e,n,!0),n}class y{stopped=!1;constructor(){}stop(){this.stopped=!0}}function v(t,e,n={},r="l",o){const s=/^_mc/.test(e)?e:h(e),c=o||new y,a=new CustomEvent(s,{detail:{data:n,control:c},bubbles:!1});c.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),c.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(s,n,r,c)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(s,n,r,c)))}}),0)))}class E{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==w&&e.trigger("Init")}),0),function(t){if(!f()||t.constructor===w)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else b(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class O extends E{constructor(t){super(t)}}class w extends E{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new w(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){p(this.target,t,e)}on(t,e){return b(this.target,t,e)}one(t,e){return g(this.target,t,e)}trigger(t,e={},n="l",r){v(this.target,t,e,n,r)}ancestors(){let t=this?.target,e=[];if(!m(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return m(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return m(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!m(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}const A=new Set;function j(t){return()=>{const e=Array.from(document.querySelectorAll(`[data-mc*="${t}"]`)).filter((t=>t instanceof HTMLElement));if(0===e.length)return;const n=customElements.get(t);e.forEach((e=>{w.add(e,n.name,new n(e));const r=e.getAttribute("data-mc").split(" ").filter((e=>e!==t&&""!==e)).join(" ").trim();e.setAttribute("data-mc",r)}))}}function C(t){if(A.has(t))return;A.add(t);const e="./"+t.split("-").join("/")+".js",n=document.createElement("script");n.setAttribute("src",e),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("data-name",t),n.setAttribute("loading",""),customElements.whenDefined(t).then(j(t)),n.addEventListener("load",(e=>{A.delete(t),document.head.querySelector(`script[data-name="${t}"]`)?.remove()})),n.addEventListener("error",(t=>{console.error("could not load DC code from",e)})),document.head.append(n)}function S(){[...document.querySelectorAll(":not(:defined)")].filter((t=>!!t&&!customElements.get(t.tagName.toLowerCase())&&!A.has(t.tagName.toLowerCase()))).forEach((t=>{C(t.tagName.toLowerCase())})),[...document.querySelectorAll('[data-mc]:not([data-mc=""]')].filter((t=>!!t)).forEach((t=>{const e=t.getAttribute("data-mc")?.split(" ").filter((t=>""!==t));e?.forEach((t=>{const e=customElements.get(t);A.has(t)||e?e&&j(t)():C(t)}))}))}let k=!1,_=null;function N(t=!0){return t?(k=t,_=new MutationObserver(S),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),S()}),5),window.autoload=window.autoload||N,k):(_?.disconnect(),_=null,k)}N.state=A;class T extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function L(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function x(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=i(t);L(e.prototype.constructor)&&e.prototype instanceof E?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends T{instance;constructor(t){super();const n=L(e)?new e(this,t):e;w.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function M(t){return customElements.get(t)}function P(t){return null!=t&&"object"==typeof t}function D(t){let e=new Set,n=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(n))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(n));r.forEach((t=>r.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(n))).forEach((t=>{(t.nodeValue||"").match(n).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}const q=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class H extends w{data={};oldDisplay="";constructor(t){super(t),D(t).forEach((t=>this.data[t]="")),$(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var r;this.data.observe((r=t.getAttribute(e),o=>{let s=r;n.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,s)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{e=!0;let r=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let s=e;r.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=s})(n.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!q.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(e[n]=t.detail.data[n])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const I={};function V(t){let e=t.constructor.name;return I[e]||function(t){const e=t.constructor,n=e.name;let r=class extends e{#e=!0;#n=[];constructor(t){super(t),this.constructor.callbacks=[],P(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#n}set callbacks(t){this.#n=t}observe(t){return this.#n.push(t),this}bind(t){if(P(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!D(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||w.add(t,"_placeholders",new H(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),n=function(t){let n=o(t);e.forEach((t=>{t&&v(t,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=P(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#n.forEach((t=>{t(e)})),this}};return I[n]=r,r}(t)}const $=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let n=t[e],r=new(V(n))(n);Object.defineProperty(t,e,{enumerable:!0,get(){if(P(r.valueOf())){let t=structuredClone(Object.assign({},r));setTimeout(l((function(){s(structuredClone(Object.assign({},r)),t)||r.notify()}),0),0)}return r},set(t){if(typeof t==typeof r.valueOf())if(P(r.valueOf())&&r.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},r));void 0===r?.constructor?.prototype?.observe&&(r=new(V(t))(structuredClone(Object.assign({},t))),d(t,r),r.seal()),Object.assign(r,t),setTimeout(l((function(){s(structuredClone(Object.assign({},r)),e)||r.notify()}),0),0)}else{let e=r.valueOf(),n=r.callbacks;t!==e&&(r=new(V(t))(t),r.callbacks=n,r.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof r.valueOf(),r,"- CANNOT BECOME:",typeof t)}}),t[e]=n}})),t);class R{constructor(t){}}class F extends R{#r;constructor(t){super(t),this.#r=t}get val(){return new FormData(this.#r.form).get(this.#r.name)}set val(t){[...this.#r.form.querySelectorAll(`input[type="radio"][name="${this.#r.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class G extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.checked}set val(t){this.#r.checked=t}}class J extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value}set val(t){this.#r.value=t}}class Z extends R{#r;#o=!1;constructor(t){super(t),this.#r=t,this.#o=t.multiple}get val(){const t=[];return[...this.#r.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#o?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#r.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class z extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value||""}set val(t){this.#r.value=t}}const B=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],n={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let r=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":r=new F(t);break;case"checkbox":r=new G(t);break;default:r=new J(t)}break;case"select":r=new Z(t);break;case"textarea":r=new z(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}r&&(w.add(t,e,r),Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r.val,set:t=>{r.val!==t&&(r.val=t)}}))}})),n};function U(t,e,n){let r=B(n);t[e]=Object.assign({},r),$(t,e),d(r,t[e]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{t[e].notify()}))}))}return e})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.microcomponents=e():t.microcomponents=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return t&&t.constructor&&t.constructor===Object}function r(t){let e={};return[...Object.keys(t)].sort().forEach((o=>{n(t[o])?e[o]=r(t[o]):e[o]=t[o]})),e}function o(t,e=!0){let n={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=o(t[e],!1);for(const t in r)n[e+"."+t]=r[t]}else n[e]=t[e]})),e?r(n):n}function s(t,e){return JSON.stringify(o(t))===JSON.stringify(o(e))}function c(t,e={}){let n=t.constructor===String?t.split("."):t;if(e&&n[0]&&e[n[0]])return e[n[0]].constructor===Object&&n.length>1?c(n.splice(1),e[n[0]]):e[n[0]];console.warn("ns",n[0],"not in",e)}function a(t,e){var r=Array.from(arguments);if(r.length>2){for(;r.length>1;)r[0]=a(r[0],r[1]),r.splice(1,1);return r[0]}if("string"==typeof t)t.match(/\{[^\{\}]*\}/g)?.forEach((function(n){var r=c(n.substring(1,n.length-1),e);void 0!==r&&(t=t.replace(n,r))}));else if(n(t))switch(t.constructor){case Object:Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&(t[n]=a(t[n],e))}));break;case Array:t.forEach((function(n,r,o){o[r]=a(t[r],e)}))}return t}function i(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function l(t,e){let n;return()=>{clearTimeout(n),n=setTimeout((function(){t(...arguments)}),e)}}function u(t){let e=document.createElement("template");return t=t.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),e.innerHTML=t,e.content.normalize(),Array.from(e.content.childNodes)}function d(t,e){const n=Object.getOwnPropertyDescriptors(t);for(const[t,r]of Object.entries(n))("get"in r||"set"in r)&&Object.defineProperty(e,t,r)}t.r(e),t.d(e,{DC:()=>w,MC:()=>O,McBase:()=>E,autoload:()=>N,copyGettersSetters:()=>d,debounce:()=>l,deepEqual:()=>s,defineCE:()=>x,flattenObject:()=>o,formValues:()=>U,getCE:()=>M,htmlToElements:()=>u,isNativeObject:()=>n,kebabToPascal:()=>i,nameSpace:()=>c,observe:()=>$,off:()=>p,on:()=>b,one:()=>g,parse:()=>a,sortObject:()=>r,trigger:()=>v});const f=new Function("try {return this===window;}catch(e){ return false;}");function m(t){return t&&t instanceof HTMLElement}function h(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function p(t,e,n){t.removeEventListener(h(e),n)}function b(t,e,n,r=!1){return t.addEventListener(h(e),n,{capture:!1,once:r}),n}function g(t,e,n){return b(t,e,n,!0),n}class y{stopped=!1;constructor(){}stop(){this.stopped=!0}}function v(t,e,n={},r="l",o){const s=/^_mc/.test(e)?e:h(e),c=o||new y,a=new CustomEvent(s,{detail:{data:n,control:c},bubbles:!1});c.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),c.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(s,n,r,c)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(s,n,r)))}}),0)))}class E{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==w&&e.trigger("Init")}),0),function(t){if(!f()||t.constructor===w)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else b(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class O extends E{constructor(t){super(t)}}class w extends E{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new w(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){p(this.target,t,e)}on(t,e){return b(this.target,t,e)}one(t,e){return g(this.target,t,e)}trigger(t,e={},n="l",r){v(this.target,t,e,n,r)}ancestors(){let t=this?.target,e=[];if(!m(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return m(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return m(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!m(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}const A=new Set;function j(t){return()=>{const e=Array.from(document.querySelectorAll(`[data-mc*="${t}"]`)).filter((t=>t instanceof HTMLElement));if(0===e.length)return;const n=customElements.get(t);e.forEach((e=>{w.add(e,n.name,new n(e));const r=e.getAttribute("data-mc").split(" ").filter((e=>e!==t&&""!==e)).join(" ").trim();e.setAttribute("data-mc",r)}))}}function C(t){if(A.has(t))return;A.add(t);const e="./"+t.split("-").join("/")+".js",n=document.createElement("script");n.setAttribute("src",e),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("data-name",t),n.setAttribute("loading",""),customElements.whenDefined(t).then(j(t)),n.addEventListener("load",(e=>{A.delete(t),document.head.querySelector(`script[data-name="${t}"]`)?.remove()})),n.addEventListener("error",(t=>{console.error("could not load DC code from",e)})),document.head.append(n)}function S(){[...document.querySelectorAll(":not(:defined)")].filter((t=>!!t&&!customElements.get(t.tagName.toLowerCase())&&!A.has(t.tagName.toLowerCase()))).forEach((t=>{C(t.tagName.toLowerCase())})),[...document.querySelectorAll('[data-mc]:not([data-mc=""]')].filter((t=>!!t)).forEach((t=>{const e=t.getAttribute("data-mc")?.split(" ").filter((t=>""!==t));e?.forEach((t=>{const e=customElements.get(t);A.has(t)||e?e&&j(t)():C(t)}))}))}let k=!1,_=null;function N(t=!0){return t?(k=t,_=new MutationObserver(S),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),S()}),5),window.autoload=window.autoload||N,k):(_?.disconnect(),_=null,k)}N.state=A;class T extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function L(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function x(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=i(t);L(e.prototype.constructor)&&e.prototype instanceof E?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends T{instance;constructor(t){super();const n=L(e)?new e(this,t):e;w.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function M(t){return customElements.get(t)}function P(t){return null!=t&&"object"==typeof t}function D(t){let e=new Set,n=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(n))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(n));r.forEach((t=>r.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(n))).forEach((t=>{(t.nodeValue||"").match(n).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}const q=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class H extends w{data={};oldDisplay="";constructor(t){super(t),D(t).forEach((t=>this.data[t]="")),$(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var r;this.data.observe((r=t.getAttribute(e),o=>{let s=r;n.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,s)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{e=!0;let r=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let s=e;r.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=s})(n.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!q.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(e[n]=t.detail.data[n])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const I={};function V(t){let e=t.constructor.name;return I[e]||function(t){const e=t.constructor,n=e.name;let r=class extends e{#e=!0;#n=[];constructor(t){super(t),this.constructor.callbacks=[],P(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#n}set callbacks(t){this.#n=t}observe(t){return this.#n.push(t),this}bind(t){if(P(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!D(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||w.add(t,"_placeholders",new H(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),n=function(t){let n=o(t);e.forEach((t=>{t&&v(t,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=P(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#n.forEach((t=>{t(e)})),this}};return I[n]=r,r}(t)}const $=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let n=t[e],r=new(V(n))(n);Object.defineProperty(t,e,{enumerable:!0,get(){if(P(r.valueOf())){let t=structuredClone(Object.assign({},r));setTimeout(l((function(){s(structuredClone(Object.assign({},r)),t)||r.notify()}),0),0)}return r},set(t){if(typeof t==typeof r.valueOf())if(P(r.valueOf())&&r.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},r));void 0===r?.constructor?.prototype?.observe&&(r=new(V(t))(structuredClone(Object.assign({},t))),d(t,r),r.seal()),Object.assign(r,t),setTimeout(l((function(){s(structuredClone(Object.assign({},r)),e)||r.notify()}),0),0)}else{let e=r.valueOf(),n=r.callbacks;t!==e&&(r=new(V(t))(t),r.callbacks=n,r.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof r.valueOf(),r,"- CANNOT BECOME:",typeof t)}}),t[e]=n}})),t);class R{constructor(t){}}class F extends R{#r;constructor(t){super(t),this.#r=t}get val(){return new FormData(this.#r.form).get(this.#r.name)}set val(t){[...this.#r.form.querySelectorAll(`input[type="radio"][name="${this.#r.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class G extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.checked}set val(t){this.#r.checked=t}}class J extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value}set val(t){this.#r.value=t}}class Z extends R{#r;#o=!1;constructor(t){super(t),this.#r=t,this.#o=t.multiple}get val(){const t=[];return[...this.#r.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#o?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#r.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class z extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value||""}set val(t){this.#r.value=t}}const B=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],n={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let r=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":r=new F(t);break;case"checkbox":r=new G(t);break;default:r=new J(t)}break;case"select":r=new Z(t);break;case"textarea":r=new z(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}r&&(w.add(t,e,r),Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r.val,set:t=>{r.val!==t&&(r.val=t)}}))}})),n};function U(t,e,n){let r=B(n);t[e]=Object.assign({},r),$(t,e),d(r,t[e]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{t[e].notify()}))}))}return e})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.observables=e():t.observables=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var o;(o=t[n])&&o.constructor&&o.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let o={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)o[e+"."+t]=r[t]}else o[e]=t[e]})),e?r(o):o}function o(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function c(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}t.r(e),t.d(e,{observe:()=>v});const s=new Function("try {return this===window;}catch(e){ return false;}");function a(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function l(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class u{stopped=!1;constructor(){}stop(){this.stopped=!0}}function f(t,e,r={},n="l",o){const c=/^_mc/.test(e)?e:i(e),s=o||new u,a=new CustomEvent(c,{detail:{data:r,control:s},bubbles:!1});s.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),s.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(c,r,n,s)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(c,r,n
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.observables=e():t.observables=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var o;(o=t[n])&&o.constructor&&o.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let o={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)o[e+"."+t]=r[t]}else o[e]=t[e]})),e?r(o):o}function o(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function c(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}t.r(e),t.d(e,{observe:()=>v});const s=new Function("try {return this===window;}catch(e){ return false;}");function a(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function l(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class u{stopped=!1;constructor(){}stop(){this.stopped=!0}}function f(t,e,r={},n="l",o){const c=/^_mc/.test(e)?e:i(e),s=o||new u,a=new CustomEvent(c,{detail:{data:r,control:s},bubbles:!1});s.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),s.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(c,r,n,s)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(c,r,n)))}}),0)))}class d{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==h&&e.trigger("Init")}),0),function(t){if(!s()||t.constructor===h)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),c=o.toLowerCase();if("on"+c in e){let n=e=>{r[t](e)};e.addEventListener(c,n)}else l(e,o,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class h extends d{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new h(t));const o=n._mc;return e.length&&!o[e]&&(o[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return l(this.target,t,e)}one(t,e){return function(t,e,r){return l(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l",n){f(this.target,t,e,r,n)}ancestors(){let t=this?.target,e=[];if(!a(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return a(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return a(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!a(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function p(t){return null!=t&&"object"==typeof t}function m(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const b=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class g extends h{data={};oldDisplay="";constructor(t){super(t),m(t).forEach((t=>this.data[t]="")),v(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),o=>{let c=n;r.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,c)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let c=e;n.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=c})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!b.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const y={};function O(t){let e=t.constructor.name;return y[e]||function(t){const e=t.constructor,r=e.name;let o=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],p(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(p(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!m(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||h.add(t,"_placeholders",new g(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&f(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=p(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return y[r]=o,o}(t)}const v=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(O(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(p(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(c((function(){o(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(p(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(O(t))(structuredClone(Object.assign({},t))),function(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}(t,n),n.seal()),Object.assign(n,t),setTimeout(c((function(){o(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(O(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);return e})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grandparent=e():t.grandparent=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{GrandParent:()=>w});const n=new Function("try {return this===window;}catch(e){ return false;}");function o(t){return t&&t instanceof HTMLElement}function r(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function s(t,e,n,o=!1){return t.addEventListener(r(e),n,{capture:!1,once:o}),n}class c{stopped=!1;constructor(){}stop(){this.stopped=!0}}class a{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==l&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===l)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let o=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),c=r.toLowerCase();if("on"+c in e){let o=e=>{n[t](e)};e.addEventListener(c,o)}else s(e,r,(e=>{n[t](e)}),o)}))}}(this)}get target(){return this._target.deref()}}class l extends a{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let o=t;o._mc||(o._mc=new l(t));const r=o._mc;return e.length&&!r[e]&&(r[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),o}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(r(e),n)}(this.target,t,e)}on(t,e){return s(this.target,t,e)}one(t,e){return function(t,e,n){return s(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",o){!function(t,e,n={},o="l",s){const a=/^_mc/.test(e)?e:r(e),l=s||new c,i=new CustomEvent(a,{detail:{data:n,control:l},bubbles:!1});l.stopped||(t.dispatchEvent(i),i.stopImmediatePropagation(),l.stopped||/[ud]/.test(o)&&(-1===o.indexOf("l")&&(o+="l"),setTimeout((()=>{if(o.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(a,n,o,l)}if(o.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(a,n,o
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grandparent=e():t.grandparent=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{GrandParent:()=>w});const n=new Function("try {return this===window;}catch(e){ return false;}");function o(t){return t&&t instanceof HTMLElement}function r(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function s(t,e,n,o=!1){return t.addEventListener(r(e),n,{capture:!1,once:o}),n}class c{stopped=!1;constructor(){}stop(){this.stopped=!0}}class a{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==l&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===l)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let o=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),c=r.toLowerCase();if("on"+c in e){let o=e=>{n[t](e)};e.addEventListener(c,o)}else s(e,r,(e=>{n[t](e)}),o)}))}}(this)}get target(){return this._target.deref()}}class l extends a{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let o=t;o._mc||(o._mc=new l(t));const r=o._mc;return e.length&&!r[e]&&(r[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),o}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(r(e),n)}(this.target,t,e)}on(t,e){return s(this.target,t,e)}one(t,e){return function(t,e,n){return s(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",o){!function(t,e,n={},o="l",s){const a=/^_mc/.test(e)?e:r(e),l=s||new c,i=new CustomEvent(a,{detail:{data:n,control:l},bubbles:!1});l.stopped||(t.dispatchEvent(i),i.stopImmediatePropagation(),l.stopped||/[ud]/.test(o)&&(-1===o.indexOf("l")&&(o+="l"),setTimeout((()=>{if(o.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(a,n,o,l)}if(o.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(a,n,o)))}}),0)))}(this.target,t,e,n,o)}ancestors(){let t=this?.target,e=[];if(!o(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return o(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return o(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const o=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),o.length?o:null}(t):null}descendants(){const t=this?.target;if(!o(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}new Set;class i extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function d(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function u(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let o=t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("");d(e.prototype.constructor)&&e.prototype instanceof a?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(o,class extends i{instance;constructor(t){super();const n=d(e)?new e(this,t):e;l.add(this,o,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function p(t){return customElements.get(t)}function m(t,e){return Math.floor(Math.random()*(e-t+1)+t)}u("test-greatgrandchild",class extends l{constructor(t){super(t)}onConnected(){this.updateStyle()}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('greatgrandchild "Up" handler')}updateStyle(){this.target.setAttribute("style","border-color:rgb("+m(0,255)+","+m(0,255)+","+m(0,255)+")")}});const g=p("test-greatgrandchild");u("test-grandchild",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<2;e++)t.target.append(new g)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('grandchild "Up" handler')}});const h=p("test-grandchild");u("test-child",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<10;e++)t.target.append(new h)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('child "Up" handler'),t.detail.control.stop()}onDown(t){console.log('child "Down" handler')}});const f=p("test-child");u("test-parent",class extends l{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<5;e++)t.target.append(new f)}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('parent "Up" handler')}onDown(t){console.log('parent "Down" handler')}});const b=p("test-parent");u("test-grandparent",class extends l{constructor(t){super(t)}onConnected(t){for(let t=0;t<5;t++)this.target.append(new b)}onDisconnected(t){}onAdopted(t){}onAttributeChanged(t){}onClick(t){this.trigger("Up",null,"lu"),t.stopImmediatePropagation()}onUp(t){console.log('grandparent "Up" handler'),this.trigger("Down",{},"ld")}onDown(t){console.log('grandparent "Down" handler')}});const w=p("test-grandparent");return e})()));
|
|
@@ -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";const e=new Function("try {return this===window;}catch(e){ return false;}");function t(e){return e&&e instanceof HTMLElement}function n(e){return"_mc"+e[0].toUpperCase()+e.substring(1)}function a(e,t,a,l=!1){return e.addEventListener(n(t),a,{capture:!1,once:l}),a}class l{stopped=!1;constructor(){}stop(){this.stopped=!0}}function r(e,t,a={},r="l",s){const o=/^_mc/.test(t)?t:n(t),i=s||new l,c=new CustomEvent(o,{detail:{data:a,control:i},bubbles:!1});i.stopped||(e.dispatchEvent(c),c.stopImmediatePropagation(),i.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let t=e.parentElement?.closest("[data-mc]");t&&t?._mc.trigger(o,a,r,i)}if(r.indexOf("d")>-1){let t=e._mc.children();t&&t.forEach((e=>e.trigger(o,a,r,i)))}}),0)))}class s{_target;constructor(t){var n;this._target=new WeakRef(t||{}),n=this,setTimeout((()=>{n.constructor!==o&&n.trigger("Init")}),0),function(t){if(!e()||t.constructor===o)return;const n=t.target;if(n instanceof HTMLElement){let e=t;Object.getOwnPropertyNames(e.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof e.constructor.prototype[t])).forEach((t=>{let l=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),s=r.toLowerCase();if("on"+s in n){let a=n=>{e[t](n)};n.addEventListener(s,a)}else a(n,r,(n=>{e[t](n)}),l)}))}}(this)}get target(){return this._target.deref()}}class o extends s{constructor(e){super(e)}static add(e,t,n={}){return function(e,t,n={}){let a=e;a._mc||(a._mc=new o(e));const l=a._mc;return t.length&&!l[t]&&(l[t]=n,e instanceof HTMLElement&&!e.getAttribute("data-mc")&&e.setAttribute("data-mc","")),a}(e,t,n)}static remove(e,t){!function(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("data-mc")&&e.removeAttribute("data-mc")}(e,t)}off(e,t){!function(e,t,a){e.removeEventListener(n(t),a)}(this.target,e,t)}on(e,t){return a(this.target,e,t)}one(e,t){return function(e,t,n){return a(e,t,n,!0),n}(this.target,e,t)}trigger(e,t={},n="l",a){r(this.target,e,t,n,a)}ancestors(){let e=this?.target,n=[];if(!t(e))return[];for(;e=e.closest("[data-mc]");)e?._mc&&n.push(e?._mc);return n.length?n:null}closest(){let e=this.target;return t(e)&&e.closest("[data-mc]")?._mc||null}children(){let e=this?.target;return t(e)?function(e){const t=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+t+'"] [data-mc] [data-mc])';e.setAttribute("temp_id",t);const a=[...e.querySelectorAll(n)].filter((e=>!!e._mc)).map((e=>e._mc));return e.removeAttribute("temp_id"),a.length?a:null}(e):null}descendants(){const e=this?.target;if(!t(e))return[];const n=[...e.querySelectorAll("[data-mc]")].filter((e=>!!e._mc)).map((e=>e._mc));return n.length?n:null}}function i(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=i(e[n]):t[n]=e[n]})),t}function c(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=c(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?i(n):n}function u(e,t){return JSON.stringify(c(e))===JSON.stringify(c(t))}function p(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function d(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 Set;class b extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(e,t,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:e,oldValue:t,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function m(e){return"function"==typeof e&&/^class\s/.test(Function.prototype.toString.call(e))}function f(e){return null!=e&&"object"==typeof e}function h(e){let t=new Set,n=/\{[^\{\}]*\}/g;return(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(n))).forEach((t=>{let a=new Set(e.getAttribute(t)?.match(n));a.forEach((e=>a.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,"")))}const g=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends o{data={};oldDisplay="";constructor(e){super(e),h(e).forEach((e=>this.data[e]="")),E(this),this.#e()}#e(){let e=this.target,t=!1;(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(/\{[^\{\}]*\}/g))).forEach((t=>{let n=new Set(e.getAttribute(t)?.match(/\{[^\{\}]*\}/g));var a;this.data.observe((a=e.getAttribute(t),l=>{let r=a;n.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),e.setAttribute(t,r)}))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{t=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((t=>l=>{let r=t;a.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),this.oldDisplay?e.style=this.oldDisplay:e.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=r})(n.nodeValue)),this.oldDisplay=e.getAttribute("style")||"",t&&!g.includes(e.constructor)&&"FIELDSET"!==e.tagName&&(e.style.display="none")}))}onData(e){let t={};Object.keys(e.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(t[n]=e.detail.data[n])})),JSON.stringify(t)!==JSON.stringify(this.data)&&Object.assign(this.data,t)}}const v={};function O(e){let t=e.constructor.name;return v[t]||function(e){const t=e.constructor,n=t.name;let a=class extends t{#t=!0;#n=[];constructor(e){super(e),this.constructor.callbacks=[],f(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}get callbacks(){return this.#n}set callbacks(e){this.#n=e}observe(e){return this.#n.push(e),this}bind(e){if(f(this.valueOf())){!function(e){var t;(t=e,[t].concat([...t.querySelectorAll("*")]).filter((e=>!!h(e).length)).filter((e=>"STYLE"!==e?.tagName)).reverse()).forEach((e=>{e?._mc?._placeholders||o.add(e,"_placeholders",new y(e))}))}(e);const t=[e,...e.querySelectorAll("[data-mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let n=c(e);t.forEach((e=>{e&&r(e,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(e){let t=f(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==e&&(this.#t=e),this.#n.forEach((e=>{e(t)})),this}};return v[n]=a,a}(e)}const E=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if(e.hasOwnProperty(t)&&"function"!=typeof e[t]&&!e?.[t]?.constructor?.prototype?.observe){if("_"===t[0]||void 0===e?.[t])return e;let n=e[t],a=new(O(n))(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(f(a.valueOf())){let e=structuredClone(Object.assign({},a));setTimeout(p((function(){u(structuredClone(Object.assign({},a)),e)||a.notify()}),0),0)}return a},set(e){if(typeof e==typeof a.valueOf())if(f(a.valueOf())&&a.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},a));void 0===a?.constructor?.prototype?.observe&&(a=new(O(e))(structuredClone(Object.assign({},e))),d(e,a),a.seal()),Object.assign(a,e),setTimeout(p((function(){u(structuredClone(Object.assign({},a)),t)||a.notify()}),0),0)}else{let t=a.valueOf(),n=a.callbacks;e!==t&&(a=new(O(e))(e),a.callbacks=n,a.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof a.valueOf(),a,"- CANNOT BECOME:",typeof e)}}),e[t]=n}})),e);class w{constructor(e){}}class x extends w{#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 k extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class A extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class C extends w{#a;#l=!1;constructor(e){super(e),this.#a=e,this.#l=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#l?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 S extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}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("");m(t.prototype.constructor)&&t.prototype instanceof s?customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends b{instance;constructor(e){super();const n=m(t)?new t(this,e):t;o.add(this,a,n)}static get observedAttributes(){return n}})):customElements.define(e,t)}("test-testform",class extends o{data;constructor(e){super(e);let t=this.target.attachShadow({mode:"open"});t.innerHTML=`<style>${this.css}</style>${this.template}`,function(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 x(e);break;case"checkbox":a=new k(e);break;default:a=new A(e)}break;case"select":a=new C(e);break;case"textarea":a=new S(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(o.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),E(e,t),d(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{e[t].notify()}))}))}(this,"data",t),this.data.bind(t),fetch("./testform.json").then((e=>e.json())).then((e=>{this.data=e}))}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" /> <strong>2wB: </strong>{textInput}<br />\n <label>color</label><input type="color" name="colorInput" value="#000000" /><br />\n <label>date</label><input type="date" name="dateInput" value="" /><br />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" /><br />\n <label>email</label><input type="email" name="email" value="" /><br />\n <label>file</label><input type="file" name="fileInput" value="" /><br />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" /><br />\n <label>month</label><input type="month" name="month" value="" /><br />\n <label>number</label><input type="number" name="number" value="" /><br />\n <label>password</label><input type="password" name="passInput" value="" /><br />\n <label>range</label><input type="range" name="rangeInput" value="" /><br />\n <label>search</label><input type="search" name="searchInput" value="" /><br />\n <label>tel</label><input type="tel" name="telInput" value="" /><br />\n <label>time</label><input type="time" name="timeInput" value="" /><br />\n <label>url</label><input type="url" name="urlInput" value="" /><br />\n <label>week</label><input type="week" name="weekInput" value="" /><br />\n </fieldset>\n\n <fieldset>\n <legend>Selects <strong>2wB: </strong> <span>"{singleSelect}"</span> <span>[{multiSelect}]</span></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><br />\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 <strong>2wB: </strong><span>"{myRadio}"</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1"><br />\n <label>radio2</label><input type="radio" name="myRadio" value="radio2"><br />\n <label>radio3</label><input type="radio" name="myRadio" value="radio3"><br />\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1"><br />\n <label>cb2</label><input type="checkbox" name="cb2"><br />\n <label>cb3</label><input type="checkbox" name="cb3"><br />\n <label>cb4</label><input type="checkbox" name="cb4"><br />\n <label>cb5</label><input type="checkbox" name="cb5"><br />\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 font-weight: bold;\n}\n\nlabel {\n display: inline-block;\n margin-top: 1em;\n margin-left: 5px;\n vertical-align: top;\n min-width:10em;\n text-align: right;\n}\n\nform input,\nform select,\nform textarea {\n display: inline-block;\n margin-left: 5px;\n margin-top: 1.1em;\n}\n\ninput[type="radio"],\ninput[type="checkbox"] {\n margin-top: 1.3em;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid #aaaaaa;\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";const e=new Function("try {return this===window;}catch(e){ return false;}");function t(e){return e&&e instanceof HTMLElement}function n(e){return"_mc"+e[0].toUpperCase()+e.substring(1)}function a(e,t,a,l=!1){return e.addEventListener(n(t),a,{capture:!1,once:l}),a}class l{stopped=!1;constructor(){}stop(){this.stopped=!0}}function r(e,t,a={},r="l",s){const o=/^_mc/.test(t)?t:n(t),i=s||new l,c=new CustomEvent(o,{detail:{data:a,control:i},bubbles:!1});i.stopped||(e.dispatchEvent(c),c.stopImmediatePropagation(),i.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let t=e.parentElement?.closest("[data-mc]");t&&t?._mc.trigger(o,a,r,i)}if(r.indexOf("d")>-1){let t=e._mc.children();t&&t.forEach((e=>e.trigger(o,a,r)))}}),0)))}class s{_target;constructor(t){var n;this._target=new WeakRef(t||{}),n=this,setTimeout((()=>{n.constructor!==o&&n.trigger("Init")}),0),function(t){if(!e()||t.constructor===o)return;const n=t.target;if(n instanceof HTMLElement){let e=t;Object.getOwnPropertyNames(e.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof e.constructor.prototype[t])).forEach((t=>{let l=/^one/.test(t),r=t.replace(/^on[e]{0,1}/,""),s=r.toLowerCase();if("on"+s in n){let a=n=>{e[t](n)};n.addEventListener(s,a)}else a(n,r,(n=>{e[t](n)}),l)}))}}(this)}get target(){return this._target.deref()}}class o extends s{constructor(e){super(e)}static add(e,t,n={}){return function(e,t,n={}){let a=e;a._mc||(a._mc=new o(e));const l=a._mc;return t.length&&!l[t]&&(l[t]=n,e instanceof HTMLElement&&!e.getAttribute("data-mc")&&e.setAttribute("data-mc","")),a}(e,t,n)}static remove(e,t){!function(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("data-mc")&&e.removeAttribute("data-mc")}(e,t)}off(e,t){!function(e,t,a){e.removeEventListener(n(t),a)}(this.target,e,t)}on(e,t){return a(this.target,e,t)}one(e,t){return function(e,t,n){return a(e,t,n,!0),n}(this.target,e,t)}trigger(e,t={},n="l",a){r(this.target,e,t,n,a)}ancestors(){let e=this?.target,n=[];if(!t(e))return[];for(;e=e.closest("[data-mc]");)e?._mc&&n.push(e?._mc);return n.length?n:null}closest(){let e=this.target;return t(e)&&e.closest("[data-mc]")?._mc||null}children(){let e=this?.target;return t(e)?function(e){const t=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+t+'"] [data-mc] [data-mc])';e.setAttribute("temp_id",t);const a=[...e.querySelectorAll(n)].filter((e=>!!e._mc)).map((e=>e._mc));return e.removeAttribute("temp_id"),a.length?a:null}(e):null}descendants(){const e=this?.target;if(!t(e))return[];const n=[...e.querySelectorAll("[data-mc]")].filter((e=>!!e._mc)).map((e=>e._mc));return n.length?n:null}}function i(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var a;(a=e[n])&&a.constructor&&a.constructor===Object?t[n]=i(e[n]):t[n]=e[n]})),t}function c(e,t=!0){let n={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const a=c(e[t],!1);for(const e in a)n[t+"."+e]=a[e]}else n[t]=e[t]})),t?i(n):n}function u(e,t){return JSON.stringify(c(e))===JSON.stringify(c(t))}function p(e,t){let n;return()=>{clearTimeout(n),n=setTimeout((function(){e(...arguments)}),t)}}function d(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 Set;class b extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(e,t,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:e,oldValue:t,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function m(e){return"function"==typeof e&&/^class\s/.test(Function.prototype.toString.call(e))}function f(e){return null!=e&&"object"==typeof e}function h(e){let t=new Set,n=/\{[^\{\}]*\}/g;return(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(n))).forEach((t=>{let a=new Set(e.getAttribute(t)?.match(n));a.forEach((e=>a.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,"")))}const g=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends o{data={};oldDisplay="";constructor(e){super(e),h(e).forEach((e=>this.data[e]="")),E(this),this.#e()}#e(){let e=this.target,t=!1;(e.getAttributeNames?e.getAttributeNames():[]).filter((t=>e.getAttribute(t)?.match(/\{[^\{\}]*\}/g))).forEach((t=>{let n=new Set(e.getAttribute(t)?.match(/\{[^\{\}]*\}/g));var a;this.data.observe((a=e.getAttribute(t),l=>{let r=a;n.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),e.setAttribute(t,r)}))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{t=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((t=>l=>{let r=t;a.forEach((e=>{r=r.replace(e,l[e.replace(/[\{\}]/g,"")])})),this.oldDisplay?e.style=this.oldDisplay:e.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=r})(n.nodeValue)),this.oldDisplay=e.getAttribute("style")||"",t&&!g.includes(e.constructor)&&"FIELDSET"!==e.tagName&&(e.style.display="none")}))}onData(e){let t={};Object.keys(e.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(t[n]=e.detail.data[n])})),JSON.stringify(t)!==JSON.stringify(this.data)&&Object.assign(this.data,t)}}const v={};function O(e){let t=e.constructor.name;return v[t]||function(e){const t=e.constructor,n=t.name;let a=class extends t{#t=!0;#n=[];constructor(e){super(e),this.constructor.callbacks=[],f(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}get callbacks(){return this.#n}set callbacks(e){this.#n=e}observe(e){return this.#n.push(e),this}bind(e){if(f(this.valueOf())){!function(e){var t;(t=e,[t].concat([...t.querySelectorAll("*")]).filter((e=>!!h(e).length)).filter((e=>"STYLE"!==e?.tagName)).reverse()).forEach((e=>{e?._mc?._placeholders||o.add(e,"_placeholders",new y(e))}))}(e);const t=[e,...e.querySelectorAll("[data-mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let n=c(e);t.forEach((e=>{e&&r(e,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(e){let t=f(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==e&&(this.#t=e),this.#n.forEach((e=>{e(t)})),this}};return v[n]=a,a}(e)}const E=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if(e.hasOwnProperty(t)&&"function"!=typeof e[t]&&!e?.[t]?.constructor?.prototype?.observe){if("_"===t[0]||void 0===e?.[t])return e;let n=e[t],a=new(O(n))(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(f(a.valueOf())){let e=structuredClone(Object.assign({},a));setTimeout(p((function(){u(structuredClone(Object.assign({},a)),e)||a.notify()}),0),0)}return a},set(e){if(typeof e==typeof a.valueOf())if(f(a.valueOf())&&a.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},a));void 0===a?.constructor?.prototype?.observe&&(a=new(O(e))(structuredClone(Object.assign({},e))),d(e,a),a.seal()),Object.assign(a,e),setTimeout(p((function(){u(structuredClone(Object.assign({},a)),t)||a.notify()}),0),0)}else{let t=a.valueOf(),n=a.callbacks;e!==t&&(a=new(O(e))(e),a.callbacks=n,a.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof a.valueOf(),a,"- CANNOT BECOME:",typeof e)}}),e[t]=n}})),e);class w{constructor(e){}}class x extends w{#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 k extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.checked}set val(e){this.#a.checked=e}}class A extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value}set val(e){this.#a.value=e}}class C extends w{#a;#l=!1;constructor(e){super(e),this.#a=e,this.#l=e.multiple}get val(){const e=[];return[...this.#a.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#l?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 S extends w{#a;constructor(e){super(e),this.#a=e}get val(){return this.#a.value||""}set val(e){this.#a.value=e}}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("");m(t.prototype.constructor)&&t.prototype instanceof s?customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(a,class extends b{instance;constructor(e){super();const n=m(t)?new t(this,e):t;o.add(this,a,n)}static get observedAttributes(){return n}})):customElements.define(e,t)}("test-testform",class extends o{data;constructor(e){super(e);let t=this.target.attachShadow({mode:"open"});t.innerHTML=`<style>${this.css}</style>${this.template}`,function(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 x(e);break;case"checkbox":a=new k(e);break;default:a=new A(e)}break;case"select":a=new C(e);break;case"textarea":a=new S(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}a&&(o.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),E(e,t),d(a,e[t]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{e[t].notify()}))}))}(this,"data",t),this.data.bind(t),fetch("./testform.json").then((e=>e.json())).then((e=>{this.data=e}))}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" /> <strong>2wB: </strong>{textInput}<br />\n <label>color</label><input type="color" name="colorInput" value="#000000" /><br />\n <label>date</label><input type="date" name="dateInput" value="" /><br />\n <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" /><br />\n <label>email</label><input type="email" name="email" value="" /><br />\n <label>file</label><input type="file" name="fileInput" value="" /><br />\n <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" /><br />\n <label>month</label><input type="month" name="month" value="" /><br />\n <label>number</label><input type="number" name="number" value="" /><br />\n <label>password</label><input type="password" name="passInput" value="" /><br />\n <label>range</label><input type="range" name="rangeInput" value="" /><br />\n <label>search</label><input type="search" name="searchInput" value="" /><br />\n <label>tel</label><input type="tel" name="telInput" value="" /><br />\n <label>time</label><input type="time" name="timeInput" value="" /><br />\n <label>url</label><input type="url" name="urlInput" value="" /><br />\n <label>week</label><input type="week" name="weekInput" value="" /><br />\n </fieldset>\n\n <fieldset>\n <legend>Selects <strong>2wB: </strong> <span>"{singleSelect}"</span> <span>[{multiSelect}]</span></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><br />\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 <strong>2wB: </strong><span>"{myRadio}"</span></legend>\n\n <label>radio1</label><input type="radio" name="myRadio" value="radio1"><br />\n <label>radio2</label><input type="radio" name="myRadio" value="radio2"><br />\n <label>radio3</label><input type="radio" name="myRadio" value="radio3"><br />\n\n </fieldset>\n\n <fieldset>\n <legend>Checkboxes</legend>\n <label>cb1</label><input type="checkbox" name="cb1"><br />\n <label>cb2</label><input type="checkbox" name="cb2"><br />\n <label>cb3</label><input type="checkbox" name="cb3"><br />\n <label>cb4</label><input type="checkbox" name="cb4"><br />\n <label>cb5</label><input type="checkbox" name="cb5"><br />\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 font-weight: bold;\n}\n\nlabel {\n display: inline-block;\n margin-top: 1em;\n margin-left: 5px;\n vertical-align: top;\n min-width:10em;\n text-align: right;\n}\n\nform input,\nform select,\nform textarea {\n display: inline-block;\n margin-left: 5px;\n margin-top: 1.1em;\n}\n\ninput[type="radio"],\ninput[type="checkbox"] {\n margin-top: 1.3em;\n}\n\nbody > form {\n display: block;\n}\n\nform fieldset {\n border: 1px solid #aaaaaa;\n border-radius: 3px;\n margin: 0.5em 0;\n}\n '}}),{}})()));
|