@twobirds/microcomponents 0.0.21 → 0.0.22
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/.gitlab-ci.yml +1 -0
- package/README.md +31 -12
- package/assets/documentation/MicroComponents.md +228 -0
- package/assets/my-tag.css +4 -0
- package/assets/test.html +5 -1
- package/dist/MC.d.ts +32 -0
- package/dist/MC.d.ts.map +1 -0
- package/dist/MC.min.js +414 -0
- package/dist/MC.ts +350 -0
- package/dist/MCbundle.d.ts +8 -0
- package/dist/MCbundle.d.ts.map +1 -0
- package/dist/MCbundle.min.js +1 -0
- package/dist/MCbundle.ts +8 -0
- package/dist/McEvent.d.ts +15 -0
- package/dist/McEvent.d.ts.map +1 -0
- package/dist/McEvent.ts +96 -0
- package/dist/autoloader.d.ts +2 -0
- package/dist/autoloader.d.ts.map +1 -0
- package/dist/autoloader.ts +98 -0
- package/dist/customElements.d.ts +5 -0
- package/dist/customElements.d.ts.map +1 -0
- package/dist/customElements.min.js +1 -0
- package/dist/customElements.ts +67 -0
- package/dist/customObservables.d.ts +3 -0
- package/dist/customObservables.d.ts.map +1 -0
- package/dist/customObservables.min.js +1 -0
- package/dist/customObservables.ts +340 -0
- package/dist/customSelectors.d.ts +108 -0
- package/dist/customSelectors.d.ts.map +1 -0
- package/dist/customSelectors.min.js +1 -0
- package/dist/customSelectors.ts +1634 -0
- package/dist/formValues.d.ts +4 -0
- package/dist/formValues.d.ts.map +1 -0
- package/dist/formValues.ts +275 -0
- package/dist/formvValues.min.js +1 -0
- package/dist/helpers.d.ts +11 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.ts +173 -0
- package/dist/microcomponents.es3.d.ts +1 -20
- package/dist/microcomponents.es3.d.ts.map +1 -1
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/package.json +11 -7
- package/public/MC.js +273 -0
- package/public/MC.min.js +414 -0
- package/public/MCbundle.js +8 -0
- package/public/MCbundle.min.js +1 -0
- package/public/McEvent.js +74 -0
- package/public/MicroComponents.svg +15 -0
- package/public/assets/search.js +1 -1
- package/public/autoloader.js +57 -0
- package/public/classes/MC.DC.html +247 -0
- package/public/classes/MC.MC.html +150 -0
- package/public/classes/MC.McBase.html +123 -0
- package/public/classes/MCbundle.McEvent.html +184 -0
- package/public/customElements.js +48 -0
- package/public/customElements.min.js +1 -0
- package/public/customObservables.js +255 -0
- package/public/customObservables.min.js +1 -0
- package/public/customSelectors.js +1088 -0
- package/public/customSelectors.min.js +1 -0
- package/public/documentation/MicroComponents.md +228 -0
- package/public/formValues.js +211 -0
- package/public/formvValues.min.js +1 -0
- package/public/functions/MC.addListener.html +73 -0
- package/public/functions/MC.removeListener.html +69 -0
- package/public/functions/MCbundle._d.html +85 -0
- package/public/functions/MCbundle._t.html +85 -0
- package/public/functions/MCbundle.debounce.html +85 -0
- package/public/functions/MCbundle.deepEqual.html +85 -0
- package/public/functions/MCbundle.defineCE.html +98 -0
- package/public/functions/MCbundle.formValues.html +89 -0
- package/public/functions/MCbundle.getCE.html +83 -0
- package/public/functions/MCbundle.htmlToElements.html +83 -0
- package/public/functions/MCbundle.isObject.html +83 -0
- package/public/functions/MCbundle.kebabToPascal.html +83 -0
- package/public/functions/MCbundle.makeCO.html +85 -0
- package/public/functions/MCbundle.nameSpace.html +89 -0
- package/public/functions/MCbundle.parse.html +85 -0
- package/public/helpers.js +128 -0
- package/public/index.html +22 -13
- package/public/interfaces/MC.HTMLMcElement.html +3605 -0
- package/public/interfaces/MCbundle.DSelector.html +1010 -0
- package/public/interfaces/MCbundle.LooseObject.html +80 -0
- package/public/interfaces/MCbundle.TSelector.html +709 -0
- package/public/microcomponents.es3.js +348 -0
- package/public/modules/MC.html +84 -0
- package/public/modules/MCbundle.html +133 -0
- package/public/modules.html +4 -4
- package/public/my-tag.css +4 -0
- package/public/test.html +5 -1
- package/public/test.js +100 -202
- package/public/types/MCbundle.selection.html +74 -0
- package/public/types/MCbundle.singleSelector.html +74 -0
- package/src/MC.ts +350 -0
- package/src/MCbundle.ts +8 -0
- package/src/McEvent.ts +96 -0
- package/src/autoloader.ts +98 -0
- package/src/customElements.ts +67 -0
- package/src/customObservables.ts +340 -0
- package/src/customSelectors.ts +1634 -0
- package/src/formValues.ts +275 -0
- package/src/helpers.ts +173 -0
- package/src/microcomponents.es3.js +353 -82
- package/src/test.js +137 -218
- package/tsconfig.json +2 -2
- package/typedoc.json +1 -1
- package/webpack.config.js +233 -0
- package/dist/microcomponents.d.ts +0 -26
- package/dist/microcomponents.d.ts.map +0 -1
- package/dist/microcomponents.es3.js +0 -96
- package/dist/microcomponents.es3.min.js +0 -15
- package/dist/microcomponents.js +0 -176
- package/dist/microcomponents.min.js +0 -38
- package/dist/microcomponents.ts +0 -216
- package/public/classes/microcomponents.MC.html +0 -313
- package/public/classes/microcomponents_es3.MC.html +0 -336
- package/public/functions/microcomponents_es3.__isEmpty.html +0 -60
- package/public/microcomponents.js +0 -176
- package/public/modules/microcomponents.html +0 -57
- package/public/modules/microcomponents_es3.html +0 -60
- package/src/microcomponents.ts +0 -216
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>MCbundle | 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 async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base="..">
|
|
4
|
+
<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"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<div id="tsd-toolbar-links"></div></div>
|
|
7
|
+
<ul class="results">
|
|
8
|
+
<li class="state loading">Preparing search index...</li>
|
|
9
|
+
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Micro Components</a></div>
|
|
10
|
+
<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"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
11
|
+
<div class="container container-main">
|
|
12
|
+
<div class="col-8 col-content">
|
|
13
|
+
<div class="tsd-page-title">
|
|
14
|
+
<ul class="tsd-breadcrumb">
|
|
15
|
+
<li><a href="../modules.html">Micro Components</a></li>
|
|
16
|
+
<li><a href="MCbundle.html">MCbundle</a></li></ul>
|
|
17
|
+
<h1>Module MCbundle</h1></div><aside class="tsd-sources">
|
|
18
|
+
<ul>
|
|
19
|
+
<li>Defined in <a href="https://gitlab.com/twoBirds/microcomponents/-/blob/3ccde69/src/MCbundle.ts#L1">src/MCbundle.ts:1</a></li></ul></aside>
|
|
20
|
+
<section class="tsd-panel-group">
|
|
21
|
+
<section class="tsd-panel tsd-typography"></section></section>
|
|
22
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
23
|
+
<section class="tsd-panel tsd-index-panel">
|
|
24
|
+
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
25
|
+
<h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex=0><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-text)"></path></svg> Index</h5></summary>
|
|
26
|
+
<div class="tsd-accordion-details">
|
|
27
|
+
<section class="tsd-index-section">
|
|
28
|
+
<h3 class="tsd-index-heading">References</h3>
|
|
29
|
+
<div class="tsd-index-list"><a href="MCbundle.html#DC" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF4D82" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-8388608-path"></rect><path d="M10.354 17V8.24H13.066C13.586 8.24 14.042 8.348 14.434 8.564C14.826 8.772 15.13 9.064 15.346 9.44C15.562 9.816 15.67 10.256 15.67 10.76C15.67 11.352 15.514 11.86 15.202 12.284C14.898 12.708 14.482 13 13.954 13.16L15.79 17H14.518L12.838 13.28H11.434V17H10.354ZM11.434 12.308H13.066C13.514 12.308 13.874 12.168 14.146 11.888C14.418 11.6 14.554 11.224 14.554 10.76C14.554 10.288 14.418 9.912 14.146 9.632C13.874 9.352 13.514 9.212 13.066 9.212H11.434V12.308Z" fill="var(--color-text)" id="icon-8388608-text"></path></svg><span>DC</span></a>
|
|
30
|
+
<a href="MCbundle.html#HTMLMcElement" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg><span>HTMLMc<wbr/>Element</span></a>
|
|
31
|
+
<a href="MCbundle.html#MC" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg><span>MC</span></a>
|
|
32
|
+
<a href="MCbundle.html#McBase" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg><span>Mc<wbr/>Base</span></a>
|
|
33
|
+
<a href="MCbundle.html#addListener" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg><span>add<wbr/>Listener</span></a>
|
|
34
|
+
<a href="MCbundle.html#removeListener" class="tsd-index-link tsd-kind-reference tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg><span>remove<wbr/>Listener</span></a>
|
|
35
|
+
</div></section>
|
|
36
|
+
<section class="tsd-index-section">
|
|
37
|
+
<h3 class="tsd-index-heading">Classes</h3>
|
|
38
|
+
<div class="tsd-index-list"><a href="../classes/MCbundle.McEvent.html" class="tsd-index-link tsd-kind-class tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg><span>Mc<wbr/>Event</span></a>
|
|
39
|
+
</div></section>
|
|
40
|
+
<section class="tsd-index-section">
|
|
41
|
+
<h3 class="tsd-index-heading">Interfaces</h3>
|
|
42
|
+
<div class="tsd-index-list"><a href="../interfaces/MCbundle.DSelector.html" class="tsd-index-link tsd-kind-interface tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-256-path"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)" id="icon-256-text"></path></svg><span>DSelector</span></a>
|
|
43
|
+
<a href="../interfaces/MCbundle.LooseObject.html" class="tsd-index-link tsd-kind-interface tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Loose<wbr/>Object</span></a>
|
|
44
|
+
<a href="../interfaces/MCbundle.TSelector.html" class="tsd-index-link tsd-kind-interface tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>TSelector</span></a>
|
|
45
|
+
</div></section>
|
|
46
|
+
<section class="tsd-index-section">
|
|
47
|
+
<h3 class="tsd-index-heading">Type Aliases</h3>
|
|
48
|
+
<div class="tsd-index-list"><a href="../types/MCbundle.selection.html" class="tsd-index-link tsd-kind-type-alias tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg><span>selection</span></a>
|
|
49
|
+
<a href="../types/MCbundle.singleSelector.html" class="tsd-index-link tsd-kind-type-alias tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg><span>single<wbr/>Selector</span></a>
|
|
50
|
+
</div></section>
|
|
51
|
+
<section class="tsd-index-section">
|
|
52
|
+
<h3 class="tsd-index-heading">Functions</h3>
|
|
53
|
+
<div class="tsd-index-list"><a href="../functions/MCbundle._d.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>$d</span></a>
|
|
54
|
+
<a href="../functions/MCbundle._t.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>$t</span></a>
|
|
55
|
+
<a href="../functions/MCbundle.debounce.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>debounce</span></a>
|
|
56
|
+
<a href="../functions/MCbundle.deepEqual.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>deep<wbr/>Equal</span></a>
|
|
57
|
+
<a href="../functions/MCbundle.defineCE.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>defineCE</span></a>
|
|
58
|
+
<a href="../functions/MCbundle.formValues.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>form<wbr/>Values</span></a>
|
|
59
|
+
<a href="../functions/MCbundle.getCE.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>getCE</span></a>
|
|
60
|
+
<a href="../functions/MCbundle.htmlToElements.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>html<wbr/>To<wbr/>Elements</span></a>
|
|
61
|
+
<a href="../functions/MCbundle.isObject.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>is<wbr/>Object</span></a>
|
|
62
|
+
<a href="../functions/MCbundle.kebabToPascal.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>kebab<wbr/>To<wbr/>Pascal</span></a>
|
|
63
|
+
<a href="../functions/MCbundle.makeCO.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>makeCO</span></a>
|
|
64
|
+
<a href="../functions/MCbundle.nameSpace.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>name<wbr/>Space</span></a>
|
|
65
|
+
<a href="../functions/MCbundle.parse.html" class="tsd-index-link tsd-kind-function tsd-parent-kind-module"><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><span>parse</span></a>
|
|
66
|
+
</div></section></div></details></section></section>
|
|
67
|
+
<section class="tsd-panel-group tsd-member-group">
|
|
68
|
+
<h2>References</h2>
|
|
69
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="DC" class="tsd-anchor"></a>
|
|
70
|
+
<h3 class="tsd-anchor-link"><span>DC</span><a href="#DC" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>Re-exports <a href="../classes/MC.DC.html">DC</a></section>
|
|
71
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="HTMLMcElement" class="tsd-anchor"></a>
|
|
72
|
+
<h3 class="tsd-anchor-link"><span>HTMLMc<wbr/>Element</span><a href="#HTMLMcElement" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>Re-exports <a href="../interfaces/MC.HTMLMcElement.html">HTMLMcElement</a></section>
|
|
73
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="MC" class="tsd-anchor"></a>
|
|
74
|
+
<h3 class="tsd-anchor-link"><span>MC</span><a href="#MC" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>Re-exports <a href="../classes/MC.MC.html">MC</a></section>
|
|
75
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="McBase" class="tsd-anchor"></a>
|
|
76
|
+
<h3 class="tsd-anchor-link"><span>Mc<wbr/>Base</span><a href="#McBase" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>Re-exports <a href="../classes/MC.McBase.html">McBase</a></section>
|
|
77
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="addListener" class="tsd-anchor"></a>
|
|
78
|
+
<h3 class="tsd-anchor-link"><span>add<wbr/>Listener</span><a href="#addListener" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>Re-exports <a href="../functions/MC.addListener.html">addListener</a></section>
|
|
79
|
+
<section class="tsd-panel tsd-member tsd-kind-reference tsd-parent-kind-module"><a id="removeListener" class="tsd-anchor"></a>
|
|
80
|
+
<h3 class="tsd-anchor-link"><span>remove<wbr/>Listener</span><a href="#removeListener" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>Re-exports <a href="../functions/MC.removeListener.html">removeListener</a></section></section></div>
|
|
81
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
82
|
+
<div class="tsd-navigation settings">
|
|
83
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
84
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
85
|
+
<div class="tsd-accordion-details">
|
|
86
|
+
<div class="tsd-filter-visibility">
|
|
87
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
88
|
+
<ul id="tsd-filter-options">
|
|
89
|
+
<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>
|
|
90
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><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>Private</span></label></li>
|
|
91
|
+
<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>
|
|
92
|
+
<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></form></div>
|
|
93
|
+
<div class="tsd-theme-toggle">
|
|
94
|
+
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
95
|
+
<nav class="tsd-navigation primary">
|
|
96
|
+
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
97
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
98
|
+
<div class="tsd-accordion-details">
|
|
99
|
+
<ul>
|
|
100
|
+
<li class="current"><a href="../modules.html">Micro <wbr/>Components</a>
|
|
101
|
+
<ul>
|
|
102
|
+
<li class="tsd-kind-module"><a href="MC.html">MC</a></li>
|
|
103
|
+
<li class="current selected tsd-kind-module"><a href="MCbundle.html">MCbundle</a></li></ul></li></ul></div></details></nav>
|
|
104
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
105
|
+
<ul>
|
|
106
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#DC" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>DC</a></li>
|
|
107
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#HTMLMcElement" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>HTMLMc<wbr/>Element</a></li>
|
|
108
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#MC" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>MC</a></li>
|
|
109
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#McBase" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>Mc<wbr/>Base</a></li>
|
|
110
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#addListener" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>add<wbr/>Listener</a></li>
|
|
111
|
+
<li class="tsd-kind-reference tsd-parent-kind-module"><a href="MCbundle.html#removeListener" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-8388608-path"></use><use href="#icon-8388608-text"></use></svg>remove<wbr/>Listener</a></li>
|
|
112
|
+
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/MCbundle.McEvent.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Mc<wbr/>Event</a></li>
|
|
113
|
+
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/MCbundle.DSelector.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>DSelector</a></li>
|
|
114
|
+
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/MCbundle.LooseObject.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>Loose<wbr/>Object</a></li>
|
|
115
|
+
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/MCbundle.TSelector.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg>TSelector</a></li>
|
|
116
|
+
<li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="../types/MCbundle.selection.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>selection</a></li>
|
|
117
|
+
<li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="../types/MCbundle.singleSelector.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>single<wbr/>Selector</a></li>
|
|
118
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle._d.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>$d</a></li>
|
|
119
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle._t.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>$t</a></li>
|
|
120
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.debounce.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>debounce</a></li>
|
|
121
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.deepEqual.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>deep<wbr/>Equal</a></li>
|
|
122
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.defineCE.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>defineCE</a></li>
|
|
123
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.formValues.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>form<wbr/>Values</a></li>
|
|
124
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.getCE.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>getCE</a></li>
|
|
125
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.htmlToElements.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>html<wbr/>To<wbr/>Elements</a></li>
|
|
126
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.isObject.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>is<wbr/>Object</a></li>
|
|
127
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.kebabToPascal.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>kebab<wbr/>To<wbr/>Pascal</a></li>
|
|
128
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.makeCO.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>makeCO</a></li>
|
|
129
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.nameSpace.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>name<wbr/>Space</a></li>
|
|
130
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="../functions/MCbundle.parse.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>parse</a></li></ul></nav></div></div>
|
|
131
|
+
<div class="container tsd-generator">
|
|
132
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
133
|
+
<div class="overlay"></div><script src="../assets/main.js"></script></body></html>
|
package/public/modules.html
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
<h3 class="tsd-index-heading uppercase">Index</h3>
|
|
18
18
|
<section class="tsd-index-section">
|
|
19
19
|
<h3 class="tsd-index-heading">Modules</h3>
|
|
20
|
-
<div class="tsd-index-list"><a href="modules/
|
|
21
|
-
<a href="modules/
|
|
20
|
+
<div class="tsd-index-list"><a href="modules/MC.html" class="tsd-index-link tsd-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4-path"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)" id="icon-4-text"></path></svg><span>MC</span></a>
|
|
21
|
+
<a href="modules/MCbundle.html" class="tsd-index-link tsd-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4-path"></use><use href="#icon-4-text"></use></svg><span>MCbundle</span></a>
|
|
22
22
|
</div></section></section></section></div>
|
|
23
23
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
24
24
|
<div class="tsd-navigation settings">
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
<ul>
|
|
42
42
|
<li class="current selected"><a href="modules.html">Micro <wbr/>Components</a>
|
|
43
43
|
<ul>
|
|
44
|
-
<li class="tsd-kind-module"><a href="modules/
|
|
45
|
-
<li class="tsd-kind-module"><a href="modules/
|
|
44
|
+
<li class="tsd-kind-module"><a href="modules/MC.html">MC</a></li>
|
|
45
|
+
<li class="tsd-kind-module"><a href="modules/MCbundle.html">MCbundle</a></li></ul></li></ul></div></details></nav></div></div>
|
|
46
46
|
<div class="container tsd-generator">
|
|
47
47
|
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
48
48
|
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
package/public/test.html
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Micro Components Manual Test</title>
|
|
7
|
+
<link rel="icon" type="image/svg+xml" sizes="any" href="MicroComponents.svg" />
|
|
8
|
+
<link href="./my-tag.css" rel="stylesheet" />
|
|
9
|
+
<script type="module" src="./test.js"></script>
|
|
10
|
+
<script src="./customSelectors.min.js"></script>
|
|
7
11
|
</head>
|
|
8
12
|
<body>
|
|
9
|
-
|
|
13
|
+
Open the debugger, read console, then:
|
|
10
14
|
</body>
|
|
11
15
|
</html>
|
package/public/test.js
CHANGED
|
@@ -1,216 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
else if (search && _mc && _mc[search]) {
|
|
12
|
-
mcValues.push(_mc[search]);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return mcValues;
|
|
18
|
-
}
|
|
19
|
-
function traverseNodes(node, search, firstonly = true) {
|
|
20
|
-
let mcValues = [];
|
|
21
|
-
while (node) {
|
|
22
|
-
if (node._mc) {
|
|
23
|
-
if (!search) {
|
|
24
|
-
mcValues = mcValues.concat(Object.values(node._mc));
|
|
25
|
-
}
|
|
26
|
-
else if (search && node._mc[search]) {
|
|
27
|
-
mcValues.push(node._mc[search]);
|
|
28
|
-
}
|
|
29
|
-
if (firstonly)
|
|
30
|
-
return mcValues;
|
|
31
|
-
}
|
|
32
|
-
node = node.parentNode;
|
|
2
|
+
import { MC, DC } from "./MC.js";
|
|
3
|
+
import { defineCE, getCE } from "./customElements.js";
|
|
4
|
+
import { makeCO } from "./customObservables.js";
|
|
5
|
+
//MC.debug = true;
|
|
6
|
+
class Adder {
|
|
7
|
+
constructor() { }
|
|
8
|
+
sum(...numbers) {
|
|
9
|
+
return numbers.reduce((acc, curr) => acc + curr, 0);
|
|
33
10
|
}
|
|
34
|
-
return mcValues;
|
|
35
|
-
}
|
|
36
|
-
function isDOM(element) {
|
|
37
|
-
return element && element instanceof HTMLElement;
|
|
38
11
|
}
|
|
39
|
-
class MC {
|
|
40
|
-
#target = {};
|
|
41
|
-
#_mc = {};
|
|
42
|
-
static debug = false;
|
|
12
|
+
class EvTarget extends MC {
|
|
43
13
|
constructor(target) {
|
|
44
|
-
|
|
45
|
-
this.#_mc = {};
|
|
46
|
-
}
|
|
47
|
-
get _mc() {
|
|
48
|
-
if (!MC.debug)
|
|
49
|
-
return undefined;
|
|
50
|
-
return this.#_mc;
|
|
51
|
-
}
|
|
52
|
-
get target() {
|
|
53
|
-
return this.#target;
|
|
54
|
-
}
|
|
55
|
-
static siblings(target, search = "") {
|
|
56
|
-
const mc = target;
|
|
57
|
-
if (!mc._mc) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
const _mc = mc._mc;
|
|
61
|
-
if (search.length) {
|
|
62
|
-
return _mc?.[search] || [];
|
|
63
|
-
}
|
|
64
|
-
return [...Object.values(_mc)];
|
|
65
|
-
}
|
|
66
|
-
static add(target, key, element = {}) {
|
|
67
|
-
let node = target;
|
|
68
|
-
if (!node._mc) {
|
|
69
|
-
node._mc = new MC(target);
|
|
70
|
-
}
|
|
71
|
-
const _mc = node._mc;
|
|
72
|
-
if (key.length && !_mc[key]) {
|
|
73
|
-
_mc[key] = element;
|
|
74
|
-
if (target instanceof HTMLElement) {
|
|
75
|
-
target.setAttribute("_mc", "");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return element;
|
|
79
|
-
}
|
|
80
|
-
static remove(target, key) {
|
|
81
|
-
if (!key)
|
|
82
|
-
return;
|
|
83
|
-
const _mc = target?._mc || {};
|
|
84
|
-
if (_mc && _mc[key]) {
|
|
85
|
-
delete _mc[key];
|
|
86
|
-
}
|
|
87
|
-
if (!Object.keys(_mc).length &&
|
|
88
|
-
target instanceof HTMLElement &&
|
|
89
|
-
target.hasAttribute("_mc")) {
|
|
90
|
-
target.removeAttribute("_mc");
|
|
91
|
-
}
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
add(key, element, target) {
|
|
95
|
-
if (this.#_mc[key])
|
|
96
|
-
return;
|
|
97
|
-
if (target) {
|
|
98
|
-
MC.add(target, key, element);
|
|
99
|
-
}
|
|
100
|
-
this.#_mc[key] = element;
|
|
101
|
-
return element;
|
|
102
|
-
}
|
|
103
|
-
remove(key, target) {
|
|
104
|
-
const _mc = this.#_mc;
|
|
105
|
-
const t = target;
|
|
106
|
-
if (target) {
|
|
107
|
-
MC.remove(t, key);
|
|
108
|
-
}
|
|
109
|
-
delete _mc?.[key];
|
|
110
|
-
}
|
|
111
|
-
siblings(search = "") {
|
|
112
|
-
const _mc = this.#_mc;
|
|
113
|
-
if (!_mc)
|
|
114
|
-
return [];
|
|
115
|
-
const result = _mc[search || ""];
|
|
116
|
-
return search && result ? [result] : [...Object.values(_mc)];
|
|
117
|
-
}
|
|
118
|
-
parent(search = "") {
|
|
119
|
-
if (!isDOM(this.#target))
|
|
120
|
-
return [];
|
|
121
|
-
return traverseNodes(this.#target.parentNode, search, true);
|
|
122
|
-
}
|
|
123
|
-
parents(search = "") {
|
|
124
|
-
if (!isDOM(this.#target))
|
|
125
|
-
return [];
|
|
126
|
-
return traverseNodes(this.#target.parentNode, search, false);
|
|
14
|
+
super(target);
|
|
127
15
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const id = Math.random().toString().replace(".", "");
|
|
132
|
-
const selector = '[_mc]:not([temp_id="' + id + '"] [_mc] [_mc])';
|
|
133
|
-
this.#target.setAttribute("temp_id", id);
|
|
134
|
-
const myDomElements = this.#target.querySelectorAll(selector);
|
|
135
|
-
const mcValues = getMicroComponents([...myDomElements], search);
|
|
136
|
-
this.#target.removeAttribute("temp_id");
|
|
137
|
-
return mcValues;
|
|
16
|
+
onCustomEvent(ev) {
|
|
17
|
+
let logger = this.target?.target?._mc?.logger;
|
|
18
|
+
logger?.log("onCustomEvent", ev);
|
|
138
19
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const myDomElements = this.#target.querySelectorAll("*[_mc]");
|
|
143
|
-
return getMicroComponents([...myDomElements], search);
|
|
20
|
+
oneInit(ev) {
|
|
21
|
+
let logger = this.target?.target?._mc?.logger;
|
|
22
|
+
logger?.warn("EvTarget .oneInit(ev)", ev);
|
|
144
23
|
}
|
|
145
24
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
let elements = [...document.querySelectorAll("div")].reverse();
|
|
150
|
-
elements.forEach((e) => (e.innerHTML = e.innerHTML.repeat(5)));
|
|
151
|
-
document.body.innerHTML = document.body.innerHTML.repeat(5);
|
|
152
|
-
document.body.innerHTML =
|
|
153
|
-
document.body.innerHTML +
|
|
154
|
-
"<span>F12 opens the debugger, console has some manual tests...</span>";
|
|
155
|
-
}
|
|
156
|
-
// create an inner micro component class
|
|
157
|
-
class MyInnerMC extends MC {
|
|
158
|
-
constructor(target) {
|
|
25
|
+
class Logger extends DC {
|
|
26
|
+
constructor(target, logger, prefix) {
|
|
27
|
+
// logger must implement the console interface
|
|
159
28
|
super(target);
|
|
29
|
+
let that = this; // scoping and minifier help
|
|
30
|
+
that.prefix = prefix;
|
|
31
|
+
// instance that handles logging, depency injection
|
|
32
|
+
that.stdOut = logger;
|
|
160
33
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
console.log(this.siblings());
|
|
34
|
+
log() {
|
|
35
|
+
this.stdOut.log(this.prefix, this.target.constructor.name, ...arguments);
|
|
164
36
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
class MyMC extends MC {
|
|
168
|
-
#myInner;
|
|
169
|
-
constructor(target) {
|
|
170
|
-
super(target);
|
|
171
|
-
//add a micro component
|
|
172
|
-
this.add("myInnerMC", new MyInnerMC(target));
|
|
173
|
-
// add a private MC
|
|
174
|
-
this.#myInner = new MyInnerMC(target);
|
|
37
|
+
info() {
|
|
38
|
+
this.stdOut.info(this.prefix, this.target.constructor.name, ...arguments);
|
|
175
39
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.#myInner.doSomething();
|
|
40
|
+
warn() {
|
|
41
|
+
this.stdOut.warn(this.prefix, this.target.constructor.name, ...arguments);
|
|
179
42
|
}
|
|
180
43
|
}
|
|
181
|
-
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
44
|
+
defineCE(
|
|
45
|
+
// equivalent to custom element registry .define()
|
|
46
|
+
"my-tag", class MyTag extends DC {
|
|
47
|
+
constructor(target, data) {
|
|
48
|
+
super(target);
|
|
49
|
+
let that = this; // minifier help
|
|
50
|
+
// state observables
|
|
51
|
+
that.In = data;
|
|
52
|
+
that.Counter = 0;
|
|
53
|
+
// convert all props defined so far into custom observables
|
|
54
|
+
makeCO(that);
|
|
55
|
+
DC.add(target, "logger", new Logger(target, console, "[logger]"));
|
|
56
|
+
// render
|
|
57
|
+
target.innerHTML = "Click Me";
|
|
58
|
+
// automatically attach native DOM event handlers
|
|
59
|
+
that.autoAttachListeners();
|
|
60
|
+
}
|
|
61
|
+
/*
|
|
62
|
+
web component specific event handlers
|
|
63
|
+
*/
|
|
64
|
+
onConnected(ev) {
|
|
65
|
+
this.target._mc?.logger.info("onConnected handler", ev);
|
|
66
|
+
}
|
|
67
|
+
onAttributeChanged(ev) {
|
|
68
|
+
let logger = this.target._mc?.logger;
|
|
69
|
+
logger?.info("onAttributeChanged handler", ev);
|
|
70
|
+
}
|
|
71
|
+
/*
|
|
72
|
+
native event handlers
|
|
73
|
+
*/
|
|
74
|
+
oneClick(ev) {
|
|
75
|
+
let logger = this.target._mc?.logger;
|
|
76
|
+
logger.info("oneClick handler", ev);
|
|
77
|
+
this._mc.customEventTarget.trigger("customEvent");
|
|
78
|
+
this.target.setAttribute("my-attribute", "testValue");
|
|
79
|
+
}
|
|
80
|
+
onClick(ev) {
|
|
81
|
+
let logger = this.target._mc?.logger;
|
|
82
|
+
logger?.info("onClick handler", ev);
|
|
83
|
+
this.Counter++;
|
|
84
|
+
}
|
|
85
|
+
/*
|
|
86
|
+
DC custom event handlers
|
|
87
|
+
*/
|
|
88
|
+
oneInit(ev) {
|
|
89
|
+
let that = this;
|
|
90
|
+
// add a public logger
|
|
91
|
+
//that.target._mc.logger = new Logger(that.target, console, "[Logger]");
|
|
92
|
+
let logger = that.target._mc.logger;
|
|
93
|
+
logger.warn("oneInit handler", ev);
|
|
94
|
+
// add a private event target
|
|
95
|
+
that._mc.customEventTarget = new EvTarget(that);
|
|
96
|
+
// add a private adder
|
|
97
|
+
that._mc.Adder = new Adder();
|
|
98
|
+
// add callback for this.Counter changes
|
|
99
|
+
that.Counter.observe((value) => {
|
|
100
|
+
logger.log("Counter has changed to: " + value);
|
|
101
|
+
});
|
|
102
|
+
logger.log("add 1,2,3 =", that._mc.Adder.sum(1, 2, 3));
|
|
103
|
+
}
|
|
104
|
+
onDoSomething(ev) {
|
|
105
|
+
let logger = this.target._mc?.logger;
|
|
106
|
+
logger?.log(".onDoSomething(ev): something done...", ev);
|
|
107
|
+
}
|
|
108
|
+
}, ["my-attribute"]);
|
|
109
|
+
let MyTag = getCE("my-tag");
|
|
110
|
+
document.body.appendChild(new MyTag("my-data"));
|
|
111
|
+
let element = document.querySelector("my-tag");
|
|
112
|
+
console.log("\n\n%cInspect this tag:%c \n( ...to see the inner structure in the '._mc' property )\n\n %O %c %s", "font-weight: bold;", "font-weight: normal;", element, "font-weight: bold;", "\n\nLook up code in the debugger: test.js\n\n");
|
|
113
|
+
// will trigger the event on all micro components contained in <my-tag>
|
|
114
|
+
DC.trigger(element, "doSomething");
|