@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
package/src/test.js
CHANGED
|
@@ -1,247 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
return mcValues;
|
|
16
|
-
}
|
|
17
|
-
function traverseNodes(node, search, firstonly = true) {
|
|
18
|
-
let mcValues = [];
|
|
19
|
-
while (node) {
|
|
20
|
-
if (node._mc) {
|
|
21
|
-
if (!search) {
|
|
22
|
-
mcValues = mcValues.concat(Object.values(node._mc));
|
|
23
|
-
} else if (search && node._mc[search]) {
|
|
24
|
-
mcValues.push(node._mc[search]);
|
|
25
|
-
}
|
|
26
|
-
if (firstonly) return mcValues;
|
|
27
|
-
}
|
|
28
|
-
node = node.parentNode;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MC, DC } from "./MC.js";
|
|
4
|
+
import { defineCE, getCE } from "./customElements.js";
|
|
5
|
+
import { makeCO } from "./customObservables.js";
|
|
6
|
+
|
|
7
|
+
//MC.debug = true;
|
|
8
|
+
|
|
9
|
+
class Adder {
|
|
10
|
+
constructor() {}
|
|
11
|
+
|
|
12
|
+
sum(...numbers) {
|
|
13
|
+
return numbers.reduce((acc, curr) => acc + curr, 0);
|
|
29
14
|
}
|
|
30
|
-
return mcValues;
|
|
31
15
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
class MC {
|
|
36
|
-
#target = {};
|
|
37
|
-
#_mc = {};
|
|
38
|
-
static debug = false;
|
|
16
|
+
|
|
17
|
+
class EvTarget extends MC {
|
|
39
18
|
constructor(target) {
|
|
40
|
-
|
|
41
|
-
this.#_mc = {};
|
|
42
|
-
}
|
|
43
|
-
get _mc() {
|
|
44
|
-
if (!MC.debug) return undefined;
|
|
45
|
-
return this.#_mc;
|
|
46
|
-
}
|
|
47
|
-
get target() {
|
|
48
|
-
return this.#target;
|
|
49
|
-
}
|
|
50
|
-
static siblings(target, search = "") {
|
|
51
|
-
const mc = target;
|
|
52
|
-
if (!mc._mc) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
const _mc = mc._mc;
|
|
56
|
-
if (search.length) {
|
|
57
|
-
return _mc?.[search] || [];
|
|
58
|
-
}
|
|
59
|
-
return [...Object.values(_mc)];
|
|
60
|
-
}
|
|
61
|
-
static add(target, key, element = {}) {
|
|
62
|
-
let node = target;
|
|
63
|
-
if (!node._mc) {
|
|
64
|
-
node._mc = new MC(target);
|
|
65
|
-
}
|
|
66
|
-
const _mc = node._mc;
|
|
67
|
-
if (key.length && !_mc[key]) {
|
|
68
|
-
_mc[key] = element;
|
|
69
|
-
if (target instanceof HTMLElement) {
|
|
70
|
-
target.setAttribute("_mc", "");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return element;
|
|
74
|
-
}
|
|
75
|
-
static remove(target, key) {
|
|
76
|
-
if (!key) return;
|
|
77
|
-
const _mc = target?._mc || {};
|
|
78
|
-
if (_mc && _mc[key]) {
|
|
79
|
-
delete _mc[key];
|
|
80
|
-
}
|
|
81
|
-
if (
|
|
82
|
-
!Object.keys(_mc).length &&
|
|
83
|
-
target instanceof HTMLElement &&
|
|
84
|
-
target.hasAttribute("_mc")
|
|
85
|
-
) {
|
|
86
|
-
target.removeAttribute("_mc");
|
|
87
|
-
}
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
add(key, element, target) {
|
|
91
|
-
if (this.#_mc[key]) return;
|
|
92
|
-
if (target) {
|
|
93
|
-
MC.add(target, key, element);
|
|
94
|
-
}
|
|
95
|
-
this.#_mc[key] = element;
|
|
96
|
-
return element;
|
|
19
|
+
super(target);
|
|
97
20
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
MC.remove(t, key);
|
|
103
|
-
}
|
|
104
|
-
delete _mc?.[key];
|
|
21
|
+
|
|
22
|
+
onCustomEvent(ev) {
|
|
23
|
+
let logger = this.target?.target?._mc?.logger;
|
|
24
|
+
logger?.log("onCustomEvent", ev);
|
|
105
25
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return search && result ? [result] : [...Object.values(_mc)];
|
|
26
|
+
|
|
27
|
+
oneInit(ev) {
|
|
28
|
+
let logger = this.target?.target?._mc?.logger;
|
|
29
|
+
logger?.warn("EvTarget .oneInit(ev)", ev);
|
|
111
30
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class Logger extends DC {
|
|
34
|
+
constructor(target, logger, prefix) {
|
|
35
|
+
// logger must implement the console interface
|
|
36
|
+
super(target);
|
|
37
|
+
|
|
38
|
+
let that = this; // scoping and minifier help
|
|
39
|
+
|
|
40
|
+
that.prefix = prefix;
|
|
41
|
+
|
|
42
|
+
// instance that handles logging, depency injection
|
|
43
|
+
that.stdOut = logger;
|
|
115
44
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
45
|
+
|
|
46
|
+
log() {
|
|
47
|
+
this.stdOut.log(this.prefix, this.target.constructor.name, ...arguments);
|
|
119
48
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const selector = '[_mc]:not([temp_id="' + id + '"] [_mc] [_mc])';
|
|
124
|
-
this.#target.setAttribute("temp_id", id);
|
|
125
|
-
const myDomElements = this.#target.querySelectorAll(selector);
|
|
126
|
-
const mcValues = getMicroComponents([...myDomElements], search);
|
|
127
|
-
this.#target.removeAttribute("temp_id");
|
|
128
|
-
return mcValues;
|
|
49
|
+
|
|
50
|
+
info() {
|
|
51
|
+
this.stdOut.info(this.prefix, this.target.constructor.name, ...arguments);
|
|
129
52
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const myDomElements = this.#target.querySelectorAll("*[_mc]");
|
|
133
|
-
return getMicroComponents([...myDomElements], search);
|
|
53
|
+
warn() {
|
|
54
|
+
this.stdOut.warn(this.prefix, this.target.constructor.name, ...arguments);
|
|
134
55
|
}
|
|
135
56
|
}
|
|
136
57
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
58
|
+
defineCE(
|
|
59
|
+
// equivalent to custom element registry .define()
|
|
60
|
+
"my-tag",
|
|
61
|
+
class MyTag extends DC {
|
|
62
|
+
constructor(target, data) {
|
|
63
|
+
super(target);
|
|
140
64
|
|
|
141
|
-
|
|
142
|
-
elements.forEach((e) => (e.innerHTML = e.innerHTML.repeat(5)));
|
|
65
|
+
let that = this; // minifier help
|
|
143
66
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"<span>F12 opens the debugger, console has some manual tests...</span>";
|
|
148
|
-
}
|
|
67
|
+
// state observables
|
|
68
|
+
that.In = data;
|
|
69
|
+
that.Counter = 0;
|
|
149
70
|
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
constructor(target) {
|
|
153
|
-
super(target);
|
|
154
|
-
}
|
|
71
|
+
// convert all props defined so far into custom observables
|
|
72
|
+
makeCO(that);
|
|
155
73
|
|
|
156
|
-
|
|
157
|
-
console.log(this, " myInnerMC something done");
|
|
158
|
-
console.log(this.siblings());
|
|
159
|
-
}
|
|
160
|
-
}
|
|
74
|
+
DC.add(target, "logger", new Logger(target, console, "[logger]"));
|
|
161
75
|
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
#myInner;
|
|
76
|
+
// render
|
|
77
|
+
target.innerHTML = "Click Me";
|
|
165
78
|
|
|
166
|
-
|
|
167
|
-
|
|
79
|
+
// automatically attach native DOM event handlers
|
|
80
|
+
that.autoAttachListeners();
|
|
81
|
+
}
|
|
168
82
|
|
|
169
|
-
|
|
170
|
-
|
|
83
|
+
/*
|
|
84
|
+
web component specific event handlers
|
|
85
|
+
*/
|
|
171
86
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
87
|
+
onConnected(ev) {
|
|
88
|
+
this.target._mc?.logger.info("onConnected handler", ev);
|
|
89
|
+
}
|
|
175
90
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
91
|
+
onAttributeChanged(ev) {
|
|
92
|
+
let logger = this.target._mc?.logger;
|
|
93
|
+
logger?.info("onAttributeChanged handler", ev);
|
|
94
|
+
}
|
|
181
95
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
MC.add(domElement, "myFirstMC", new MyMC(domElement));
|
|
188
|
-
|
|
189
|
-
// Add the custom micro component instance to every div
|
|
190
|
-
document.querySelectorAll("div").forEach((e) => {
|
|
191
|
-
MC.add(e, "myPublicMC1", new MyMC(e));
|
|
192
|
-
MC.add(e, "myPublicMC2", new MyMC(e));
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
console.timeEnd("MC creation time");
|
|
196
|
-
|
|
197
|
-
let c = document.querySelectorAll("[_mc]");
|
|
198
|
-
console.info(
|
|
199
|
-
"number of DOM nodes:",
|
|
200
|
-
document.querySelectorAll("*").length,
|
|
201
|
-
"\nnumber of DOM nodes containing micro components:",
|
|
202
|
-
c.length,
|
|
203
|
-
"\nnumber of top level micro components:",
|
|
204
|
-
c.length * 2 + 1, // TODO write reducer
|
|
205
|
-
"\nnumber of top level & inner micro components:",
|
|
206
|
-
c.length * 6 + 2 // TODO write reducer
|
|
207
|
-
);
|
|
96
|
+
/*
|
|
97
|
+
native event handlers
|
|
98
|
+
*/
|
|
99
|
+
oneClick(ev) {
|
|
100
|
+
let logger = this.target._mc?.logger;
|
|
208
101
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
console.log(
|
|
213
|
-
"domElement\n ._mc\n .myFirstMC\n ._mc (MC.debug = false)",
|
|
214
|
-
domElement._mc.myFirstMC._mc
|
|
215
|
-
);
|
|
216
|
-
MC.debug = true;
|
|
217
|
-
console.log(
|
|
218
|
-
"domElement\n ._mc\n .myFirstMC\n ._mc (MC.debug = true)",
|
|
219
|
-
domElement._mc.myFirstMC._mc
|
|
220
|
-
);
|
|
221
|
-
MC.debug = false;
|
|
102
|
+
logger.info("oneClick handler", ev);
|
|
103
|
+
|
|
104
|
+
this._mc.customEventTarget.trigger("customEvent");
|
|
222
105
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
*/
|
|
106
|
+
this.target.setAttribute("my-attribute", "testValue");
|
|
107
|
+
}
|
|
226
108
|
|
|
227
|
-
|
|
228
|
-
|
|
109
|
+
onClick(ev) {
|
|
110
|
+
let logger = this.target._mc?.logger;
|
|
229
111
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
112
|
+
logger?.info("onClick handler", ev);
|
|
113
|
+
|
|
114
|
+
this.Counter++;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
DC custom event handlers
|
|
119
|
+
*/
|
|
120
|
+
oneInit(ev) {
|
|
121
|
+
let that = this;
|
|
122
|
+
|
|
123
|
+
// add a public logger
|
|
124
|
+
//that.target._mc.logger = new Logger(that.target, console, "[Logger]");
|
|
125
|
+
|
|
126
|
+
let logger = that.target._mc.logger;
|
|
127
|
+
|
|
128
|
+
logger.warn("oneInit handler", ev);
|
|
129
|
+
|
|
130
|
+
// add a private event target
|
|
131
|
+
that._mc.customEventTarget = new EvTarget(that);
|
|
132
|
+
|
|
133
|
+
// add a private adder
|
|
134
|
+
that._mc.Adder = new Adder();
|
|
135
|
+
|
|
136
|
+
// add callback for this.Counter changes
|
|
137
|
+
that.Counter.observe((value) => {
|
|
138
|
+
logger.log("Counter has changed to: " + value);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
logger.log("add 1,2,3 =", that._mc.Adder.sum(1, 2, 3));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onDoSomething(ev) {
|
|
145
|
+
let logger = this.target._mc?.logger;
|
|
146
|
+
logger?.log(".onDoSomething(ev): something done...", ev);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
["my-attribute"]
|
|
237
150
|
);
|
|
238
|
-
|
|
239
|
-
|
|
151
|
+
|
|
152
|
+
let MyTag = getCE("my-tag");
|
|
153
|
+
document.body.appendChild(new MyTag("my-data"));
|
|
154
|
+
let element = document.querySelector("my-tag");
|
|
155
|
+
|
|
240
156
|
console.log(
|
|
241
|
-
"
|
|
242
|
-
|
|
243
|
-
|
|
157
|
+
"\n\n%cInspect this tag:%c \n( ...to see the inner structure in the '._mc' property )\n\n %O %c %s",
|
|
158
|
+
"font-weight: bold;",
|
|
159
|
+
"font-weight: normal;",
|
|
160
|
+
element,
|
|
161
|
+
"font-weight: bold;",
|
|
162
|
+
"\n\nLook up code in the debugger: test.js\n\n"
|
|
244
163
|
);
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
164
|
+
|
|
165
|
+
// will trigger the event on all micro components contained in <my-tag>
|
|
166
|
+
DC.trigger(element, "doSomething");
|
package/tsconfig.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/* Projects */
|
|
6
6
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
|
|
7
|
+
///////"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
8
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
9
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
10
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
67
67
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
68
68
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
69
|
-
"declarationDir": "./build", /* Specify the output directory for generated declaration files. */
|
|
69
|
+
//"declarationDir": "./build/types", /* Specify the output directory for generated declaration files. */
|
|
70
70
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
71
71
|
|
|
72
72
|
/* Interop Constraints */
|
package/typedoc.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"entryPoints": ["src/
|
|
2
|
+
"entryPoints": ["src/MCbundle.ts","src/MCIbundle.ts","src/MC.ts","src/MCI.ts","src/convenienceobservables.ts","src/formvalues.ts","src/customelements.ts"],
|
|
3
3
|
"out": "./public/",
|
|
4
4
|
"readme": "README.md",
|
|
5
5
|
"name": "Micro Components",
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
entry: "./build/MC.js",
|
|
6
|
+
mode: "production",
|
|
7
|
+
output: {
|
|
8
|
+
path: path.resolve(__dirname, "dist"),
|
|
9
|
+
filename: "MC.min.js",
|
|
10
|
+
libraryTarget: "umd",
|
|
11
|
+
library: "MC",
|
|
12
|
+
globalObject: "this",
|
|
13
|
+
},
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
// test: /\.tsx?$/,
|
|
18
|
+
use: [
|
|
19
|
+
{
|
|
20
|
+
loader: "ts-loader",
|
|
21
|
+
options: {
|
|
22
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
23
|
+
compilerOptions: {
|
|
24
|
+
declaration: false, // Generate .d.ts files
|
|
25
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
26
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
exclude: /node_modules/,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
resolve: {
|
|
36
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
37
|
+
},
|
|
38
|
+
optimization: {
|
|
39
|
+
minimize: false, // Enable minification
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
entry: "./build/customElements.js",
|
|
44
|
+
mode: "production",
|
|
45
|
+
output: {
|
|
46
|
+
path: path.resolve(__dirname, "dist"),
|
|
47
|
+
filename: "customElements.min.js",
|
|
48
|
+
libraryTarget: "umd",
|
|
49
|
+
library: "customElements",
|
|
50
|
+
globalObject: "this",
|
|
51
|
+
},
|
|
52
|
+
module: {
|
|
53
|
+
rules: [
|
|
54
|
+
{
|
|
55
|
+
// test: /\.tsx?$/,
|
|
56
|
+
use: [
|
|
57
|
+
{
|
|
58
|
+
loader: "ts-loader",
|
|
59
|
+
options: {
|
|
60
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
61
|
+
compilerOptions: {
|
|
62
|
+
declaration: false, // Generate .d.ts files
|
|
63
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
64
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
exclude: /node_modules/,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
resolve: {
|
|
74
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
75
|
+
},
|
|
76
|
+
optimization: {
|
|
77
|
+
minimize: true, // Enable minification
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
entry: "./build/customSelectors.js",
|
|
82
|
+
mode: "production",
|
|
83
|
+
output: {
|
|
84
|
+
path: path.resolve(__dirname, "dist"),
|
|
85
|
+
filename: "customSelectors.min.js",
|
|
86
|
+
libraryTarget: "umd",
|
|
87
|
+
library: "customSelectors",
|
|
88
|
+
globalObject: "this",
|
|
89
|
+
},
|
|
90
|
+
module: {
|
|
91
|
+
rules: [
|
|
92
|
+
{
|
|
93
|
+
// test: /\.tsx?$/,
|
|
94
|
+
use: [
|
|
95
|
+
{
|
|
96
|
+
loader: "ts-loader",
|
|
97
|
+
options: {
|
|
98
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
99
|
+
compilerOptions: {
|
|
100
|
+
declaration: false, // Generate .d.ts files
|
|
101
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
102
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
exclude: /node_modules/,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
resolve: {
|
|
112
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
113
|
+
},
|
|
114
|
+
optimization: {
|
|
115
|
+
minimize: true, // Enable minification
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
entry: "./build/formValues.js",
|
|
120
|
+
mode: "production",
|
|
121
|
+
output: {
|
|
122
|
+
path: path.resolve(__dirname, "dist"),
|
|
123
|
+
filename: "formvValues.min.js",
|
|
124
|
+
libraryTarget: "umd",
|
|
125
|
+
library: "formValues",
|
|
126
|
+
globalObject: "this",
|
|
127
|
+
},
|
|
128
|
+
module: {
|
|
129
|
+
rules: [
|
|
130
|
+
{
|
|
131
|
+
// test: /\.tsx?$/,
|
|
132
|
+
use: [
|
|
133
|
+
{
|
|
134
|
+
loader: "ts-loader",
|
|
135
|
+
options: {
|
|
136
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
137
|
+
compilerOptions: {
|
|
138
|
+
declaration: false, // Generate .d.ts files
|
|
139
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
140
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
exclude: /node_modules/,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
resolve: {
|
|
150
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
151
|
+
},
|
|
152
|
+
optimization: {
|
|
153
|
+
minimize: true, // Enable minification
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
entry: "./build/customObservables.js",
|
|
158
|
+
mode: "production",
|
|
159
|
+
output: {
|
|
160
|
+
path: path.resolve(__dirname, "dist"),
|
|
161
|
+
filename: "customObservables.min.js",
|
|
162
|
+
libraryTarget: "umd",
|
|
163
|
+
library: "customObservables",
|
|
164
|
+
globalObject: "this",
|
|
165
|
+
},
|
|
166
|
+
module: {
|
|
167
|
+
rules: [
|
|
168
|
+
{
|
|
169
|
+
// test: /\.tsx?$/,
|
|
170
|
+
use: [
|
|
171
|
+
{
|
|
172
|
+
loader: "ts-loader",
|
|
173
|
+
options: {
|
|
174
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
175
|
+
compilerOptions: {
|
|
176
|
+
declaration: false, // Generate .d.ts files
|
|
177
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
178
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
exclude: /node_modules/,
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
resolve: {
|
|
188
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
189
|
+
},
|
|
190
|
+
optimization: {
|
|
191
|
+
minimize: true, // Enable minification
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
// bundle files
|
|
195
|
+
{
|
|
196
|
+
entry: "./build/MCbundle.js",
|
|
197
|
+
mode: "production",
|
|
198
|
+
output: {
|
|
199
|
+
path: path.resolve(__dirname, "dist"),
|
|
200
|
+
filename: "MCbundle.min.js",
|
|
201
|
+
libraryTarget: "umd",
|
|
202
|
+
library: "MCbundle",
|
|
203
|
+
globalObject: "this",
|
|
204
|
+
},
|
|
205
|
+
module: {
|
|
206
|
+
rules: [
|
|
207
|
+
{
|
|
208
|
+
// test: /\.tsx?$/,
|
|
209
|
+
use: [
|
|
210
|
+
{
|
|
211
|
+
loader: "ts-loader",
|
|
212
|
+
options: {
|
|
213
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
214
|
+
compilerOptions: {
|
|
215
|
+
declaration: false, // Generate .d.ts files
|
|
216
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
217
|
+
outDir: "build/types", // Output .d.ts and .d.ts.map to a different directory
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
exclude: /node_modules/,
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
resolve: {
|
|
227
|
+
extensions: [".tsx", ".ts", ".js"],
|
|
228
|
+
},
|
|
229
|
+
optimization: {
|
|
230
|
+
minimize: true, // Enable minification
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
type HTMLElementMC = HTMLElement & {
|
|
2
|
-
_mc: {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
};
|
|
5
|
-
};
|
|
6
|
-
export declare class MC {
|
|
7
|
-
#private;
|
|
8
|
-
static debug: boolean;
|
|
9
|
-
constructor(target: {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
});
|
|
12
|
-
get _mc(): undefined | any;
|
|
13
|
-
get target(): any;
|
|
14
|
-
static siblings(target: HTMLElementMC, search?: string): any[];
|
|
15
|
-
static add(target: HTMLElement, key: string, element?: {}): any;
|
|
16
|
-
static remove(target: HTMLElementMC, key: string): void;
|
|
17
|
-
add(key: string, element: any, target?: HTMLElement): any;
|
|
18
|
-
remove(key: string, target?: HTMLElement): void;
|
|
19
|
-
siblings(search?: string): any[];
|
|
20
|
-
parent(search?: string): any[];
|
|
21
|
-
parents(search?: string): any[];
|
|
22
|
-
children(search?: string): any[];
|
|
23
|
-
descendants(search?: string): any[];
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=microcomponents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"microcomponents.d.ts","sourceRoot":"","sources":["../src/microcomponents.ts"],"names":[],"mappings":"AAiDA,KAAK,aAAa,GAAG,WAAW,GAAG;IAAE,GAAG,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;CAAE,CAAA;AAEjE,qBAAa,EAAE;;IAMd,MAAM,CAAC,KAAK,EAAE,OAAO,CAAS;gBAEjB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAC,MAAM,GAAG,GAAG,CAAA;KAAE;IAK1C,IAAI,GAAG,IAAI,SAAS,GAAG,GAAG,CAGzB;IAED,IAAI,MAAM,IAAI,GAAG,CAEhB;IAGD,MAAM,CAAC,QAAQ,CAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;IAiBpE,MAAM,CAAC,GAAG,CAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,KAAK,GAAI,GAAG;IAuBjE,MAAM,CAAC,MAAM,CAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM;IAkBjD,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAI,GAAG;IAgB3D,MAAM,CAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAI,IAAI;IAiBjD,QAAQ,CAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;IAetC,MAAM,CAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;IAOpC,OAAO,CAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;IAOrC,QAAQ,CAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;IActC,WAAW,CAAE,MAAM,GAAE,MAAW,GAAI,GAAG,EAAE;CAOzC"}
|