@twobirds/microcomponents 0.0.48 → 0.0.51
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/assets/Grandparent.css +13 -0
- package/assets/documentation/MC.md +380 -166
- package/assets/test.html +5 -1
- package/dist/MC.d.ts +1 -0
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.min.js +44 -0
- package/dist/MC.ts +65 -0
- package/dist/elements.min.js +1 -1
- package/dist/elements.ts +10 -10
- package/dist/formValues.d.ts +3 -2
- package/dist/formValues.d.ts.map +1 -1
- package/dist/formValues.ts +205 -203
- package/dist/formvValues.min.js +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.ts +9 -0
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.d.ts +1 -1
- package/dist/observables.d.ts.map +1 -1
- package/dist/observables.min.js +1 -1
- package/dist/observables.ts +64 -31
- package/dist/selectors.min.js +1 -1
- package/dist/test.ts +8 -5
- package/package.json +1 -1
- package/public/assets/search.js +1 -1
- package/public/classes/MC.DC.html +13 -13
- package/public/classes/MC.MC.html +7 -7
- package/public/classes/MC.McBase.html +4 -4
- package/public/classes/MC.McEvent.html +13 -13
- package/public/classes/formValues.FormValues.html +86 -0
- package/public/functions/MC.addListener.html +2 -1
- package/public/functions/{formValues.formValues.html → MC.autoload.html} +18 -17
- package/public/functions/MC.removeListener.html +2 -1
- package/public/functions/elements.defineCE.html +1 -1
- package/public/functions/elements.getCE.html +1 -1
- package/public/functions/observables.observe.html +3 -3
- package/public/functions/selectors._d.html +1 -1
- package/public/functions/selectors._t.html +1 -1
- package/public/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/interfaces/selectors.DSelector.html +55 -55
- package/public/interfaces/selectors.TSelector.html +37 -37
- package/public/modules/MC.html +3 -1
- package/public/modules/elements.html +1 -1
- package/public/modules/formValues.html +4 -4
- package/public/modules/observables.html +1 -1
- package/public/modules/selectors.html +1 -1
- package/public/types/observables.Observable.html +1 -1
- package/public/types/selectors.selection.html +1 -1
- package/public/types/selectors.singleSelector.html +1 -1
- package/src/MC.ts +65 -0
- package/src/elements.ts +10 -10
- package/src/formValues.ts +205 -203
- package/src/helpers.ts +9 -0
- package/src/observables.ts +64 -31
- package/src/test/Child.ts +21 -0
- package/src/test/Grandchild.ts +21 -0
- package/src/test/Grandparent.css +11 -0
- package/src/test/Grandparent.ts +21 -0
- package/src/test/Greatgrandchild.ts +42 -0
- package/src/test/Parent.ts +21 -0
- package/src/test/Testform.css +47 -0
- package/src/test/Testform.html +56 -0
- package/src/test/Testform.json +27 -0
- package/src/test/Testform.ts +159 -0
- package/src/test.ts +8 -5
- package/webpack.config.js +135 -61
- package/public/3d.html +0 -42
- package/public/MC.js +0 -271
- package/public/MC.js.map +0 -1
- package/public/MC.min.js +0 -407
- package/public/McEvent.js +0 -71
- package/public/McEvent.js.map +0 -1
- package/public/MicroComponents.svg +0 -15
- package/public/autoloader.js +0 -53
- package/public/autoloader.js.map +0 -1
- package/public/documentation/MC.md +0 -256
- package/public/documentation/ajaxian-1.png +0 -0
- package/public/documentation/ajaxian-2.png +0 -0
- package/public/documentation/ajaxian-3.png +0 -0
- package/public/documentation/comparision.md +0 -0
- package/public/documentation/elements.md +0 -276
- package/public/documentation/functional_requirements.md +0 -8
- package/public/documentation/history.md +0 -436
- package/public/documentation/how_tos.md +0 -0
- package/public/documentation/introduction.md +0 -0
- package/public/documentation/magic.md +0 -29
- package/public/documentation/proposal_draft.md +0 -37
- package/public/documentation/rnd0023-1.jpg +0 -0
- package/public/documentation/rnd0023-2.jpg +0 -0
- package/public/documentation/rnd0023-3.jpg +0 -0
- package/public/documentation/tB_react.md +0 -207
- package/public/documentation/usage.md +0 -142
- package/public/documentation/why.md +0 -25
- package/public/elements.js +0 -48
- package/public/elements.js.map +0 -1
- package/public/elements.min.js +0 -1
- package/public/fiddle/MicroComponents.svg +0 -15
- package/public/fiddle/fiddle.css +0 -0
- package/public/fiddle/fiddle.js +0 -0
- package/public/fiddle/index.html +0 -0
- package/public/formValues.js +0 -196
- package/public/formValues.js.map +0 -1
- package/public/formvValues.min.js +0 -1
- package/public/helpers.js +0 -105
- package/public/helpers.js.map +0 -1
- package/public/microcomponents.es3.js +0 -303
- package/public/microcomponents.es3.js.map +0 -1
- package/public/microcomponents.js +0 -9
- package/public/microcomponents.js.map +0 -1
- package/public/microcomponents.min.js +0 -1
- package/public/my-tag.css +0 -19
- package/public/observables.js +0 -239
- package/public/observables.js.map +0 -1
- package/public/observables.min.js +0 -1
- package/public/selectors.js +0 -971
- package/public/selectors.js.map +0 -1
- package/public/selectors.min.js +0 -1
- package/public/src/MC.ts +0 -413
- package/public/src/McEvent.ts +0 -96
- package/public/src/autoloader.ts +0 -98
- package/public/src/elements.ts +0 -76
- package/public/src/formValues.ts +0 -275
- package/public/src/helpers.ts +0 -140
- package/public/src/microcomponents.ts +0 -8
- package/public/src/observables.ts +0 -372
- package/public/src/selectors.ts +0 -1634
- package/public/src/test.ts +0 -174
- package/public/test.html +0 -23
- package/public/test.js +0 -79
- package/public/test.js.map +0 -1
package/assets/test.html
CHANGED
|
@@ -11,13 +11,17 @@
|
|
|
11
11
|
href="MicroComponents.svg"
|
|
12
12
|
/>
|
|
13
13
|
<link href="./my-tag.css" rel="stylesheet" />
|
|
14
|
+
<link href="./Grandparent.css" rel="stylesheet" />
|
|
14
15
|
<script src="./microcomponents.min.js"></script>
|
|
15
16
|
<script>
|
|
16
|
-
Object.assign(window, microcomponents); // make global
|
|
17
|
+
Object.assign(window, microcomponents); // make system global, for debugging
|
|
18
|
+
autoload(true); // automatically load web components that are undefined
|
|
17
19
|
</script>
|
|
18
20
|
<script type="module" src="./test.js"></script>
|
|
19
21
|
</head>
|
|
20
22
|
<body>
|
|
23
|
+
<test-grandparent></test-grandparent>
|
|
24
|
+
<test-testform></test-testform>
|
|
21
25
|
Open the debugger, read console, then:<br />
|
|
22
26
|
</body>
|
|
23
27
|
</html>
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ase: () => (/* binding */ McBase),
|
|
55
55
|
McEvent: () => (/* reexport */ McEvent),
|
|
56
56
|
addListener: () => (/* binding */ addListener),
|
|
57
|
+
autoload: () => (/* binding */ autoload),
|
|
57
58
|
removeListener: () => (/* binding */ removeListener)
|
|
58
59
|
});
|
|
59
60
|
|
|
@@ -400,6 +401,49 @@ class DC extends McBase {
|
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
403
|
|
|
404
|
+
let observer = null;
|
|
405
|
+
const unresolved = new Map();
|
|
406
|
+
function loadit() {
|
|
407
|
+
document
|
|
408
|
+
.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])')
|
|
409
|
+
.forEach((el) => {
|
|
410
|
+
const load = el.tagName.includes('-')
|
|
411
|
+
? [el.tagName.toLowerCase()]
|
|
412
|
+
: el.getAttribute('_mc').trim().split(' ');
|
|
413
|
+
load.forEach((elementName) => {
|
|
414
|
+
let fileName = elementName.toLowerCase().split('-'), lastElement = fileName[fileName.length - 1], renameLastElement = lastElement[0].toUpperCase() + lastElement.slice(1);
|
|
415
|
+
fileName[fileName.length - 1] = renameLastElement;
|
|
416
|
+
fileName = fileName.join('/') + '.js';
|
|
417
|
+
if (el.tagName.includes('-') &&
|
|
418
|
+
!unresolved.has(el.tagName.toLowerCase())) {
|
|
419
|
+
const se = document.createElement('script');
|
|
420
|
+
unresolved.set(elementName, fileName);
|
|
421
|
+
se.setAttribute('src', fileName);
|
|
422
|
+
se.setAttribute('blocking', 'render');
|
|
423
|
+
se.setAttribute('type', 'module');
|
|
424
|
+
se.onload = () => {
|
|
425
|
+
unresolved.delete(elementName);
|
|
426
|
+
};
|
|
427
|
+
document.head.append(se);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
let autoloadEnabled = false;
|
|
433
|
+
function autoload(enable = true) {
|
|
434
|
+
if (!enable) {
|
|
435
|
+
observer?.disconnect();
|
|
436
|
+
observer = null;
|
|
437
|
+
return autoloadEnabled;
|
|
438
|
+
}
|
|
439
|
+
autoloadEnabled = enable;
|
|
440
|
+
observer = new MutationObserver(loadit);
|
|
441
|
+
setTimeout(() => {
|
|
442
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
443
|
+
loadit();
|
|
444
|
+
}, 5);
|
|
445
|
+
return autoloadEnabled;
|
|
446
|
+
}
|
|
403
447
|
|
|
404
448
|
/******/ return __webpack_exports__;
|
|
405
449
|
/******/ })()
|
package/dist/MC.ts
CHANGED
|
@@ -411,3 +411,68 @@ class DC extends McBase {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
export { addListener, removeListener, McBase, MC, DC, McEvent };
|
|
414
|
+
|
|
415
|
+
let observer: MutationObserver | null = null;
|
|
416
|
+
const unresolved = new Map();
|
|
417
|
+
|
|
418
|
+
function loadit() {
|
|
419
|
+
document
|
|
420
|
+
.querySelectorAll(':not(:defined),[_mc]:not([_mc=""])')
|
|
421
|
+
.forEach((el) => {
|
|
422
|
+
const load: string[] = el.tagName.includes('-')
|
|
423
|
+
? [el.tagName.toLowerCase()]
|
|
424
|
+
: el.getAttribute('_mc')!.trim().split(' ');
|
|
425
|
+
|
|
426
|
+
load.forEach((elementName) => {
|
|
427
|
+
let fileName: any = elementName.toLowerCase().split('-'), // intentional any
|
|
428
|
+
lastElement = fileName[fileName.length - 1],
|
|
429
|
+
renameLastElement =
|
|
430
|
+
lastElement[0].toUpperCase() + lastElement.slice(1);
|
|
431
|
+
fileName[fileName.length - 1] = renameLastElement;
|
|
432
|
+
fileName = fileName.join('/') + '.js';
|
|
433
|
+
|
|
434
|
+
// autoload web components
|
|
435
|
+
// TBD: _mc components
|
|
436
|
+
if (
|
|
437
|
+
el.tagName.includes('-') &&
|
|
438
|
+
!unresolved.has(el.tagName.toLowerCase())
|
|
439
|
+
) {
|
|
440
|
+
const se: HTMLScriptElement = document.createElement('script');
|
|
441
|
+
|
|
442
|
+
unresolved.set(elementName, fileName);
|
|
443
|
+
|
|
444
|
+
se.setAttribute('src', fileName);
|
|
445
|
+
se.setAttribute('blocking', 'render');
|
|
446
|
+
se.setAttribute('type', 'module');
|
|
447
|
+
se.onload = () => {
|
|
448
|
+
// console.info('loaded', s);
|
|
449
|
+
unresolved.delete(elementName);
|
|
450
|
+
//console.log(unresolved);
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
document.head.append(se);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
//console.log(unresolved);
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
let autoloadEnabled: boolean = false;
|
|
461
|
+
|
|
462
|
+
export function autoload(enable: boolean = true): boolean {
|
|
463
|
+
if (!enable) {
|
|
464
|
+
observer?.disconnect();
|
|
465
|
+
observer = null;
|
|
466
|
+
return autoloadEnabled;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
autoloadEnabled = enable;
|
|
470
|
+
observer = new MutationObserver(loadit);
|
|
471
|
+
|
|
472
|
+
setTimeout(() => {
|
|
473
|
+
observer!.observe(document.body, { childList: true, subtree: true });
|
|
474
|
+
loadit();
|
|
475
|
+
}, 5);
|
|
476
|
+
|
|
477
|
+
return autoloadEnabled;
|
|
478
|
+
}
|
package/dist/elements.min.js
CHANGED
|
@@ -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.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>y,getCE:()=>w});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class o{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var i=new Function("try {return this===window;}catch(e){ return false;}");let c=new Set;function s(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function a(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function u(e){return e&&e instanceof HTMLElement}function l(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let i=e?._mc;if(!i)return;let c=t instanceof o?new o(t.type,t.data,"l"):new o(t,r,"l"),s="string"!=typeof t?t:new o(t,r,n);[...Object.values(i)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&f(e,s)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=a(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}i()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>c.add(e)));class g{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!i()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),i=n.replace(/^on[e]{0,1}/,""),s=i.toLowerCase();o&&Object.defineProperty(e,"on"+i,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),c.has("on"+s)&&function(e,t,r,n=!1,o=!1){let i={once:!1};n&&(i.capture=n),o&&(i.once=o),e.addEventListener(t,r,i)}(t,s,(e=>{r.trigger(i,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class m extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===m||n.constructor===b){let i=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),c="string"!=typeof e?e:new o(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(i)})),void(/[ud]/.test(c.bubble)&&f(n.target,c))}if(n instanceof m||n instanceof b){const n=this,i="string"!=typeof e?e:new o(e,t,r),c="on"+i.type[0].toUpperCase()+i.type.slice(1);if(i.bubble.indexOf("l")>-1&&(i.immediateStopped||"function"!=typeof n[c]||(n[c](i),n.hasOwnProperty(c)&&delete n[c])),i.stopped||"l"===i.bubble)return n;/[ud]/.test(i.bubble)&&f(n.target,i)}}}class b extends g{_mc={};constructor(e,t=!1){super(e)}static add=l;static remove=d;static trigger=p;trigger(e,t={},r){m.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return u(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return u(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!u(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=s([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return u(t)?s([...t.querySelectorAll("*[_mc]")],e):[]}}class h extends HTMLElement{constructor(){super()}connectedCallback(){b.trigger(this,"Connected")}disconnectedCallback(){b.trigger(this,"Disconnected")}adoptedCallback(){b.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){b.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function y(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends h{instance;constructor(e){super();let r=new t(this,e);b.add(this,n,r)}static get observedAttributes(){return r}}))}function w(e){return customElements.get(e)}return t})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>y,getCE:()=>w});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class o{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var i=new Function("try {return this===window;}catch(e){ return false;}");let c=new Set;function s(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function a(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function u(e){return e&&e instanceof HTMLElement}function l(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let i=e?._mc;if(!i)return;let c=t instanceof o?new o(t.type,t.data,"l"):new o(t,r,"l"),s="string"!=typeof t?t:new o(t,r,n);[...Object.values(i)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&f(e,s)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=a(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}i()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>c.add(e)));class g{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!i()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),i=n.replace(/^on[e]{0,1}/,""),s=i.toLowerCase();o&&Object.defineProperty(e,"on"+i,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),c.has("on"+s)&&function(e,t,r,n=!1,o=!1){let i={once:!1};n&&(i.capture=n),o&&(i.once=o),e.addEventListener(t,r,i)}(t,s,(e=>{r.trigger(i,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class m extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===m||n.constructor===b){let i=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),c="string"!=typeof e?e:new o(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(i)})),void(/[ud]/.test(c.bubble)&&f(n.target,c))}if(n instanceof m||n instanceof b){const n=this,i="string"!=typeof e?e:new o(e,t,r),c="on"+i.type[0].toUpperCase()+i.type.slice(1);if(i.bubble.indexOf("l")>-1&&(i.immediateStopped||"function"!=typeof n[c]||(n[c](i),n.hasOwnProperty(c)&&delete n[c])),i.stopped||"l"===i.bubble)return n;/[ud]/.test(i.bubble)&&f(n.target,i)}}}class b extends g{_mc={};constructor(e,t=!1){super(e)}static add=l;static remove=d;static trigger=p;trigger(e,t={},r){m.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return u(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return u(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!u(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=s([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return u(t)?s([...t.querySelectorAll("*[_mc]")],e):[]}}new Map;class h extends HTMLElement{constructor(){super()}connectedCallback(){b.trigger(this,"Connected")}disconnectedCallback(){b.trigger(this,"Disconnected")}adoptedCallback(){b.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){b.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function y(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends h{instance;constructor(e){super();let r=new t(this,e);b.add(this,n,r)}static get observedAttributes(){return r}}))}function w(e){return customElements.get(e)}return t})()));
|
package/dist/elements.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
import { DC } from
|
|
4
|
-
import { kebabToPascal } from
|
|
3
|
+
import { DC } from './MC.js';
|
|
4
|
+
import { kebabToPascal } from './helpers.js';
|
|
5
5
|
|
|
6
6
|
class CeBaseClass extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -9,19 +9,19 @@ class CeBaseClass extends HTMLElement {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
connectedCallback() {
|
|
12
|
-
(DC as any).trigger(this,
|
|
12
|
+
(DC as any).trigger(this, 'Connected');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
disconnectedCallback() {
|
|
16
|
-
(DC as any).trigger(this,
|
|
16
|
+
(DC as any).trigger(this, 'Disconnected');
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
adoptedCallback() {
|
|
20
|
-
(DC as any).trigger(this,
|
|
20
|
+
(DC as any).trigger(this, 'Adopted');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
attributeChangedCallback(name: string, oldValue: any, newValue: any) {
|
|
24
|
-
(DC as any).trigger(this,
|
|
24
|
+
(DC as any).trigger(this, 'AttributeChanged', { name, oldValue, newValue });
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ function createNamedClass(
|
|
|
29
29
|
name: string,
|
|
30
30
|
ClassBody: { new (...args: any[]): any }
|
|
31
31
|
) {
|
|
32
|
-
return Object.defineProperty(ClassBody,
|
|
32
|
+
return Object.defineProperty(ClassBody, 'name', { value: name });
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function defineCE(
|
|
@@ -42,7 +42,7 @@ export function defineCE(
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
if (!tagName.includes(
|
|
45
|
+
if (!tagName.includes('-')) {
|
|
46
46
|
throw new Error(
|
|
47
47
|
'createCustomElement: tagName must contain at least one hyphen ("-").'
|
|
48
48
|
);
|
|
@@ -60,7 +60,7 @@ export function defineCE(
|
|
|
60
60
|
constructor(data?: any) {
|
|
61
61
|
super();
|
|
62
62
|
let instance = new DefinitionClass(this, data);
|
|
63
|
-
|
|
63
|
+
DC.add(this, name, instance);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
static get observedAttributes() {
|
package/dist/formValues.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LooseObject } from './helpers.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export declare class FormValues {
|
|
3
|
+
constructor(targetObject: LooseObject, propertyName: string, dom: HTMLElement | ShadowRoot);
|
|
4
|
+
}
|
|
4
5
|
//# sourceMappingURL=formValues.d.ts.map
|
package/dist/formValues.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formValues.d.ts","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"formValues.d.ts","sourceRoot":"","sources":["../src/formValues.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AAoP/D,qBAAa,UAAU;gBAErB,YAAY,EAAE,WAAW,EACzB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW,GAAG,UAAU;CA0B9B"}
|