@twobirds/microcomponents 0.0.99 → 0.0.100

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.
Files changed (100) hide show
  1. package/dist/MC.d.ts +7 -2
  2. package/dist/MC.d.ts.map +1 -1
  3. package/dist/MC.js +33 -27
  4. package/dist/MC.min.js +33 -27
  5. package/dist/MC.ts +48 -39
  6. package/dist/elements.min.js +1 -1
  7. package/dist/formValues.min.js +1 -1
  8. package/dist/microcomponents.min.js +1 -1
  9. package/dist/observables.min.js +1 -1
  10. package/package.json +1 -1
  11. package/public/MC.d.ts +7 -2
  12. package/public/MC.d.ts.map +1 -1
  13. package/public/MC.js +33 -27
  14. package/public/MC.js.map +1 -1
  15. package/public/MC.min.js +33 -27
  16. package/public/MC.ts +48 -39
  17. package/public/elements.min.js +1 -1
  18. package/public/formValues.min.js +1 -1
  19. package/public/microcomponents.min.js +1 -1
  20. package/public/observables.min.js +1 -1
  21. package/public/src/MC.d.ts +7 -2
  22. package/public/src/MC.d.ts.map +1 -1
  23. package/public/src/MC.js +33 -27
  24. package/public/src/MC.js.map +1 -1
  25. package/public/src/MC.ts +48 -39
  26. package/public/src/test/test/child.d.ts.map +1 -1
  27. package/public/src/test/test/child.js +11 -0
  28. package/public/src/test/test/child.js.map +1 -1
  29. package/public/src/test/test/child.ts +15 -0
  30. package/public/src/test/test/grandchild.d.ts.map +1 -1
  31. package/public/src/test/test/grandchild.js +7 -0
  32. package/public/src/test/test/grandchild.js.map +1 -1
  33. package/public/src/test/test/grandchild.ts +10 -0
  34. package/public/src/test/test/grandparent.d.ts.map +1 -1
  35. package/public/src/test/test/grandparent.js +1 -1
  36. package/public/src/test/test/grandparent.js.map +1 -1
  37. package/public/src/test/test/grandparent.ts +14 -0
  38. package/public/src/test/test/greatgrandchild.d.ts.map +1 -1
  39. package/public/src/test/test/greatgrandchild.js +7 -0
  40. package/public/src/test/test/greatgrandchild.js.map +1 -1
  41. package/public/src/test/test/greatgrandchild.ts +9 -0
  42. package/public/src/test/test/parent.d.ts.map +1 -1
  43. package/public/src/test/test/parent.js +10 -0
  44. package/public/src/test/test/parent.js.map +1 -1
  45. package/public/src/test/test/parent.ts +14 -0
  46. package/public/src/test/test/testform.js +1 -1
  47. package/public/test/MC.d.ts +7 -2
  48. package/public/test/MC.d.ts.map +1 -1
  49. package/public/test/MC.js +33 -27
  50. package/public/test/MC.min.js +33 -27
  51. package/public/test/MC.ts +48 -39
  52. package/public/test/elements.min.js +1 -1
  53. package/public/test/formValues.min.js +1 -1
  54. package/public/test/microcomponents.min.js +1 -1
  55. package/public/test/observables.min.js +1 -1
  56. package/public/test/test/child.d.ts.map +1 -1
  57. package/public/test/test/child.js +11 -0
  58. package/public/test/test/child.js.map +1 -1
  59. package/public/test/test/child.ts +15 -0
  60. package/public/test/test/grandchild.d.ts.map +1 -1
  61. package/public/test/test/grandchild.js +7 -0
  62. package/public/test/test/grandchild.js.map +1 -1
  63. package/public/test/test/grandchild.ts +10 -0
  64. package/public/test/test/grandparent.d.ts.map +1 -1
  65. package/public/test/test/grandparent.js +1 -1
  66. package/public/test/test/grandparent.js.map +1 -1
  67. package/public/test/test/grandparent.ts +14 -0
  68. package/public/test/test/greatgrandchild.d.ts.map +1 -1
  69. package/public/test/test/greatgrandchild.js +7 -0
  70. package/public/test/test/greatgrandchild.js.map +1 -1
  71. package/public/test/test/greatgrandchild.ts +9 -0
  72. package/public/test/test/parent.d.ts.map +1 -1
  73. package/public/test/test/parent.js +10 -0
  74. package/public/test/test/parent.js.map +1 -1
  75. package/public/test/test/parent.ts +14 -0
  76. package/public/test/test/testform.js +1 -1
  77. package/public/typedoc/classes/MC.DC.html +2 -2
  78. package/public/typedoc/classes/MC.MC.html +2 -2
  79. package/public/typedoc/classes/MC.McBase.html +2 -2
  80. package/public/typedoc/functions/MC.autoload.html +1 -1
  81. package/public/typedoc/functions/MC.off.html +1 -1
  82. package/public/typedoc/functions/MC.on.html +1 -1
  83. package/public/typedoc/functions/MC.one.html +1 -1
  84. package/public/typedoc/functions/MC.trigger.html +1 -1
  85. package/public/typedoc/functions/elements.defineCE.html +1 -1
  86. package/public/typedoc/functions/elements.getCE.html +1 -1
  87. package/public/typedoc/functions/formValues.formValues.html +1 -1
  88. package/public/typedoc/functions/observables.observe.html +1 -1
  89. package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
  90. package/public/typedoc/modules/MC.html +1 -1
  91. package/public/typedoc/modules/elements.html +1 -1
  92. package/public/typedoc/modules/formValues.html +1 -1
  93. package/public/typedoc/modules/observables.html +1 -1
  94. package/public/typedoc/types/observables.Observable.html +1 -1
  95. package/src/MC.ts +48 -39
  96. package/src/test/test/child.ts +15 -0
  97. package/src/test/test/grandchild.ts +10 -0
  98. package/src/test/test/grandparent.ts +14 -0
  99. package/src/test/test/greatgrandchild.ts +9 -0
  100. package/src/test/test/parent.ts +14 -0
