@twobirds/microcomponents 0.0.85 → 0.0.88
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/README.md +18 -3
- package/assets/documentation/MC.md +23 -42
- package/assets/test/{my-tag.css → myButton.css} +4 -4
- package/assets/test/test.html +1 -1
- package/dist/MC.d.ts +5 -5
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.js +17 -21
- package/dist/MC.min.js +17 -21
- package/dist/MC.ts +25 -34
- package/dist/elements.min.js +1 -1
- package/dist/formValues.min.js +1 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.min.js +1 -1
- package/package.json +2 -2
- package/public/MC.d.ts +5 -5
- package/public/MC.d.ts.map +1 -1
- package/public/MC.js +17 -21
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +17 -21
- package/public/MC.ts +25 -34
- package/public/documentation/MC.md +23 -42
- package/public/elements.min.js +1 -1
- package/public/formValues.min.js +1 -1
- package/public/microcomponents.min.js +1 -1
- package/public/observables.min.js +1 -1
- package/public/src/MC.d.ts +5 -5
- package/public/src/MC.d.ts.map +1 -1
- package/public/src/MC.js +17 -21
- package/public/src/MC.js.map +1 -1
- package/public/src/MC.ts +25 -34
- package/public/src/test/test/grandparent.js +1 -1
- package/public/src/test/test/testform.js +1 -1
- package/public/src/test/test.js +22 -30
- package/public/src/test/test.js.map +1 -1
- package/public/src/test/test.ts +59 -72
- package/public/test/MC.d.ts +5 -5
- package/public/test/MC.d.ts.map +1 -1
- package/public/test/MC.js +17 -21
- package/public/test/MC.min.js +17 -21
- package/public/test/MC.ts +25 -34
- package/public/test/elements.min.js +1 -1
- package/public/test/formValues.min.js +1 -1
- package/public/test/microcomponents.min.js +1 -1
- package/public/test/{my-tag.css → myButton.css} +4 -4
- package/public/test/observables.min.js +1 -1
- package/public/test/test/grandparent.js +1 -1
- package/public/test/test/testform.js +1 -1
- package/public/test/test.html +1 -1
- package/public/test/test.js +22 -30
- package/public/test/test.js.map +1 -1
- package/public/test/test.ts +59 -72
- package/public/typedoc/assets/search.js +1 -1
- package/public/typedoc/classes/MC.DC.html +3 -3
- package/public/typedoc/classes/MC.MC.html +2 -2
- package/public/typedoc/classes/MC.McBase.html +2 -2
- package/public/typedoc/functions/MC.autoload.html +1 -1
- package/public/typedoc/functions/MC.off.html +1 -1
- package/public/typedoc/functions/MC.on.html +1 -1
- package/public/typedoc/functions/MC.one.html +1 -1
- package/public/typedoc/functions/MC.trigger.html +1 -1
- package/public/typedoc/functions/elements.defineCE.html +1 -1
- package/public/typedoc/functions/elements.getCE.html +1 -1
- package/public/typedoc/functions/formValues.formValues.html +1 -1
- package/public/typedoc/functions/observables.observe.html +1 -1
- package/public/typedoc/index.html +14 -3
- package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/typedoc/modules/MC.html +1 -1
- package/public/typedoc/modules/elements.html +1 -1
- package/public/typedoc/modules/formValues.html +1 -1
- package/public/typedoc/modules/observables.html +1 -1
- package/public/typedoc/types/observables.Observable.html +1 -1
- package/src/MC.ts +25 -34
- package/src/test/test.ts +59 -72
- package/public/McEvent._ts +0 -96
- package/public/src/McEvent._ts +0 -96
- package/src/McEvent._ts +0 -96
package/public/src/McEvent._ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var isBrowser=new Function("try {return this===window;}catch(e){ return false;}");
|
|
4
|
-
|
|
5
|
-
let nativeEventNames: Set<string> = new Set();
|
|
6
|
-
|
|
7
|
-
// HTMLElement native event names
|
|
8
|
-
if ( isBrowser() ){
|
|
9
|
-
Object.keys( HTMLElement.prototype ).filter( key => /^on/.test(key) ).forEach( eventName => nativeEventNames.add( eventName ) );
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isDOM(element: { [key:string]: any } ) {
|
|
13
|
-
return element && element instanceof HTMLElement;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface McEvent {
|
|
17
|
-
data: any;
|
|
18
|
-
bubble: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
class McEvent{
|
|
22
|
-
|
|
23
|
-
#type: string;
|
|
24
|
-
#stopped: boolean = false;
|
|
25
|
-
#immediateStopped: boolean = false;
|
|
26
|
-
|
|
27
|
-
constructor( type: string, data: any = {}, bubble: string = 'l' ){
|
|
28
|
-
// bubble standard = local only, options = any combination of'uld' characters: up to root, local, down
|
|
29
|
-
this.#type = type;
|
|
30
|
-
this.data = data;
|
|
31
|
-
this.bubble = bubble;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get type(): string {
|
|
35
|
-
return this.#type;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get stopped(): boolean {
|
|
39
|
-
return this.#stopped;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get immediateStopped(): boolean {
|
|
43
|
-
return this.#immediateStopped;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
stopPropagation(){
|
|
47
|
-
this.#stopped = true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
stopImmediatePropagation(){
|
|
51
|
-
this.stopPropagation();
|
|
52
|
-
this.#immediateStopped = true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// get all microcomponents from a list of HTMLElements
|
|
58
|
-
function getMicroComponents( elements: any[], search: string): any[] {
|
|
59
|
-
let mcValues: any[] = [];
|
|
60
|
-
|
|
61
|
-
elements.forEach( e => {
|
|
62
|
-
if (e) {
|
|
63
|
-
if (e instanceof HTMLElement) {
|
|
64
|
-
const _mc = ( e as any )?._mc;
|
|
65
|
-
if ( !search && _mc ) {
|
|
66
|
-
mcValues = mcValues.concat(Object.values(( e as any )._mc));
|
|
67
|
-
}
|
|
68
|
-
else if ( search && _mc && _mc[search] ) {
|
|
69
|
-
mcValues.push( _mc[search] );
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return mcValues;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// get all ancestor DOM nodes up to the document root
|
|
78
|
-
function traverseNodes(node: { [key:string]: any }, search: string, firstonly = true): any[] {
|
|
79
|
-
let mcValues: any[] = [];
|
|
80
|
-
while (node) {
|
|
81
|
-
if (node._mc) {
|
|
82
|
-
if (!search) {
|
|
83
|
-
mcValues = mcValues.concat(Object.values(node._mc));
|
|
84
|
-
}
|
|
85
|
-
else if (search && node._mc[search]) {
|
|
86
|
-
mcValues.push(node._mc[search]);
|
|
87
|
-
}
|
|
88
|
-
if (firstonly)
|
|
89
|
-
return mcValues;
|
|
90
|
-
}
|
|
91
|
-
node = node.parentNode;
|
|
92
|
-
}
|
|
93
|
-
return mcValues;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { McEvent };
|
package/src/McEvent._ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var isBrowser=new Function("try {return this===window;}catch(e){ return false;}");
|
|
4
|
-
|
|
5
|
-
let nativeEventNames: Set<string> = new Set();
|
|
6
|
-
|
|
7
|
-
// HTMLElement native event names
|
|
8
|
-
if ( isBrowser() ){
|
|
9
|
-
Object.keys( HTMLElement.prototype ).filter( key => /^on/.test(key) ).forEach( eventName => nativeEventNames.add( eventName ) );
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isDOM(element: { [key:string]: any } ) {
|
|
13
|
-
return element && element instanceof HTMLElement;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface McEvent {
|
|
17
|
-
data: any;
|
|
18
|
-
bubble: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
class McEvent{
|
|
22
|
-
|
|
23
|
-
#type: string;
|
|
24
|
-
#stopped: boolean = false;
|
|
25
|
-
#immediateStopped: boolean = false;
|
|
26
|
-
|
|
27
|
-
constructor( type: string, data: any = {}, bubble: string = 'l' ){
|
|
28
|
-
// bubble standard = local only, options = any combination of'uld' characters: up to root, local, down
|
|
29
|
-
this.#type = type;
|
|
30
|
-
this.data = data;
|
|
31
|
-
this.bubble = bubble;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get type(): string {
|
|
35
|
-
return this.#type;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get stopped(): boolean {
|
|
39
|
-
return this.#stopped;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get immediateStopped(): boolean {
|
|
43
|
-
return this.#immediateStopped;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
stopPropagation(){
|
|
47
|
-
this.#stopped = true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
stopImmediatePropagation(){
|
|
51
|
-
this.stopPropagation();
|
|
52
|
-
this.#immediateStopped = true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// get all microcomponents from a list of HTMLElements
|
|
58
|
-
function getMicroComponents( elements: any[], search: string): any[] {
|
|
59
|
-
let mcValues: any[] = [];
|
|
60
|
-
|
|
61
|
-
elements.forEach( e => {
|
|
62
|
-
if (e) {
|
|
63
|
-
if (e instanceof HTMLElement) {
|
|
64
|
-
const _mc = ( e as any )?._mc;
|
|
65
|
-
if ( !search && _mc ) {
|
|
66
|
-
mcValues = mcValues.concat(Object.values(( e as any )._mc));
|
|
67
|
-
}
|
|
68
|
-
else if ( search && _mc && _mc[search] ) {
|
|
69
|
-
mcValues.push( _mc[search] );
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return mcValues;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// get all ancestor DOM nodes up to the document root
|
|
78
|
-
function traverseNodes(node: { [key:string]: any }, search: string, firstonly = true): any[] {
|
|
79
|
-
let mcValues: any[] = [];
|
|
80
|
-
while (node) {
|
|
81
|
-
if (node._mc) {
|
|
82
|
-
if (!search) {
|
|
83
|
-
mcValues = mcValues.concat(Object.values(node._mc));
|
|
84
|
-
}
|
|
85
|
-
else if (search && node._mc[search]) {
|
|
86
|
-
mcValues.push(node._mc[search]);
|
|
87
|
-
}
|
|
88
|
-
if (firstonly)
|
|
89
|
-
return mcValues;
|
|
90
|
-
}
|
|
91
|
-
node = node.parentNode;
|
|
92
|
-
}
|
|
93
|
-
return mcValues;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { McEvent };
|