@twobirds/microcomponents 0.0.82 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/documentation/MC.md +0 -1
- package/assets/test/test.html +1 -1
- package/dist/MC.d.ts +11 -10
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.js +137 -200
- package/dist/MC.min.js +157 -296
- package/dist/MC.ts +202 -337
- package/dist/elements.d.ts +1 -1
- package/dist/elements.d.ts.map +1 -1
- package/dist/elements.js +26 -6
- package/dist/elements.min.js +1 -1
- package/dist/elements.ts +50 -7
- package/dist/formValues.js +2 -2
- package/dist/formValues.min.js +1 -1
- package/dist/formValues.ts +3 -3
- package/dist/microcomponents.d.ts +0 -1
- package/dist/microcomponents.d.ts.map +1 -1
- package/dist/microcomponents.js +0 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/microcomponents.ts +1 -1
- package/dist/observables.d.ts.map +1 -1
- package/dist/observables.js +52 -57
- package/dist/observables.min.js +1 -1
- package/dist/observables.ts +68 -73
- package/package.json +6 -5
- package/public/MC.d.ts +11 -10
- package/public/MC.d.ts.map +1 -1
- package/public/MC.js +137 -200
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +157 -296
- package/public/MC.ts +202 -337
- package/public/documentation/MC.md +0 -1
- package/public/elements.d.ts +1 -1
- package/public/elements.d.ts.map +1 -1
- package/public/elements.js +26 -6
- package/public/elements.js.map +1 -1
- package/public/elements.min.js +1 -1
- package/public/elements.ts +50 -7
- package/public/formValues.js +2 -2
- package/public/formValues.js.map +1 -1
- package/public/formValues.min.js +1 -1
- package/public/formValues.ts +3 -3
- package/public/microcomponents.d.ts +0 -1
- package/public/microcomponents.d.ts.map +1 -1
- package/public/microcomponents.js +0 -1
- package/public/microcomponents.js.map +1 -1
- package/public/microcomponents.min.js +1 -1
- package/public/microcomponents.ts +1 -1
- package/public/observables.d.ts.map +1 -1
- package/public/observables.js +52 -57
- package/public/observables.js.map +1 -1
- package/public/observables.min.js +1 -1
- package/public/observables.ts +68 -73
- package/public/{test/selectors.ts → selectors._ts} +2 -367
- package/public/src/MC.d.ts +37 -0
- package/public/src/MC.d.ts.map +1 -0
- package/public/src/MC.js +316 -0
- package/public/src/MC.js.map +1 -0
- package/public/src/MC.ts +202 -337
- package/public/src/elements.d.ts +5 -0
- package/public/src/elements.d.ts.map +1 -0
- package/public/src/elements.js +68 -0
- package/public/src/elements.js.map +1 -0
- package/public/src/elements.ts +50 -7
- package/public/src/formValues.d.ts +3 -0
- package/public/src/formValues.d.ts.map +1 -0
- package/public/src/formValues.js +162 -0
- package/public/src/formValues.js.map +1 -0
- package/public/src/formValues.ts +3 -3
- package/public/src/helpers.d.ts +14 -0
- package/public/src/helpers.d.ts.map +1 -0
- package/public/src/helpers.js +113 -0
- package/public/src/microcomponents.d.ts +6 -0
- package/public/src/microcomponents.d.ts.map +1 -0
- package/public/src/microcomponents.js +7 -0
- package/public/src/microcomponents.js.map +1 -0
- package/public/src/microcomponents.ts +1 -1
- package/public/src/observables.d.ts +11 -0
- package/public/src/observables.d.ts.map +1 -0
- package/public/src/observables.js +244 -0
- package/public/src/observables.js.map +1 -0
- package/public/src/observables.ts +68 -73
- package/public/{selectors.ts → src/selectors._ts} +2 -367
- package/public/src/test/grandparent.css +11 -0
- package/public/src/test/test/child.d.ts +2 -0
- package/public/src/test/test/child.d.ts.map +1 -0
- package/public/src/test/test/child.js +15 -0
- package/public/src/test/test/child.js.map +1 -0
- package/public/src/test/test/child.ts +21 -0
- package/public/src/test/test/grandchild.d.ts +2 -0
- package/public/src/test/test/grandchild.d.ts.map +1 -0
- package/public/src/test/test/grandchild.js +15 -0
- package/public/src/test/test/grandchild.js.map +1 -0
- package/public/src/test/test/grandchild.ts +21 -0
- package/public/src/test/test/grandparent.d.ts +2 -0
- package/public/src/test/test/grandparent.d.ts.map +1 -0
- package/public/src/test/test/grandparent.js +1 -0
- package/public/src/test/test/grandparent.js.map +1 -0
- package/public/src/test/test/grandparent.ts +29 -0
- package/public/src/test/test/greatgrandchild.d.ts +2 -0
- package/public/src/test/test/greatgrandchild.d.ts.map +1 -0
- package/public/src/test/test/greatgrandchild.js +29 -0
- package/public/src/test/test/greatgrandchild.js.map +1 -0
- package/public/src/test/test/greatgrandchild.ts +42 -0
- package/public/src/test/test/parent.d.ts +2 -0
- package/public/src/test/test/parent.d.ts.map +1 -0
- package/public/src/test/test/parent.js +15 -0
- package/public/src/test/test/parent.js.map +1 -0
- package/public/src/test/test/parent.ts +21 -0
- package/public/src/test/test/testform.d.ts +2 -0
- package/public/src/test/test/testform.d.ts.map +1 -0
- package/public/src/test/test/testform.js +1 -0
- package/public/src/test/test/testform.js.map +1 -0
- package/public/src/test/test/testform.ts +153 -0
- package/public/src/test/test/testfunction.d.ts +3 -0
- package/public/src/test/test/testfunction.d.ts.map +1 -0
- package/public/src/test/test/testfunction.js +7 -0
- package/public/src/test/test/testfunction.js.map +1 -0
- package/public/src/test/test/testfunction.ts +12 -0
- package/public/src/test/test/testmc.d.ts +3 -0
- package/public/src/test/test/testmc.d.ts.map +1 -0
- package/public/src/test/test/testmc.js +10 -0
- package/public/src/test/test/testmc.js.map +1 -0
- package/public/src/test/test/testmc.ts +16 -0
- package/public/src/test/test/testsimpleclass.d.ts +3 -0
- package/public/src/test/test/testsimpleclass.d.ts.map +1 -0
- package/public/src/test/test/testsimpleclass.js +9 -0
- package/public/src/test/test/testsimpleclass.js.map +1 -0
- package/public/src/test/test/testsimpleclass.ts +15 -0
- package/public/src/test/test.d.ts +2 -0
- package/public/src/test/test.d.ts.map +1 -0
- package/public/src/test/test.js +80 -0
- package/public/src/test/test.js.map +1 -0
- package/public/src/test/test.ts +188 -0
- package/public/src/test/testform.css +47 -0
- package/public/src/test/testform.html +56 -0
- package/public/src/test/testform.json +27 -0
- package/public/test/MC.d.ts +11 -10
- package/public/test/MC.d.ts.map +1 -1
- package/public/test/MC.js +137 -200
- package/public/test/MC.min.js +377 -0
- package/public/test/MC.ts +202 -337
- package/public/test/elements.d.ts +1 -1
- package/public/test/elements.d.ts.map +1 -1
- package/public/test/elements.js +26 -6
- package/public/test/elements.min.js +1 -0
- package/public/test/elements.ts +50 -7
- package/public/test/formValues.js +2 -2
- package/public/test/formValues.min.js +1 -0
- package/public/test/formValues.ts +3 -3
- package/public/test/grandparent.css +1 -3
- package/public/test/microcomponents.d.ts +0 -1
- package/public/test/microcomponents.d.ts.map +1 -1
- package/public/test/microcomponents.js +0 -1
- package/public/test/microcomponents.min.js +1 -1
- package/public/test/microcomponents.ts +1 -1
- package/public/test/observables.d.ts.map +1 -1
- package/public/test/observables.js +52 -57
- package/public/test/observables.min.js +1 -0
- package/public/test/observables.ts +68 -73
- package/public/test/test/child.ts +21 -0
- package/public/test/test/grandchild.ts +21 -0
- package/public/test/test/grandparent.d.ts.map +1 -1
- package/public/test/test/grandparent.js +1 -1
- package/public/test/test/grandparent.js.map +1 -1
- package/public/test/test/grandparent.ts +29 -0
- package/public/test/test/greatgrandchild.ts +42 -0
- package/public/test/test/parent.ts +21 -0
- package/public/test/test/testform.js +1 -1
- package/public/test/test/testform.js.map +1 -1
- package/public/test/test/testform.ts +153 -0
- package/public/test/test/testfunction.d.ts +3 -0
- package/public/test/test/testfunction.d.ts.map +1 -0
- package/public/test/test/testfunction.js +7 -0
- package/public/test/test/testfunction.js.map +1 -0
- package/public/test/test/testfunction.ts +12 -0
- package/public/test/test/testmc.d.ts +2 -5
- package/public/test/test/testmc.d.ts.map +1 -1
- package/public/test/test/testmc.js +4 -4
- package/public/test/test/testmc.js.map +1 -1
- package/public/test/test/testmc.ts +16 -0
- package/public/test/test/testsimpleclass.d.ts +3 -0
- package/public/test/test/testsimpleclass.d.ts.map +1 -0
- package/public/test/test/testsimpleclass.js +9 -0
- package/public/test/test/testsimpleclass.js.map +1 -0
- package/public/test/test/testsimpleclass.ts +15 -0
- package/public/test/test.html +1 -1
- package/public/test/test.js +5 -6
- package/public/test/test.js.map +1 -1
- package/public/test/test.ts +188 -0
- package/public/test/testform.css +47 -0
- package/public/test/testform.html +56 -0
- package/public/test/testform.json +3 -3
- package/public/typedoc/assets/navigation.js +1 -1
- package/public/typedoc/assets/search.js +1 -1
- package/public/typedoc/classes/MC.DC.html +6 -4
- package/public/typedoc/classes/MC.MC.html +3 -4
- package/public/typedoc/classes/MC.McBase.html +2 -2
- package/public/typedoc/functions/MC.autoload.html +1 -1
- package/public/typedoc/functions/MC.off.html +1 -0
- package/public/typedoc/functions/MC.on.html +1 -0
- package/public/typedoc/functions/MC.one.html +1 -0
- package/public/typedoc/functions/elements.defineCE.html +1 -1
- package/public/typedoc/functions/elements.getCE.html +1 -1
- package/public/typedoc/functions/formValues.formValues.html +1 -1
- package/public/typedoc/functions/observables.observe.html +1 -1
- package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/typedoc/modules/MC.html +7 -6
- package/public/typedoc/modules/elements.html +1 -1
- package/public/typedoc/modules/formValues.html +1 -1
- package/public/typedoc/modules/observables.html +1 -1
- package/public/typedoc/types/observables.Observable.html +1 -1
- package/src/MC.ts +202 -337
- package/src/elements.ts +50 -7
- package/src/formValues.ts +3 -3
- package/src/microcomponents.ts +1 -1
- package/src/observables.ts +68 -73
- package/{dist/selectors.ts → src/selectors._ts} +2 -367
- package/src/test/test/grandparent.ts +12 -4
- package/src/test/test/testform.ts +13 -11
- package/src/test/test/testfunction.ts +12 -0
- package/src/test/test/testmc.ts +13 -9
- package/src/test/test/testsimpleclass.ts +15 -0
- package/src/test/test.ts +8 -20
- package/tasks.md +36 -0
- package/tsconfig.json +2 -2
- package/typedoc.json +1 -1
- package/webpack.config.js +2 -2
- package/dist/McEvent.d.ts +0 -15
- package/dist/McEvent.d.ts.map +0 -1
- package/dist/McEvent.js +0 -71
- package/dist/selectors.d.ts +0 -108
- package/dist/selectors.d.ts.map +0 -1
- package/dist/selectors.js +0 -971
- package/dist/selectors.min.js +0 -1
- package/public/McEvent.d.ts +0 -15
- package/public/McEvent.d.ts.map +0 -1
- package/public/McEvent.js +0 -71
- package/public/McEvent.js.map +0 -1
- package/public/selectors.d.ts +0 -108
- package/public/selectors.d.ts.map +0 -1
- package/public/selectors.js +0 -971
- package/public/selectors.js.map +0 -1
- package/public/selectors.min.js +0 -1
- package/public/src/selectors.ts +0 -1634
- package/public/test/MC.js.map +0 -1
- package/public/test/McEvent.d.ts +0 -15
- package/public/test/McEvent.d.ts.map +0 -1
- package/public/test/McEvent.js +0 -71
- package/public/test/McEvent.js.map +0 -1
- package/public/test/McEvent.ts +0 -96
- package/public/test/elements.js.map +0 -1
- package/public/test/formValues.js.map +0 -1
- package/public/test/microcomponents.js.map +0 -1
- package/public/test/observables.js.map +0 -1
- package/public/test/selectors.d.ts +0 -108
- package/public/test/selectors.d.ts.map +0 -1
- package/public/test/selectors.js +0 -971
- package/public/test/selectors.js.map +0 -1
- package/public/typedoc/classes/MC.McEvent.html +0 -9
- package/public/typedoc/functions/MC.addListener.html +0 -1
- package/public/typedoc/functions/MC.removeListener.html +0 -1
- package/src/McEvent.ts +0 -96
- package/src/selectors.ts +0 -1634
- /package/{dist/McEvent.ts → public/McEvent._ts} +0 -0
- /package/public/{McEvent.ts → src/McEvent._ts} +0 -0
- /package/public/{test → src}/helpers.js.map +0 -0
- /package/{public/src/McEvent.ts → src/McEvent._ts} +0 -0
|
@@ -29,249 +29,6 @@ const words = ( classes: Array<string> ): Array<string> => {
|
|
|
29
29
|
return classes;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
type inputTypes = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
33
|
-
|
|
34
|
-
const getInputName = ( e: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement ): string => {
|
|
35
|
-
|
|
36
|
-
let ret = e instanceof HTMLInputElement
|
|
37
|
-
? 'input'
|
|
38
|
-
: e instanceof HTMLSelectElement
|
|
39
|
-
? 'select'
|
|
40
|
-
: e instanceof HTMLTextAreaElement
|
|
41
|
-
? 'textarea'
|
|
42
|
-
: ''
|
|
43
|
-
;
|
|
44
|
-
|
|
45
|
-
return ret;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const getInputHandlers = ( e: HTMLElement | ShadowRoot ): LooseObject => {
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
//inputList = ( Array.from( e.querySelectorAll('*') ) as HTMLElement[] ).filter( i => isInputElement(i) ),
|
|
53
|
-
inputList = $d('input,select,textarea', e).array,
|
|
54
|
-
handlers: LooseObject = {};
|
|
55
|
-
|
|
56
|
-
inputList.forEach( (i) => {
|
|
57
|
-
const
|
|
58
|
-
name: string = ( i as inputTypes ).getAttribute('name') || 'undefined';
|
|
59
|
-
|
|
60
|
-
if ( name ){
|
|
61
|
-
let h: InputBase;
|
|
62
|
-
switch ( getInputName( i as inputTypes ) ){
|
|
63
|
-
case 'input':
|
|
64
|
-
//console.log( i, 'is HTMLInputElement');
|
|
65
|
-
h = new InputHandler( i as HTMLInputElement, e ); // e = element to search radios in = radioBase
|
|
66
|
-
Object.defineProperty( handlers, name, {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
configurable: true,
|
|
69
|
-
get: (): any => { return h.val },
|
|
70
|
-
set: ( value: any ) => { h.val = value }
|
|
71
|
-
});
|
|
72
|
-
break;
|
|
73
|
-
case 'select':
|
|
74
|
-
//console.log( i, 'is HTMLSelectElement');
|
|
75
|
-
h = new SelectHandler( i as HTMLSelectElement );
|
|
76
|
-
Object.defineProperty( handlers, name, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
configurable: true,
|
|
79
|
-
get: (): any => { return h.val },
|
|
80
|
-
set: ( value: any ) => { h.val = value }
|
|
81
|
-
});
|
|
82
|
-
break;
|
|
83
|
-
case 'textarea':
|
|
84
|
-
//console.log( i, 'is HTMLTextAreaElement');
|
|
85
|
-
h = new TextAreaHandler( i as HTMLTextAreaElement );
|
|
86
|
-
Object.defineProperty( handlers, name, {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
configurable: true,
|
|
89
|
-
get: (): any => { return h.val },
|
|
90
|
-
set: ( value: any ) => { h.val = value }
|
|
91
|
-
});
|
|
92
|
-
break;
|
|
93
|
-
default:
|
|
94
|
-
console.warn('handler missing:', name, 'for', i);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return handlers;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
abstract class InputBase{
|
|
104
|
-
constructor( e: any ){
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
abstract get val(): any;
|
|
108
|
-
|
|
109
|
-
abstract set val( value: any );
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
class InputHandler extends InputBase {
|
|
114
|
-
|
|
115
|
-
#e: HTMLInputElement;
|
|
116
|
-
#type: string;
|
|
117
|
-
#radioBase: any;
|
|
118
|
-
|
|
119
|
-
constructor( e: HTMLInputElement, radioBase?: HTMLElement | ShadowRoot ){
|
|
120
|
-
super( e );
|
|
121
|
-
this.#e = e;
|
|
122
|
-
this.#type = e.type;
|
|
123
|
-
this.#radioBase = radioBase;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
get val(): any{
|
|
127
|
-
let that = this,
|
|
128
|
-
type = that.#type,
|
|
129
|
-
ret: any;
|
|
130
|
-
|
|
131
|
-
switch (type){
|
|
132
|
-
case 'radio':
|
|
133
|
-
const check = $d( `input[type="radio"][name="${ this.#e.getAttribute('name') }"]`, this.#radioBase )
|
|
134
|
-
.filter( e => e.checked );
|
|
135
|
-
if ( !check.length ) return '';
|
|
136
|
-
ret = check.array[0];
|
|
137
|
-
return ret.value;
|
|
138
|
-
case 'checkbox':
|
|
139
|
-
return that.#e.checked;
|
|
140
|
-
default:
|
|
141
|
-
return that.#e.value;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return '';
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
set val( value: any ){
|
|
149
|
-
let that = this,
|
|
150
|
-
type = that.#type,
|
|
151
|
-
ret: any;
|
|
152
|
-
|
|
153
|
-
switch (type){
|
|
154
|
-
case 'radio':
|
|
155
|
-
const
|
|
156
|
-
selection = `input[type="radio"][name="${ this.#e.getAttribute('name') }"]`,
|
|
157
|
-
radios = $d( selection, this.#radioBase );
|
|
158
|
-
|
|
159
|
-
// console.log('set radios', selection, this.#radioBase, radios.array );
|
|
160
|
-
|
|
161
|
-
if ( !radios.length ) return;
|
|
162
|
-
|
|
163
|
-
if ( value === '' ){ // uncheck all
|
|
164
|
-
radios.forEach( r => { if (r.checked) r.checked = false } );
|
|
165
|
-
//console.log('unset all radios', radios.array );
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const setRadioElement = radios.filter( r => r.getAttribute('value') === value );
|
|
170
|
-
|
|
171
|
-
if ( !setRadioElement.length ) return;
|
|
172
|
-
|
|
173
|
-
// console.log('set this radio', setRadioElement.array );
|
|
174
|
-
|
|
175
|
-
(setRadioElement.array[0] as HTMLInputElement).checked = true;
|
|
176
|
-
|
|
177
|
-
// console.log('done', setRadioElement.array );
|
|
178
|
-
return;
|
|
179
|
-
break;
|
|
180
|
-
case 'checkbox':
|
|
181
|
-
that.#e.checked = value;
|
|
182
|
-
break;
|
|
183
|
-
default:
|
|
184
|
-
that.#e.value = value;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
class SelectHandler extends InputBase {
|
|
194
|
-
|
|
195
|
-
#e: HTMLSelectElement;
|
|
196
|
-
#multi: boolean = false;
|
|
197
|
-
|
|
198
|
-
constructor( e: HTMLSelectElement ){
|
|
199
|
-
super( e );
|
|
200
|
-
this.#e = e;
|
|
201
|
-
this.#multi = e.type === 'select-multiple';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
get val(): string[] | string{
|
|
205
|
-
const
|
|
206
|
-
that = this,
|
|
207
|
-
ret: string[] = [];
|
|
208
|
-
|
|
209
|
-
// get all options
|
|
210
|
-
const options = $d( that.#e.querySelectorAll('option') )
|
|
211
|
-
.filter( o => o.selected )
|
|
212
|
-
.forEach( o => { if ( o.selected ) ret.push( o.value ) } );
|
|
213
|
-
|
|
214
|
-
if ( this.#multi ) return ret;
|
|
215
|
-
return ret.length ? ret[0] : '';
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
set val( value: string[] | string ){
|
|
219
|
-
const
|
|
220
|
-
that = this;
|
|
221
|
-
|
|
222
|
-
value = typeof value === 'string' ? [ value ] : value;
|
|
223
|
-
|
|
224
|
-
//console.log('set values', value );
|
|
225
|
-
|
|
226
|
-
// set all options
|
|
227
|
-
const options = $d( that.#e.querySelectorAll('option') )
|
|
228
|
-
.forEach( o => {
|
|
229
|
-
if ( value.indexOf( o.value ) > -1 ) {
|
|
230
|
-
o.setAttribute( 'selected', true )
|
|
231
|
-
o.selected = true;
|
|
232
|
-
} else {
|
|
233
|
-
o.removeAttribute( 'selected' )
|
|
234
|
-
o.selected = false;
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
/*
|
|
239
|
-
if (pOption.selected) {
|
|
240
|
-
if (
|
|
241
|
-
!pOption.disabled &&
|
|
242
|
-
(!pOption.parentNode.disabled ||
|
|
243
|
-
pOption.parentNode.nodeName !==
|
|
244
|
-
'optgroup')
|
|
245
|
-
) {
|
|
246
|
-
var value = pOption.value;
|
|
247
|
-
|
|
248
|
-
ret.push(value);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
*/
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
class TextAreaHandler extends InputBase {
|
|
258
|
-
#e: HTMLTextAreaElement
|
|
259
|
-
constructor( e: HTMLTextAreaElement ){
|
|
260
|
-
super(e);
|
|
261
|
-
this.#e = e;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
get val(): string{
|
|
265
|
-
return this.#e.value;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
set val( value: string ){
|
|
269
|
-
this.#e.value = value;
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
275
32
|
/*
|
|
276
33
|
selector classes
|
|
277
34
|
*/
|
|
@@ -303,28 +60,9 @@ class DomSelector{
|
|
|
303
60
|
that = this,
|
|
304
61
|
undefinedTags: Set<any> = new Set();
|
|
305
62
|
|
|
306
|
-
// // console.log('DomSelector constructor', ...arguments);
|
|
307
|
-
|
|
308
63
|
if ( !selection ) {
|
|
309
64
|
return that;
|
|
310
65
|
}
|
|
311
|
-
|
|
312
|
-
/* autoloading disabled !
|
|
313
|
-
if ( selection instanceof Array ){
|
|
314
|
-
selection.forEach( (select) => {
|
|
315
|
-
_getElementList( select, element ).forEach( (e) => {
|
|
316
|
-
if ( e.localName?.indexOf('-') !== -1 || e.getAttribute?.('is') ) _loadRequirements( e );
|
|
317
|
-
that.#set.add( e );
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
} else {
|
|
321
|
-
_getElementList( selection, element ).forEach( (e) => {
|
|
322
|
-
if ( e.localName?.indexOf('-') !== -1 || e.getAttribute?.('is') ) _loadRequirements( e );
|
|
323
|
-
that.#set.add( e );
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
*/
|
|
327
|
-
|
|
328
66
|
}
|
|
329
67
|
|
|
330
68
|
$t( nameSpace?: string ): TSelector {
|
|
@@ -652,20 +390,6 @@ class DomSelector{
|
|
|
652
390
|
return that;
|
|
653
391
|
}
|
|
654
392
|
|
|
655
|
-
/*
|
|
656
|
-
load(): DSelector{
|
|
657
|
-
let that = this;
|
|
658
|
-
|
|
659
|
-
if( !that.length ){
|
|
660
|
-
that.add( document.body );
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
that.forEach( e => _loadRequirements( e ) );
|
|
664
|
-
|
|
665
|
-
return that;
|
|
666
|
-
}
|
|
667
|
-
*/
|
|
668
|
-
|
|
669
393
|
next( selection?: selection, rootNode?: HTMLElement ): DSelector{
|
|
670
394
|
let
|
|
671
395
|
that: DomSelector = this,
|
|
@@ -805,7 +529,7 @@ class DomSelector{
|
|
|
805
529
|
return that;
|
|
806
530
|
}
|
|
807
531
|
|
|
808
|
-
|
|
532
|
+
ancestors( selection?: selection, rootNode?: HTMLElement ): DSelector {
|
|
809
533
|
let
|
|
810
534
|
that: DomSelector = this,
|
|
811
535
|
set: Set<HTMLElement> = new Set()
|
|
@@ -948,95 +672,6 @@ class DomSelector{
|
|
|
948
672
|
return that;
|
|
949
673
|
}
|
|
950
674
|
|
|
951
|
-
// INFO:
|
|
952
|
-
// val(): LooseObject; // no param: get all as LooseObject
|
|
953
|
-
// val( p1: string ): Array<string> | number | string; // get from input name
|
|
954
|
-
// val( p1: object ): DomSelector; // set from object
|
|
955
|
-
// val( p1: string, p2: any ): DomSelector; // set from name and value
|
|
956
|
-
val( p1?: any, p2?: any ): any {
|
|
957
|
-
|
|
958
|
-
if ( !this.length ) return this;
|
|
959
|
-
|
|
960
|
-
const
|
|
961
|
-
that = this
|
|
962
|
-
;
|
|
963
|
-
|
|
964
|
-
let result: any,
|
|
965
|
-
handlers: LooseObject = getInputHandlers( that.array[0] );
|
|
966
|
-
|
|
967
|
-
// work with it
|
|
968
|
-
if ( !p1 ){ // get all inputs as LooseObject
|
|
969
|
-
result = Object.assign( {}, handlers );
|
|
970
|
-
// Object.keys( handlers ).forEach( ( key ) => result[key] = handlers.hasOwnProperty(key) ? handlers[key].val : undefined );
|
|
971
|
-
} else {
|
|
972
|
-
if ( isObject(p1) ){ // set inputs from Object
|
|
973
|
-
Object.assign( handlers, p1 );
|
|
974
|
-
// Object.keys( p1 ).forEach( ( key ) => !!handlers[key] ? handlers[key].val = p1[key] : false );
|
|
975
|
-
result = that;
|
|
976
|
-
} else if ( typeof p1 === 'string' ){
|
|
977
|
-
if ( p2 === undefined ){ // get a single input
|
|
978
|
-
result = handlers[p1];
|
|
979
|
-
} else { // set a single input
|
|
980
|
-
handlers[p1] = p2;
|
|
981
|
-
result = that;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
return result;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
values( values?: LooseObject ): LooseObject {
|
|
990
|
-
const
|
|
991
|
-
that = this,
|
|
992
|
-
holder: LooseObject = {};
|
|
993
|
-
|
|
994
|
-
let
|
|
995
|
-
data: LooseObject = {};
|
|
996
|
-
|
|
997
|
-
//console.log( '$d().values()', values );
|
|
998
|
-
|
|
999
|
-
if ( !that.length ) {
|
|
1000
|
-
console.warn('no dom selection to search inputs in');
|
|
1001
|
-
return {};
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
let handlers = getInputHandlers( that.array[0] );
|
|
1005
|
-
|
|
1006
|
-
//console.log( 'handlers', Object.keys(handlers), handlers['cb1'] );
|
|
1007
|
-
|
|
1008
|
-
// let values = that.val();
|
|
1009
|
-
|
|
1010
|
-
// console.log( 'values', values );
|
|
1011
|
-
|
|
1012
|
-
Object.keys( handlers ).forEach( (key: string) => {
|
|
1013
|
-
//console.log(key);
|
|
1014
|
-
data[key] = handlers[key];
|
|
1015
|
-
});
|
|
1016
|
-
|
|
1017
|
-
// data = Object.assign( {}, that.val() )
|
|
1018
|
-
//console.log( 'data', that.array[0], data, Object.keys( data ) );
|
|
1019
|
-
|
|
1020
|
-
if ( Object.keys( data ).length === 0 ) {
|
|
1021
|
-
console.warn('no inputs in this dom selection', that.array[0], data );
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
//console.log( '$d val()', data );
|
|
1025
|
-
if (values) {
|
|
1026
|
-
Object
|
|
1027
|
-
.keys( values )
|
|
1028
|
-
.forEach( key => {
|
|
1029
|
-
if ( handlers.hasOwnProperty(key) ) {
|
|
1030
|
-
console.log( 'key found', key );
|
|
1031
|
-
handlers[key] = values[key];
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
// .forEach( key => handlers[key] = values[key] )
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
return structuredClone( Object.assign( handlers ) );
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
675
|
/*
|
|
1041
676
|
array method mapping
|
|
1042
677
|
*/
|
|
@@ -1434,7 +1069,7 @@ class TbSelector{
|
|
|
1434
1069
|
return that;
|
|
1435
1070
|
}
|
|
1436
1071
|
|
|
1437
|
-
|
|
1072
|
+
ancestors( nameSpace?: string ): TSelector {
|
|
1438
1073
|
|
|
1439
1074
|
let
|
|
1440
1075
|
that: TbSelector = this,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.d.ts","sourceRoot":"","sources":["../../../src/test/test/child.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,KAAK,sCAAsB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from './../../microcomponents.js';
|
|
2
|
+
import { Grandchild } from './grandchild.js';
|
|
3
|
+
defineCE('test-child', class TestChild extends DC {
|
|
4
|
+
constructor(target) {
|
|
5
|
+
super(target);
|
|
6
|
+
}
|
|
7
|
+
onConnected() {
|
|
8
|
+
let that = this;
|
|
9
|
+
for (let x = 0; x < 10; x++) {
|
|
10
|
+
that.target.append(new Grandchild());
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export const Child = getCE('test-child');
|
|
15
|
+
//# sourceMappingURL=child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.js","sourceRoot":"","sources":["../../../src/test/test/child.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,QAAQ,CACP,YAAY,EAEZ,MAAM,SAAU,SAAQ,EAAE;IACzB,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED,WAAW;QACV,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,UAAW,EAAE,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;CACD,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from './../../microcomponents.js';
|
|
2
|
+
import { Grandchild } from './grandchild.js';
|
|
3
|
+
defineCE(
|
|
4
|
+
'test-child',
|
|
5
|
+
|
|
6
|
+
class TestChild extends DC {
|
|
7
|
+
constructor(target: HTMLElement) {
|
|
8
|
+
super(target);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
onConnected() {
|
|
12
|
+
let that = this;
|
|
13
|
+
|
|
14
|
+
for (let x = 0; x < 10; x++) {
|
|
15
|
+
that.target.append(new Grandchild!());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const Child = getCE('test-child');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grandchild.d.ts","sourceRoot":"","sources":["../../../src/test/test/grandchild.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,UAAU,sCAA2B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from '../../microcomponents.js';
|
|
2
|
+
import { Greatgrandchild } from './greatgrandchild.js';
|
|
3
|
+
defineCE('test-grandchild', class TestGrandchild extends DC {
|
|
4
|
+
constructor(target) {
|
|
5
|
+
super(target);
|
|
6
|
+
}
|
|
7
|
+
onConnected() {
|
|
8
|
+
let that = this;
|
|
9
|
+
for (let x = 0; x < 2; x++) {
|
|
10
|
+
that.target.append(new Greatgrandchild());
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export const Grandchild = getCE('test-grandchild');
|
|
15
|
+
//# sourceMappingURL=grandchild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grandchild.js","sourceRoot":"","sources":["../../../src/test/test/grandchild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,QAAQ,CACP,iBAAiB,EAEjB,MAAM,cAAe,SAAQ,EAAE;IAC9B,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED,WAAW;QACV,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,eAAgB,EAAE,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;CACD,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from '../../microcomponents.js';
|
|
2
|
+
import { Greatgrandchild } from './greatgrandchild.js';
|
|
3
|
+
defineCE(
|
|
4
|
+
'test-grandchild',
|
|
5
|
+
|
|
6
|
+
class TestGrandchild extends DC {
|
|
7
|
+
constructor(target: HTMLElement) {
|
|
8
|
+
super(target);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
onConnected() {
|
|
12
|
+
let that = this;
|
|
13
|
+
|
|
14
|
+
for (let x = 0; x < 2; x++) {
|
|
15
|
+
that.target.append(new Greatgrandchild!());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const Grandchild = getCE('test-grandchild');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grandparent.d.ts","sourceRoot":"","sources":["../../../src/test/test/grandparent.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,WAAW,sCAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.grandparent=e():t.grandparent=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var 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,{GrandParent:()=>_});var n=new Function("try {return this===window;}catch(e){ return false;}");function r(t,e){let n=[];return t.forEach((t=>{if(t&&t instanceof HTMLElement){const r=t?._mc;!e&&r?n=n.concat(Object.values(t._mc)):e&&r&&r[e]&&n.push(r[e])}})),n}function o(t,e,n=!0){let r=[];for(;t;){if(t._mc&&(e?e&&t._mc[e]&&r.push(t._mc[e]):r=r.concat(Object.values(t._mc)),n))return r;t=t.parentNode}return r}function c(t){return t&&t instanceof HTMLElement}function s(t,e,n={}){let r=t;if(!r._mc){let e=p?.debug;p.debug=!1,r._mc=new p(t),p.debug=e,delete r._mc._mc}const o=r._mc;return e.length&&!o[e]&&(o[e]=n,t instanceof HTMLElement&&!t.getAttribute("data-mc")&&t.setAttribute("data-mc","")),n}function a(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")}function i(t){return"_mc"+t[0].toUpperCase()+t.substring(1)}function d(t,e,n,r=!1){t.addEventListener(i(e),n,{capture:!1,once:r})}function u(t,e,n={},r="l"){const o="string"==typeof e?new CustomEvent(i(e),{detail:{data:n,bubble:r}}):e;r.length&&r.indexOf("l")>-1&&t.dispatchEvent(o),/[u|d]/.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&&p.trigger(t,e)}))}),0)}(t,o)}class l{_target;constructor(t,e=!1){var r;this._target=new WeakRef(t||{}),(r=this).constructor!==p&&setTimeout((()=>{r.trigger("Init")}),0),function(t){if(!n()||t.constructor===p)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(),s=e=>{n[t](e)};e["on"+c]?e.addEventListener(c,s):d(e,o,s,r)}))}}(this)}get target(){return this._target.deref()}}class p extends l{constructor(t,e=!1){super(t)}static add=s;static remove=a;static trigger=u;off(t,e){!function(t,e,n){t.removeEventListener(i(e),n)}(this.target,t,e)}on(t,e){d(this.target,t,e)}one(t,e){!function(t,e,n){d(t,e,n,!0)}(this.target,t,e)}trigger(t,e={},n="l"){}parent(t=""){let e=this.target;return c(e)?o(e.parentNode,t,!0):[]}ancestors(t=""){let e=this?.target;return c(e)?o(this.target.parentNode,t,!1):[]}children(t=""){let e=this?.target;return c(e)?r([...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);return t.removeAttribute("temp_id"),r}(e)],t):[]}descendants(t=""){let e=this?.target;return c(e)?r([...e.querySelectorAll("*[data-mc]")],t):[]}}new Set;class m 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 f(t){return"function"==typeof t&&/^class\s/.test(Function.prototype.toString.call(t))}function h(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("");f(e.prototype.constructor)&&e.prototype instanceof l?customElements.define(t,function(t,e){return Object.defineProperty(e,"name",{value:t})}(r,class extends m{instance;constructor(t){super();const n=f(e)?new e(this,t):e;p.add(this,r,n)}static get observedAttributes(){return n}})):customElements.define(t,e)}function g(t){return customElements.get(t)}function b(t,e){return Math.floor(Math.random()*(e-t+1)+t)}h("test-greatgrandchild",class extends p{constructor(t){super(t)}onConnected(){this.updateStyle()}updateStyle(){this.target.setAttribute("style","border-color:rgb("+b(0,255)+","+b(0,255)+","+b(0,255)+")")}});const v=g("test-greatgrandchild");h("test-grandchild",class extends p{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<2;e++)t.target.append(new v)}});const E=g("test-grandchild");h("test-child",class extends p{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<10;e++)t.target.append(new E)}});const y=g("test-child");h("test-parent",class extends p{constructor(t){super(t)}onConnected(){let t=this;for(let e=0;e<5;e++)t.target.append(new y)}});const C=g("test-parent");h("test-grandparent",class extends p{constructor(t){super(t)}onConnected(t){for(let t=0;t<5;t++)this.target.append(new C)}onDisconnected(t){}onAdopted(t){}onAttributeChanged(t){}});const _=g("test-grandparent");return e})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grandparent.js","sourceRoot":"","sources":["../../../src/test/test/grandparent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,QAAQ,CACP,kBAAkB,EAElB,MAAM,eAAgB,SAAQ,EAAE;IAC/B,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED,WAAW,CAAC,EAAc;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAO,EAAE,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAED,cAAc,CAAC,EAAc;IAC7B,CAAC;IAED,SAAS,CAAC,EAAc;IACxB,CAAC;IAED,kBAAkB,CAAC,EAAc;IACjC,CAAC;CAED,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from '../../microcomponents.js';
|
|
2
|
+
import { Parent } from './parent.js';
|
|
3
|
+
defineCE(
|
|
4
|
+
'test-grandparent',
|
|
5
|
+
|
|
6
|
+
class TestGrandparent extends DC {
|
|
7
|
+
constructor(target: HTMLElement) {
|
|
8
|
+
super(target);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
onConnected(ev:CustomEvent) {
|
|
12
|
+
for (let x = 0; x < 5; x++) {
|
|
13
|
+
this.target.append(new Parent!());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
onDisconnected(ev:CustomEvent) {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onAdopted(ev:CustomEvent) {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onAttributeChanged(ev:CustomEvent) {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const GrandParent = getCE('test-grandparent');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greatgrandchild.d.ts","sourceRoot":"","sources":["../../../src/test/test/greatgrandchild.ts"],"names":[],"mappings":"AAyCA,eAAO,MAAM,eAAe,sCAAgC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from '../../microcomponents.js';
|
|
2
|
+
function random(min, max) {
|
|
3
|
+
var random = Math.floor(Math.random() * (max - min + 1) + min);
|
|
4
|
+
return random;
|
|
5
|
+
}
|
|
6
|
+
defineCE('test-greatgrandchild', class TestGreatgrandchild extends DC {
|
|
7
|
+
constructor(target) {
|
|
8
|
+
super(target);
|
|
9
|
+
}
|
|
10
|
+
onConnected() {
|
|
11
|
+
let that = this;
|
|
12
|
+
that.updateStyle();
|
|
13
|
+
}
|
|
14
|
+
updateStyle() {
|
|
15
|
+
var that = this;
|
|
16
|
+
function randomBorderColor() {
|
|
17
|
+
return ('rgb(' +
|
|
18
|
+
random(0, 255) +
|
|
19
|
+
',' +
|
|
20
|
+
random(0, 255) +
|
|
21
|
+
',' +
|
|
22
|
+
random(0, 255) +
|
|
23
|
+
')');
|
|
24
|
+
}
|
|
25
|
+
that.target.setAttribute('style', 'border-color:' + randomBorderColor());
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export const Greatgrandchild = getCE('test-greatgrandchild');
|
|
29
|
+
//# sourceMappingURL=greatgrandchild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greatgrandchild.js","sourceRoot":"","sources":["../../../src/test/test/greatgrandchild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAE/D,SAAS,MAAM,CAAC,GAAW,EAAE,GAAW;IACvC,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC;AACf,CAAC;AAED,QAAQ,CACP,sBAAsB,EAEtB,MAAM,mBAAoB,SAAQ,EAAE;IACnC,YAAY,MAAmB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IACf,CAAC;IAED,WAAW;QACV,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;IAED,WAAW;QACV,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,SAAS,iBAAiB;YACzB,OAAO,CACN,MAAM;gBACN,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;gBACd,GAAG;gBACH,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;gBACd,GAAG;gBACH,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC;gBACd,GAAG,CACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,EAAE,CAAC,CAAC;IAC1E,CAAC;CACD,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DC, defineCE, getCE } from '../../microcomponents.js';
|
|
2
|
+
|
|
3
|
+
function random(min: number, max: number) {
|
|
4
|
+
var random = Math.floor(Math.random() * (max - min + 1) + min);
|
|
5
|
+
return random;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
defineCE(
|
|
9
|
+
'test-greatgrandchild',
|
|
10
|
+
|
|
11
|
+
class TestGreatgrandchild extends DC {
|
|
12
|
+
constructor(target: HTMLElement) {
|
|
13
|
+
super(target);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
onConnected() {
|
|
17
|
+
let that = this;
|
|
18
|
+
|
|
19
|
+
that.updateStyle();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
updateStyle() {
|
|
23
|
+
var that = this;
|
|
24
|
+
|
|
25
|
+
function randomBorderColor() {
|
|
26
|
+
return (
|
|
27
|
+
'rgb(' +
|
|
28
|
+
random(0, 255) +
|
|
29
|
+
',' +
|
|
30
|
+
random(0, 255) +
|
|
31
|
+
',' +
|
|
32
|
+
random(0, 255) +
|
|
33
|
+
')'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
that.target.setAttribute('style', 'border-color:' + randomBorderColor());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const Greatgrandchild = getCE('test-greatgrandchild');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../../src/test/test/parent.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,MAAM,sCAAuB,CAAC"}
|