package/dist/MC.d.ts CHANGED
@@ -5,7 +5,12 @@ export interface HTMLMcElement extends HTMLElement {
5
5
  declare function off(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject): void;
6
6
  declare function on(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject, once?: boolean): EventListenerOrEventListenerObject;
7
7
  declare function one(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
8
- declare function trigger(domNode: HTMLElement, event: CustomEvent | string, data?: any, bubble?: string): void;
8
+ declare class BubbleController {
9
+ stopped: boolean;
10
+ constructor();
11
+ stop(): void;
12
+ }
13
+ declare function trigger(domNode: HTMLElement, event: string, data?: any, bubble?: string, controller?: BubbleController): void;
9
14
  declare class McBase {
10
15
  private _target;
11
16
  constructor(target?: {
@@ -23,7 +28,7 @@ declare class DC extends McBase {
23
28
  off(eventName: string, handler: EventListenerOrEventListenerObject): void;
24
29
  on(eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
25
30
  one(eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
26
- trigger(eventName: string, data?: any, bubble?: string): void;
31
+ trigger(eventName: string, data?: any, bubble?: string, controller?: BubbleController): void;
27
32
  ancestors(): DC[] | null;
28
33
  closest(): DC | null;
29
34
  children(): DC[] | null;
package/dist/MC.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"MC.d.ts","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,GAAG,EAAE,WAAW,CAAC;CACjB;AAmED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,QAE1F;AAED,iBAAS,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,EAAE,IAAI,GAAE,OAAe,GAAI,kCAAkC,CAGtJ;AAED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC,CAGhI;AAGD,iBAAS,OAAO,CACf,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,WAAW,GAAG,MAAM,EAC3B,IAAI,GAAE,GAAQ,EACd,MAAM,GAAE,MAAY,QAepB;AA+ED,cAAM,MAAM;IACX,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAU3C,IAAI,MAAM,IAAI,GAAG,CAEhB;CAED;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,CAAC,EAAE,GAAG;CAGxB;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,EAAE,WAAW;IAI/B,MAAM,CAAC,GAAG,CAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAI,aAAa;IAIhF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;IAK9C,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC;IAInE,EAAE,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIxG,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIzG,OAAO,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,EAAE,MAAM,GAAE,MAAY;IAKhE,SAAS,IAAI,EAAE,EAAE,GAAG,IAAI;IAgBxB,OAAO,IAAI,EAAE,GAAG,IAAI;IAOpB,QAAQ,IAAI,EAAE,EAAE,GAAG,IAAI;IAMvB,WAAW,IAAI,EAAE,EAAE,GAAG,IAAI;CAS1B;AAiHD,iBAAS,QAAQ,CAAC,MAAM,GAAE,OAAc,GAAG,OAAO,CAmBjD;AAID,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"MC.d.ts","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,GAAG,EAAE,WAAW,CAAC;CACjB;AAmED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,QAE1F;AAED,iBAAS,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,EAAE,IAAI,GAAE,OAAe,GAAI,kCAAkC,CAGtJ;AAED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC,CAGhI;AAED,cAAM,gBAAgB;IACrB,OAAO,UAAS;;IAGhB,IAAI;CAGJ;AAGD,iBAAS,OAAO,CACf,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,GAAQ,EACd,MAAM,GAAE,MAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,QA4C7B;AAiDD,cAAM,MAAM;IACX,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAU3C,IAAI,MAAM,IAAI,GAAG,CAEhB;CAED;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,CAAC,EAAE,GAAG;CAGxB;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,EAAE,WAAW;IAI/B,MAAM,CAAC,GAAG,CAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAI,aAAa;IAIhF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;IAK9C,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC;IAInE,EAAE,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIxG,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIzG,OAAO,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,EAAE,MAAM,GAAE,MAAY,EAAE,UAAU,CAAC,EAAE,gBAAgB;IAK/F,SAAS,IAAI,EAAE,EAAE,GAAG,IAAI;IAgBxB,OAAO,IAAI,EAAE,GAAG,IAAI;IAOpB,QAAQ,IAAI,EAAE,EAAE,GAAG,IAAI;IAMvB,WAAW,IAAI,EAAE,EAAE,GAAG,IAAI;CAS1B;AAiHD,iBAAS,QAAQ,CAAC,MAAM,GAAE,OAAc,GAAG,OAAO,CAmBjD;AAID,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
package/dist/MC.js CHANGED
@@ -52,35 +52,41 @@ function one(domNode, eventName, handler) {
52
52
  on(domNode, eventName, handler, true);
53
53
  return handler;
54
54
  }
55
- function trigger(domNode, event, data = {}, bubble = 'l') {
56
- const ev = typeof event === 'string'
57
- ? new CustomEvent(getMcEventName(event), { detail: { data, bubble } })
58
- : event;
59
- if (bubble.length && bubble.indexOf('l') > -1) {
60
- domNode.dispatchEvent(ev);
55
+ class BubbleController {
56
+ stopped = false;
57
+ constructor() {
61
58
  }
62
- if (/[ud]/.test(bubble)) {
63
- bubbleEvent(domNode, ev);
59
+ stop() {
60
+ this.stopped = true;
64
61
  }
65
62
  }
66
- function bubbleEvent(domNode, ev) {
67
- setTimeout(() => {
68
- if (ev.detail.bubble.indexOf('l') === -1) {
69
- ev.detail.bubble += 'l';
70
- }
71
- if (ev.detail.bubble.indexOf('u') > -1) {
72
- domNode.closest('[data-mc]')?.dispatchEvent(ev);
73
- }
74
- if (ev.detail.bubble.indexOf('d') > -1) {
75
- let targets = new Set(domNode._mc
76
- .children()
77
- .map((c) => c?.target));
78
- targets.forEach((target) => {
79
- if (target)
80
- target._mc.trigger(target, ev);
81
- });
63
+ function trigger(domNode, event, data = {}, bubble = 'l', controller) {
64
+ const eventName = /^_mc/.test(event) ? event : getMcEventName(event), bubbleController = !!controller ? controller : new BubbleController(), ev = new CustomEvent(eventName, { detail: { data, control: bubbleController }, bubbles: false });
65
+ if (bubbleController.stopped)
66
+ return;
67
+ domNode.dispatchEvent(ev);
68
+ ev.stopImmediatePropagation();
69
+ if (bubbleController.stopped)
70
+ return;
71
+ if (/[ud]/.test(bubble)) {
72
+ if (bubble.indexOf('l') === -1) {
73
+ bubble += 'l';
82
74
  }
83
- }, 0);
75
+ setTimeout(() => {
76
+ if (bubble.indexOf('u') > -1) {
77
+ let parentMc = domNode.parentElement?.closest('[data-mc]');
78
+ if (!!parentMc) {
79
+ parentMc?._mc.trigger(eventName, data, bubble, bubbleController);
80
+ }
81
+ }
82
+ if (bubble.indexOf('d') > -1) {
83
+ let childNodes = domNode._mc.children();
84
+ if (!!childNodes) {
85
+ childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble, bubbleController));
86
+ }
87
+ }
88
+ }, 0);
89
+ }
84
90
  }
85
91
  function autoAttachListeners(element) {
86
92
  if (!isBrowser() || element.constructor === DC)
@@ -155,8 +161,8 @@ class DC extends McBase {
155
161
  one(eventName, handler) {
156
162
  return one(this.target, eventName, handler);
157
163
  }
158
- trigger(eventName, data = {}, bubble = 'l') {
159
- trigger(this.target, eventName, data, bubble);
164
+ trigger(eventName, data = {}, bubble = 'l', controller) {
165
+ trigger(this.target, eventName, data, bubble, controller);
160
166
  }
161
167
  ancestors() {
162
168
  let currentNode = this?.target, result = [];
package/dist/MC.min.js CHANGED
@@ -109,35 +109,41 @@ function one(domNode, eventName, handler) {
109
109
  on(domNode, eventName, handler, true);
110
110
  return handler;
111
111
  }
112
- function trigger(domNode, event, data = {}, bubble = 'l') {
113
- const ev = typeof event === 'string'
114
- ? new CustomEvent(getMcEventName(event), { detail: { data, bubble } })
115
- : event;
116
- if (bubble.length && bubble.indexOf('l') > -1) {
117
- domNode.dispatchEvent(ev);
112
+ class BubbleController {
113
+ stopped = false;
114
+ constructor() {
118
115
  }
119
- if (/[ud]/.test(bubble)) {
120
- bubbleEvent(domNode, ev);
116
+ stop() {
117
+ this.stopped = true;
121
118
  }
122
119
  }
123
- function bubbleEvent(domNode, ev) {
124
- setTimeout(() => {
125
- if (ev.detail.bubble.indexOf('l') === -1) {
126
- ev.detail.bubble += 'l';
127
- }
128
- if (ev.detail.bubble.indexOf('u') > -1) {
129
- domNode.closest('[data-mc]')?.dispatchEvent(ev);
130
- }
131
- if (ev.detail.bubble.indexOf('d') > -1) {
132
- let targets = new Set(domNode._mc
133
- .children()
134
- .map((c) => c?.target));
135
- targets.forEach((target) => {
136
- if (target)
137
- target._mc.trigger(target, ev);
138
- });
120
+ function trigger(domNode, event, data = {}, bubble = 'l', controller) {
121
+ const eventName = /^_mc/.test(event) ? event : getMcEventName(event), bubbleController = !!controller ? controller : new BubbleController(), ev = new CustomEvent(eventName, { detail: { data, control: bubbleController }, bubbles: false });
122
+ if (bubbleController.stopped)
123
+ return;
124
+ domNode.dispatchEvent(ev);
125
+ ev.stopImmediatePropagation();
126
+ if (bubbleController.stopped)
127
+ return;
128
+ if (/[ud]/.test(bubble)) {
129
+ if (bubble.indexOf('l') === -1) {
130
+ bubble += 'l';
139
131
  }
140
- }, 0);
132
+ setTimeout(() => {
133
+ if (bubble.indexOf('u') > -1) {
134
+ let parentMc = domNode.parentElement?.closest('[data-mc]');
135
+ if (!!parentMc) {
136
+ parentMc?._mc.trigger(eventName, data, bubble, bubbleController);
137
+ }
138
+ }
139
+ if (bubble.indexOf('d') > -1) {
140
+ let childNodes = domNode._mc.children();
141
+ if (!!childNodes) {
142
+ childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble, bubbleController));
143
+ }
144
+ }
145
+ }, 0);
146
+ }
141
147
  }
142
148
  function autoAttachListeners(element) {
143
149
  if (!isBrowser() || element.constructor === DC)
@@ -212,8 +218,8 @@ class DC extends McBase {
212
218
  one(eventName, handler) {
213
219
  return one(this.target, eventName, handler);
214
220
  }
215
- trigger(eventName, data = {}, bubble = 'l') {
216
- trigger(this.target, eventName, data, bubble);
221
+ trigger(eventName, data = {}, bubble = 'l', controller) {
222
+ trigger(this.target, eventName, data, bubble, controller);
217
223
  }
218
224
  ancestors() {
219
225
  let currentNode = this?.target, result = [];
package/dist/MC.ts CHANGED
@@ -89,56 +89,65 @@ function one( domNode: Node, eventName: string, handler: EventListenerOrEventLis
89
89
  return handler;
90
90
  }
91
91
 
92
+ class BubbleController{
93
+ stopped = false;
94
+ constructor(){
95
+ }
96
+ stop(){
97
+ this.stopped = true;
98
+ }
99
+ }
100
+
92
101
  // create and dispatch custom event
93
102
  function trigger(
94
103
  domNode: HTMLElement,
95
- event: CustomEvent | string,
104
+ event: string,
96
105
  data: any = {},
97
- bubble: string = 'l'
106
+ bubble: string = 'l', // direction of bubbling
107
+ controller?: BubbleController
98
108
  ){
99
- const ev = typeof event === 'string'
100
- ? new CustomEvent( getMcEventName( event ), { detail: {data, bubble} } )
101
- : event;
102
-
103
- // execute locally if 'l' or nothing is given as bubble
104
- if( bubble.length && bubble.indexOf('l') > -1 ){
105
- domNode.dispatchEvent( ev );
106
- }
107
-
109
+ const eventName = /^_mc/.test( event ) ? event : getMcEventName( event ),
110
+ bubbleController = !!controller ? controller : new BubbleController(),
111
+ ev = new CustomEvent( eventName, { detail: {data,control: bubbleController}, bubbles: false } );
112
+
113
+ if ( bubbleController.stopped ) return;
114
+
115
+ domNode.dispatchEvent( ev );
116
+ ev.stopImmediatePropagation();
117
+
118
+ if ( bubbleController.stopped ) return;
119
+
108
120
  // bubble if up or down is indicated
109
121
  if( /[ud]/.test( bubble ) ){
110
- bubbleEvent( domNode, ev );
111
- }
112
- }
113
-
114
- function bubbleEvent( domNode: HTMLElement, ev: CustomEvent) {
115
- // at this point, either 'u' or 'd' bubbling should be indicated
116
- // event bubbling is asynchronous!
117
- setTimeout(() => {
122
+ //console.log( 'bubble', bubble, domNode );
118
123
 
119
124
  // add missing 'l', or else no handlers are executed
120
- if (ev.detail.bubble.indexOf('l') === -1) {
121
- ev.detail.bubble += 'l';
125
+ if (bubble.indexOf('l') === -1) {
126
+ bubble += 'l';
122
127
  }
123
128
 
124
- // bubble up towards root
125
- if (ev.detail.bubble.indexOf('u') > -1 ) {
126
- domNode.closest('[data-mc]')?.dispatchEvent( ev );
127
- }
129
+ setTimeout(
130
+ () => {
128
131
 
129
- // bubble down
130
- if (ev.detail.bubble.indexOf('d') > -1) {
131
- let targets = new Set<HTMLMcElement>(
132
- (domNode as HTMLMcElement)._mc
133
- .children()
134
- .map((c: unknown) => (c as any)?.target)
135
- );
136
- targets.forEach((target: HTMLMcElement) => {
137
- if (target) target._mc.trigger(target, ev);
138
- });
139
- }
132
+ // bubble up towards root
133
+ if ( bubble.indexOf('u') > -1 ) {
134
+ let parentMc: HTMLMcElement | null | undefined = domNode.parentElement?.closest('[data-mc]') ;
135
+ if ( !!parentMc ){
136
+ parentMc?._mc.trigger( eventName, data, bubble, bubbleController );
137
+ }
138
+ }
140
139
 
141
- }, 0);
140
+ // bubble down
141
+ if (bubble.indexOf('d') > -1) {
142
+ let childNodes: DC[] | null = ( domNode as HTMLMcElement)._mc.children();
143
+ if( !!childNodes ){
144
+ childNodes.forEach( (_mc: DC) => _mc.trigger( eventName, data, bubble, bubbleController ) );
145
+ }
146
+ }
147
+ },
148
+ 0
149
+ );
150
+ }
142
151
  }
143
152
 
144
153
  function autoAttachListeners(element: MC | DC) {
@@ -239,8 +248,8 @@ class DC extends McBase {
239
248
  return one( this.target, eventName, handler );
240
249
  }
241
250
 
242
- trigger( eventName: string, data: any = {}, bubble: string = 'l') {
243
- trigger( this.target, eventName, data, bubble);
251
+ trigger( eventName: string, data: any = {}, bubble: string = 'l', controller?: BubbleController) {
252
+ trigger( this.target, eventName, data, bubble, controller);
244
253
  }
245
254
 
246
255
  /* DOM traversal */
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elements=e():t.elements=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{defineCE:()=>u,getCE:()=>d});const n=new Function("try {return this===window;}catch(e){ return false;}");function r(t){return t&&t instanceof HTMLElement}function o(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function c(t,e,n,r=!1){return t.addEventListener(o(e),n,{capture:!1,once:r}),n}class s{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==i&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===i)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else c(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class i extends s{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new i(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(o(e),n)}(this.target,t,e)}on(t,e){return c(this.target,t,e)}one(t,e){return function(t,e,n){return c(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l"){!function(t,e,n={},r="l"){const c="string"==typeof e?new CustomEvent(o(e),{detail:{data:n,bubble:r}}):e;r.length&&r.indexOf("l")>-1&&t.dispatchEvent(c),/[ud]/.test(r)&&function(t,e){setTimeout((()=>{-1===e.detail.bubble.indexOf("l")&&(e.detail.bubble+="l"),e.detail.bubble.indexOf("u")>-1&&t.closest("[data-mc]")?.dispatchEvent(e),e.detail.bubble.indexOf("d")>-1&&new Set(t._mc.children().map((t=>t?.target))).forEach((t=>{t&&t._mc.trigger(t,e)}))}),0)}(t,c)}(this.target,t,e,n)}ancestors(){let t=this?.target,e=[];if(!r(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return r(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return r(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!r(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}new Set;class a extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function l(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function u(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("");l(e.prototype.constructor)&&e.prototype instanceof s?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends a{instance;constructor(t){super();const n=l(e)?new e(this,t):e;i.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function d(t){return customElements.get(t)}return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elements=e():t.elements=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{defineCE:()=>d,getCE:()=>m});const n=new Function("try {return this===window;}catch(e){ return false;}");function r(t){return t&&t instanceof HTMLElement}function o(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function c(t,e,n,r=!1){return t.addEventListener(o(e),n,{capture:!1,once:r}),n}class s{stopped=!1;constructor(){}stop(){this.stopped=!0}}class i{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==a&&e.trigger("Init")}),0),function(t){if(!n()||t.constructor===a)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else c(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class a extends i{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new a(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,n){t.removeEventListener(o(e),n)}(this.target,t,e)}on(t,e){return c(this.target,t,e)}one(t,e){return function(t,e,n){return c(t,e,n,!0),n}(this.target,t,e)}trigger(t,e={},n="l",r){!function(t,e,n={},r="l",c){const i=/^_mc/.test(e)?e:o(e),a=c||new s,u=new CustomEvent(i,{detail:{data:n,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(u),u.stopImmediatePropagation(),a.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(i,n,r,a)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(i,n,r,a)))}}),0)))}(this.target,t,e,n,r)}ancestors(){let t=this?.target,e=[];if(!r(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return r(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return r(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!r(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}new Set;class u extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function l(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function d(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("");l(e.prototype.constructor)&&e.prototype instanceof i?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends u{instance;constructor(t){super();const n=l(e)?new e(this,t):e;a.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function m(t){return customElements.get(t)}return e})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formValues=e():t.formValues=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var s;(s=t[n])&&s.constructor&&s.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let s={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)s[e+"."+t]=r[t]}else s[e]=t[e]})),e?r(s):s}function s(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function a(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}function c(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}t.r(e),t.d(e,{formValues:()=>x});const o=new Function("try {return this===window;}catch(e){ return false;}");function l(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function u(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}function f(t,e,r={},n="l"){const s="string"==typeof e?new CustomEvent(i(e),{detail:{data:r,bubble:n}}):e;n.length&&n.indexOf("l")>-1&&t.dispatchEvent(s),/[ud]/.test(n)&&function(t,e){setTimeout((()=>{-1===e.detail.bubble.indexOf("l")&&(e.detail.bubble+="l"),e.detail.bubble.indexOf("u")>-1&&t.closest("[data-mc]")?.dispatchEvent(e),e.detail.bubble.indexOf("d")>-1&&new Set(t._mc.children().map((t=>t?.target))).forEach((t=>{t&&t._mc.trigger(t,e)}))}),0)}(t,s)}class d{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==h&&e.trigger("Init")}),0),function(t){if(!o()||t.constructor===h)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),s=t.replace(/^on[e]{0,1}/,""),a=s.toLowerCase();if("on"+a in e){let n=e=>{r[t](e)};e.addEventListener(a,n)}else u(e,s,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class h extends d{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new h(t));const s=n._mc;return e.length&&!s[e]&&(s[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return u(this.target,t,e)}one(t,e){return function(t,e,r){return u(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l"){f(this.target,t,e,r)}ancestors(){let t=this?.target,e=[];if(!l(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return l(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return l(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!l(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function b(t){return null!=t&&"object"==typeof t}function m(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const p=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class g extends h{data={};oldDisplay="";constructor(t){super(t),m(t).forEach((t=>this.data[t]="")),O(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),s=>{let a=n;r.forEach((t=>{a=a.replace(t,s[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,a)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>s=>{let a=e;n.forEach((t=>{a=a.replace(t,s[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=a})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!p.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const y={};function v(t){let e=t.constructor.name;return y[e]||function(t){const e=t.constructor,r=e.name;let s=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],b(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(b(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!m(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||h.add(t,"_placeholders",new g(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&f(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=b(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return y[r]=s,s}(t)}const O=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(v(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(b(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(a((function(){s(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(b(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(v(t))(structuredClone(Object.assign({},t))),c(t,n),n.seal()),Object.assign(n,t),setTimeout(a((function(){s(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(v(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);class E{constructor(t){}}class w extends E{#n;constructor(t){super(t),this.#n=t}get val(){return new FormData(this.#n.form).get(this.#n.name)}set val(t){[...this.#n.form.querySelectorAll(`input[type="radio"][name="${this.#n.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class A extends E{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.checked}set val(t){this.#n.checked=t}}class j extends E{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value}set val(t){this.#n.value=t}}class S extends E{#n;#s=!1;constructor(t){super(t),this.#n=t,this.#s=t.multiple}get val(){const t=[];return[...this.#n.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#s?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#n.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class _ extends E{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value||""}set val(t){this.#n.value=t}}const k=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],r={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let n=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":n=new w(t);break;case"checkbox":n=new A(t);break;default:n=new j(t)}break;case"select":n=new S(t);break;case"textarea":n=new _(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}n&&(h.add(t,e,n),Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>n.val,set:t=>{n.val!==t&&(n.val=t)}}))}})),r};function x(t,e,r){let n=k(r);t[e]=Object.assign({},n),O(t,e),c(n,t[e]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{r.addEventListener("input",(r=>{t[e].notify()}))}))}return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formValues=e():t.formValues=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var s;(s=t[n])&&s.constructor&&s.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let s={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)s[e+"."+t]=r[t]}else s[e]=t[e]})),e?r(s):s}function s(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function o(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}function a(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}t.r(e),t.d(e,{formValues:()=>x});const c=new Function("try {return this===window;}catch(e){ return false;}");function l(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function u(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class f{stopped=!1;constructor(){}stop(){this.stopped=!0}}function d(t,e,r={},n="l",s){const o=/^_mc/.test(e)?e:i(e),a=s||new f,c=new CustomEvent(o,{detail:{data:r,control:a},bubbles:!1});a.stopped||(t.dispatchEvent(c),c.stopImmediatePropagation(),a.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(o,r,n,a)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(o,r,n,a)))}}),0)))}class h{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==p&&e.trigger("Init")}),0),function(t){if(!c()||t.constructor===p)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),s=t.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();if("on"+o in e){let n=e=>{r[t](e)};e.addEventListener(o,n)}else u(e,s,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class p extends h{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new p(t));const s=n._mc;return e.length&&!s[e]&&(s[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return u(this.target,t,e)}one(t,e){return function(t,e,r){return u(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l",n){d(this.target,t,e,r,n)}ancestors(){let t=this?.target,e=[];if(!l(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return l(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return l(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!l(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function m(t){return null!=t&&"object"==typeof t}function g(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const b=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class y extends p{data={};oldDisplay="";constructor(t){super(t),g(t).forEach((t=>this.data[t]="")),E(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),s=>{let o=n;r.forEach((t=>{o=o.replace(t,s[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,o)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>s=>{let o=e;n.forEach((t=>{o=o.replace(t,s[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=o})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!b.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const v={};function O(t){let e=t.constructor.name;return v[e]||function(t){const e=t.constructor,r=e.name;let s=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],m(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(m(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!g(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||p.add(t,"_placeholders",new y(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&d(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=m(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return v[r]=s,s}(t)}const E=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(O(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(m(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(o((function(){s(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(m(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(O(t))(structuredClone(Object.assign({},t))),a(t,n),n.seal()),Object.assign(n,t),setTimeout(o((function(){s(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(O(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);class w{constructor(t){}}class A extends w{#n;constructor(t){super(t),this.#n=t}get val(){return new FormData(this.#n.form).get(this.#n.name)}set val(t){[...this.#n.form.querySelectorAll(`input[type="radio"][name="${this.#n.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class j extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.checked}set val(t){this.#n.checked=t}}class S extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value}set val(t){this.#n.value=t}}class _ extends w{#n;#s=!1;constructor(t){super(t),this.#n=t,this.#s=t.multiple}get val(){const t=[];return[...this.#n.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#s?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#n.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class k extends w{#n;constructor(t){super(t),this.#n=t}get val(){return this.#n.value||""}set val(t){this.#n.value=t}}const N=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],r={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let n=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":n=new A(t);break;case"checkbox":n=new j(t);break;default:n=new S(t)}break;case"select":n=new _(t);break;case"textarea":n=new k(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}n&&(p.add(t,e,n),Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>n.val,set:t=>{n.val!==t&&(n.val=t)}}))}})),r};function x(t,e,r){let n=N(r);t[e]=Object.assign({},n),E(t,e),a(n,t[e]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{r.addEventListener("input",(r=>{t[e].notify()}))}))}return e})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.microcomponents=e():t.microcomponents=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return t&&t.constructor&&t.constructor===Object}function r(t){let e={};return[...Object.keys(t)].sort().forEach((o=>{n(t[o])?e[o]=r(t[o]):e[o]=t[o]})),e}function o(t,e=!0){let n={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=o(t[e],!1);for(const t in r)n[e+"."+t]=r[t]}else n[e]=t[e]})),e?r(n):n}function c(t,e){return JSON.stringify(o(t))===JSON.stringify(o(e))}function s(t,e={}){let n=t.constructor===String?t.split("."):t;if(e&&n[0]&&e[n[0]])return e[n[0]].constructor===Object&&n.length>1?s(n.splice(1),e[n[0]]):e[n[0]];console.warn("ns",n[0],"not in",e)}function a(t,e){var r=Array.from(arguments);if(r.length>2){for(;r.length>1;)r[0]=a(r[0],r[1]),r.splice(1,1);return r[0]}if("string"==typeof t)t.match(/\{[^\{\}]*\}/g)?.forEach((function(n){var r=s(n.substring(1,n.length-1),e);void 0!==r&&(t=t.replace(n,r))}));else if(n(t))switch(t.constructor){case Object:Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&(t[n]=a(t[n],e))}));break;case Array:t.forEach((function(n,r,o){o[r]=a(t[r],e)}))}return t}function i(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function l(t,e){let n;return()=>{clearTimeout(n),n=setTimeout((function(){t(...arguments)}),e)}}function u(t){let e=document.createElement("template");return t=t.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),e.innerHTML=t,e.content.normalize(),Array.from(e.content.childNodes)}function d(t,e){const n=Object.getOwnPropertyDescriptors(t);for(const[t,r]of Object.entries(n))("get"in r||"set"in r)&&Object.defineProperty(e,t,r)}t.r(e),t.d(e,{DC:()=>O,MC:()=>E,McBase:()=>v,autoload:()=>_,copyGettersSetters:()=>d,debounce:()=>l,deepEqual:()=>c,defineCE:()=>x,flattenObject:()=>o,formValues:()=>B,getCE:()=>L,htmlToElements:()=>u,isNativeObject:()=>n,kebabToPascal:()=>i,nameSpace:()=>s,observe:()=>I,off:()=>p,on:()=>b,one:()=>g,parse:()=>a,sortObject:()=>r,trigger:()=>y});const f=new Function("try {return this===window;}catch(e){ return false;}");function m(t){return t&&t instanceof HTMLElement}function h(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function p(t,e,n){t.removeEventListener(h(e),n)}function b(t,e,n,r=!1){return t.addEventListener(h(e),n,{capture:!1,once:r}),n}function g(t,e,n){return b(t,e,n,!0),n}function y(t,e,n={},r="l"){const o="string"==typeof e?new CustomEvent(h(e),{detail:{data:n,bubble:r}}):e;r.length&&r.indexOf("l")>-1&&t.dispatchEvent(o),/[ud]/.test(r)&&function(t,e){setTimeout((()=>{-1===e.detail.bubble.indexOf("l")&&(e.detail.bubble+="l"),e.detail.bubble.indexOf("u")>-1&&t.closest("[data-mc]")?.dispatchEvent(e),e.detail.bubble.indexOf("d")>-1&&new Set(t._mc.children().map((t=>t?.target))).forEach((t=>{t&&t._mc.trigger(t,e)}))}),0)}(t,o)}class v{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==O&&e.trigger("Init")}),0),function(t){if(!f()||t.constructor===O)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),c=o.toLowerCase();if("on"+c in e){let r=e=>{n[t](e)};e.addEventListener(c,r)}else b(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class E extends v{constructor(t){super(t)}}class O extends v{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new O(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){p(this.target,t,e)}on(t,e){return b(this.target,t,e)}one(t,e){return g(this.target,t,e)}trigger(t,e={},n="l"){y(this.target,t,e,n)}ancestors(){let t=this?.target,e=[];if(!m(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return m(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return m(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!m(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}const w=new Set;function A(t){return()=>{const e=Array.from(document.querySelectorAll(`[data-mc*="${t}"]`)).filter((t=>t instanceof HTMLElement));if(0===e.length)return;const n=customElements.get(t);e.forEach((e=>{O.add(e,n.name,new n(e));const r=e.getAttribute("data-mc").split(" ").filter((e=>e!==t&&""!==e)).join(" ").trim();e.setAttribute("data-mc",r)}))}}function j(t){if(w.has(t))return;w.add(t);const e="./"+t.split("-").join("/")+".js",n=document.createElement("script");n.setAttribute("src",e),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("data-name",t),n.setAttribute("loading",""),customElements.whenDefined(t).then(A(t)),n.addEventListener("load",(e=>{w.delete(t),document.head.querySelector(`script[data-name="${t}"]`)?.remove()})),n.addEventListener("error",(t=>{console.error("could not load DC code from",e)})),document.head.append(n)}function C(){[...document.querySelectorAll(":not(:defined)")].filter((t=>!!t&&!customElements.get(t.tagName.toLowerCase())&&!w.has(t.tagName.toLowerCase()))).forEach((t=>{j(t.tagName.toLowerCase())})),[...document.querySelectorAll('[data-mc]:not([data-mc=""]')].filter((t=>!!t)).forEach((t=>{const e=t.getAttribute("data-mc")?.split(" ").filter((t=>""!==t));e?.forEach((t=>{const e=customElements.get(t);w.has(t)||e?e&&A(t)():j(t)}))}))}let S=!1,k=null;function _(t=!0){return t?(S=t,k=new MutationObserver(C),setTimeout((()=>{k.observe(document.body,{childList:!0,subtree:!0}),C()}),5),window.autoload=window.autoload||_,S):(k?.disconnect(),k=null,S)}_.state=w;class N extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function T(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function x(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=i(t);T(e.prototype.constructor)&&e.prototype instanceof v?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends N{instance;constructor(t){super();const n=T(e)?new e(this,t):e;O.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function L(t){return customElements.get(t)}function M(t){return null!=t&&"object"==typeof t}function P(t){let e=new Set,n=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(n))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(n));r.forEach((t=>r.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(n))).forEach((t=>{(t.nodeValue||"").match(n).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}const D=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class q extends O{data={};oldDisplay="";constructor(t){super(t),P(t).forEach((t=>this.data[t]="")),I(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var r;this.data.observe((r=t.getAttribute(e),o=>{let c=r;n.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,c)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{e=!0;let r=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let c=e;r.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=c})(n.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!D.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(e[n]=t.detail.data[n])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const H={};function V(t){let e=t.constructor.name;return H[e]||function(t){const e=t.constructor,n=e.name;let r=class extends e{#e=!0;#n=[];constructor(t){super(t),this.constructor.callbacks=[],M(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#n}set callbacks(t){this.#n=t}observe(t){return this.#n.push(t),this}bind(t){if(M(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!P(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||O.add(t,"_placeholders",new q(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),n=function(t){let n=o(t);e.forEach((t=>{t&&y(t,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=M(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#n.forEach((t=>{t(e)})),this}};return H[n]=r,r}(t)}const I=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let n=t[e],r=new(V(n))(n);Object.defineProperty(t,e,{enumerable:!0,get(){if(M(r.valueOf())){let t=structuredClone(Object.assign({},r));setTimeout(l((function(){c(structuredClone(Object.assign({},r)),t)||r.notify()}),0),0)}return r},set(t){if(typeof t==typeof r.valueOf())if(M(r.valueOf())&&r.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},r));void 0===r?.constructor?.prototype?.observe&&(r=new(V(t))(structuredClone(Object.assign({},t))),d(t,r),r.seal()),Object.assign(r,t),setTimeout(l((function(){c(structuredClone(Object.assign({},r)),e)||r.notify()}),0),0)}else{let e=r.valueOf(),n=r.callbacks;t!==e&&(r=new(V(t))(t),r.callbacks=n,r.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof r.valueOf(),r,"- CANNOT BECOME:",typeof t)}}),t[e]=n}})),t);class ${constructor(t){}}class R extends ${#r;constructor(t){super(t),this.#r=t}get val(){return new FormData(this.#r.form).get(this.#r.name)}set val(t){[...this.#r.form.querySelectorAll(`input[type="radio"][name="${this.#r.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class F extends ${#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.checked}set val(t){this.#r.checked=t}}class G extends ${#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value}set val(t){this.#r.value=t}}class J extends ${#r;#o=!1;constructor(t){super(t),this.#r=t,this.#o=t.multiple}get val(){const t=[];return[...this.#r.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#o?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#r.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class Z extends ${#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value||""}set val(t){this.#r.value=t}}const z=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],n={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let r=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":r=new R(t);break;case"checkbox":r=new F(t);break;default:r=new G(t)}break;case"select":r=new J(t);break;case"textarea":r=new Z(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}r&&(O.add(t,e,r),Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r.val,set:t=>{r.val!==t&&(r.val=t)}}))}})),n};function B(t,e,n){let r=z(n);t[e]=Object.assign({},r),I(t,e),d(r,t[e]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{t[e].notify()}))}))}return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.microcomponents=e():t.microcomponents=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return t&&t.constructor&&t.constructor===Object}function r(t){let e={};return[...Object.keys(t)].sort().forEach((o=>{n(t[o])?e[o]=r(t[o]):e[o]=t[o]})),e}function o(t,e=!0){let n={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=o(t[e],!1);for(const t in r)n[e+"."+t]=r[t]}else n[e]=t[e]})),e?r(n):n}function s(t,e){return JSON.stringify(o(t))===JSON.stringify(o(e))}function c(t,e={}){let n=t.constructor===String?t.split("."):t;if(e&&n[0]&&e[n[0]])return e[n[0]].constructor===Object&&n.length>1?c(n.splice(1),e[n[0]]):e[n[0]];console.warn("ns",n[0],"not in",e)}function a(t,e){var r=Array.from(arguments);if(r.length>2){for(;r.length>1;)r[0]=a(r[0],r[1]),r.splice(1,1);return r[0]}if("string"==typeof t)t.match(/\{[^\{\}]*\}/g)?.forEach((function(n){var r=c(n.substring(1,n.length-1),e);void 0!==r&&(t=t.replace(n,r))}));else if(n(t))switch(t.constructor){case Object:Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&(t[n]=a(t[n],e))}));break;case Array:t.forEach((function(n,r,o){o[r]=a(t[r],e)}))}return t}function i(t){return t.split("-").map((t=>t.charAt(0).toUpperCase()+t.slice(1))).join("")}function l(t,e){let n;return()=>{clearTimeout(n),n=setTimeout((function(){t(...arguments)}),e)}}function u(t){let e=document.createElement("template");return t=t.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),e.innerHTML=t,e.content.normalize(),Array.from(e.content.childNodes)}function d(t,e){const n=Object.getOwnPropertyDescriptors(t);for(const[t,r]of Object.entries(n))("get"in r||"set"in r)&&Object.defineProperty(e,t,r)}t.r(e),t.d(e,{DC:()=>w,MC:()=>O,McBase:()=>E,autoload:()=>N,copyGettersSetters:()=>d,debounce:()=>l,deepEqual:()=>s,defineCE:()=>x,flattenObject:()=>o,formValues:()=>U,getCE:()=>M,htmlToElements:()=>u,isNativeObject:()=>n,kebabToPascal:()=>i,nameSpace:()=>c,observe:()=>$,off:()=>p,on:()=>b,one:()=>g,parse:()=>a,sortObject:()=>r,trigger:()=>v});const f=new Function("try {return this===window;}catch(e){ return false;}");function m(t){return t&&t instanceof HTMLElement}function h(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function p(t,e,n){t.removeEventListener(h(e),n)}function b(t,e,n,r=!1){return t.addEventListener(h(e),n,{capture:!1,once:r}),n}function g(t,e,n){return b(t,e,n,!0),n}class y{stopped=!1;constructor(){}stop(){this.stopped=!0}}function v(t,e,n={},r="l",o){const s=/^_mc/.test(e)?e:h(e),c=o||new y,a=new CustomEvent(s,{detail:{data:n,control:c},bubbles:!1});c.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),c.stopped||/[ud]/.test(r)&&(-1===r.indexOf("l")&&(r+="l"),setTimeout((()=>{if(r.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(s,n,r,c)}if(r.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(s,n,r,c)))}}),0)))}class E{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==w&&e.trigger("Init")}),0),function(t){if(!f()||t.constructor===w)return;const e=t.target;if(e instanceof HTMLElement){let n=t;Object.getOwnPropertyNames(n.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof n.constructor.prototype[t])).forEach((t=>{let r=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),s=o.toLowerCase();if("on"+s in e){let r=e=>{n[t](e)};e.addEventListener(s,r)}else b(e,o,(e=>{n[t](e)}),r)}))}}(this)}get target(){return this._target.deref()}}class O extends E{constructor(t){super(t)}}class w extends E{constructor(t){super(t)}static add(t,e,n={}){return function(t,e,n={}){let r=t;r._mc||(r._mc=new w(t));const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),r}(t,e,n)}static remove(t,e){!function(t,e){if(!e)return;const n=t?._mc||{};n&&n[e]&&delete n[e],!Object.keys(n).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){p(this.target,t,e)}on(t,e){return b(this.target,t,e)}one(t,e){return g(this.target,t,e)}trigger(t,e={},n="l",r){v(this.target,t,e,n,r)}ancestors(){let t=this?.target,e=[];if(!m(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return m(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return m(t)?function(t){const e=Math.random().toString().replace(".",""),n='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const r=[...t.querySelectorAll(n)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),r.length?r:null}(t):null}descendants(){const t=this?.target;if(!m(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}const A=new Set;function j(t){return()=>{const e=Array.from(document.querySelectorAll(`[data-mc*="${t}"]`)).filter((t=>t instanceof HTMLElement));if(0===e.length)return;const n=customElements.get(t);e.forEach((e=>{w.add(e,n.name,new n(e));const r=e.getAttribute("data-mc").split(" ").filter((e=>e!==t&&""!==e)).join(" ").trim();e.setAttribute("data-mc",r)}))}}function C(t){if(A.has(t))return;A.add(t);const e="./"+t.split("-").join("/")+".js",n=document.createElement("script");n.setAttribute("src",e),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("data-name",t),n.setAttribute("loading",""),customElements.whenDefined(t).then(j(t)),n.addEventListener("load",(e=>{A.delete(t),document.head.querySelector(`script[data-name="${t}"]`)?.remove()})),n.addEventListener("error",(t=>{console.error("could not load DC code from",e)})),document.head.append(n)}function S(){[...document.querySelectorAll(":not(:defined)")].filter((t=>!!t&&!customElements.get(t.tagName.toLowerCase())&&!A.has(t.tagName.toLowerCase()))).forEach((t=>{C(t.tagName.toLowerCase())})),[...document.querySelectorAll('[data-mc]:not([data-mc=""]')].filter((t=>!!t)).forEach((t=>{const e=t.getAttribute("data-mc")?.split(" ").filter((t=>""!==t));e?.forEach((t=>{const e=customElements.get(t);A.has(t)||e?e&&j(t)():C(t)}))}))}let k=!1,_=null;function N(t=!0){return t?(k=t,_=new MutationObserver(S),setTimeout((()=>{_.observe(document.body,{childList:!0,subtree:!0}),S()}),5),window.autoload=window.autoload||N,k):(_?.disconnect(),_=null,k)}N.state=A;class T extends HTMLElement{constructor(){super()}connectedCallback(){this.dispatchEvent(new CustomEvent("_mcConnected"))}connectedMoveCallback(){this.dispatchEvent(new CustomEvent("_mcConnectedMove"))}disconnectedCallback(){this.dispatchEvent(new CustomEvent("_mcDisconnected"))}adoptedCallback(){this.dispatchEvent(new CustomEvent("_mcAdopted"))}attributeChangedCallback(t,e,n){this.dispatchEvent(new CustomEvent("_mcAttributeChanged",{detail:{name:t,oldValue:e,newValue:n}}))}formResetCallback(){this.dispatchEvent(new CustomEvent("_mcFormReset"))}}function L(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function x(t,e,n=[]){if(customElements.get(t))return void console.warn(`IGNORED: Custom element "${t}" is already defined!`);if(!t.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=i(t);L(e.prototype.constructor)&&e.prototype instanceof E?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends T{instance;constructor(t){super();const n=L(e)?new e(this,t):e;w.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function M(t){return customElements.get(t)}function P(t){return null!=t&&"object"==typeof t}function D(t){let e=new Set,n=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(n))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(n));r.forEach((t=>r.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(n))).forEach((t=>{(t.nodeValue||"").match(n).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}const q=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class H extends w{data={};oldDisplay="";constructor(t){super(t),D(t).forEach((t=>this.data[t]="")),$(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var r;this.data.observe((r=t.getAttribute(e),o=>{let s=r;n.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,s)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{e=!0;let r=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let s=e;r.forEach((t=>{s=s.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,n.nodeValue=s})(n.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!q.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((n=>{this.data.hasOwnProperty(n)&&(e[n]=t.detail.data[n])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const I={};function V(t){let e=t.constructor.name;return I[e]||function(t){const e=t.constructor,n=e.name;let r=class extends e{#e=!0;#n=[];constructor(t){super(t),this.constructor.callbacks=[],P(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#n}set callbacks(t){this.#n=t}observe(t){return this.#n.push(t),this}bind(t){if(P(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!D(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||w.add(t,"_placeholders",new H(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),n=function(t){let n=o(t);e.forEach((t=>{t&&v(t,"data",n)}))};this.#n.push(n),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=P(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#n.forEach((t=>{t(e)})),this}};return I[n]=r,r}(t)}const $=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let n=t[e],r=new(V(n))(n);Object.defineProperty(t,e,{enumerable:!0,get(){if(P(r.valueOf())){let t=structuredClone(Object.assign({},r));setTimeout(l((function(){s(structuredClone(Object.assign({},r)),t)||r.notify()}),0),0)}return r},set(t){if(typeof t==typeof r.valueOf())if(P(r.valueOf())&&r.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},r));void 0===r?.constructor?.prototype?.observe&&(r=new(V(t))(structuredClone(Object.assign({},t))),d(t,r),r.seal()),Object.assign(r,t),setTimeout(l((function(){s(structuredClone(Object.assign({},r)),e)||r.notify()}),0),0)}else{let e=r.valueOf(),n=r.callbacks;t!==e&&(r=new(V(t))(t),r.callbacks=n,r.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof r.valueOf(),r,"- CANNOT BECOME:",typeof t)}}),t[e]=n}})),t);class R{constructor(t){}}class F extends R{#r;constructor(t){super(t),this.#r=t}get val(){return new FormData(this.#r.form).get(this.#r.name)}set val(t){[...this.#r.form.querySelectorAll(`input[type="radio"][name="${this.#r.name}"]`)].filter((e=>e.getAttribute("value")===t)).shift().checked=!0}}class G extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.checked}set val(t){this.#r.checked=t}}class J extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value}set val(t){this.#r.value=t}}class Z extends R{#r;#o=!1;constructor(t){super(t),this.#r=t,this.#o=t.multiple}get val(){const t=[];return[...this.#r.querySelectorAll("option")].filter((t=>t.selected)).forEach((e=>{t.push(e.value)})),this.#o?t:t.length?t[0]:""}set val(t){t="string"==typeof t?[t]:t,[...this.#r.querySelectorAll("option")].forEach((e=>{t.indexOf(e.value)>-1?e.selected=!0:e.selected=!1}))}}class z extends R{#r;constructor(t){super(t),this.#r=t}get val(){return this.#r.value||""}set val(t){this.#r.value=t}}const B=t=>{let e=[...(t||document).querySelectorAll("input,select,textarea")],n={};return e.forEach((t=>{const e=t.getAttribute("name");if(e){let r=!1;switch((t=>t.tagName.toLowerCase())(t)){case"input":switch(t.type){case"radio":r=new F(t);break;case"checkbox":r=new G(t);break;default:r=new J(t)}break;case"select":r=new Z(t);break;case"textarea":r=new z(t);break;default:console.warn("handler missing:",e,"for",t.tagName.toLowerCase(),t)}r&&(w.add(t,e,r),Object.defineProperty(n,e,{enumerable:!0,configurable:!0,get:()=>r.val,set:t=>{r.val!==t&&(r.val=t)}}))}})),n};function U(t,e,n){let r=B(n);t[e]=Object.assign({},r),$(t,e),d(r,t[e]),[...n.querySelectorAll("input, textarea, select")].forEach((n=>{n.addEventListener("input",(n=>{t[e].notify()}))}))}return e})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.observables=e():t.observables=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var o;(o=t[n])&&o.constructor&&o.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let o={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)o[e+"."+t]=r[t]}else o[e]=t[e]})),e?r(o):o}function o(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function c(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}t.r(e),t.d(e,{observe:()=>O});const a=new Function("try {return this===window;}catch(e){ return false;}");function s(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function l(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}function u(t,e,r={},n="l"){const o="string"==typeof e?new CustomEvent(i(e),{detail:{data:r,bubble:n}}):e;n.length&&n.indexOf("l")>-1&&t.dispatchEvent(o),/[ud]/.test(n)&&function(t,e){setTimeout((()=>{-1===e.detail.bubble.indexOf("l")&&(e.detail.bubble+="l"),e.detail.bubble.indexOf("u")>-1&&t.closest("[data-mc]")?.dispatchEvent(e),e.detail.bubble.indexOf("d")>-1&&new Set(t._mc.children().map((t=>t?.target))).forEach((t=>{t&&t._mc.trigger(t,e)}))}),0)}(t,o)}class f{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==d&&e.trigger("Init")}),0),function(t){if(!a()||t.constructor===d)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),c=o.toLowerCase();if("on"+c in e){let n=e=>{r[t](e)};e.addEventListener(c,n)}else l(e,o,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class d extends f{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new d(t));const o=n._mc;return e.length&&!o[e]&&(o[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return l(this.target,t,e)}one(t,e){return function(t,e,r){return l(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l"){u(this.target,t,e,r)}ancestors(){let t=this?.target,e=[];if(!s(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return s(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return s(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!s(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function h(t){return null!=t&&"object"==typeof t}function b(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const m=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class p extends d{data={};oldDisplay="";constructor(t){super(t),b(t).forEach((t=>this.data[t]="")),O(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),o=>{let c=n;r.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,c)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let c=e;n.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=c})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!m.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const g={};function y(t){let e=t.constructor.name;return g[e]||function(t){const e=t.constructor,r=e.name;let o=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],h(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(h(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!b(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||d.add(t,"_placeholders",new p(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&u(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=h(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return g[r]=o,o}(t)}const O=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(y(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(h(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(c((function(){o(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(h(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(y(t))(structuredClone(Object.assign({},t))),function(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}(t,n),n.seal()),Object.assign(n,t),setTimeout(c((function(){o(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(y(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.observables=e():t.observables=e()}(this,(()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){let e={};return[...Object.keys(t)].sort().forEach((n=>{var o;(o=t[n])&&o.constructor&&o.constructor===Object?e[n]=r(t[n]):e[n]=t[n]})),e}function n(t,e=!0){let o={};return[...Object.getOwnPropertyNames(t)].forEach((e=>{if(t[e]&&t[e].constructor&&t[e].constructor===Object){const r=n(t[e],!1);for(const t in r)o[e+"."+t]=r[t]}else o[e]=t[e]})),e?r(o):o}function o(t,e){return JSON.stringify(n(t))===JSON.stringify(n(e))}function c(t,e){let r;return()=>{clearTimeout(r),r=setTimeout((function(){t(...arguments)}),e)}}t.r(e),t.d(e,{observe:()=>v});const s=new Function("try {return this===window;}catch(e){ return false;}");function a(t){return t&&t instanceof HTMLElement}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function l(t,e,r,n=!1){return t.addEventListener(i(e),r,{capture:!1,once:n}),r}class u{stopped=!1;constructor(){}stop(){this.stopped=!0}}function f(t,e,r={},n="l",o){const c=/^_mc/.test(e)?e:i(e),s=o||new u,a=new CustomEvent(c,{detail:{data:r,control:s},bubbles:!1});s.stopped||(t.dispatchEvent(a),a.stopImmediatePropagation(),s.stopped||/[ud]/.test(n)&&(-1===n.indexOf("l")&&(n+="l"),setTimeout((()=>{if(n.indexOf("u")>-1){let e=t.parentElement?.closest("[data-mc]");e&&e?._mc.trigger(c,r,n,s)}if(n.indexOf("d")>-1){let e=t._mc.children();e&&e.forEach((t=>t.trigger(c,r,n,s)))}}),0)))}class d{_target;constructor(t){var e;this._target=new WeakRef(t||{}),e=this,setTimeout((()=>{e.constructor!==h&&e.trigger("Init")}),0),function(t){if(!s()||t.constructor===h)return;const e=t.target;if(e instanceof HTMLElement){let r=t;Object.getOwnPropertyNames(r.constructor.prototype).filter((t=>/^on[A-Z]|one[A-Z]/.test(t)&&"function"==typeof r.constructor.prototype[t])).forEach((t=>{let n=/^one/.test(t),o=t.replace(/^on[e]{0,1}/,""),c=o.toLowerCase();if("on"+c in e){let n=e=>{r[t](e)};e.addEventListener(c,n)}else l(e,o,(e=>{r[t](e)}),n)}))}}(this)}get target(){return this._target.deref()}}class h extends d{constructor(t){super(t)}static add(t,e,r={}){return function(t,e,r={}){let n=t;n._mc||(n._mc=new h(t));const o=n._mc;return e.length&&!o[e]&&(o[e]=r,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}(t,e,r)}static remove(t,e){!function(t,e){if(!e)return;const r=t?._mc||{};r&&r[e]&&delete r[e],!Object.keys(r).length&&t instanceof HTMLElement&&t.hasAttribute("data-mc")&&t.removeAttribute("data-mc")}(t,e)}off(t,e){!function(t,e,r){t.removeEventListener(i(e),r)}(this.target,t,e)}on(t,e){return l(this.target,t,e)}one(t,e){return function(t,e,r){return l(t,e,r,!0),r}(this.target,t,e)}trigger(t,e={},r="l",n){f(this.target,t,e,r,n)}ancestors(){let t=this?.target,e=[];if(!a(t))return[];for(;t=t.closest("[data-mc]");)t?._mc&&e.push(t?._mc);return e.length?e:null}closest(){let t=this.target;return a(t)&&t.closest("[data-mc]")?._mc||null}children(){let t=this?.target;return a(t)?function(t){const e=Math.random().toString().replace(".",""),r='[data-mc]:not([temp_id="'+e+'"] [data-mc] [data-mc])';t.setAttribute("temp_id",e);const n=[...t.querySelectorAll(r)].filter((t=>!!t._mc)).map((t=>t._mc));return t.removeAttribute("temp_id"),n.length?n:null}(t):null}descendants(){const t=this?.target;if(!a(t))return[];const e=[...t.querySelectorAll("[data-mc]")].filter((t=>!!t._mc)).map((t=>t._mc));return e.length?e:null}}function p(t){return null!=t&&"object"==typeof t}function m(t){let e=new Set,r=/\{[^\{\}]*\}/g;return(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(r))).forEach((e=>{let n=new Set(t.getAttribute(e)?.match(r));n.forEach((t=>n.add(t.replace(/[\{\}]/g,""))))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(r))).forEach((t=>{(t.nodeValue||"").match(r).forEach((t=>{e.add(t.replace(/[\{\}]/g,""))}))})),[...e].map((t=>t.replace(/[\{\}]/g,"")))}new Set;const b=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class g extends h{data={};oldDisplay="";constructor(t){super(t),m(t).forEach((t=>this.data[t]="")),v(this),this.#t()}#t(){let t=this.target,e=!1;(t.getAttributeNames?t.getAttributeNames():[]).filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((e=>{let r=new Set(t.getAttribute(e)?.match(/\{[^\{\}]*\}/g));var n;this.data.observe((n=t.getAttribute(e),o=>{let c=n;r.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),t.setAttribute(e,c)}))})),[...t.childNodes].filter((t=>3===t.nodeType&&(t.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((r=>{e=!0;let n=new Set(r.nodeValue.match(/\{[^\{\}]*\}/g));this.data.observe((e=>o=>{let c=e;n.forEach((t=>{c=c.replace(t,o[t.replace(/[\{\}]/g,"")])})),this.oldDisplay?t.style=this.oldDisplay:t.removeAttribute("style"),delete this.oldDisplay,r.nodeValue=c})(r.nodeValue)),this.oldDisplay=t.getAttribute("style")||"",e&&!b.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(t){let e={};Object.keys(t.detail.data).forEach((r=>{this.data.hasOwnProperty(r)&&(e[r]=t.detail.data[r])})),JSON.stringify(e)!==JSON.stringify(this.data)&&Object.assign(this.data,e)}}const y={};function O(t){let e=t.constructor.name;return y[e]||function(t){const e=t.constructor,r=e.name;let o=class extends e{#e=!0;#r=[];constructor(t){super(t),this.constructor.callbacks=[],p(t)&&Object.getOwnPropertyNames(t).forEach((e=>{this[e]=t[e]}))}get callbacks(){return this.#r}set callbacks(t){this.#r=t}observe(t){return this.#r.push(t),this}bind(t){if(p(this.valueOf())){!function(t){var e;(e=t,[e].concat([...e.querySelectorAll("*")]).filter((t=>!!m(t).length)).filter((t=>"STYLE"!==t?.tagName)).reverse()).forEach((t=>{t?._mc?._placeholders||h.add(t,"_placeholders",new g(t))}))}(t);const e=[t,...t.querySelectorAll("[data-mc]")].filter((t=>!!t?._mc?._placeholders)),r=function(t){let r=n(t);e.forEach((t=>{t&&f(t,"data",r)}))};this.#r.push(r),this.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof this.valueOf(),this);return this}notify(t){let e=p(this.valueOf())&&this.valueOf()instanceof Array==0?structuredClone(Object.assign({},this)):this.valueOf();return void 0!==t&&(this.#e=t),this.#r.forEach((t=>{t(e)})),this}};return y[r]=o,o}(t)}const v=(t,e)=>((e?[e]:[...Object.getOwnPropertyNames(t)]).forEach((e=>{if(t.hasOwnProperty(e)&&"function"!=typeof t[e]&&!t?.[e]?.constructor?.prototype?.observe){if("_"===e[0]||void 0===t?.[e])return t;let r=t[e],n=new(O(r))(r);Object.defineProperty(t,e,{enumerable:!0,get(){if(p(n.valueOf())){let t=structuredClone(Object.assign({},n));setTimeout(c((function(){o(structuredClone(Object.assign({},n)),t)||n.notify()}),0),0)}return n},set(t){if(typeof t==typeof n.valueOf())if(p(n.valueOf())&&n.valueOf()instanceof Array==0){let e=structuredClone(Object.assign({},n));void 0===n?.constructor?.prototype?.observe&&(n=new(O(t))(structuredClone(Object.assign({},t))),function(t,e){const r=Object.getOwnPropertyDescriptors(t);for(const[t,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(e,t,n)}(t,n),n.seal()),Object.assign(n,t),setTimeout(c((function(){o(structuredClone(Object.assign({},n)),e)||n.notify()}),0),0)}else{let e=n.valueOf(),r=n.callbacks;t!==e&&(n=new(O(t))(t),n.callbacks=r,n.notify())}else console.warn("IGNORED - cannot change observable types, IS:",typeof n.valueOf(),n,"- CANNOT BECOME:",typeof t)}}),t[e]=r}})),t);return e})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twobirds/microcomponents",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "Micro Components Organization Class",
5
5
  "main": "./dist/microcomponents.ts",
6
6
  "types": "./dist/microcomponents.d.ts",
package/public/MC.d.ts CHANGED
@@ -5,7 +5,12 @@ export interface HTMLMcElement extends HTMLElement {
5
5
  declare function off(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject): void;
6
6
  declare function on(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject, once?: boolean): EventListenerOrEventListenerObject;
7
7
  declare function one(domNode: Node, eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
8
- declare function trigger(domNode: HTMLElement, event: CustomEvent | string, data?: any, bubble?: string): void;
8
+ declare class BubbleController {
9
+ stopped: boolean;
10
+ constructor();
11
+ stop(): void;
12
+ }
13
+ declare function trigger(domNode: HTMLElement, event: string, data?: any, bubble?: string, controller?: BubbleController): void;
9
14
  declare class McBase {
10
15
  private _target;
11
16
  constructor(target?: {
@@ -23,7 +28,7 @@ declare class DC extends McBase {
23
28
  off(eventName: string, handler: EventListenerOrEventListenerObject): void;
24
29
  on(eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
25
30
  one(eventName: string, handler: EventListenerOrEventListenerObject): EventListenerOrEventListenerObject;
26
- trigger(eventName: string, data?: any, bubble?: string): void;
31
+ trigger(eventName: string, data?: any, bubble?: string, controller?: BubbleController): void;
27
32
  ancestors(): DC[] | null;
28
33
  closest(): DC | null;
29
34
  children(): DC[] | null;
@@ -1 +1 @@
1
- {"version":3,"file":"MC.d.ts","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,GAAG,EAAE,WAAW,CAAC;CACjB;AAmED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,QAE1F;AAED,iBAAS,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,EAAE,IAAI,GAAE,OAAe,GAAI,kCAAkC,CAGtJ;AAED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC,CAGhI;AAGD,iBAAS,OAAO,CACf,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,WAAW,GAAG,MAAM,EAC3B,IAAI,GAAE,GAAQ,EACd,MAAM,GAAE,MAAY,QAepB;AA+ED,cAAM,MAAM;IACX,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAU3C,IAAI,MAAM,IAAI,GAAG,CAEhB;CAED;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,CAAC,EAAE,GAAG;CAGxB;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,EAAE,WAAW;IAI/B,MAAM,CAAC,GAAG,CAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAI,aAAa;IAIhF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;IAK9C,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC;IAInE,EAAE,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIxG,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIzG,OAAO,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,EAAE,MAAM,GAAE,MAAY;IAKhE,SAAS,IAAI,EAAE,EAAE,GAAG,IAAI;IAgBxB,OAAO,IAAI,EAAE,GAAG,IAAI;IAOpB,QAAQ,IAAI,EAAE,EAAE,GAAG,IAAI;IAMvB,WAAW,IAAI,EAAE,EAAE,GAAG,IAAI;CAS1B;AAiHD,iBAAS,QAAQ,CAAC,MAAM,GAAE,OAAc,GAAG,OAAO,CAmBjD;AAID,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"MC.d.ts","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,GAAG,EAAE,WAAW,CAAC;CACjB;AAmED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,QAE1F;AAED,iBAAS,EAAE,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,EAAE,IAAI,GAAE,OAAe,GAAI,kCAAkC,CAGtJ;AAED,iBAAS,GAAG,CAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC,CAGhI;AAED,cAAM,gBAAgB;IACrB,OAAO,UAAS;;IAGhB,IAAI;CAGJ;AAGD,iBAAS,OAAO,CACf,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,GAAQ,EACd,MAAM,GAAE,MAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,QA4C7B;AAiDD,cAAM,MAAM;IACX,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAU3C,IAAI,MAAM,IAAI,GAAG,CAEhB;CAED;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,CAAC,EAAE,GAAG;CAGxB;AAED,cAAM,EAAG,SAAQ,MAAM;gBACV,MAAM,EAAE,WAAW;IAI/B,MAAM,CAAC,GAAG,CAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,GAAQ,GAAI,aAAa;IAIhF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM;IAK9C,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC;IAInE,EAAE,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIxG,GAAG,CAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAI,kCAAkC;IAIzG,OAAO,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,EAAE,MAAM,GAAE,MAAY,EAAE,UAAU,CAAC,EAAE,gBAAgB;IAK/F,SAAS,IAAI,EAAE,EAAE,GAAG,IAAI;IAgBxB,OAAO,IAAI,EAAE,GAAG,IAAI;IAOpB,QAAQ,IAAI,EAAE,EAAE,GAAG,IAAI;IAMvB,WAAW,IAAI,EAAE,EAAE,GAAG,IAAI;CAS1B;AAiHD,iBAAS,QAAQ,CAAC,MAAM,GAAE,OAAc,GAAG,OAAO,CAmBjD;AAID,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}