@twobirds/microcomponents 0.0.88 → 0.0.89
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 +21 -16
- package/assets/test/grandparent.css +3 -0
- package/package.json +1 -1
- package/public/src/test/grandparent.css +3 -0
- package/public/src/test/test.js +1 -1
- package/public/src/test/test.js.map +1 -1
- package/public/src/test/test.ts +1 -1
- package/public/test/grandparent.css +3 -0
- package/public/test/test.js +1 -1
- package/public/test/test.js.map +1 -1
- package/public/test/test.ts +1 -1
- package/public/typedoc/classes/MC.DC.html +2 -2
- 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 +13 -13
- 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/test/grandparent.css +3 -0
- package/src/test/test.ts +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Micro Components</title><meta name="description" content="Documentation for Micro Components"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">Micro Components</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h1>Micro Components</h1></div><div class="tsd-panel tsd-typography"><p><img src="media/MicroComponents.svg" alt="logo"></p>
|
|
2
|
-
<a id="md:micro-components" class="tsd-anchor"></a><h2 class="tsd-anchor-link">MICRO COMPONENTS<a href="#md:micro-components" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p><strong>
|
|
3
|
-
<p>Micro Components are built on <strong>OOP</strong> for structure, so you should embrace <strong>DRY, KISS and SOLID</strong> principles. MCs provide a structure for your code. It is agnostic as to what code you put in this structure.</p>
|
|
4
|
-
<p>MCs provide a runtime app structure that is directly linked to the browser DOM. That is you dont need web components, you can attach them to plain HTMLElements. Having said this: the library also allows for standard web component programming.</p>
|
|
2
|
+
<a id="md:micro-components" class="tsd-anchor"></a><h2 class="tsd-anchor-link">MICRO COMPONENTS<a href="#md:micro-components" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p><strong>MCs are function blocks that you attach to DOM nodes.</strong> These are re-usable in any framework, and you can have any number of MCs in one DOM node.</p>
|
|
5
3
|
<p>There are helpers for the following functionalities:</p>
|
|
6
4
|
<ul>
|
|
5
|
+
<li><strong>Web Components:</strong> create native web components. Their functionality is comprised of a set of inner MCs.</li>
|
|
7
6
|
<li><strong>State</strong> is done by observable objects that you can attach callbacks to. This also allows for 1-way binding to DOM placeholders, and it can be extended to allow for complex data driven state machines.</li>
|
|
8
7
|
<li><strong>Form Handling</strong> allows for 2-way binding from an observable form object to DOM form input elements.</li>
|
|
9
8
|
<li><strong>Communication</strong> between DOM micro components is ensured via direct selected or directional bubbling CustomEvent's.</li>
|
|
10
9
|
<li><strong>Autoloading</strong> allows for build-free websites that dynamically load JS requirements into DOM HTMLElements.</li>
|
|
11
10
|
</ul>
|
|
12
|
-
<p>
|
|
11
|
+
<a id="md:goal" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Goal<a href="#md:goal" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>This code aims at improving Javascript modularity and encapsulation. Micro Components are built on <strong>OOP</strong> for structure, so you should embrace <strong>DRY, KISS and SOLID</strong> principles.</p>
|
|
12
|
+
<p>MCs provide a runtime app structure that is directly linked to the browser DOM. That is you don't need web components, you can attach MCs to plain HTMLElements. Having said this: the library also allows for standard web component programming, acting as a framework.</p>
|
|
13
|
+
<p>In general this is a <strong>HTML / Web Standards first</strong> system. There is almost no abstraction, especially not for templating, except state binding to the DOM via simple placeholders.</p>
|
|
13
14
|
<p>It has no interference with other frameworks, since it creates a second layer that hovers above the DOM. So what you intended to work as an add-on to React, is usable e.g. in Angular also.</p>
|
|
14
15
|
<p>And, of course, you can use it as your main framework using its custom web component functionality.</p>
|
|
15
16
|
<p>Its basic principle is <strong>composition over inheritance</strong>. So: using when using it for app coding it is recommended you do not extend your own classes, as it is not needed and induces problems.</p>
|
|
16
|
-
<p>Also it helps to embrace <strong>DIY</strong> (
|
|
17
|
-
<p>You can use <strong>Vanilla JS or Typescript</strong> or both in your project. For example you could use plain JS for rapid prototyping functionalities, then convert to TS for production.</p>
|
|
18
|
-
<
|
|
19
|
-
<p>
|
|
20
|
-
<p>You <strong>attach instances of your classes to any HTMLElement</strong>, and
|
|
21
|
-
<p>Also you can easily <strong>define JS custom elements</strong>. Since these are just another instance of a DC internally, you can enhance them even at runtime, as they are displayed in the browser.</p>
|
|
17
|
+
<p>Also it helps to embrace <strong>DIY</strong> (<strong>D</strong>o <strong>I</strong>t <strong>Y</strong>ourself) <strong>over Toolchains</strong>, but this is up to your personal preference.</p>
|
|
18
|
+
<p>You can use <strong>Vanilla JS or Typescript</strong> or both in parallel in your project. For example you could use plain JS for rapid prototyping functionalities, then convert to TS for production.</p>
|
|
19
|
+
<p>Most of all this system by design <strong>allows for outsourcing without sharing the main development system</strong>. It is absolutely granular as it enforces <strong>DRY</strong> (<strong>D</strong>on't <strong>R</strong>epeat <strong>Y</strong>ourself).</p>
|
|
20
|
+
<p>Finally it allows for a clear distinction between <code>Junior</code>, <code>Senior</code> and <code>Architect</code> roles in a project. No more hiring junior programmers with 5 years experience in 50 tools under their belt. A junior in this system is somebody who likes HTML, CSS and JS/TS - nothing more. Teaching all of this system starting at zero takes 1 day. The rest is finger muscle memory and learning/knowing web standards.</p>
|
|
21
|
+
<a id="md:think-building-blocks" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Think <strong>Building Blocks</strong><a href="#md:think-building-blocks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>You <strong>attach instances of your classes to any HTMLElement</strong>, and you can <strong>attach as many as you want to a single HTMLElement</strong>. 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>
|
|
22
22
|
<a id="md:principles" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Principles<a href="#md:principles" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>This systems <strong>modular</strong> approach gives you full control over your software, without the need to rely on other frameworks.</p>
|
|
23
23
|
<p>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>
|
|
24
24
|
<a id="md:status" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Status<a href="#md:status" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>In <a href="https://twobirds.gitlab.io/microcomponents/test/test.html" target="_blank" class="external">manual testing</a> ( also a speed test). I am working on the documentation.</p>
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
<p>The <code>data-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>
|
|
70
70
|
<p>The <code>_mc</code> <strong>property</strong> is the only interference with the DOM, so any other system should be happy to work with this.</p>
|
|
71
|
-
<a id="md:distinct-differences-to-other-frameworks" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Distinct differences to other frameworks<a href="#md:distinct-differences-to-other-frameworks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>There are a few potentially unique aspects of this micro components system that might differentiate it from other
|
|
71
|
+
<a id="md:distinct-differences-to-other-frameworks" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Distinct differences to other frameworks<a href="#md:distinct-differences-to-other-frameworks" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h2><p>There are a few potentially unique aspects of this micro components system that might differentiate it from other framework or library:</p>
|
|
72
72
|
<ul>
|
|
73
73
|
<li>
|
|
74
74
|
<p><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.</p>
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
<p><strong>Minimal Interference</strong>: The system has minimal DOM interference, only adding _mc property to DOM nodes that contain code. This makes it unusually compatible with other frameworks or libraries.</p>
|
|
78
78
|
</li>
|
|
79
79
|
<li>
|
|
80
|
-
<p><strong>Hierarchical Component Traversal</strong>: The built-in
|
|
80
|
+
<p><strong>Hierarchical Component Traversal</strong>: The built-in ancestor/closest/child/descendant traversal methods provide a clean way to navigate component relationships.</p>
|
|
81
81
|
</li>
|
|
82
82
|
<li>
|
|
83
83
|
<p><strong>Direct DOM Integration</strong>: Unlike virtual DOM-based frameworks, this approach works directly with the actual DOM while still providing component encapsulation.</p>
|
|
@@ -94,4 +94,4 @@
|
|
|
94
94
|
<p>Later this will be backported into twoBirds as a dependency, and twoBirds will become completely modularized on the base of MCs.</p>
|
|
95
95
|
<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" target="_blank" class="external">20+ years of javascript programming</a> into open source libraries, so feel free to <a href="https://www.gofundme.com/f/nachhaltige-programmierung" target="_blank" class="external">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>
|
|
96
96
|
<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>
|
|
97
|
-
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:micro-components"><span>MICRO COMPONENTS</span></a><a href="#md:think-building-blocks"><span>Think <wbr/>Building <wbr/>Blocks</span></a><a href="#md:principles"><span>Principles</span></a><a href="#md:status"><span>Status</span></a><a href="#md:general"><span>General</span></a><a href="#md:simple-usage-example"><span>Simple <wbr/>Usage <wbr/>Example</span></a><a href="#md:distinct-differences-to-other-frameworks"><span>Distinct differences to other frameworks</span></a><a href="#md:contact"><span>Contact</span></a><a href="#md:disclaimer"><span>Disclaimer</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>Micro Components</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
97
|
+
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:micro-components"><span>MICRO COMPONENTS</span></a><a href="#md:goal"><span>Goal</span></a><a href="#md:think-building-blocks"><span>Think <wbr/>Building <wbr/>Blocks</span></a><a href="#md:principles"><span>Principles</span></a><a href="#md:status"><span>Status</span></a><a href="#md:general"><span>General</span></a><a href="#md:simple-usage-example"><span>Simple <wbr/>Usage <wbr/>Example</span></a><a href="#md:distinct-differences-to-other-frameworks"><span>Distinct differences to other frameworks</span></a><a href="#md:contact"><span>Contact</span></a><a href="#md:disclaimer"><span>Disclaimer</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>Micro Components</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|