@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.
Files changed (76) hide show
  1. package/README.md +18 -3
  2. package/assets/documentation/MC.md +23 -42
  3. package/assets/test/{my-tag.css → myButton.css} +4 -4
  4. package/assets/test/test.html +1 -1
  5. package/dist/MC.d.ts +5 -5
  6. package/dist/MC.d.ts.map +1 -1
  7. package/dist/MC.js +17 -21
  8. package/dist/MC.min.js +17 -21
  9. package/dist/MC.ts +25 -34
  10. package/dist/elements.min.js +1 -1
  11. package/dist/formValues.min.js +1 -1
  12. package/dist/microcomponents.min.js +1 -1
  13. package/dist/observables.min.js +1 -1
  14. package/package.json +2 -2
  15. package/public/MC.d.ts +5 -5
  16. package/public/MC.d.ts.map +1 -1
  17. package/public/MC.js +17 -21
  18. package/public/MC.js.map +1 -1
  19. package/public/MC.min.js +17 -21
  20. package/public/MC.ts +25 -34
  21. package/public/documentation/MC.md +23 -42
  22. package/public/elements.min.js +1 -1
  23. package/public/formValues.min.js +1 -1
  24. package/public/microcomponents.min.js +1 -1
  25. package/public/observables.min.js +1 -1
  26. package/public/src/MC.d.ts +5 -5
  27. package/public/src/MC.d.ts.map +1 -1
  28. package/public/src/MC.js +17 -21
  29. package/public/src/MC.js.map +1 -1
  30. package/public/src/MC.ts +25 -34
  31. package/public/src/test/test/grandparent.js +1 -1
  32. package/public/src/test/test/testform.js +1 -1
  33. package/public/src/test/test.js +22 -30
  34. package/public/src/test/test.js.map +1 -1
  35. package/public/src/test/test.ts +59 -72
  36. package/public/test/MC.d.ts +5 -5
  37. package/public/test/MC.d.ts.map +1 -1
  38. package/public/test/MC.js +17 -21
  39. package/public/test/MC.min.js +17 -21
  40. package/public/test/MC.ts +25 -34
  41. package/public/test/elements.min.js +1 -1
  42. package/public/test/formValues.min.js +1 -1
  43. package/public/test/microcomponents.min.js +1 -1
  44. package/public/test/{my-tag.css → myButton.css} +4 -4
  45. package/public/test/observables.min.js +1 -1
  46. package/public/test/test/grandparent.js +1 -1
  47. package/public/test/test/testform.js +1 -1
  48. package/public/test/test.html +1 -1
  49. package/public/test/test.js +22 -30
  50. package/public/test/test.js.map +1 -1
  51. package/public/test/test.ts +59 -72
  52. package/public/typedoc/assets/search.js +1 -1
  53. package/public/typedoc/classes/MC.DC.html +3 -3
  54. package/public/typedoc/classes/MC.MC.html +2 -2
  55. package/public/typedoc/classes/MC.McBase.html +2 -2
  56. package/public/typedoc/functions/MC.autoload.html +1 -1
  57. package/public/typedoc/functions/MC.off.html +1 -1
  58. package/public/typedoc/functions/MC.on.html +1 -1
  59. package/public/typedoc/functions/MC.one.html +1 -1
  60. package/public/typedoc/functions/MC.trigger.html +1 -1
  61. package/public/typedoc/functions/elements.defineCE.html +1 -1
  62. package/public/typedoc/functions/elements.getCE.html +1 -1
  63. package/public/typedoc/functions/formValues.formValues.html +1 -1
  64. package/public/typedoc/functions/observables.observe.html +1 -1
  65. package/public/typedoc/index.html +14 -3
  66. package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
  67. package/public/typedoc/modules/MC.html +1 -1
  68. package/public/typedoc/modules/elements.html +1 -1
  69. package/public/typedoc/modules/formValues.html +1 -1
  70. package/public/typedoc/modules/observables.html +1 -1
  71. package/public/typedoc/types/observables.Observable.html +1 -1
  72. package/src/MC.ts +25 -34
  73. package/src/test/test.ts +59 -72
  74. package/public/McEvent._ts +0 -96
  75. package/public/src/McEvent._ts +0 -96
  76. package/src/McEvent._ts +0 -96
@@ -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 };