@twobirds/microcomponents 0.0.50 → 0.0.51

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.
Files changed (105) hide show
  1. package/dist/formValues.d.ts.map +1 -1
  2. package/dist/formValues.ts +17 -18
  3. package/dist/formvValues.min.js +1 -1
  4. package/dist/microcomponents.min.js +1 -1
  5. package/package.json +1 -1
  6. package/public/assets/search.js +1 -1
  7. package/public/classes/MC.DC.html +13 -13
  8. package/public/classes/MC.MC.html +7 -7
  9. package/public/classes/MC.McBase.html +4 -4
  10. package/public/classes/MC.McEvent.html +13 -13
  11. package/public/classes/formValues.FormValues.html +86 -0
  12. package/public/functions/MC.addListener.html +2 -1
  13. package/public/functions/{formValues.formValues.html → MC.autoload.html} +18 -17
  14. package/public/functions/MC.removeListener.html +2 -1
  15. package/public/functions/elements.defineCE.html +1 -1
  16. package/public/functions/elements.getCE.html +1 -1
  17. package/public/functions/observables.observe.html +3 -3
  18. package/public/functions/selectors._d.html +1 -1
  19. package/public/functions/selectors._t.html +1 -1
  20. package/public/interfaces/MC.HTMLMcElement.html +2 -2
  21. package/public/interfaces/selectors.DSelector.html +55 -55
  22. package/public/interfaces/selectors.TSelector.html +37 -37
  23. package/public/modules/MC.html +3 -1
  24. package/public/modules/elements.html +1 -1
  25. package/public/modules/formValues.html +4 -4
  26. package/public/modules/observables.html +1 -1
  27. package/public/modules/selectors.html +1 -1
  28. package/public/types/observables.Observable.html +1 -1
  29. package/public/types/selectors.selection.html +1 -1
  30. package/public/types/selectors.singleSelector.html +1 -1
  31. package/src/formValues.ts +17 -18
  32. package/public/3d.html +0 -42
  33. package/public/Grandparent.css +0 -13
  34. package/public/Grandparent.js +0 -338
  35. package/public/MC.js +0 -314
  36. package/public/MC.js.map +0 -1
  37. package/public/MC.min.js +0 -451
  38. package/public/McEvent.js +0 -71
  39. package/public/McEvent.js.map +0 -1
  40. package/public/MicroComponents.svg +0 -15
  41. package/public/TestForm.css +0 -47
  42. package/public/TestForm.html +0 -56
  43. package/public/TestForm.js +0 -56
  44. package/public/TestForm.json +0 -27
  45. package/public/Testform.js +0 -149
  46. package/public/autoloader.js +0 -53
  47. package/public/autoloader.js.map +0 -1
  48. package/public/documentation/MC.md +0 -470
  49. package/public/documentation/ajaxian-1.png +0 -0
  50. package/public/documentation/ajaxian-2.png +0 -0
  51. package/public/documentation/ajaxian-3.png +0 -0
  52. package/public/documentation/comparision.md +0 -0
  53. package/public/documentation/elements.md +0 -276
  54. package/public/documentation/functional_requirements.md +0 -8
  55. package/public/documentation/history.md +0 -436
  56. package/public/documentation/how_tos.md +0 -0
  57. package/public/documentation/introduction.md +0 -0
  58. package/public/documentation/magic.md +0 -29
  59. package/public/documentation/observe.md +0 -317
  60. package/public/documentation/proposal_draft.md +0 -37
  61. package/public/documentation/rnd0023-1.jpg +0 -0
  62. package/public/documentation/rnd0023-2.jpg +0 -0
  63. package/public/documentation/rnd0023-3.jpg +0 -0
  64. package/public/documentation/tB_react.md +0 -207
  65. package/public/documentation/usage.md +0 -142
  66. package/public/documentation/why.md +0 -25
  67. package/public/elements.js +0 -48
  68. package/public/elements.js.map +0 -1
  69. package/public/elements.min.js +0 -1
  70. package/public/fiddle/MicroComponents.svg +0 -15
  71. package/public/fiddle/fiddle.css +0 -0
  72. package/public/fiddle/fiddle.js +0 -0
  73. package/public/fiddle/index.html +0 -0
  74. package/public/formValues.js +0 -205
  75. package/public/formValues.js.map +0 -1
  76. package/public/formvValues.min.js +0 -1
  77. package/public/helpers.js +0 -113
  78. package/public/helpers.js.map +0 -1
  79. package/public/microcomponents.es3.js +0 -303
  80. package/public/microcomponents.es3.js.map +0 -1
  81. package/public/microcomponents.js +0 -9
  82. package/public/microcomponents.js.map +0 -1
  83. package/public/microcomponents.min.js +0 -1
  84. package/public/my-tag.css +0 -19
  85. package/public/observables.js +0 -251
  86. package/public/observables.js.map +0 -1
  87. package/public/observables.min.js +0 -1
  88. package/public/selectors.js +0 -971
  89. package/public/selectors.js.map +0 -1
  90. package/public/selectors.min.js +0 -1
  91. package/public/src/MC.ts +0 -478
  92. package/public/src/McEvent.ts +0 -96
  93. package/public/src/autoloader.ts +0 -98
  94. package/public/src/elements.ts +0 -76
  95. package/public/src/formValues.ts +0 -278
  96. package/public/src/helpers.ts +0 -149
  97. package/public/src/microcomponents.ts +0 -8
  98. package/public/src/observables.ts +0 -405
  99. package/public/src/selectors.ts +0 -1634
  100. package/public/src/test.ts +0 -177
  101. package/public/test/Grandparent.js +0 -1
  102. package/public/test/Testform.js +0 -1
  103. package/public/test.html +0 -27
  104. package/public/test.js +0 -78
  105. package/public/test.js.map +0 -1
