@twobirds/microcomponents 0.0.28 → 0.0.29
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/documentation/MicroComponents.md +39 -20
- package/dist/customObservables.d.ts +1 -1
- package/dist/customObservables.d.ts.map +1 -1
- package/dist/customObservables.min.js +1 -1
- package/dist/customObservables.ts +2 -2
- package/dist/microcomponents.min.js +1 -1
- package/dist/test.ts +3 -3
- package/package.json +1 -1
- package/public/classes/DC.html +15 -15
- package/public/classes/MC.html +7 -7
- package/public/classes/McBase.html +4 -4
- package/public/classes/McEvent.html +13 -13
- package/public/customObservables.js +1 -1
- package/public/customObservables.js.map +1 -1
- package/public/customObservables.min.js +1 -1
- package/public/documentation/MicroComponents.md +39 -20
- package/public/functions/addListener.html +1 -1
- package/public/functions/removeListener.html +1 -1
- package/public/interfaces/HTMLMcElement.html +2 -2
- package/public/microcomponents.min.js +1 -1
- package/public/test.js +3 -3
- package/public/test.js.map +1 -1
- package/src/customObservables.ts +2 -2
- package/src/test.ts +3 -3
|
@@ -27,16 +27,27 @@ As an application programmer you should understand **MC** and **DC** methods and
|
|
|
27
27
|
- **DC** use observables and formValues to provide 1-way and 2-way binding to the DOM.
|
|
28
28
|
- **DC** have selectors to find other DCs in the DOM.
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## McBase() Superclass (not exported), Overview
|
|
31
31
|
|
|
32
32
|
**Instance Properties**
|
|
33
33
|
- `.target`: readonly, a getter returning the DOM element or parent MC instance your instance resides in
|
|
34
|
+
|
|
35
|
+
**Constructor:**
|
|
36
|
+
- calls `init()`: triggers the 'init' lifecycle event, also recursively into the inner '._mc' structure.
|
|
37
|
+
- calls `autoAttachListeners()`: methods in your MC that start with "on[A-Z]" or "one[A-Z]" and describe native DOM events (e.g. "onClick") will be added to the DOM Element as listeners.
|
|
38
|
+
|
|
39
|
+
# Exported:
|
|
40
|
+
|
|
41
|
+
## MC() Class, extends McBase
|
|
42
|
+
|
|
43
|
+
**Instance Properties**
|
|
44
|
+
- `.target`: (inherited from McBase)
|
|
34
45
|
- `._mc`: a hash object that contains inner micro components
|
|
35
46
|
|
|
36
47
|
- **Instance Methods:**
|
|
37
|
-
- `.trigger( eventName, data )`:
|
|
48
|
+
- `.trigger( eventName, data )`: (inherited from McBase)
|
|
38
49
|
|
|
39
|
-
## DC() Class
|
|
50
|
+
## DC() Class, extends McBase
|
|
40
51
|
|
|
41
52
|
- **Static Methods:**
|
|
42
53
|
- `DC.add( DomElement, key, mc)`: Add a DC to an HTMLElement.
|
|
@@ -44,27 +55,24 @@ As an application programmer you should understand **MC** and **DC** methods and
|
|
|
44
55
|
- `DC.trigger( eventName, DomElement, data, bubble )`: trigger an event, handles directional traversal in the DOM.
|
|
45
56
|
|
|
46
57
|
**Instance Properties**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- `.target`: readonly, a getter returning the DOM element the instance resides in
|
|
50
|
-
- `._mc`: a hash object that contains inner MCs
|
|
58
|
+
- `.target`: (inherited from McBase)
|
|
59
|
+
- `._mc`: a hash object that contains inner micro components
|
|
51
60
|
|
|
52
61
|
- **Instance Methods:**
|
|
53
62
|
- `.parent(search?)`: Get parent DCs.
|
|
54
63
|
- `.ancestors(search?)`: Get ancestor DCs.
|
|
55
64
|
- `.children(search?)`: Get child DCs.
|
|
56
65
|
- `.descendants(search?)`: Get descendant DCs.
|
|
57
|
-
- `.autoAttachListeners()`: methods in your MC that start with "on[A-Z]" or "one[A-Z]" and describe native DOM events (e.g. "onClick") will be added to the DOM Element as listeners.
|
|
58
|
-
|
|
59
|
-
(inherited from MC )
|
|
60
66
|
- `.trigger( eventName, data, bubble )`: trigger an event on "this", handles directional bubbling in the DOM.
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
# Usage
|
|
69
|
+
|
|
70
|
+
## Typical Workflow
|
|
63
71
|
|
|
64
72
|
1. **Attach DCs** to HTMLElements using `DC.add()`.
|
|
65
73
|
2. **Access** other DCs by their property key or navigating through DOM (e.g., `ancestors()`, `children()`, etc.) **and use their inner functionality**.
|
|
66
74
|
|
|
67
|
-
|
|
75
|
+
### Attach Micro Components to a DOM element
|
|
68
76
|
|
|
69
77
|
To attach a micro component to an HTML element, use the `DC.add()` static function.
|
|
70
78
|
|
|
@@ -96,7 +104,7 @@ DC.add( myElement, 'myDcComponent', new MyClass( myElement ) );
|
|
|
96
104
|
- After you added a micro component using this function, the **HTMLElement will contain a property `_mc`** which contains the external MC instances.
|
|
97
105
|
- Also the **HTMLElement then has an attribute '_mc'** which will indicate that at least one micro component is attached to this dom element.
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
### Remove a top level Micro Component from a DOM element
|
|
100
108
|
|
|
101
109
|
Micro components can be removed using the `DC.remove()` static method.
|
|
102
110
|
|
|
@@ -106,7 +114,7 @@ DC.remove( myDomElement, 'myComponent');
|
|
|
106
114
|
|
|
107
115
|
**When all micro components are removed** (the _mc object has no more properties), the **`_mc` attribute is also removed** from the HTML element.
|
|
108
116
|
|
|
109
|
-
|
|
117
|
+
### Retrieve Micro Components from a DOM element
|
|
110
118
|
|
|
111
119
|
```javascript
|
|
112
120
|
const target = document.querySelector( 'div' );
|
|
@@ -120,7 +128,7 @@ const specificInstance = target._mc?.myPublicComponent;
|
|
|
120
128
|
console.log(specificInstance);
|
|
121
129
|
```
|
|
122
130
|
|
|
123
|
-
### Trigger an Event
|
|
131
|
+
### Trigger an Event
|
|
124
132
|
|
|
125
133
|
```javascript
|
|
126
134
|
const target = document.querySelector( 'div' );
|
|
@@ -132,7 +140,7 @@ DC.trigger( target, '<eventName>', data | null, bubble );
|
|
|
132
140
|
|
|
133
141
|
# Methods you can use in your Micro Component Instances
|
|
134
142
|
|
|
135
|
-
##
|
|
143
|
+
## Retrieve Inner Micro Components
|
|
136
144
|
|
|
137
145
|
You can retrieve an inner micro component by using the ._mc property.
|
|
138
146
|
|
|
@@ -144,7 +152,7 @@ console.log(innerComponent);
|
|
|
144
152
|
**The following methods hop over HTMLElements that DO NOT contain micro components.**
|
|
145
153
|
|
|
146
154
|
|
|
147
|
-
##
|
|
155
|
+
## Navigate Parent and Ancestor Micro Components
|
|
148
156
|
|
|
149
157
|
The `.parent()` and `.ancestors()` methods allow you to retrieve micro components attached to parent elements.
|
|
150
158
|
|
|
@@ -161,7 +169,7 @@ To retrieve specific micro component(s) attached to ancestors:
|
|
|
161
169
|
const specificAncestorMc = this.ancestors('myComponent');
|
|
162
170
|
```
|
|
163
171
|
|
|
164
|
-
##
|
|
172
|
+
## Retrieve Child and Descendant Micro Components
|
|
165
173
|
|
|
166
174
|
The `.children()` and `.descendants()` methods retrieve micro components attached to child elements or any descendants.
|
|
167
175
|
```javascript
|
|
@@ -175,7 +183,7 @@ console.log(descendantComponents); // an array of all descendant micro componen
|
|
|
175
183
|
const specificMcs = this.descenants('specificMc');
|
|
176
184
|
```
|
|
177
185
|
|
|
178
|
-
|
|
186
|
+
## Trigger an Event
|
|
179
187
|
```javascript
|
|
180
188
|
// trigger an event on yourself
|
|
181
189
|
this
|
|
@@ -206,7 +214,7 @@ this
|
|
|
206
214
|
|
|
207
215
|
## Automatically attach Listener Methods to the DOM
|
|
208
216
|
|
|
209
|
-
On any **DC** instance,
|
|
217
|
+
On any **MC** and **DC** instance, the Superclass McBase calls **autoAttachListeners()** in the constructor.
|
|
210
218
|
|
|
211
219
|
Any methods you define in your code that start with **"on"** or **"one"**, and also match DOM event names, will be called accordingly:
|
|
212
220
|
|
|
@@ -226,3 +234,14 @@ let myFirstDiv = document.querySelector('div');
|
|
|
226
234
|
DC.add( myFirstDiv, 'myEventTarget', new MyEventTarget( myFirstDiv ) );
|
|
227
235
|
// now wait for somebody to click on that <div>
|
|
228
236
|
```
|
|
237
|
+
# Lifecycle Events on **MC** and **DC**
|
|
238
|
+
|
|
239
|
+
## Init
|
|
240
|
+
- "this" first
|
|
241
|
+
- traverses recursively into the _mc structure
|
|
242
|
+
- requires **method .oneInit()** to be present in your class definition.
|
|
243
|
+
|
|
244
|
+
## Destroy ( TBD )
|
|
245
|
+
- recursive "_mc" first
|
|
246
|
+
- then "this"
|
|
247
|
+
- requires **method .oneDestroy()** to be present in your class definition.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LooseObject } from './helpers.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const observe: (target: LooseObject, propertyName?: string) => void;
|
|
3
3
|
type Callback = (value: any) => void;
|
|
4
4
|
export type Observable = {
|
|
5
5
|
observe: (cb: Callback) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customObservables.d.ts","sourceRoot":"","sources":["../src/customObservables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"customObservables.d.ts","sourceRoot":"","sources":["../src/customObservables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,eAAO,MAAM,OAAO,WAAa,WAAW,iBAAiB,MAAM,SA8UlE,CAAA;AAED,KAAK,QAAQ,GAAG,CAAE,KAAK,EAAE,GAAG,KAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,UAAU,GAAG;IACrB,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,KAAK,IAAI,CAAC;CACpD,CAAC"}
|
|
@@ -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.customObservables=t():e.customObservables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return null!=e&&"object"==typeof e}function o(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function n(e,t){const o=Object.keys(e),c=Object.keys(t);if(o.length!==c.length)return!1;for(const c of o){const o=e[c],a=t[c],u=r(o)&&r(a);if(u&&!n(o,a)||!u&&o!==a)return!1}return!0}function c(e,t,o=null,n){let a=e.split(".");n||(n=t);let u=a.shift(),s=a.join(".");null!==o&&u.length&&void 0===t[u]&&(t[u]={});let l=t[u];return 0===s.length?null!==o?(t[u]=o,n):t[u]:r(t[u])?c(s,t[u],o,n):o?n:l[u]}function a(e,t){var o=Array.from(arguments);if(o.length){if(1===o.length)return o[1];if(o.length>2){for(;o.length>1;)o[0]=a(o[0],o[1]),o.splice(1,1);return o[0]}if("string"==typeof e){var n=e.match(/\{[^\{\}]*\}/g);n&&n.forEach((function(r){var o=c(r.substr(1,r.length-2),t);void 0!==o&&(e=e.replace(r,o))}))}else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=a(e[r],t))}));break;case Array:e.forEach((function(r,o,n){n[o]=a(e[o],t)}))}return e}console.error("no arguments give to parse")}e.r(t),e.d(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.customObservables=t():e.customObservables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return null!=e&&"object"==typeof e}function o(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function n(e,t){const o=Object.keys(e),c=Object.keys(t);if(o.length!==c.length)return!1;for(const c of o){const o=e[c],a=t[c],u=r(o)&&r(a);if(u&&!n(o,a)||!u&&o!==a)return!1}return!0}function c(e,t,o=null,n){let a=e.split(".");n||(n=t);let u=a.shift(),s=a.join(".");null!==o&&u.length&&void 0===t[u]&&(t[u]={});let l=t[u];return 0===s.length?null!==o?(t[u]=o,n):t[u]:r(t[u])?c(s,t[u],o,n):o?n:l[u]}function a(e,t){var o=Array.from(arguments);if(o.length){if(1===o.length)return o[1];if(o.length>2){for(;o.length>1;)o[0]=a(o[0],o[1]),o.splice(1,1);return o[0]}if("string"==typeof e){var n=e.match(/\{[^\{\}]*\}/g);n&&n.forEach((function(r){var o=c(r.substr(1,r.length-2),t);void 0!==o&&(e=e.replace(r,o))}))}else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=a(e[r],t))}));break;case Array:e.forEach((function(r,o,n){n[o]=a(e[o],t)}))}return e}console.error("no arguments give to parse")}e.r(t),e.d(t,{observe:()=>u});const u=(e,t)=>{(t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return;let c,u=e[t];if(!u.prototype)switch(typeof u){case"string":c=String;break;case"number":c=Number;break;case"boolean":c=Boolean;break;case"object":c=u instanceof Array?Array:Object;break;default:return}let s=class extends c{constructor(e){super(e),this.constructor.callbacks=[],r(e)&&(this.constructor.bound=[],Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]})))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this,o=r(t.valueOf()),n=t.constructor.bound;if(o){function c(e){if(e.nodeType&&3===e.nodeType){var r=Array.from(e.nodeValue&&e.nodeValue.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var u=(s=e.nodeValue||"",function(t){var n,c=!1;return r&&(o?r.forEach((function(e){u.values[e]!==t[e]&&(u.values[e]=t[e],c=!0)})):(u.values=t,c=!0)),c&&(n=s,e.nodeValue=o?a(n,u.values):n.replace(/\{.*\}/g,u.values)),t});u.values=o?{}:void 0,r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let t=o?{}:void 0;r.forEach((function(e){o&&(t[e]="")})),n.push(u)}Array.from(e.childNodes).forEach((function(e){c(e)})),t.notify()}var s;e.nodeType&&1===e.nodeType&&(Array.from(e.attributes).forEach((function(t){var r=Array.from(t.value&&t.value.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var o=function(t){return function(n){var c,u=!1;return r&&r.forEach((function(e){o.values[e]!==n[e]&&(o.values[e]=n[e],u=!0)})),u&&(c=t,e.nodeValue=a(c,o.values)),n}}(t.value||"");o.values={},r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let c={};r.forEach((function(e){c[e]=""})),n.push(o)}})),Array.from(e.childNodes).forEach((function(e){c(e)})),t.notify()),e.nodeType&&11===e.nodeType&&Array.from(e.childNodes).forEach((function(e){c(e)}))}c(e),n.length>0&&t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf());return this}notify(){let e=this,t=r(e.valueOf())&&e.valueOf()instanceof Array==0?structuredClone(Object.assign({},e)):e.valueOf();return e.constructor.callbacks.forEach((e=>{e(t)})),r(e.valueOf())&&e.constructor.bound.forEach((e=>{e(t)})),this}},l=new s(u);Object.defineProperty(e,t,{enumerable:!0,get(){if(r(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(o((function(){n(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(r(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));e=structuredClone(Object.assign({},e));let r=l.constructor?.hasFormHandler??!1,c=l.constructor.callbacks,a=l.constructor.bound;l=new s(structuredClone(Object.assign({},e))),l.constructor.callbacks=r,l.constructor.callbacks=c,l.constructor.bound=a,setTimeout(o((function(){n(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new s(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),"- CANNOT BECOME:",typeof e)}}),e[t]=u}))};return t})()));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { LooseObject } from './helpers.js';
|
|
4
4
|
import { isObject, parse, debounce, deepEqual } from './helpers.js';
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const observe = ( target: LooseObject, propertyName?: string ) => {
|
|
7
7
|
|
|
8
8
|
let keys = !propertyName ? [ ...Object.getOwnPropertyNames(target) ] : [ propertyName ];
|
|
9
9
|
|
|
@@ -341,7 +341,7 @@ export const makeCO = ( target: LooseObject, propertyName?: string ) => {
|
|
|
341
341
|
|
|
342
342
|
type Callback = ( value: any ) => void;
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
export type Observable = {
|
|
345
345
|
observe: (cb: Callback) => void;
|
|
346
346
|
notify: () => void;
|
|
347
347
|
bind: (target: HTMLElement | ShadowRoot) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return null!=e&&"object"==typeof e}function n(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function s(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function a(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const s of n){const n=e[s],o=t[s],c=r(n)&&r(o);if(c&&!a(n,o)||!c&&n!==o)return!1}return!0}function o(e,t,n=null,s){let a=e.split(".");s||(s=t);let c=a.shift(),i=a.join(".");null!==n&&c.length&&void 0===t[c]&&(t[c]={});let l=t[c];return 0===i.length?null!==n?(t[c]=n,s):t[c]:r(t[c])?o(i,t[c],n,s):n?s:l[c]}function c(e,t){var n=Array.from(arguments);if(n.length){if(1===n.length)return n[1];if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e){var s=e.match(/\{[^\{\}]*\}/g);s&&s.forEach((function(r){var n=o(r.substr(1,r.length-2),t);void 0!==n&&(e=e.replace(r,n))}))}else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,s){s[n]=c(e[n],t)}))}return e}console.error("no arguments give to parse")}function i(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}e.r(t),e.d(t,{$d:()=>I,$t:()=>B,DC:()=>S,MC:()=>A,McBase:()=>w,McEvent:()=>f,addListener:()=>b,debounce:()=>s,deepEqual:()=>a,defineCE:()=>k,formValues:()=>F,getCE:()=>x,htmlToElements:()=>i,isObject:()=>r,kebabToPascal:()=>n,makeCO:()=>T,nameSpace:()=>o,parse:()=>c,removeListener:()=>g});var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class f{#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 h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;function p(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 m(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 y(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function g(e,t,r){e.removeEventListener(t,r)}function E(e,t,r={}){let n=e;if(!n._mc){let t=S?.debug;S.debug=!1,n._mc=new S(e),S.debug=t}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function v(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 O(e,t,r={}){let n=e?._mc;n&&[...Object.values(n)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(t,r)}))}h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class w{#n;constructor(e){this.#n=new WeakRef(e),function(e){let t=e.constructor===S;setTimeout((()=>{e.trigger("Init"),t||setTimeout((()=>{let t=Object.keys(e?._mc);t.length&&t?.forEach((t=>{let r=e?._mc?.[t];r.oneInit&&"function"==typeof r.oneInit&&r.oneInit(new f("Init"))}))}),0)}),0)}(this),function(e){if(!h()||e.constructor===S)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 s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),o=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),d.has("on"+o)&&b(t,o,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class A extends w{_mc={};constructor(e){super(e)}static trigger=O;trigger(e,t={},r){let n=this;if(r=r||"l",n.constructor!==A&&n.constructor!==S){if(n instanceof A||n instanceof S){const n=this,s="string"!=typeof e?e:new f(e,t,r),a="on"+s.type[0].toUpperCase()+s.type.slice(1);if(s.bubble.indexOf("l")>-1&&(s.immediateStopped||"function"!=typeof n[a]||(n[a](s),n.hasOwnProperty(a)&&delete n[a])),s.stopped||"l"===s.bubble)return n;h()&&/[ud]/.test(s.bubble)&&n instanceof A&&setTimeout((()=>{-1===s.bubble.indexOf("l")&&(s.bubble+="l"),s.bubble.indexOf("u")>-1&&n.parent().forEach((e=>{e instanceof A&&e.trigger(s)})),s.bubble.indexOf("d")>-1&&n.children().forEach((e=>{e instanceof A&&e.trigger(s)}))}),0)}}else[...Object.getOwnPropertyNames(n)].forEach((s=>{n[s]?.trigger&&"function"==typeof n[s]?.trigger&&n[s]?.trigger(e,t,r)}))}}class S extends w{__mc={};constructor(e){super(e)}static debug=!1;static add=E;static remove=v;static trigger=O;get _mc(){return this.__mc}trigger(e,t={},r){A.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return y(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return y(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!y(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=p([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return y(t)?p([...t.querySelectorAll("*[_mc]")],e):[]}}class j extends HTMLElement{constructor(){super()}connectedCallback(){S.trigger(this,"Connected")}disconnectedCallback(){S.trigger(this,"Disconnected")}adoptedCallback(){S.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){S.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function k(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 s=n(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(s,class extends j{instance;constructor(e){super();let r=new t(this,e);S.add(this,s,r)}static get observedAttributes(){return r}}))}function x(e){return customElements.get(e)}const T=(e,t)=>{(t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return;let n,o=e[t];if(!o.prototype)switch(typeof o){case"string":n=String;break;case"number":n=Number;break;case"boolean":n=Boolean;break;case"object":n=o instanceof Array?Array:Object;break;default:return}let i=class extends n{constructor(e){super(e),this.constructor.callbacks=[],r(e)&&(this.constructor.bound=[],Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]})))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this,n=r(t.valueOf()),s=t.constructor.bound;if(n){function a(e){if(e.nodeType&&3===e.nodeType){var r=Array.from(e.nodeValue&&e.nodeValue.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var o=(i=e.nodeValue||"",function(t){var s,a=!1;return r&&(n?r.forEach((function(e){o.values[e]!==t[e]&&(o.values[e]=t[e],a=!0)})):(o.values=t,a=!0)),a&&(s=i,e.nodeValue=n?c(s,o.values):s.replace(/\{.*\}/g,o.values)),t});o.values=n?{}:void 0,r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let t=n?{}:void 0;r.forEach((function(e){n&&(t[e]="")})),s.push(o)}Array.from(e.childNodes).forEach((function(e){a(e)})),t.notify()}var i;e.nodeType&&1===e.nodeType&&(Array.from(e.attributes).forEach((function(t){var r=Array.from(t.value&&t.value.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var n=function(t){return function(s){var a,o=!1;return r&&r.forEach((function(e){n.values[e]!==s[e]&&(n.values[e]=s[e],o=!0)})),o&&(a=t,e.nodeValue=c(a,n.values)),s}}(t.value||"");n.values={},r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let a={};r.forEach((function(e){a[e]=""})),s.push(n)}})),Array.from(e.childNodes).forEach((function(e){a(e)})),t.notify()),e.nodeType&&11===e.nodeType&&Array.from(e.childNodes).forEach((function(e){a(e)}))}a(e),s.length>0&&t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf());return this}notify(){let e=this,t=r(e.valueOf())&&e.valueOf()instanceof Array==0?structuredClone(Object.assign({},e)):e.valueOf();return e.constructor.callbacks.forEach((e=>{e(t)})),r(e.valueOf())&&e.constructor.bound.forEach((e=>{e(t)})),this}},l=new i(o);Object.defineProperty(e,t,{enumerable:!0,get(){if(r(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(s((function(){a(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(r(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));e=structuredClone(Object.assign({},e));let r=l.constructor?.hasFormHandler??!1,n=l.constructor.callbacks,o=l.constructor.bound;l=new i(structuredClone(Object.assign({},e))),l.constructor.callbacks=r,l.constructor.callbacks=n,l.constructor.bound=o,setTimeout(s((function(){a(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),"- CANNOT BECOME:",typeof e)}}),e[t]=o}))},_=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},C=e=>{let t=I("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new H(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class N{constructor(e){}}class L extends N{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=I(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=I(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends N{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return I(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,I(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class H extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class P{#c=new Set;get set(){return this.#c}get array(){return Array.from(this.#c)}set set(e){this.#c=e}get length(){return this.#c.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new $;return this.#c.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return I(e,t).forEach((e=>{r.#c.add(e)})),r}addClass(...e){return e=_(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=I(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=I(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=I(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{I(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=I(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=I(e,t)),r.#c.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=I([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#c.has(e)}hasClass(...e){return e=_(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#c.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){g(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){b(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){b(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=I(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=_(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=_(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#c.forEach((e=>{c.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=C(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=C(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return I(this.array.at(e))}concat(e){let t=this;return(e instanceof P?e.array:e).forEach((e=>{t.#c.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#c=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#c.add(e)})),this}shift(){let e=this,t=e.#c.size?e.array[0]:void 0;return t&&e.#c.delete(t),t}slice(e,t){return I(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),I(n)}}class ${#c=new Set;get set(){return this.#c}get array(){return Array.from(this.#c)}set set(e){this.#c=e}get length(){return this.#c.size}set length(e){}constructor(e,t=document.body){if(!e)return this;I(e,t).forEach((e=>{B(e).forEach((e=>{this.#c.add(e)}))}))}$d(e,t=document.body){let r=new P,n=new Set,s=!!e||!1,a=new Set;return s&&(a=I(e,t).set),this.#c.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}descendants(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}first(e){let t=this,r=new Set;return t.#c.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#c.has(e)}last(e){let t=this,r=new Set;return t.#c.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#c.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);B([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){g(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){b(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){b(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}parents(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}prev(e){let t=this,r=new Set;return t.#c.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);B([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return B(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#c.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return B(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#c=new Set(e),t}push(e){return this.#c.add(e),this}shift(){let e=this.array.shift();return this.#c.delete(e),e}slice(e,t){return B(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return B(n)}}const I=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{I(e,t).forEach((e=>{r.add(e)}))})),new P([...r])):new P(e,t)},B=(e,t=document)=>I(e,t).$t();class q{constructor(e){}}class V extends q{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=[...(this.#a||document).querySelectorAll(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`)].filter((e=>e.checked));return r.length?(e=r?.[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=[...(this.#a||document).querySelectorAll(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`)];if(!r.length)return;if(""===e)return void r.forEach((e=>{e.checked&&(e.checked=!1)}));const n=r.filter((t=>t.getAttribute("value")===e));if(!n.length)return;return void((n?.[0]).checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class z extends q{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}const F=(e,t={},r,n)=>{let s=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new V(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new D(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r})(e);function a(e){Object.keys(e).forEach((t=>{s.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(s[t]=e[t])}))}if(Object.keys(t).length>0&&a(t),void 0!==n){let t=r[n];t.constructor?.hasFormHandler||(t.constructor.hasFormHandler=!0,t.observe(a)),r[n].observe((()=>{})),[...e.querySelectorAll("input, textarea, select")].forEach((e=>{b(e,"keyup",(()=>{r[n]=structuredClone(Object.assign(s))})),b(e,"change",(()=>{r[n]=structuredClone(Object.assign(s))})),e instanceof HTMLSelectElement&&b(e,"select",(()=>{r[n]=structuredClone(Object.assign(s))}))}))}return n?r[n]:Object.assign({},s)};return t})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return null!=e&&"object"==typeof e}function n(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function s(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function a(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const s of n){const n=e[s],o=t[s],c=r(n)&&r(o);if(c&&!a(n,o)||!c&&n!==o)return!1}return!0}function o(e,t,n=null,s){let a=e.split(".");s||(s=t);let c=a.shift(),i=a.join(".");null!==n&&c.length&&void 0===t[c]&&(t[c]={});let l=t[c];return 0===i.length?null!==n?(t[c]=n,s):t[c]:r(t[c])?o(i,t[c],n,s):n?s:l[c]}function c(e,t){var n=Array.from(arguments);if(n.length){if(1===n.length)return n[1];if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e){var s=e.match(/\{[^\{\}]*\}/g);s&&s.forEach((function(r){var n=o(r.substr(1,r.length-2),t);void 0!==n&&(e=e.replace(r,n))}))}else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,s){s[n]=c(e[n],t)}))}return e}console.error("no arguments give to parse")}function i(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}e.r(t),e.d(t,{$d:()=>I,$t:()=>B,DC:()=>S,MC:()=>A,McBase:()=>w,McEvent:()=>f,addListener:()=>b,debounce:()=>s,deepEqual:()=>a,defineCE:()=>k,formValues:()=>F,getCE:()=>x,htmlToElements:()=>i,isObject:()=>r,kebabToPascal:()=>n,nameSpace:()=>o,observe:()=>T,parse:()=>c,removeListener:()=>g});var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class f{#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 h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;function p(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 m(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 y(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function g(e,t,r){e.removeEventListener(t,r)}function E(e,t,r={}){let n=e;if(!n._mc){let t=S?.debug;S.debug=!1,n._mc=new S(e),S.debug=t}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&e.setAttribute("_mc","")),r}function v(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 O(e,t,r={}){let n=e?._mc;n&&[...Object.values(n)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(t,r)}))}h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class w{#n;constructor(e){this.#n=new WeakRef(e),function(e){let t=e.constructor===S;setTimeout((()=>{e.trigger("Init"),t||setTimeout((()=>{let t=Object.keys(e?._mc);t.length&&t?.forEach((t=>{let r=e?._mc?.[t];r.oneInit&&"function"==typeof r.oneInit&&r.oneInit(new f("Init"))}))}),0)}),0)}(this),function(e){if(!h()||e.constructor===S)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 s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),o=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),d.has("on"+o)&&b(t,o,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class A extends w{_mc={};constructor(e){super(e)}static trigger=O;trigger(e,t={},r){let n=this;if(r=r||"l",n.constructor!==A&&n.constructor!==S){if(n instanceof A||n instanceof S){const n=this,s="string"!=typeof e?e:new f(e,t,r),a="on"+s.type[0].toUpperCase()+s.type.slice(1);if(s.bubble.indexOf("l")>-1&&(s.immediateStopped||"function"!=typeof n[a]||(n[a](s),n.hasOwnProperty(a)&&delete n[a])),s.stopped||"l"===s.bubble)return n;h()&&/[ud]/.test(s.bubble)&&n instanceof A&&setTimeout((()=>{-1===s.bubble.indexOf("l")&&(s.bubble+="l"),s.bubble.indexOf("u")>-1&&n.parent().forEach((e=>{e instanceof A&&e.trigger(s)})),s.bubble.indexOf("d")>-1&&n.children().forEach((e=>{e instanceof A&&e.trigger(s)}))}),0)}}else[...Object.getOwnPropertyNames(n)].forEach((s=>{n[s]?.trigger&&"function"==typeof n[s]?.trigger&&n[s]?.trigger(e,t,r)}))}}class S extends w{__mc={};constructor(e){super(e)}static debug=!1;static add=E;static remove=v;static trigger=O;get _mc(){return this.__mc}trigger(e,t={},r){A.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return y(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return y(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!y(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=p([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return y(t)?p([...t.querySelectorAll("*[_mc]")],e):[]}}class j extends HTMLElement{constructor(){super()}connectedCallback(){S.trigger(this,"Connected")}disconnectedCallback(){S.trigger(this,"Disconnected")}adoptedCallback(){S.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){S.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function k(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 s=n(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(s,class extends j{instance;constructor(e){super();let r=new t(this,e);S.add(this,s,r)}static get observedAttributes(){return r}}))}function x(e){return customElements.get(e)}const T=(e,t)=>{(t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return;let n,o=e[t];if(!o.prototype)switch(typeof o){case"string":n=String;break;case"number":n=Number;break;case"boolean":n=Boolean;break;case"object":n=o instanceof Array?Array:Object;break;default:return}let i=class extends n{constructor(e){super(e),this.constructor.callbacks=[],r(e)&&(this.constructor.bound=[],Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]})))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this,n=r(t.valueOf()),s=t.constructor.bound;if(n){function a(e){if(e.nodeType&&3===e.nodeType){var r=Array.from(e.nodeValue&&e.nodeValue.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var o=(i=e.nodeValue||"",function(t){var s,a=!1;return r&&(n?r.forEach((function(e){o.values[e]!==t[e]&&(o.values[e]=t[e],a=!0)})):(o.values=t,a=!0)),a&&(s=i,e.nodeValue=n?c(s,o.values):s.replace(/\{.*\}/g,o.values)),t});o.values=n?{}:void 0,r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let t=n?{}:void 0;r.forEach((function(e){n&&(t[e]="")})),s.push(o)}Array.from(e.childNodes).forEach((function(e){a(e)})),t.notify()}var i;e.nodeType&&1===e.nodeType&&(Array.from(e.attributes).forEach((function(t){var r=Array.from(t.value&&t.value.match(/\{[^\{\}]*\}/g)||[]);if(r.length>0){var n=function(t){return function(s){var a,o=!1;return r&&r.forEach((function(e){n.values[e]!==s[e]&&(n.values[e]=s[e],o=!0)})),o&&(a=t,e.nodeValue=c(a,n.values)),s}}(t.value||"");n.values={},r=Array.from(r).map((e=>e.replace(/[\{\}]/g,"").trim()));let a={};r.forEach((function(e){a[e]=""})),s.push(n)}})),Array.from(e.childNodes).forEach((function(e){a(e)})),t.notify()),e.nodeType&&11===e.nodeType&&Array.from(e.childNodes).forEach((function(e){a(e)}))}a(e),s.length>0&&t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf());return this}notify(){let e=this,t=r(e.valueOf())&&e.valueOf()instanceof Array==0?structuredClone(Object.assign({},e)):e.valueOf();return e.constructor.callbacks.forEach((e=>{e(t)})),r(e.valueOf())&&e.constructor.bound.forEach((e=>{e(t)})),this}},l=new i(o);Object.defineProperty(e,t,{enumerable:!0,get(){if(r(l.valueOf())){let e=structuredClone(Object.assign({},l));setTimeout(s((function(){a(structuredClone(Object.assign({},l)),e)||l.notify()}),0),0)}return l},set(e){if(typeof e==typeof l.valueOf())if(r(l.valueOf())&&l.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},l));e=structuredClone(Object.assign({},e));let r=l.constructor?.hasFormHandler??!1,n=l.constructor.callbacks,o=l.constructor.bound;l=new i(structuredClone(Object.assign({},e))),l.constructor.callbacks=r,l.constructor.callbacks=n,l.constructor.bound=o,setTimeout(s((function(){a(structuredClone(Object.assign({},l)),t)||l.notify()}),0),0)}else{let t=l.valueOf(),r=l.constructor.callbacks;l=new i(e),l.constructor.callbacks=r,e!==t&&l.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof l.valueOf(),"- CANNOT BECOME:",typeof e)}}),e[t]=o}))},_=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},C=e=>{let t=I("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new H(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class N{constructor(e){}}class L extends N{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=I(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=I(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends N{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return I(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,I(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class H extends N{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class P{#c=new Set;get set(){return this.#c}get array(){return Array.from(this.#c)}set set(e){this.#c=e}get length(){return this.#c.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new $;return this.#c.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return I(e,t).forEach((e=>{r.#c.add(e)})),r}addClass(...e){return e=_(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=I(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=I(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=I(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{I(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=I(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=I(e,t)),r.#c.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=I([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#c.has(e)}hasClass(...e){return e=_(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#c.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){g(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){b(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){b(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=I(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#c.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=I([...n]),e){let n=I(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=_(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=_(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#c.forEach((e=>{c.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=C(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=C(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return I(this.array.at(e))}concat(e){let t=this;return(e instanceof P?e.array:e).forEach((e=>{t.#c.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#c=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#c.add(e)})),this}shift(){let e=this,t=e.#c.size?e.array[0]:void 0;return t&&e.#c.delete(t),t}slice(e,t){return I(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),I(n)}}class ${#c=new Set;get set(){return this.#c}get array(){return Array.from(this.#c)}set set(e){this.#c=e}get length(){return this.#c.size}set length(e){}constructor(e,t=document.body){if(!e)return this;I(e,t).forEach((e=>{B(e).forEach((e=>{this.#c.add(e)}))}))}$d(e,t=document.body){let r=new P,n=new Set,s=!!e||!1,a=new Set;return s&&(a=I(e,t).set),this.#c.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}descendants(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}first(e){let t=this,r=new Set;return t.#c.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#c.has(e)}last(e){let t=this,r=new Set;return t.#c.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#c.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);B([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){g(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){b(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){b(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}parents(e){let t=this,r=new Set;return t.#c.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#c=r,t}prev(e){let t=this,r=new Set;return t.#c.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);B([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#c=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return B(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#c.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return B(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#c=new Set(e),t}push(e){return this.#c.add(e),this}shift(){let e=this.array.shift();return this.#c.delete(e),e}slice(e,t){return B(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return B(n)}}const I=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{I(e,t).forEach((e=>{r.add(e)}))})),new P([...r])):new P(e,t)},B=(e,t=document)=>I(e,t).$t();class q{constructor(e){}}class V extends q{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=[...(this.#a||document).querySelectorAll(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`)].filter((e=>e.checked));return r.length?(e=r?.[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=[...(this.#a||document).querySelectorAll(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`)];if(!r.length)return;if(""===e)return void r.forEach((e=>{e.checked&&(e.checked=!1)}));const n=r.filter((t=>t.getAttribute("value")===e));if(!n.length)return;return void((n?.[0]).checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class z extends q{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected","selected"),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}const F=(e,t={},r,n)=>{let s=(e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new V(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new D(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r})(e);function a(e){Object.keys(e).forEach((t=>{s.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(s[t]=e[t])}))}if(Object.keys(t).length>0&&a(t),void 0!==n){let t=r[n];t.constructor?.hasFormHandler||(t.constructor.hasFormHandler=!0,t.observe(a)),r[n].observe((()=>{})),[...e.querySelectorAll("input, textarea, select")].forEach((e=>{b(e,"keyup",(()=>{r[n]=structuredClone(Object.assign(s))})),b(e,"change",(()=>{r[n]=structuredClone(Object.assign(s))})),e instanceof HTMLSelectElement&&b(e,"select",(()=>{r[n]=structuredClone(Object.assign(s))}))}))}return n?r[n]:Object.assign({},s)};return t})()));
|
package/dist/test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { MC, DC, McEvent, defineCE, getCE,
|
|
3
|
+
import { MC, DC, McEvent, defineCE, getCE, observe } from "./microcomponents.js";
|
|
4
4
|
//import { MC, DC, McEvent } from "./MC.js";
|
|
5
5
|
//import { defineCE, getCE } from "./customElements.js";
|
|
6
|
-
//import {
|
|
6
|
+
//import { observe } from "./customObservables.js";
|
|
7
7
|
|
|
8
8
|
//MC.debug = true;
|
|
9
9
|
|
|
@@ -96,7 +96,7 @@ defineCE(
|
|
|
96
96
|
that.Counter = 0;
|
|
97
97
|
|
|
98
98
|
// convert all props defined so far into custom observables
|
|
99
|
-
|
|
99
|
+
observe(that);
|
|
100
100
|
|
|
101
101
|
DC.add(target, "logger", new Logger(target, console, "[logger]"));
|
|
102
102
|
|
package/package.json
CHANGED
package/public/classes/DC.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<ul class="tsd-hierarchy">
|
|
23
23
|
<li><span class="target">DC</span></li></ul></li></ul></section><aside class="tsd-sources">
|
|
24
24
|
<ul>
|
|
25
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
25
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L329">src/MC.ts:329</a></li></ul></aside>
|
|
26
26
|
<section class="tsd-panel-group tsd-index-group">
|
|
27
27
|
<section class="tsd-panel tsd-index-panel">
|
|
28
28
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<h4 class="tsd-returns-title">Returns <a href="DC.html" class="tsd-signature-type" data-tsd-kind="Class">DC</a></h4><aside class="tsd-sources">
|
|
70
70
|
<p>Overrides <a href="McBase.html">McBase</a>.<a href="McBase.html#constructor">constructor</a></p>
|
|
71
71
|
<ul>
|
|
72
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
72
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L333">src/MC.ts:333</a></li></ul></aside></li></ul></section></section>
|
|
73
73
|
<section class="tsd-panel-group tsd-member-group">
|
|
74
74
|
<h2>Properties</h2>
|
|
75
75
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private tsd-is-inherited"><a id="_target" class="tsd-anchor"></a>
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
<div class="tsd-signature">#target<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">WeakRef</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
|
78
78
|
<p>Inherited from <a href="McBase.html">McBase</a>.<a href="McBase.html#_target">#target</a></p>
|
|
79
79
|
<ul>
|
|
80
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
80
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L216">src/MC.ts:216</a></li></ul></aside></section>
|
|
81
81
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a id="__mc" class="tsd-anchor"></a>
|
|
82
82
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagProtected">Protected</code> <span>__mc</span><a href="#__mc" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
83
83
|
<div class="tsd-signature">__mc<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span>[key: <span class="tsd-signature-type">string</span>]<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = {}</span></div>
|
|
@@ -87,27 +87,27 @@
|
|
|
87
87
|
<li class="tsd-parameter-index-signature">
|
|
88
88
|
<h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5></li></ul></div><aside class="tsd-sources">
|
|
89
89
|
<ul>
|
|
90
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
90
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L331">src/MC.ts:331</a></li></ul></aside></section>
|
|
91
91
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="add" class="tsd-anchor"></a>
|
|
92
92
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>add</span><a href="#add" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
93
93
|
<div class="tsd-signature">add<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = add</span></div><aside class="tsd-sources">
|
|
94
94
|
<ul>
|
|
95
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
95
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L339">src/MC.ts:339</a></li></ul></aside></section>
|
|
96
96
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="debug" class="tsd-anchor"></a>
|
|
97
97
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>debug</span><a href="#debug" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
98
98
|
<div class="tsd-signature">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div><aside class="tsd-sources">
|
|
99
99
|
<ul>
|
|
100
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
100
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L337">src/MC.ts:337</a></li></ul></aside></section>
|
|
101
101
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="remove" class="tsd-anchor"></a>
|
|
102
102
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>remove</span><a href="#remove" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
103
103
|
<div class="tsd-signature">remove<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = remove</span></div><aside class="tsd-sources">
|
|
104
104
|
<ul>
|
|
105
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
105
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L340">src/MC.ts:340</a></li></ul></aside></section>
|
|
106
106
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="trigger" class="tsd-anchor"></a>
|
|
107
107
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>trigger</span><a href="#trigger" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
108
108
|
<div class="tsd-signature">trigger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = trigger</span></div><aside class="tsd-sources">
|
|
109
109
|
<ul>
|
|
110
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
110
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L341">src/MC.ts:341</a></li></ul></aside></section></section>
|
|
111
111
|
<section class="tsd-panel-group tsd-member-group">
|
|
112
112
|
<h2>Accessors</h2>
|
|
113
113
|
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"><a id="_mc" class="tsd-anchor"></a>
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
<li class="tsd-parameter-index-signature">
|
|
121
121
|
<h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5></li></ul><aside class="tsd-sources">
|
|
122
122
|
<ul>
|
|
123
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
123
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L343">src/MC.ts:343</a></li></ul></aside></li></ul></section>
|
|
124
124
|
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><a id="target" class="tsd-anchor"></a>
|
|
125
125
|
<h3 class="tsd-anchor-link"><span>target</span><a href="#target" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
126
126
|
<ul class="tsd-signatures tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited">
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><aside class="tsd-sources">
|
|
130
130
|
<p>Inherited from McBase.target</p>
|
|
131
131
|
<ul>
|
|
132
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
132
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L230">src/MC.ts:230</a></li></ul></aside></li></ul></section></section>
|
|
133
133
|
<section class="tsd-panel-group tsd-member-group">
|
|
134
134
|
<h2>Methods</h2>
|
|
135
135
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="ancestors" class="tsd-anchor"></a>
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
<h5>search: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ''</span></h5></li></ul></div>
|
|
145
145
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
|
146
146
|
<ul>
|
|
147
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
147
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L357">src/MC.ts:357</a></li></ul></aside></li></ul></section>
|
|
148
148
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="children" class="tsd-anchor"></a>
|
|
149
149
|
<h3 class="tsd-anchor-link"><span>children</span><a href="#children" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
150
150
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
<h5>search: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ''</span></h5></li></ul></div>
|
|
158
158
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
|
159
159
|
<ul>
|
|
160
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
160
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L363">src/MC.ts:363</a></li></ul></aside></li></ul></section>
|
|
161
161
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="descendants" class="tsd-anchor"></a>
|
|
162
162
|
<h3 class="tsd-anchor-link"><span>descendants</span><a href="#descendants" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
163
163
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
<h5>search: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ''</span></h5></li></ul></div>
|
|
171
171
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
|
172
172
|
<ul>
|
|
173
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
173
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L375">src/MC.ts:375</a></li></ul></aside></li></ul></section>
|
|
174
174
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="parent" class="tsd-anchor"></a>
|
|
175
175
|
<h3 class="tsd-anchor-link"><span>parent</span><a href="#parent" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
176
176
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
<h5>search: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ''</span></h5></li></ul></div>
|
|
184
184
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
|
185
185
|
<ul>
|
|
186
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
186
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L351">src/MC.ts:351</a></li></ul></aside></li></ul></section>
|
|
187
187
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="trigger-1" class="tsd-anchor"></a>
|
|
188
188
|
<h3 class="tsd-anchor-link"><span>trigger</span><a href="#trigger-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
189
189
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> bubble: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
201
201
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
|
|
202
202
|
<ul>
|
|
203
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
203
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L347">src/MC.ts:347</a></li></ul></aside></li></ul></section></section></div>
|
|
204
204
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
205
205
|
<div class="tsd-navigation settings">
|
|
206
206
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
package/public/classes/MC.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<ul class="tsd-hierarchy">
|
|
23
23
|
<li><span class="target">MC</span></li></ul></li></ul></section><aside class="tsd-sources">
|
|
24
24
|
<ul>
|
|
25
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
25
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L236">src/MC.ts:236</a></li></ul></aside>
|
|
26
26
|
<section class="tsd-panel-group tsd-index-group">
|
|
27
27
|
<section class="tsd-panel tsd-index-panel">
|
|
28
28
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
<h4 class="tsd-returns-title">Returns <a href="MC.html" class="tsd-signature-type" data-tsd-kind="Class">MC</a></h4><aside class="tsd-sources">
|
|
62
62
|
<p>Overrides <a href="McBase.html">McBase</a>.<a href="McBase.html#constructor">constructor</a></p>
|
|
63
63
|
<ul>
|
|
64
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
64
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L240">src/MC.ts:240</a></li></ul></aside></li></ul></section></section>
|
|
65
65
|
<section class="tsd-panel-group tsd-member-group">
|
|
66
66
|
<h2>Properties</h2>
|
|
67
67
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-private tsd-is-inherited"><a id="_target" class="tsd-anchor"></a>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<div class="tsd-signature">#target<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">WeakRef</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
|
70
70
|
<p>Inherited from <a href="McBase.html">McBase</a>.<a href="McBase.html#_target">#target</a></p>
|
|
71
71
|
<ul>
|
|
72
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
72
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L216">src/MC.ts:216</a></li></ul></aside></section>
|
|
73
73
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="_mc" class="tsd-anchor"></a>
|
|
74
74
|
<h3 class="tsd-anchor-link"><span>_mc</span><a href="#_mc" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
75
75
|
<div class="tsd-signature">_mc<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{ </span><br/><span> </span>[key: <span class="tsd-signature-type">string</span>]<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = {}</span></div>
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
<li class="tsd-parameter-index-signature">
|
|
80
80
|
<h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5></li></ul></div><aside class="tsd-sources">
|
|
81
81
|
<ul>
|
|
82
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
82
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L238">src/MC.ts:238</a></li></ul></aside></section>
|
|
83
83
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="trigger" class="tsd-anchor"></a>
|
|
84
84
|
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagStatic">Static</code> <span>trigger</span><a href="#trigger" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
85
85
|
<div class="tsd-signature">trigger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span>target<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span>, ev<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="McEvent.html" class="tsd-signature-type" data-tsd-kind="Class">McEvent</a>, data<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> = trigger</span></div>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<h5>data: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = {}</span></h5></li></ul></div>
|
|
102
102
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources">
|
|
103
103
|
<ul>
|
|
104
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
104
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L244">src/MC.ts:244</a></li></ul></aside></section></section>
|
|
105
105
|
<section class="tsd-panel-group tsd-member-group">
|
|
106
106
|
<h2>Accessors</h2>
|
|
107
107
|
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><a id="target" class="tsd-anchor"></a>
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><aside class="tsd-sources">
|
|
113
113
|
<p>Inherited from McBase.target</p>
|
|
114
114
|
<ul>
|
|
115
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
115
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L230">src/MC.ts:230</a></li></ul></aside></li></ul></section></section>
|
|
116
116
|
<section class="tsd-panel-group tsd-member-group">
|
|
117
117
|
<h2>Methods</h2>
|
|
118
118
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="trigger-1" class="tsd-anchor"></a>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> bubble: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
132
132
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="MC.html" class="tsd-signature-type" data-tsd-kind="Class">MC</a></h4><aside class="tsd-sources">
|
|
133
133
|
<ul>
|
|
134
|
-
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/
|
|
134
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/6e5722c/src/MC.ts#L246">src/MC.ts:246</a></li></ul></aside></li></ul></section></section></div>
|
|
135
135
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
136
136
|
<div class="tsd-navigation settings">
|
|
137
137
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|