@twobirds/microcomponents 0.0.33 → 0.0.37
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 +40 -27
- package/assets/documentation/{MicroComponents.md → MC.md} +17 -17
- package/assets/documentation/comparision.md +0 -0
- package/assets/documentation/elements.md +276 -0
- package/assets/documentation/magic.md +10 -68
- package/dist/MC.d.ts +2 -3
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.min.js +45 -43
- package/dist/MC.ts +173 -175
- package/dist/autoloader.ts +1 -1
- package/dist/{customElements.d.ts → elements.d.ts} +1 -1
- package/dist/elements.d.ts.map +1 -0
- package/dist/elements.min.js +1 -0
- package/dist/{customElements.ts → elements.ts} +23 -14
- package/dist/helpers.d.ts +6 -4
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.ts +95 -128
- package/dist/microcomponents.d.ts +3 -3
- package/dist/microcomponents.d.ts.map +1 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/microcomponents.ts +3 -3
- package/dist/{customObservables.d.ts → observables.d.ts} +3 -3
- package/dist/observables.d.ts.map +1 -0
- package/dist/observables.min.js +1 -0
- package/dist/observables.ts +354 -0
- package/dist/{customSelectors.d.ts → selectors.d.ts} +1 -1
- package/dist/selectors.d.ts.map +1 -0
- package/dist/selectors.min.js +1 -0
- package/dist/test.ts +133 -157
- package/klemmstein.png +0 -0
- package/package.json +52 -52
- package/public/MC.js +46 -44
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +45 -43
- package/public/assets/search.js +1 -1
- package/public/autoloader.js +1 -1
- package/public/autoloader.js.map +1 -1
- package/public/classes/{DC.html → MC.DC.html} +60 -59
- package/public/classes/{MC.html → MC.MC.html} +41 -35
- package/public/classes/{McBase.html → MC.McBase.html} +28 -20
- package/public/classes/{McEvent.html → MC.McEvent.html} +48 -42
- package/public/documentation/{MicroComponents.md → MC.md} +17 -17
- package/public/documentation/comparision.md +0 -0
- package/public/documentation/elements.md +276 -0
- package/public/documentation/magic.md +10 -68
- package/public/{customElements.js → elements.js} +9 -10
- package/public/elements.js.map +1 -0
- package/public/elements.min.js +1 -0
- package/public/functions/{addListener.html → MC.addListener.html} +18 -12
- package/public/functions/{removeListener.html → MC.removeListener.html} +18 -12
- package/public/functions/elements.defineCE.html +78 -0
- package/public/functions/elements.getCE.html +63 -0
- package/public/functions/formValues.formValues.html +68 -0
- package/public/functions/observables.observe.html +65 -0
- package/public/functions/selectors._d.html +69 -0
- package/public/functions/selectors._t.html +69 -0
- package/public/helpers.js +66 -89
- package/public/helpers.js.map +1 -1
- package/public/index.html +48 -33
- package/public/interfaces/{HTMLMcElement.html → MC.HTMLMcElement.html} +601 -595
- package/public/interfaces/selectors.DSelector.html +1013 -0
- package/public/interfaces/selectors.TSelector.html +712 -0
- package/public/microcomponents.js +3 -3
- package/public/microcomponents.js.map +1 -1
- package/public/microcomponents.min.js +1 -1
- package/public/modules/MC.html +78 -0
- package/public/modules/elements.html +62 -0
- package/public/modules/formValues.html +60 -0
- package/public/modules/observables.html +65 -0
- package/public/modules/selectors.html +76 -0
- package/public/modules.html +11 -23
- package/public/observables.js +255 -0
- package/public/observables.js.map +1 -0
- package/public/observables.min.js +1 -0
- package/public/{customSelectors.js → selectors.js} +1 -1
- package/public/selectors.js.map +1 -0
- package/public/selectors.min.js +1 -0
- package/public/src/MC.ts +376 -0
- package/public/src/McEvent.ts +96 -0
- package/public/src/autoloader.ts +98 -0
- package/{src/customElements.ts → public/src/elements.ts} +23 -14
- package/public/src/formValues.ts +275 -0
- package/public/src/helpers.ts +140 -0
- package/public/src/microcomponents.ts +8 -0
- package/public/src/observables.ts +354 -0
- package/public/src/test.ts +187 -0
- package/public/test.js +99 -115
- package/public/test.js.map +1 -1
- package/public/types/observables.Observable.html +91 -0
- package/public/types/selectors.selection.html +58 -0
- package/public/types/selectors.singleSelector.html +58 -0
- package/src/MC.ts +173 -175
- package/src/autoloader.ts +1 -1
- package/src/elements.ts +76 -0
- package/src/helpers.ts +95 -128
- package/src/microcomponents.ts +3 -3
- package/src/observables.ts +354 -0
- package/src/selectors.ts +1634 -0
- package/src/test.ts +133 -157
- package/typedoc.json +1 -1
- package/webpack.config.js +9 -9
- package/dist/customElements.d.ts.map +0 -1
- package/dist/customElements.min.js +0 -1
- package/dist/customObservables.d.ts.map +0 -1
- package/dist/customObservables.min.js +0 -1
- package/dist/customObservables.ts +0 -348
- package/dist/customSelectors.d.ts.map +0 -1
- package/dist/customSelectors.min.js +0 -1
- package/public/customElements.js.map +0 -1
- package/public/customElements.min.js +0 -1
- package/public/customObservables.js +0 -256
- package/public/customObservables.js.map +0 -1
- package/public/customObservables.min.js +0 -1
- package/public/customSelectors.js.map +0 -1
- package/public/customSelectors.min.js +0 -1
- package/src/customObservables.ts +0 -348
- /package/dist/{customSelectors.ts → selectors.ts} +0 -0
- /package/{src/customSelectors.ts → public/src/selectors.ts} +0 -0
package/public/helpers.js
CHANGED
|
@@ -1,115 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
export function
|
|
3
|
-
return value
|
|
1
|
+
'use strict';
|
|
2
|
+
export function isNativeObject(value) {
|
|
3
|
+
return value && value['constructor'] && value.constructor === Object;
|
|
4
4
|
}
|
|
5
|
-
export function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export function sortObject(o) {
|
|
6
|
+
let result = {}, keys = [...Object.keys(o)].sort();
|
|
7
|
+
keys.forEach((key) => {
|
|
8
|
+
if (isNativeObject(o[key])) {
|
|
9
|
+
result[key] = sortObject(o[key]);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
result[key] = o[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return result;
|
|
10
16
|
}
|
|
11
|
-
export function
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export function flattenObject(o, doSort = true) {
|
|
18
|
+
let result = {};
|
|
19
|
+
[...Object.getOwnPropertyNames(o)].forEach((propName) => {
|
|
20
|
+
if (o[propName] &&
|
|
21
|
+
o[propName]['constructor'] &&
|
|
22
|
+
o[propName].constructor === Object) {
|
|
23
|
+
const temp = flattenObject(o[propName], false);
|
|
24
|
+
for (const j in temp) {
|
|
25
|
+
result[propName + '.' + j] = temp[j];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
result[propName] = o[propName];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return doSort ? sortObject(result) : result;
|
|
19
33
|
}
|
|
20
|
-
;
|
|
21
34
|
export function deepEqual(o1, o2) {
|
|
22
|
-
|
|
23
|
-
const k2 = Object.keys(o2);
|
|
24
|
-
if (k1.length !== k2.length) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
for (const key of k1) {
|
|
28
|
-
const v1 = o1[key], v2 = o2[key], recurse = isObject(v1) && isObject(v2);
|
|
29
|
-
;
|
|
30
|
-
if ((recurse && !deepEqual(v1, v2))
|
|
31
|
-
|| (!recurse && v1 !== v2)) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
35
|
+
return (JSON.stringify(flattenObject(o1)) === JSON.stringify(flattenObject(o2)));
|
|
36
36
|
}
|
|
37
|
-
export function nameSpace(ns, obj
|
|
38
|
-
let
|
|
39
|
-
if (!
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// console.log( 'start', ns, obj, val, leftOver );
|
|
43
|
-
let last = leftOver.shift(), // this property name
|
|
44
|
-
lns = leftOver.join('.') // the leftover namespace
|
|
45
|
-
;
|
|
46
|
-
if (val !== null && last.length && obj[last] === undefined) { // extend if val given and ns leftover...
|
|
47
|
-
// console.log( 'add prop', last );
|
|
48
|
-
obj[last] = {};
|
|
49
|
-
}
|
|
50
|
-
let lob = obj[last] // the leftover value or obj
|
|
51
|
-
;
|
|
52
|
-
// console.log( 'lob', lob, 'last:', last, 'lns:', lns, 'obj:', obj );
|
|
53
|
-
if (lns.length === 0) { // this should be the value to set or get
|
|
54
|
-
if (val !== null) {
|
|
55
|
-
obj[last] = val;
|
|
56
|
-
return orig;
|
|
57
|
-
}
|
|
58
|
-
return obj[last];
|
|
59
|
-
}
|
|
60
|
-
if (isObject(obj[last])) {
|
|
61
|
-
return nameSpace(lns, obj[last], val, orig);
|
|
37
|
+
export function nameSpace(ns, obj = {}) {
|
|
38
|
+
let nsa = ns.constructor === String ? ns.split('.') : ns;
|
|
39
|
+
if (!obj || !nsa[0] || !obj[nsa[0]]) {
|
|
40
|
+
console.warn('ns', nsa[0], 'not in', obj);
|
|
41
|
+
return;
|
|
62
42
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return orig;
|
|
66
|
-
}
|
|
67
|
-
return lob[last];
|
|
43
|
+
if (obj[nsa[0]].constructor === Object && nsa.length > 1) {
|
|
44
|
+
return nameSpace(nsa.splice(1), obj[nsa[0]]);
|
|
68
45
|
}
|
|
46
|
+
return obj[nsa[0]];
|
|
69
47
|
}
|
|
70
48
|
export function parse(what, parseThis) {
|
|
71
49
|
var args = Array.from(arguments);
|
|
72
|
-
if (
|
|
73
|
-
console.error('no arguments give to parse');
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (args.length === 1) {
|
|
77
|
-
return args[1];
|
|
78
|
-
}
|
|
79
|
-
else if (args.length > 2) {
|
|
50
|
+
if (args.length > 2) {
|
|
80
51
|
while (args.length > 1) {
|
|
81
52
|
args[0] = parse(args[0], args[1]);
|
|
82
53
|
args.splice(1, 1);
|
|
83
54
|
}
|
|
84
55
|
return args[0];
|
|
85
56
|
}
|
|
86
|
-
// implicit else: exactly 2 arguments
|
|
87
57
|
if (typeof what === 'string') {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
58
|
+
what.match(/\{[^\{\}]*\}/g)?.forEach(function (pPropname) {
|
|
59
|
+
var propname = pPropname.substring(1, pPropname.length - 1), value = nameSpace(propname, parseThis);
|
|
60
|
+
//console.log(propname, value);
|
|
61
|
+
if (typeof value !== 'undefined') {
|
|
62
|
+
what = what.replace(pPropname, value);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
98
65
|
}
|
|
99
|
-
else if (
|
|
66
|
+
else if (isNativeObject(what)) {
|
|
100
67
|
switch (what.constructor) {
|
|
101
68
|
case Object:
|
|
102
|
-
Object
|
|
103
|
-
.keys(what)
|
|
104
|
-
.forEach(function (pKey) {
|
|
69
|
+
Object.keys(what).forEach(function (pKey) {
|
|
105
70
|
if (what.hasOwnProperty(pKey)) {
|
|
106
71
|
what[pKey] = parse(what[pKey], parseThis);
|
|
107
72
|
}
|
|
108
73
|
});
|
|
109
74
|
break;
|
|
110
75
|
case Array:
|
|
111
|
-
what
|
|
112
|
-
.forEach(function (pValue, pKey, original) {
|
|
76
|
+
what.forEach(function (pValue, pKey, original) {
|
|
113
77
|
original[pKey] = parse(what[pKey], parseThis);
|
|
114
78
|
});
|
|
115
79
|
break;
|
|
@@ -117,11 +81,24 @@ export function parse(what, parseThis) {
|
|
|
117
81
|
}
|
|
118
82
|
return what;
|
|
119
83
|
}
|
|
120
|
-
|
|
84
|
+
export function kebabToPascal(str) {
|
|
85
|
+
return str
|
|
86
|
+
.split('-') // Split by hyphens
|
|
87
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1)) // Capitalize each part
|
|
88
|
+
.join(''); // Join without spaces
|
|
89
|
+
}
|
|
90
|
+
export function debounce(func, milliseconds) {
|
|
91
|
+
let timeout;
|
|
92
|
+
return () => {
|
|
93
|
+
clearTimeout(timeout);
|
|
94
|
+
timeout = setTimeout(function () {
|
|
95
|
+
func(...arguments);
|
|
96
|
+
}, milliseconds);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
121
99
|
export function htmlToElements(html) {
|
|
122
100
|
let template = document.createElement('template');
|
|
123
|
-
html = html
|
|
124
|
-
.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi, "<$1$2></$1>"); // replace XHTML closing tags by full closing tags
|
|
101
|
+
html = html.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi, '<$1$2></$1>'); // replace XHTML closing tags by full closing tags
|
|
125
102
|
template.innerHTML = html;
|
|
126
103
|
template.content.normalize();
|
|
127
104
|
return Array.from(template.content.childNodes);
|
package/public/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAMb,MAAM,UAAU,cAAc,CAAC,KAAU;IACxC,OAAO,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAc;IACxC,IAAI,MAAM,GAAgB,EAAE,EAC3B,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEnC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACpB,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa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nC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAc,EAAE,YAAoB;IAC5D,IAAI,OAAY,CAAC;IACjB,OAAO,GAAG,EAAE;QACX,YAAY,CAAC,OAAO,CAAC,CAAC;QAEtB,OAAO,GAAG,UAAU,CAAC;YACpB,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACpB,CAAC,EAAE,YAAY,CAAC,CAAC;IAClB,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,IAAI,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAElD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,aAAa,CAAC,CAAC,CAAC,kDAAkD;IAE3H,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;IAE1B,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAE7B,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAkB,CAAC;AACjE,CAAC"}
|
package/public/index.html
CHANGED
|
@@ -12,49 +12,47 @@
|
|
|
12
12
|
<div class="col-8 col-content">
|
|
13
13
|
<div class="tsd-page-title">
|
|
14
14
|
<h2>Micro Components</h2></div>
|
|
15
|
-
<div class="tsd-panel tsd-typography">
|
|
15
|
+
<div class="tsd-panel tsd-typography"><p><img src="./MicroComponents.svg" alt="logo"></p>
|
|
16
|
+
|
|
16
17
|
<a href="#micro-components" id="micro-components" style="color: inherit; text-decoration: none;">
|
|
17
18
|
<h2>MICRO COMPONENTS</h2>
|
|
18
19
|
</a>
|
|
19
|
-
<p><img src="https://gitlab.com/twoBirds/microcomponents/-/raw/main/MicroComponents.svg" alt="Micro Components Logo"></p>
|
|
20
20
|
<p><strong>This code aims at improving Javascript modularity and encapsulation</strong>.</p>
|
|
21
21
|
<p>Using micro components enforces <strong>DRY, KISS and SOLID</strong> principles in Javascript programming.</p>
|
|
22
22
|
|
|
23
|
+
<a href="#think-building-blocks" id="think-building-blocks" style="color: inherit; text-decoration: none;">
|
|
24
|
+
<h2>Think <strong>Building Blocks</strong></h2>
|
|
25
|
+
</a>
|
|
26
|
+
<p>When coding with this system, you create classes that extend either the <strong><a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/MC.md?ref_type=heads#mc-class-extends-mcbase">MC</a></strong> or <strong><a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/MC.md?ref_type=heads#dc-class-extends-mcbase">DC</a></strong> superclasses provided here. These classes provide the structure you need to build your wonderland.</p>
|
|
27
|
+
<p>In an almost literal sense they work like childrens building blocks, where a chest full of unassuming parts lets you compose whatever functionality lies in your imagination.</p>
|
|
28
|
+
<p>This systems <strong>modular</strong> approach gives you full control over your software, without the need to rely on other frameworks. On the other hand, its <strong>minimalistic</strong> stance enables you to use the resulting functionality in any other framework, and makes the <strong>learning curve neglectable</strong>.</p>
|
|
29
|
+
|
|
23
30
|
<a href="#status" id="status" style="color: inherit; text-decoration: none;">
|
|
24
31
|
<h2>Status</h2>
|
|
25
32
|
</a>
|
|
26
33
|
<p><strong>WIP</strong>. Should be done soon. In <a href="http://twobirds.gitlab.io/microcomponents/test.html">manual testing</a>, also working a lot on the documentation.</p>
|
|
27
34
|
|
|
28
|
-
<a href="#skippable-disclaimer" id="skippable-disclaimer" style="color: inherit; text-decoration: none;">
|
|
29
|
-
<h2>Skippable Disclaimer</h2>
|
|
30
|
-
</a>
|
|
31
|
-
<p>I decided to extract this functionality from the <a href="https://www.npmjs.com/package/twobirds-core">twoBirds framework</a>, because it is a useful tool in itself and it is framework agnostic. It relies solely on the standard DOM and native javascript or typescript.</p>
|
|
32
|
-
<p>Later this will be backported into twoBirds as a dependency, and twoBirds will become completely modularized on the base of MCs.</p>
|
|
33
|
-
<p>This is a massive undertaking. MCs are just the foundation of what I do. <strong>I am about to dump</strong> <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/magic.md?ref_type=heads#things-i-already-did-with-this-in-my-own-framework-twobirds-or-in-apps-that-i-developed-with-it">20+ years of javascript programming</a> <strong>into open source libraries</strong>, so feel free to <a href="https://www.gofundme.com/f/nachhaltige-programmierung">fund this</a>. The better this is funded, the faster it will be done. Given enough resources, I will start a crowdfunded company that will develop a new open source ecosystem for javascript/typescript programming. By <strong>"Open Source"</strong> I mean <strong>really free and open</strong>, as <strong>you get all my inner source code with it</strong>. Once you understand the Micro Component principle, you are back in command of your software, no matter what MC functionality you import in your system. Since <strong>Micro Components</strong> are encapsuled, off-shoring and near-shoring is no problem, and reusability is guaranteed. Your external coders do not need to access your code repository or your toolchain. They only need to understand MCs.</p>
|
|
34
|
-
|
|
35
35
|
<a href="#general" id="general" style="color: inherit; text-decoration: none;">
|
|
36
36
|
<h2>General</h2>
|
|
37
37
|
</a>
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
<p>This functionality is <strong>portable</strong>, so you can <strong>reuse your MCs</strong> - e.g. originally written in the context of an <strong>Angular</strong> project - in your next <strong>react</strong> project right away.</p>
|
|
43
|
-
<p>In its core it consists of a two classes named <strong>MC</strong> and <strong>DC</strong>. Your class code extends from one of these classes.</p>
|
|
38
|
+
<ul>
|
|
39
|
+
<li><strong>This is a low-level OOP approach to Javascript programming.</strong> It aims at proving that strict OOP is a valid alternative to other frameworks functional approaches.</li>
|
|
40
|
+
<li>You can use it in vanilla JS or Typescript coding environments.</li>
|
|
41
|
+
</ul>
|
|
44
42
|
<p>This repository exports 5 independent functionalities:</p>
|
|
45
43
|
<ol>
|
|
46
|
-
<li><strong><a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/
|
|
47
|
-
<li><strong>
|
|
48
|
-
<li
|
|
49
|
-
<li
|
|
50
|
-
<li>(
|
|
44
|
+
<li><strong><a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/MC.md?ref_type=heads">Micro Components</a></strong> contains the <strong>MC</strong> and <strong>DC</strong> classes you can use as super classes.</li>
|
|
45
|
+
<li><strong><a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/elements.md?ref_type=heads">Elements</a></strong> lets you define and use your own native web components. Uses (1).</li>
|
|
46
|
+
<li>(wip) <strong>Observables</strong> add <strong>observability</strong> and <strong>run time type safety</strong> to object properties. Also they provide <strong>1-way binding</strong> to placeholders in your template HTML.</li>
|
|
47
|
+
<li>(wip) <strong>FormValues</strong> gives you <strong>2-way binding</strong> between a HTML form and an observable object. Uses (3).</li>
|
|
48
|
+
<li>(wip) <strong>Selectors</strong> provide chainable jQuery like selectors for both the DOM and micro components.</li>
|
|
51
49
|
</ol>
|
|
52
50
|
<p>Also there is a bundle file that contains all of the above.</p>
|
|
53
51
|
<p>Check the <a href="https://twobirds.gitlab.io/microcomponents/modules.html">typedoc API reference</a> if you want to drill into the source code.</p>
|
|
54
52
|
<p>To see what can be done, go to <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/magic.md?ref_type=heads">additional concepts</a> which shows what it already has been used for.</p>
|
|
55
53
|
|
|
56
|
-
<a href="#simple-usage" id="simple-usage" style="color: inherit; text-decoration: none;">
|
|
57
|
-
<h2>Simple Usage
|
|
54
|
+
<a href="#simple-usage-example" id="simple-usage-example" style="color: inherit; text-decoration: none;">
|
|
55
|
+
<h2>Simple Usage Example</h2>
|
|
58
56
|
</a>
|
|
59
57
|
<p><strong>Micro Components</strong> can be added to to a DOM element like this:</p>
|
|
60
58
|
<p>before:</p>
|
|
@@ -66,8 +64,29 @@
|
|
|
66
64
|
<p>after:</p>
|
|
67
65
|
<pre><code class="language-HTML"><span class="hl-0"><</span><span class="hl-1">div</span><span class="hl-4"> </span><span class="hl-10">_mc</span><span class="hl-0">></</span><span class="hl-1">div</span><span class="hl-0">></span>
|
|
68
66
|
</code></pre>
|
|
69
|
-
<p>_mc indicates that this HTML element contains at least one micro component
|
|
70
|
-
<p>The _mc attribute and
|
|
67
|
+
<p>The <code>_mc</code> <strong>attribute</strong> indicates that this <strong>HTML element contains at least one micro component</strong>. This is needed for the selectors.</p>
|
|
68
|
+
<p>The <code>_mc</code> <strong>attribute</strong> and <strong>property</strong> are the only interference with the DOM, so any other system should be happy to work with this.</p>
|
|
69
|
+
|
|
70
|
+
<a href="#disclaimer" id="disclaimer" style="color: inherit; text-decoration: none;">
|
|
71
|
+
<h2>Disclaimer</h2>
|
|
72
|
+
</a>
|
|
73
|
+
<p>I decided to extract this functionality from the <a href="https://www.npmjs.com/package/twobirds-core">twoBirds framework</a>, because it is a useful tool in itself and it is framework agnostic. It relies solely on the standard DOM and native javascript or typescript.</p>
|
|
74
|
+
<p>Later this will be backported into twoBirds as a dependency, and twoBirds will become completely modularized on the base of MCs.</p>
|
|
75
|
+
<p><strong>This is a massive undertaking.</strong> MCs are just the foundation of what I do. I am about to dump <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/main/assets/documentation/magic.md?ref_type=heads#things-i-already-did-with-this-in-my-own-framework-twobirds-or-in-apps-that-i-developed-with-it">20+ years of javascript programming</a> into open source libraries, so feel free to <a href="https://www.gofundme.com/f/nachhaltige-programmierung">fund this</a>. The better this is funded, the faster it will be done. Given enough resources, I will start a crowdfunded company that will develop a new open source ecosystem for javascript/typescript programming. By <strong>"Open Source"</strong> I mean <strong>really free and open</strong>, as <strong>you get all my inner source code with it</strong>. Once you understand the Micro Component principle, you are back in command of your software, no matter what MC functionality you import in your system.</p>
|
|
76
|
+
<p>Since <strong>Micro Components</strong> are encapsuled, off-shoring and near-shoring is no problem, and reusability is guaranteed. Your external coders do not need to access your code repository or your toolchain. They only need to understand MCs.</p>
|
|
77
|
+
|
|
78
|
+
<a href="#distinct-differences-to-other-frameworks" id="distinct-differences-to-other-frameworks" style="color: inherit; text-decoration: none;">
|
|
79
|
+
<h2>Distinct differences to other frameworks</h2>
|
|
80
|
+
</a>
|
|
81
|
+
<p>There are a few potentially unique aspects of this micro components system that might differentiate it from other frameworks:</p>
|
|
82
|
+
<ul>
|
|
83
|
+
<li><strong>Pure OOP Approach</strong>: The system explicitly positions itself as a strict object-oriented alternative to the functional approaches that dominate many modern frameworks.</li>
|
|
84
|
+
<li><strong>Minimal Interference</strong>: The system has minimal DOM interference (only adding _mc attribute and property). This makes it unusually compatible with other frameworks or libraries.</li>
|
|
85
|
+
<li><strong>Hierarchical Component Traversal</strong>: The built-in parent/child/ancestor/descendant traversal methods provide a clean way to navigate component relationships.</li>
|
|
86
|
+
<li><strong>Direct DOM Integration</strong>: Unlike virtual DOM-based frameworks, this approach works directly with the actual DOM while still providing component encapsulation.</li>
|
|
87
|
+
<li><strong>Outsourcing Potential</strong>: Your external coders do not need to access your code repository or your toolchain.</li>
|
|
88
|
+
</ul>
|
|
89
|
+
<p>The strongest argument might be for developers who prefer OOP, want minimal framework lock-in, and need a lightweight solution that works well with existing code or other libraries.</p>
|
|
71
90
|
|
|
72
91
|
<a href="#contact" id="contact" style="color: inherit; text-decoration: none;">
|
|
73
92
|
<h2>Contact</h2>
|
|
@@ -96,16 +115,12 @@
|
|
|
96
115
|
<div class="tsd-accordion-details">
|
|
97
116
|
<ul>
|
|
98
117
|
<li class="current selected"><a href="modules.html">Micro <wbr/>Components</a>
|
|
99
|
-
<ul></ul></li></ul></div></details></nav>
|
|
100
|
-
<nav class="tsd-navigation secondary menu-sticky">
|
|
101
118
|
<ul>
|
|
102
|
-
<li class="tsd-kind-
|
|
103
|
-
<li class="tsd-kind-
|
|
104
|
-
<li class="tsd-kind-
|
|
105
|
-
<li class="tsd-kind-
|
|
106
|
-
<li class="tsd-kind-
|
|
107
|
-
<li class="tsd-kind-function"><a href="functions/addListener.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-64-path"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)" id="icon-64-text"></path></svg>add<wbr/>Listener</a></li>
|
|
108
|
-
<li class="tsd-kind-function"><a href="functions/removeListener.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>remove<wbr/>Listener</a></li></ul></nav></div></div>
|
|
119
|
+
<li class="tsd-kind-module"><a href="modules/MC.html">MC</a></li>
|
|
120
|
+
<li class="tsd-kind-module"><a href="modules/elements.html">elements</a></li>
|
|
121
|
+
<li class="tsd-kind-module"><a href="modules/formValues.html">form<wbr/>Values</a></li>
|
|
122
|
+
<li class="tsd-kind-module"><a href="modules/observables.html">observables</a></li>
|
|
123
|
+
<li class="tsd-kind-module"><a href="modules/selectors.html">selectors</a></li></ul></li></ul></div></details></nav></div></div>
|
|
109
124
|
<div class="container tsd-generator">
|
|
110
125
|
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
111
126
|
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
|