package/src/formValues.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  import { LooseObject, copyGettersSetters } from './helpers.js';
4
- import { DC, HTMLMcElement, addListener } from './MC.js';
5
- import { Observable, observe } from './observables.js';
4
+ import { DC, addListener } from './MC.js';
5
+ import { observe } from './observables.js';
6
6
 
7
7
  type inputTypes = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
8
8
 
@@ -160,8 +160,7 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
160
160
  if (name) {
161
161
  let h: InputBase,
162
162
  type = (i as HTMLInputElement).type,
163
- handler: any,
164
- setter: DC;
163
+ handler: any;
165
164
  switch (getInputName(i as inputTypes)) {
166
165
  case 'input':
167
166
  switch (type) {
@@ -172,26 +171,26 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
172
171
  ? e
173
172
  : e.querySelector('form')) as HTMLFormElement
174
173
  );
175
- setter = DC.add(i, name, handler);
174
+ DC.add(i, name, handler);
176
175
  break;
177
176
  case 'checkbox':
178
177
  handler = new CheckboxHandler(i as HTMLInputElement);
179
- setter = DC.add(i, name, handler);
178
+ DC.add(i, name, handler);
180
179
  break;
181
180
  default:
182
181
  handler = new InputHandler(i as HTMLInputElement);
183
- setter = DC.add(i, name, handler);
182
+ DC.add(i, name, handler);
184
183
  }
185
184
 
