@twobirds/microcomponents 0.0.46 → 0.0.50
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/assets/Grandparent.css +13 -0
- package/assets/documentation/MC.md +380 -166
- package/assets/test.html +5 -1
- package/dist/MC.d.ts +1 -0
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.min.js +44 -0
- package/dist/MC.ts +65 -0
- package/dist/elements.min.js +1 -1
- package/dist/elements.ts +10 -10
- package/dist/formValues.d.ts +3 -2
- package/dist/formValues.d.ts.map +1 -1
- package/dist/formValues.ts +206 -203
- package/dist/formvValues.min.js +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.ts +9 -0
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.d.ts +1 -1
- package/dist/observables.d.ts.map +1 -1
- package/dist/observables.min.js +1 -1
- package/dist/observables.ts +72 -33
- package/dist/selectors.min.js +1 -1
- package/dist/test.ts +14 -14
- package/package.json +1 -1
- package/public/Grandparent.css +13 -0
- package/public/Grandparent.js +338 -0
- package/public/MC.js +43 -0
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +44 -0
- package/public/TestForm.css +47 -0
- package/public/TestForm.html +56 -0
- package/public/TestForm.js +56 -0
- package/public/TestForm.json +27 -0
- package/public/Testform.js +149 -0
- package/public/classes/MC.DC.html +13 -13
- package/public/classes/MC.MC.html +7 -7
- package/public/classes/MC.McBase.html +4 -4
- package/public/classes/MC.McEvent.html +13 -13
- package/public/documentation/MC.md +380 -166
- package/public/documentation/observe.md +317 -0
- package/public/elements.js +9 -9
- package/public/elements.js.map +1 -1
- package/public/elements.min.js +1 -1
- package/public/formValues.js +142 -133
- package/public/formValues.js.map +1 -1
- package/public/formvValues.min.js +1 -1
- package/public/functions/MC.addListener.html +1 -1
- package/public/functions/MC.removeListener.html +1 -1
- package/public/functions/elements.defineCE.html +1 -1
- package/public/functions/elements.getCE.html +1 -1
- package/public/functions/formValues.formValues.html +1 -1
- package/public/functions/observables.observe.html +1 -1
- package/public/functions/selectors._d.html +1 -1
- package/public/functions/selectors._t.html +1 -1
- package/public/helpers.js +8 -0
- package/public/helpers.js.map +1 -1
- package/public/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/interfaces/selectors.DSelector.html +55 -55
- package/public/interfaces/selectors.TSelector.html +37 -37
- package/public/microcomponents.min.js +1 -1
- package/public/modules/MC.html +1 -1
- package/public/modules/elements.html +1 -1
- package/public/modules/formValues.html +1 -1
- package/public/modules/observables.html +1 -1
- package/public/modules/selectors.html +1 -1
- package/public/observables.js +39 -21
- package/public/observables.js.map +1 -1
- package/public/observables.min.js +1 -1
- package/public/selectors.min.js +1 -1
- package/public/src/MC.ts +65 -0
- package/public/src/elements.ts +10 -10
- package/public/src/formValues.ts +206 -203
- package/public/src/helpers.ts +9 -0
- package/public/src/observables.ts +72 -33
- package/public/src/test.ts +14 -14
- package/public/test/Grandparent.js +1 -0
- package/public/test/Testform.js +1 -0
- package/public/test.html +5 -1
- package/public/test.js +9 -11
- package/public/test.js.map +1 -1
- package/public/types/observables.Observable.html +1 -1
- package/public/types/selectors.selection.html +1 -1
- package/public/types/selectors.singleSelector.html +1 -1
- package/src/MC.ts +65 -0
- package/src/elements.ts +10 -10
- package/src/formValues.ts +206 -203
- package/src/helpers.ts +9 -0
- package/src/observables.ts +72 -33
- package/src/test/Child.ts +21 -0
- package/src/test/Grandchild.ts +21 -0
- package/src/test/Grandparent.css +11 -0
- package/src/test/Grandparent.ts +21 -0
- package/src/test/Greatgrandchild.ts +42 -0
- package/src/test/Parent.ts +21 -0
- package/src/test/Testform.css +47 -0
- package/src/test/Testform.html +56 -0
- package/src/test/Testform.json +27 -0
- package/src/test/Testform.ts +159 -0
- package/src/test.ts +14 -14
- package/webpack.config.js +135 -61
package/src/test.ts
CHANGED
|
@@ -42,21 +42,18 @@ class Translator extends DC {
|
|
|
42
42
|
|
|
43
43
|
(that.Translation as Observable).bind(translationTargetObject);
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
that.target.setAttribute('language', 'en');
|
|
46
46
|
|
|
47
|
-
(
|
|
47
|
+
(that.Language as Observable).notify();
|
|
48
48
|
|
|
49
49
|
delete that._mc; // cleanup, not needed
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
onAttributeChanged(ev: McEvent) {
|
|
53
53
|
if (!ev.data.newValue) return;
|
|
54
|
-
|
|
55
|
-
let that = this;
|
|
56
|
-
|
|
57
54
|
switch (ev.data.name) {
|
|
58
55
|
case 'language':
|
|
59
|
-
|
|
56
|
+
this.Language = ev.data.newValue;
|
|
60
57
|
break;
|
|
61
58
|
}
|
|
62
59
|
}
|
|
@@ -112,10 +109,10 @@ defineCE(
|
|
|
112
109
|
|
|
113
110
|
onClick(ev: McEvent) {
|
|
114
111
|
const that = this,
|
|
115
|
-
c =
|
|
112
|
+
c = that.Dom.counter++;
|
|
116
113
|
(ev.data as PointerEvent).stopPropagation();
|
|
117
|
-
(
|
|
118
|
-
(
|
|
114
|
+
(that.target as HTMLElement).classList.remove('clicked');
|
|
115
|
+
(that.target as HTMLElement).classList.add(
|
|
119
116
|
that.Dom.counter > 9 ? 'overClicked' : 'clicked'
|
|
120
117
|
);
|
|
121
118
|
}
|
|
@@ -130,10 +127,11 @@ let MyTag: CustomElementConstructor = getCE('my-tag')!,
|
|
|
130
127
|
stress test
|
|
131
128
|
*/
|
|
132
129
|
|
|
133
|
-
let start = new Date().getTime()
|
|
130
|
+
let start = new Date().getTime(),
|
|
131
|
+
max = 100;
|
|
134
132
|
|
|
135
|
-
// create
|
|
136
|
-
for (let x = 0; x <
|
|
133
|
+
// create 1000 elements
|
|
134
|
+
for (let x = 0; x < max; x++) {
|
|
137
135
|
fragment.append(new MyTag());
|
|
138
136
|
}
|
|
139
137
|
|
|
@@ -152,14 +150,16 @@ setTimeout(() => {
|
|
|
152
150
|
// console.clear();
|
|
153
151
|
|
|
154
152
|
console.log(
|
|
155
|
-
'%c \n\nStress Test:\n\n %cInstancing
|
|
153
|
+
'%c \n\nStress Test:\n\n %cInstancing %s web components (%s classes): %c %s ms.',
|
|
156
154
|
'font-weight: bold; color: black;',
|
|
157
155
|
'font-weight: normal;',
|
|
156
|
+
max,
|
|
157
|
+
max * 3,
|
|
158
158
|
'font-weight: bold; color: blue;',
|
|
159
159
|
end - start
|
|
160
160
|
);
|
|
161
161
|
|
|
162
|
-
document.body.appendChild(new MyTag());
|
|
162
|
+
//document.body.appendChild(new MyTag());
|
|
163
163
|
|
|
164
164
|
let element = document.querySelector('my-tag');
|
|
165
165
|
|
package/webpack.config.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const path = require(
|
|
1
|
+
const path = require('path');
|
|
2
2
|
|
|
3
3
|
module.exports = [
|
|
4
4
|
{
|
|
5
|
-
entry:
|
|
6
|
-
mode:
|
|
5
|
+
entry: './build/MC.js',
|
|
6
|
+
mode: 'production',
|
|
7
7
|
output: {
|
|
8
|
-
path: path.resolve(__dirname,
|
|
9
|
-
filename:
|
|
10
|
-
libraryTarget:
|
|
11
|
-
library:
|
|
12
|
-
globalObject:
|
|
8
|
+
path: path.resolve(__dirname, 'dist'),
|
|
9
|
+
filename: 'MC.min.js',
|
|
10
|
+
libraryTarget: 'umd',
|
|
11
|
+
library: 'MC',
|
|
12
|
+
globalObject: 'this',
|
|
13
13
|
},
|
|
14
14
|
module: {
|
|
15
15
|
rules: [
|
|
@@ -17,13 +17,13 @@ module.exports = [
|
|
|
17
17
|
// test: /\.tsx?$/,
|
|
18
18
|
use: [
|
|
19
19
|
{
|
|
20
|
-
loader:
|
|
20
|
+
loader: 'ts-loader',
|
|
21
21
|
options: {
|
|
22
22
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
23
23
|
compilerOptions: {
|
|
24
24
|
declaration: false, // Generate .d.ts files
|
|
25
25
|
declarationMap: false, // Generate .d.ts.map files
|
|
26
|
-
outDir:
|
|
26
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
},
|
|
@@ -33,21 +33,21 @@ module.exports = [
|
|
|
33
33
|
],
|
|
34
34
|
},
|
|
35
35
|
resolve: {
|
|
36
|
-
extensions: [
|
|
36
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
37
37
|
},
|
|
38
38
|
optimization: {
|
|
39
39
|
minimize: false, // Enable minification
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
entry:
|
|
44
|
-
mode:
|
|
43
|
+
entry: './build/elements.js',
|
|
44
|
+
mode: 'production',
|
|
45
45
|
output: {
|
|
46
|
-
path: path.resolve(__dirname,
|
|
47
|
-
filename:
|
|
48
|
-
libraryTarget:
|
|
49
|
-
library:
|
|
50
|
-
globalObject:
|
|
46
|
+
path: path.resolve(__dirname, 'dist'),
|
|
47
|
+
filename: 'elements.min.js',
|
|
48
|
+
libraryTarget: 'umd',
|
|
49
|
+
library: 'elements',
|
|
50
|
+
globalObject: 'this',
|
|
51
51
|
},
|
|
52
52
|
module: {
|
|
53
53
|
rules: [
|
|
@@ -55,13 +55,13 @@ module.exports = [
|
|
|
55
55
|
// test: /\.tsx?$/,
|
|
56
56
|
use: [
|
|
57
57
|
{
|
|
58
|
-
loader:
|
|
58
|
+
loader: 'ts-loader',
|
|
59
59
|
options: {
|
|
60
60
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
61
61
|
compilerOptions: {
|
|
62
62
|
declaration: false, // Generate .d.ts files
|
|
63
63
|
declarationMap: false, // Generate .d.ts.map files
|
|
64
|
-
outDir:
|
|
64
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -71,21 +71,21 @@ module.exports = [
|
|
|
71
71
|
],
|
|
72
72
|
},
|
|
73
73
|
resolve: {
|
|
74
|
-
extensions: [
|
|
74
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
75
75
|
},
|
|
76
76
|
optimization: {
|
|
77
77
|
minimize: true, // Enable minification
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
entry:
|
|
82
|
-
mode:
|
|
81
|
+
entry: './build/selectors.js',
|
|
82
|
+
mode: 'production',
|
|
83
83
|
output: {
|
|
84
|
-
path: path.resolve(__dirname,
|
|
85
|
-
filename:
|
|
86
|
-
libraryTarget:
|
|
87
|
-
library:
|
|
88
|
-
globalObject:
|
|
84
|
+
path: path.resolve(__dirname, 'dist'),
|
|
85
|
+
filename: 'selectors.min.js',
|
|
86
|
+
libraryTarget: 'umd',
|
|
87
|
+
library: 'selectors',
|
|
88
|
+
globalObject: 'this',
|
|
89
89
|
},
|
|
90
90
|
module: {
|
|
91
91
|
rules: [
|
|
@@ -93,13 +93,13 @@ module.exports = [
|
|
|
93
93
|
// test: /\.tsx?$/,
|
|
94
94
|
use: [
|
|
95
95
|
{
|
|
96
|
-
loader:
|
|
96
|
+
loader: 'ts-loader',
|
|
97
97
|
options: {
|
|
98
98
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
99
99
|
compilerOptions: {
|
|
100
100
|
declaration: false, // Generate .d.ts files
|
|
101
101
|
declarationMap: false, // Generate .d.ts.map files
|
|
102
|
-
outDir:
|
|
102
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
105
|
},
|
|
@@ -109,21 +109,21 @@ module.exports = [
|
|
|
109
109
|
],
|
|
110
110
|
},
|
|
111
111
|
resolve: {
|
|
112
|
-
extensions: [
|
|
112
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
113
113
|
},
|
|
114
114
|
optimization: {
|
|
115
115
|
minimize: true, // Enable minification
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
|
-
entry:
|
|
120
|
-
mode:
|
|
119
|
+
entry: './build/formValues.js',
|
|
120
|
+
mode: 'production',
|
|
121
121
|
output: {
|
|
122
|
-
path: path.resolve(__dirname,
|
|
123
|
-
filename:
|
|
124
|
-
libraryTarget:
|
|
125
|
-
library:
|
|
126
|
-
globalObject:
|
|
122
|
+
path: path.resolve(__dirname, 'dist'),
|
|
123
|
+
filename: 'formvValues.min.js',
|
|
124
|
+
libraryTarget: 'umd',
|
|
125
|
+
library: 'formValues',
|
|
126
|
+
globalObject: 'this',
|
|
127
127
|
},
|
|
128
128
|
module: {
|
|
129
129
|
rules: [
|
|
@@ -131,13 +131,13 @@ module.exports = [
|
|
|
131
131
|
// test: /\.tsx?$/,
|
|
132
132
|
use: [
|
|
133
133
|
{
|
|
134
|
-
loader:
|
|
134
|
+
loader: 'ts-loader',
|
|
135
135
|
options: {
|
|
136
136
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
137
137
|
compilerOptions: {
|
|
138
138
|
declaration: false, // Generate .d.ts files
|
|
139
139
|
declarationMap: false, // Generate .d.ts.map files
|
|
140
|
-
outDir:
|
|
140
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
},
|
|
@@ -147,21 +147,21 @@ module.exports = [
|
|
|
147
147
|
],
|
|
148
148
|
},
|
|
149
149
|
resolve: {
|
|
150
|
-
extensions: [
|
|
150
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
151
151
|
},
|
|
152
152
|
optimization: {
|
|
153
153
|
minimize: true, // Enable minification
|
|
154
154
|
},
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
entry:
|
|
158
|
-
mode:
|
|
157
|
+
entry: './build/observables.js',
|
|
158
|
+
mode: 'production',
|
|
159
159
|
output: {
|
|
160
|
-
path: path.resolve(__dirname,
|
|
161
|
-
filename:
|
|
162
|
-
libraryTarget:
|
|
163
|
-
library:
|
|
164
|
-
globalObject:
|
|
160
|
+
path: path.resolve(__dirname, 'dist'),
|
|
161
|
+
filename: 'observables.min.js',
|
|
162
|
+
libraryTarget: 'umd',
|
|
163
|
+
library: 'observables',
|
|
164
|
+
globalObject: 'this',
|
|
165
165
|
},
|
|
166
166
|
module: {
|
|
167
167
|
rules: [
|
|
@@ -169,13 +169,13 @@ module.exports = [
|
|
|
169
169
|
// test: /\.tsx?$/,
|
|
170
170
|
use: [
|
|
171
171
|
{
|
|
172
|
-
loader:
|
|
172
|
+
loader: 'ts-loader',
|
|
173
173
|
options: {
|
|
174
174
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
175
175
|
compilerOptions: {
|
|
176
176
|
declaration: false, // Generate .d.ts files
|
|
177
177
|
declarationMap: false, // Generate .d.ts.map files
|
|
178
|
-
outDir:
|
|
178
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
179
179
|
},
|
|
180
180
|
},
|
|
181
181
|
},
|
|
@@ -185,7 +185,7 @@ module.exports = [
|
|
|
185
185
|
],
|
|
186
186
|
},
|
|
187
187
|
resolve: {
|
|
188
|
-
extensions: [
|
|
188
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
189
189
|
},
|
|
190
190
|
optimization: {
|
|
191
191
|
minimize: true, // Enable minification
|
|
@@ -193,14 +193,14 @@ module.exports = [
|
|
|
193
193
|
},
|
|
194
194
|
// bundle files
|
|
195
195
|
{
|
|
196
|
-
entry:
|
|
197
|
-
mode:
|
|
196
|
+
entry: './build/microcomponents.js',
|
|
197
|
+
mode: 'production',
|
|
198
198
|
output: {
|
|
199
|
-
path: path.resolve(__dirname,
|
|
200
|
-
filename:
|
|
201
|
-
libraryTarget:
|
|
202
|
-
library:
|
|
203
|
-
globalObject:
|
|
199
|
+
path: path.resolve(__dirname, 'dist'),
|
|
200
|
+
filename: 'microcomponents.min.js',
|
|
201
|
+
libraryTarget: 'umd',
|
|
202
|
+
library: 'microcomponents',
|
|
203
|
+
globalObject: 'this',
|
|
204
204
|
},
|
|
205
205
|
module: {
|
|
206
206
|
rules: [
|
|
@@ -208,13 +208,13 @@ module.exports = [
|
|
|
208
208
|
// test: /\.tsx?$/,
|
|
209
209
|
use: [
|
|
210
210
|
{
|
|
211
|
-
loader:
|
|
211
|
+
loader: 'ts-loader',
|
|
212
212
|
options: {
|
|
213
213
|
transpileOnly: true, // Avoid type checking during webpack build
|
|
214
214
|
compilerOptions: {
|
|
215
215
|
declaration: false, // Generate .d.ts files
|
|
216
216
|
declarationMap: false, // Generate .d.ts.map files
|
|
217
|
-
outDir:
|
|
217
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
218
218
|
},
|
|
219
219
|
},
|
|
220
220
|
},
|
|
@@ -224,7 +224,81 @@ module.exports = [
|
|
|
224
224
|
],
|
|
225
225
|
},
|
|
226
226
|
resolve: {
|
|
227
|
-
extensions: [
|
|
227
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
228
|
+
},
|
|
229
|
+
optimization: {
|
|
230
|
+
minimize: true, // Enable minification
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
entry: './build/test/Grandparent.js',
|
|
235
|
+
mode: 'production',
|
|
236
|
+
output: {
|
|
237
|
+
path: path.resolve(__dirname, 'public/test'),
|
|
238
|
+
filename: 'Grandparent.js',
|
|
239
|
+
libraryTarget: 'umd',
|
|
240
|
+
library: 'TestGrandparent',
|
|
241
|
+
},
|
|
242
|
+
module: {
|
|
243
|
+
rules: [
|
|
244
|
+
{
|
|
245
|
+
// test: /\.tsx?$/,
|
|
246
|
+
use: [
|
|
247
|
+
{
|
|
248
|
+
loader: 'ts-loader',
|
|
249
|
+
options: {
|
|
250
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
251
|
+
compilerOptions: {
|
|
252
|
+
declaration: false, // Generate .d.ts files
|
|
253
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
254
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
exclude: /node_modules/,
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
resolve: {
|
|
264
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
265
|
+
},
|
|
266
|
+
optimization: {
|
|
267
|
+
minimize: true, // Enable minification
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
entry: './build/test/Testform.js',
|
|
272
|
+
mode: 'production',
|
|
273
|
+
output: {
|
|
274
|
+
path: path.resolve(__dirname, 'public/test'),
|
|
275
|
+
filename: 'Testform.js',
|
|
276
|
+
libraryTarget: 'umd',
|
|
277
|
+
library: 'TestTestform',
|
|
278
|
+
},
|
|
279
|
+
module: {
|
|
280
|
+
rules: [
|
|
281
|
+
{
|
|
282
|
+
// test: /\.tsx?$/,
|
|
283
|
+
use: [
|
|
284
|
+
{
|
|
285
|
+
loader: 'ts-loader',
|
|
286
|
+
options: {
|
|
287
|
+
transpileOnly: true, // Avoid type checking during webpack build
|
|
288
|
+
compilerOptions: {
|
|
289
|
+
declaration: false, // Generate .d.ts files
|
|
290
|
+
declarationMap: false, // Generate .d.ts.map files
|
|
291
|
+
outDir: 'build/types', // Output .d.ts and .d.ts.map to a different directory
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
exclude: /node_modules/,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
resolve: {
|
|
301
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
228
302
|
},
|
|
229
303
|
optimization: {
|
|
230
304
|
minimize: true, // Enable minification
|