186
185
  Object.defineProperty(handlers, name, {
187
186
  enumerable: true,
188
187
  configurable: true,
189
188
  get: (): any => {
190
- return (setter as unknown as SelectHandler).val;
189
+ return handler.val;
191
190
  },
192
191
  set: (value: any) => {
193
- if ((setter as unknown as InputHandler).val !== value) {
194
- (setter as unknown as InputHandler).val = value;
192
+ if (handler.val !== value) {
193
+ handler.val = value;
195
194
  }
196
195
  },
197
196
  });
@@ -199,32 +198,32 @@ const getInputHandlers = (e: HTMLElement | ShadowRoot): LooseObject => {
199
198
  break;
200
199
  case 'select':
201
200
  handler = new SelectHandler(i as HTMLSelectElement);
202
- setter = DC.add(i, name, handler);
201
+ DC.add(i, name, handler);
203
202
  Object.defineProperty(handlers, name, {
204
203
  enumerable: true,
205
204
  configurable: true,
206
205
  get: (): any => {
207
- return (setter as unknown as SelectHandler).val;
206
+ return handler.val;
208
207
  },
209
208
  set: (value: any) => {
210
- if ((setter as unknown as SelectHandler).val !== value) {
211
- (setter as unknown as SelectHandler).val = value;
209
+ if (handler.val !== value) {
210
+ handler.val = value;
212
211
  }
213
212
  },
214
213
  });
215
214
  break;
216
215
  case 'textarea':
217
216
  handler = new TextAreaHandler(i as HTMLTextAreaElement);
218
- setter = DC.add(i, name, handler);
217
+ DC.add(i, name, handler);
219
218
  Object.defineProperty(handlers, name, {
220
219
  enumerable: true,
221
220
  configurable: true,
222
221
  get: (): any => {
223
- return (setter as unknown as TextAreaHandler).val;
222
+ return handler.val;
224
223
  },
225
224
  set: (value: any) => {
226
- if ((setter as unknown as TextAreaHandler).val !== value) {
227
- (setter as unknown as TextAreaHandler).val = value;
225
+ if (handler.val !== value) {
226
+ handler.val = value;
228
227
  }
229
228
  },
230
229
  });
package/public/3d.html DELETED
@@ -1,42 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>3D Positioned Image with CSS</title>
7
- <style>
8
- body {
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- height: 100vh;
13
- background-color: #222;
14
- perspective: 800px; /* Depth effect */
15
- }
16
-
17
- .container {
18
- width: 300px;
19
- height: 200px;
20
- transform-style: preserve-3d; /* Needed for 3D transformations */
21
- }
22
-
23
- .image3d {
24
- width: 100%;
25
- height: 100%;
26
- transform: rotateY(20deg) rotateX(10deg) translateZ(50px);
27
- transition: transform 0.5s ease-in-out;
28
- box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
29
- }
30
-
31
- /* Hover effect */
32
- .container:hover .image3d {
33
- transform: rotateY(-20deg) rotateX(-10deg) translateZ(100px);
34
- }
35
- </style>
36
- </head>
37
- <body>
38
- <div class="container">
39
- <img class="image3d" src="https://via.placeholder.com/300x200" alt="3D Image">
40
- </div>
41
- </body>
42
- </html>
@@ -1,13 +0,0 @@
1
- test-grandparent,
2
- test-parent,
3
- test-child,
4
- test-grandchild,
5
- test-greatgrandchild {
6
- display: inline-block;
7
- padding: 2px;
8
- margin: 1px;
9
- border: 1px solid darkslategray;
10
- border-radius: 2px;
11
- }
12
-
13
- /*# sourceMappingURL=GrandParent.css.map */
@@ -1,338 +0,0 @@
1
- !(function (t, e) {
2
- 'object' == typeof exports && 'object' == typeof module
3
- ? (module.exports = e())
4
- : 'function' == typeof define && define.amd
5
- ? define([], e)
6
- : 'object' == typeof exports
7
- ? (exports.Grandparent = e())
8
- : (t.Grandparent = e());
9
- })(this, () =>
10
- (() => {
11
- 'use strict';
12
- var t = new Function('try {return this===window;}catch(e){ return false;}');
13
- let e = new Set();
14
- t() &&
15
- Object.keys(HTMLElement.prototype)
16
- .filter((t) => /^on/.test(t))
17
- .forEach((t) => e.add(t));
18
- class n {
19
- #t;
20
- #e = !1;
21
- #n = !1;
22
- constructor(t, e = {}, n = 'l') {
23
- (this.#t = t), (this.data = e), (this.bubble = n);
24
- }
25
- get type() {
26
- return this.#t;
27
- }
28
- get stopped() {
29
- return this.#e;
30
- }
31
- get immediateStopped() {
32
- return this.#n;
33
- }
34
- stopPropagation() {
35
- this.#e = !0;
36
- }
37
- stopImmediatePropagation() {
38
- this.stopPropagation(), (this.#n = !0);
39
- }
40
- }
41
- var r = new Function('try {return this===window;}catch(e){ return false;}');
42
- let o = new Set();
43
- function s(t, e) {
44
- let n = [];
45
- return (
46
- t.forEach((t) => {
47
- if (t && t instanceof HTMLElement) {
48
- const r = t?._mc;
49
- !e && r
50
- ? (n = n.concat(Object.values(t._mc)))
51
- : e && r && r[e] && n.push(r[e]);
52
- }
53
- }),
54
- n
55
- );
56
- }
57
- function c(t, e, n = !0) {
58
- let r = [];
59
- for (; t; ) {
60
- if (
61
- t._mc &&
62
- (e
63
- ? e && t._mc[e] && r.push(t._mc[e])
64
- : (r = r.concat(Object.values(t._mc))),
65
- n)
66
- )
67
- return r;
68
- t = t.parentNode;
69
- }
70
- return r;
71
- }
72
- function i(t) {
73
- return t && t instanceof HTMLElement;
74
- }
75
- function a(t, e, n = {}) {
76
- let r = t;
77
- if (!r._mc) {
78
- let e = f?.debug;
79
- (f.debug = !1), (r._mc = new f(t)), (f.debug = e), delete r._mc._mc;
80
- }
81
- const o = r._mc;
82
- return (
83
- e.length &&
84
- !o[e] &&
85
- ((o[e] = n), t instanceof HTMLElement && t.setAttribute('_mc', '')),
86
- n
87
- );
88
- }
89
- function u(t, e) {
90
- if (!e) return;
91
- const n = t?._mc || {};
92
- n && n[e] && delete n[e],
93
- !Object.keys(n).length &&
94
- t instanceof HTMLElement &&
95
- t.hasAttribute('_mc') &&
96
- t.removeAttribute('_mc');
97
- }
98
- function l(t, e, r = {}, o = 'l') {
99
- let s = t?._mc;
100
- if (!s) return;
101
- let c = e instanceof n ? new n(e.type, e.data, 'l') : new n(e, r, 'l'),
102
- i = 'string' != typeof e ? e : new n(e, r, o);
103
- [...Object.values(s)].forEach((t) => {
104
- t?.trigger && 'function' == typeof t?.trigger && t?.trigger(c);
105
- }),
106
- /[ud]/.test(i.bubble) && p(t, i);
107
- }
108
- function p(t, e) {
109
- /[ud]/.test(e.bubble) &&
110
- setTimeout(() => {
111
- if (
112
- (-1 === e.bubble.indexOf('l') && (e.bubble += 'l'),
113
- e.bubble.indexOf('u') > -1)
114
- ) {
115
- let n = c(t, '', !0)?.[0].target;
116
- n && f.trigger(n, e);
117
- }
118
- e.bubble.indexOf('d') > -1 &&
119
- new Set(t._mc.children().map((t) => t?.target)).forEach((t) => {
120
- t && f.trigger(t, e);
121
- });
122
- }, 0);
123
- }
124
- r() &&
125
- Object.keys(HTMLElement.prototype)
126
- .filter((t) => /^on/.test(t))
127
- .forEach((t) => o.add(t));
128
- class d {
129
- #r;
130
- constructor(t, e = !1) {
131
- var n;
132
- (this.#r = new WeakRef(t || {})),
133
- (n = this).constructor !== f &&
134
- setTimeout(() => {
135
- n.trigger('Init');
136
- }, 0),
137
- (function (t) {
138
- if (!r() || t.constructor === f) return;
139
- const e = t.target;
140
- if (e instanceof HTMLElement) {
141
- let n = t;
142
- Object.getOwnPropertyNames(n.constructor.prototype)
143
- .filter(
144
- (t) =>
145
- /^on[A-Z]|one[A-Z]/.test(t) &&
146
- 'function' == typeof n.constructor.prototype[t]
147
- )
148
- .forEach((r) => {
149
- let s = /^one/.test(r),
150
- c = r.replace(/^on[e]{0,1}/, ''),
151
- i = c.toLowerCase();
152
- s &&
153
- Object.defineProperty(t, 'on' + c, {
154
- configurable: !0,
155
- enumerable: !1,
156
- writable: !0,
157
- value: (t) => {
158
- n.constructor.prototype[r].bind(n)(t);
159
- },
160
- }),
161
- o.has('on' + i) &&
162
- (function (t, e, n, r = !1, o = !1) {
163
- let s = { once: !1 };
164
- r && (s.capture = r),
165
- o && (s.once = o),
166
- t.addEventListener(e, n, s);
167
- })(
168
- e,
169
- i,
170
- (t) => {
171
- n.trigger(c, t);
172
- },
173
- !1,
174
- s
175
- );
176
- });
177
- }
178
- })(this);
179
- }
180
- get target() {
181
- return this.#r.deref();
182
- }
183
- }
184
- class g extends d {
185
- _mc = {};
186
- constructor(t) {
187
- super(t);
188
- }
189
- static trigger = l;
190
- trigger(t, e = {}, r = 'l') {
191
- let o = this;
192
- if (o.constructor === g || o.constructor === f) {
193
- let s =
194
- t instanceof n ? new n(t.type, t.data, 'l') : new n(t, e, 'l'),
195
- c = 'string' != typeof t ? t : new n(t, e, r);
196
- return (
197
- [...Object.getOwnPropertyNames(o)].forEach((t) => {
198
- o[t]?.trigger &&
199
- 'function' == typeof o[t]?.trigger &&
200
- o[t]?.trigger(s);
201
- }),
202
- void (/[ud]/.test(c.bubble) && p(o.target, c))
203
- );
204
- }
205
- if (o instanceof g || o instanceof f) {
206
- const o = this,
207
- s = 'string' != typeof t ? t : new n(t, e, r),
208
- c = 'on' + s.type[0].toUpperCase() + s.type.slice(1);
209
- if (
210
- (s.bubble.indexOf('l') > -1 &&
211
- (s.immediateStopped ||
212
- 'function' != typeof o[c] ||
213
- (o[c](s), o.hasOwnProperty(c) && delete o[c])),
214
- s.stopped || 'l' === s.bubble)
215
- )
216
- return o;
217
- /[ud]/.test(s.bubble) && p(o.target, s);
218
- }
219
- }
220
- }
221
- class f extends d {
222
- _mc = {};
223
- constructor(t, e = !1) {
224
- super(t);
225
- }
226
- static add = a;
227
- static remove = u;
228
- static trigger = l;
229
- trigger(t, e = {}, n) {
230
- g.prototype.trigger.call(this, t, e, n);
231
- }
232
- parent(t = '') {
233
- let e = this.target;
234
- return i(e) ? c(e.parentNode, t, !0) : [];
235
- }
236
- ancestors(t = '') {
237
- let e = this?.target;
238
- return i(e) ? c(this.target.parentNode, t, !1) : [];
239
- }
240
- children(t = '') {
241
- let e = this?.target;
242
- if (!i(e)) return [];
243
- const n = Math.random().toString().replace('.', ''),
244
- r = '[_mc]:not([temp_id="' + n + '"] [_mc] [_mc])';
245
- e.setAttribute('temp_id', n);
246
- const o = s([...e.querySelectorAll(r)], t);
247
- return e.removeAttribute('temp_id'), o;
248
- }
249
- descendants(t = '') {
250
- let e = this?.target;
251
- return i(e) ? s([...e.querySelectorAll('*[_mc]')], t) : [];
252
- }
253
- }
254
- new Map();
255
- class m extends HTMLElement {
256
- constructor() {
257
- super();
258
- }
259
- connectedCallback() {
260
- f.trigger(this, 'Connected');
261
- }
262
- disconnectedCallback() {
263
- f.trigger(this, 'Disconnected');
264
- }
265
- adoptedCallback() {
266
- f.trigger(this, 'Adopted');
267
- }
268
- attributeChangedCallback(t, e, n) {
269
- f.trigger(this, 'AttributeChanged', {
270
- name: t,
271
- oldValue: e,
272
- newValue: n,
273
- });
274
- }
275
- }
276
- function b(t, e, n = []) {
277
- if (customElements.get(t))
278
- return void console.warn(
279
- `IGNORED: Custom element "${t}" is already defined!`
280
- );
281
- if (!t.includes('-'))
282
- throw new Error(
283
- 'createCustomElement: tagName must contain at least one hyphen ("-").'
284
- );
285
- let r = t
286
- .split('-')
287
- .map((t) => t.charAt(0).toUpperCase() + t.slice(1))
288
- .join('');
289
- customElements.define(
290
- t,
291
- (function (t, e) {
292
- return Object.defineProperty(e, 'name', { value: t });
293
- })(
294
- r,
295
- class extends m {
296
- instance;
297
- constructor(t) {
298
- super();
299
- let n = new e(this, t);
300
- f.add(this, r, n);
301
- }
302
- static get observedAttributes() {
303
- return n;
304
- }
305
- }
306
- )
307
- );
308
- }
309
- b(
310
- 'test-parent',
311
- class extends f {
312
- constructor(t) {
313
- super(t);
314
- }
315
- onConnected() {
316
- console.log('TestParent onConnect');
317
- }
318
- }
319
- );
320
- const h = customElements.get('test-parent');
321
- return (
322
- b(
323
- 'test-grandparent',
324
- class extends f {
325
- constructor(t) {
326
- super(t);
327
- }
328
- onConnected() {
329
- let t = this;
330
- for (let e = 0; e < 5; e++) t.target.append(new h());
331
- console.log('Grandparent onConnect');
332
- }
333
- }
334
- ),
335
- {}
336
- );
337
- })()
338
- );