@twobirds/microcomponents 0.1.1 → 0.1.3

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 (343) hide show
  1. package/dist/MC.d.ts +0 -1
  2. package/dist/MC.js +6 -5
  3. package/dist/MC.min.js +39 -56
  4. package/dist/MC.ts +6 -4
  5. package/dist/elements.d.ts +0 -1
  6. package/dist/elements.js +0 -1
  7. package/dist/elements.min.js +1 -1
  8. package/dist/formValues.d.ts +0 -1
  9. package/dist/formValues.js +0 -1
  10. package/dist/formValues.min.js +1 -1
  11. package/dist/helpers.d.ts +0 -1
  12. package/dist/helpers.js +0 -1
  13. package/dist/microcomponents.d.ts +0 -1
  14. package/dist/microcomponents.js +0 -1
  15. package/dist/microcomponents.min.js +1 -1
  16. package/dist/observables.d.ts +0 -1
  17. package/dist/observables.js +0 -1
  18. package/dist/observables.min.js +1 -1
  19. package/package.json +10 -2
  20. package/.gitlab-ci.yml +0 -18
  21. package/.vscode/settings.json +0 -3
  22. package/MicroComponents.svg +0 -15
  23. package/assets/documentation/MC.md +0 -547
  24. package/assets/documentation/MicroComponents.svg +0 -15
  25. package/assets/documentation/ajaxian-1.png +0 -0
  26. package/assets/documentation/ajaxian-2.png +0 -0
  27. package/assets/documentation/ajaxian-3.png +0 -0
  28. package/assets/documentation/elements.md +0 -277
  29. package/assets/documentation/formvalues.md +0 -25
  30. package/assets/documentation/functional_requirements.md +0 -8
  31. package/assets/documentation/history.md +0 -436
  32. package/assets/documentation/klemmstein.png +0 -0
  33. package/assets/documentation/magic.md +0 -29
  34. package/assets/documentation/observables.md +0 -187
  35. package/assets/documentation/rnd0023-1.jpg +0 -0
  36. package/assets/documentation/rnd0023-2.jpg +0 -0
  37. package/assets/documentation/rnd0023-3.jpg +0 -0
  38. package/assets/documentation/tB_react.md +0 -207
  39. package/assets/documentation/usage.md +0 -142
  40. package/assets/documentation/why.md +0 -25
  41. package/assets/fiddle/MicroComponents.svg +0 -15
  42. package/assets/fiddle/fiddle.css +0 -0
  43. package/assets/fiddle/fiddle.js +0 -0
  44. package/assets/fiddle/index.html +0 -0
  45. package/assets/test/MicroComponents.svg +0 -15
  46. package/assets/test/grandparent.css +0 -16
  47. package/assets/test/myButton.css +0 -19
  48. package/assets/test/style.css +0 -8
  49. package/assets/test/test.html +0 -29
  50. package/assets/test/testform.json +0 -27
  51. package/dist/MC.d.ts.map +0 -1
  52. package/dist/elements.d.ts.map +0 -1
  53. package/dist/formValues.d.ts.map +0 -1
  54. package/dist/helpers.d.ts.map +0 -1
  55. package/dist/microcomponents.d.ts.map +0 -1
  56. package/dist/observables.d.ts.map +0 -1
  57. package/public/.nojekyll +0 -1
  58. package/public/MC.d.ts +0 -39
  59. package/public/MC.d.ts.map +0 -1
  60. package/public/MC.js +0 -287
  61. package/public/MC.js.map +0 -1
  62. package/public/MC.min.js +0 -348
  63. package/public/MC.ts +0 -431
  64. package/public/MicroComponents.svg +0 -15
  65. package/public/documentation/MC.md +0 -547
  66. package/public/documentation/MicroComponents.svg +0 -15
  67. package/public/documentation/ajaxian-1.png +0 -0
  68. package/public/documentation/ajaxian-2.png +0 -0
  69. package/public/documentation/ajaxian-3.png +0 -0
  70. package/public/documentation/elements.md +0 -277
  71. package/public/documentation/formvalues.md +0 -25
  72. package/public/documentation/functional_requirements.md +0 -8
  73. package/public/documentation/history.md +0 -436
  74. package/public/documentation/klemmstein.png +0 -0
  75. package/public/documentation/magic.md +0 -29
  76. package/public/documentation/observables.md +0 -187
  77. package/public/documentation/rnd0023-1.jpg +0 -0
  78. package/public/documentation/rnd0023-2.jpg +0 -0
  79. package/public/documentation/rnd0023-3.jpg +0 -0
  80. package/public/documentation/tB_react.md +0 -207
  81. package/public/documentation/usage.md +0 -142
  82. package/public/documentation/why.md +0 -25
  83. package/public/elements.d.ts +0 -5
  84. package/public/elements.d.ts.map +0 -1
  85. package/public/elements.js +0 -68
  86. package/public/elements.js.map +0 -1
  87. package/public/elements.min.js +0 -1
  88. package/public/elements.ts +0 -119
  89. package/public/fiddle/MicroComponents.svg +0 -15
  90. package/public/fiddle/fiddle.css +0 -0
  91. package/public/fiddle/fiddle.js +0 -0
  92. package/public/fiddle/index.html +0 -0
  93. package/public/formValues.d.ts +0 -3
  94. package/public/formValues.d.ts.map +0 -1
  95. package/public/formValues.js +0 -162
  96. package/public/formValues.js.map +0 -1
  97. package/public/formValues.min.js +0 -1
  98. package/public/formValues.ts +0 -225
  99. package/public/helpers.d.ts +0 -14
  100. package/public/helpers.d.ts.map +0 -1
  101. package/public/helpers.js +0 -113
  102. package/public/helpers.js.map +0 -1
  103. package/public/helpers.ts +0 -149
  104. package/public/microcomponents.d.ts +0 -6
  105. package/public/microcomponents.d.ts.map +0 -1
  106. package/public/microcomponents.js +0 -7
  107. package/public/microcomponents.js.map +0 -1
  108. package/public/microcomponents.min.js +0 -1
  109. package/public/microcomponents.ts +0 -8
  110. package/public/observables.d.ts +0 -11
  111. package/public/observables.d.ts.map +0 -1
  112. package/public/observables.js +0 -244
  113. package/public/observables.js.map +0 -1
  114. package/public/observables.min.js +0 -1
  115. package/public/observables.ts +0 -416
  116. package/public/selectors._ts +0 -1269
  117. package/public/src/MC.d.ts +0 -39
  118. package/public/src/MC.d.ts.map +0 -1
  119. package/public/src/MC.js +0 -287
  120. package/public/src/MC.js.map +0 -1
  121. package/public/src/MC.ts +0 -431
  122. package/public/src/elements.d.ts +0 -5
  123. package/public/src/elements.d.ts.map +0 -1
  124. package/public/src/elements.js +0 -68
  125. package/public/src/elements.js.map +0 -1
  126. package/public/src/elements.ts +0 -119
  127. package/public/src/formValues.d.ts +0 -3
  128. package/public/src/formValues.d.ts.map +0 -1
  129. package/public/src/formValues.js +0 -162
  130. package/public/src/formValues.js.map +0 -1
  131. package/public/src/formValues.ts +0 -225
  132. package/public/src/helpers.d.ts +0 -14
  133. package/public/src/helpers.d.ts.map +0 -1
  134. package/public/src/helpers.js +0 -113
  135. package/public/src/helpers.js.map +0 -1
  136. package/public/src/helpers.ts +0 -149
  137. package/public/src/microcomponents.d.ts +0 -6
  138. package/public/src/microcomponents.d.ts.map +0 -1
  139. package/public/src/microcomponents.js +0 -7
  140. package/public/src/microcomponents.js.map +0 -1
  141. package/public/src/microcomponents.ts +0 -8
  142. package/public/src/observables.d.ts +0 -11
  143. package/public/src/observables.d.ts.map +0 -1
  144. package/public/src/observables.js +0 -244
  145. package/public/src/observables.js.map +0 -1
  146. package/public/src/observables.ts +0 -416
  147. package/public/src/selectors._ts +0 -1269
  148. package/public/src/test/grandparent.css +0 -14
  149. package/public/src/test/test/child.d.ts +0 -2
  150. package/public/src/test/test/child.d.ts.map +0 -1
  151. package/public/src/test/test/child.js +0 -26
  152. package/public/src/test/test/child.js.map +0 -1
  153. package/public/src/test/test/child.ts +0 -36
  154. package/public/src/test/test/grandchild.d.ts +0 -2
  155. package/public/src/test/test/grandchild.d.ts.map +0 -1
  156. package/public/src/test/test/grandchild.js +0 -22
  157. package/public/src/test/test/grandchild.js.map +0 -1
  158. package/public/src/test/test/grandchild.ts +0 -31
  159. package/public/src/test/test/grandparent.d.ts +0 -2
  160. package/public/src/test/test/grandparent.d.ts.map +0 -1
  161. package/public/src/test/test/grandparent.js +0 -1
  162. package/public/src/test/test/grandparent.js.map +0 -1
  163. package/public/src/test/test/grandparent.ts +0 -43
  164. package/public/src/test/test/greatgrandchild.d.ts +0 -2
  165. package/public/src/test/test/greatgrandchild.d.ts.map +0 -1
  166. package/public/src/test/test/greatgrandchild.js +0 -36
  167. package/public/src/test/test/greatgrandchild.js.map +0 -1
  168. package/public/src/test/test/greatgrandchild.ts +0 -51
  169. package/public/src/test/test/parent.d.ts +0 -2
  170. package/public/src/test/test/parent.d.ts.map +0 -1
  171. package/public/src/test/test/parent.js +0 -25
  172. package/public/src/test/test/parent.js.map +0 -1
  173. package/public/src/test/test/parent.ts +0 -35
  174. package/public/src/test/test/testform.d.ts +0 -2
  175. package/public/src/test/test/testform.d.ts.map +0 -1
  176. package/public/src/test/test/testform.js +0 -1
  177. package/public/src/test/test/testform.js.map +0 -1
  178. package/public/src/test/test/testform.ts +0 -153
  179. package/public/src/test/test/testfunction.d.ts +0 -3
  180. package/public/src/test/test/testfunction.d.ts.map +0 -1
  181. package/public/src/test/test/testfunction.js +0 -7
  182. package/public/src/test/test/testfunction.js.map +0 -1
  183. package/public/src/test/test/testfunction.ts +0 -12
  184. package/public/src/test/test/testmc.d.ts +0 -3
  185. package/public/src/test/test/testmc.d.ts.map +0 -1
  186. package/public/src/test/test/testmc.js +0 -10
  187. package/public/src/test/test/testmc.js.map +0 -1
  188. package/public/src/test/test/testmc.ts +0 -16
  189. package/public/src/test/test/testsimpleclass.d.ts +0 -3
  190. package/public/src/test/test/testsimpleclass.d.ts.map +0 -1
  191. package/public/src/test/test/testsimpleclass.js +0 -9
  192. package/public/src/test/test/testsimpleclass.js.map +0 -1
  193. package/public/src/test/test/testsimpleclass.ts +0 -15
  194. package/public/src/test/test.d.ts +0 -2
  195. package/public/src/test/test.d.ts.map +0 -1
  196. package/public/src/test/test.js +0 -72
  197. package/public/src/test/test.js.map +0 -1
  198. package/public/src/test/test.ts +0 -176
  199. package/public/src/test/testform.css +0 -47
  200. package/public/src/test/testform.html +0 -56
  201. package/public/src/test/testform.json +0 -27
  202. package/public/test/MC.d.ts +0 -39
  203. package/public/test/MC.d.ts.map +0 -1
  204. package/public/test/MC.js +0 -287
  205. package/public/test/MC.min.js +0 -348
  206. package/public/test/MC.ts +0 -431
  207. package/public/test/MicroComponents.svg +0 -15
  208. package/public/test/elements.d.ts +0 -5
  209. package/public/test/elements.d.ts.map +0 -1
  210. package/public/test/elements.js +0 -68
  211. package/public/test/elements.min.js +0 -1
  212. package/public/test/elements.ts +0 -119
  213. package/public/test/formValues.d.ts +0 -3
  214. package/public/test/formValues.d.ts.map +0 -1
  215. package/public/test/formValues.js +0 -162
  216. package/public/test/formValues.min.js +0 -1
  217. package/public/test/formValues.ts +0 -225
  218. package/public/test/grandparent.css +0 -14
  219. package/public/test/helpers.d.ts +0 -14
  220. package/public/test/helpers.d.ts.map +0 -1
  221. package/public/test/helpers.js +0 -113
  222. package/public/test/helpers.ts +0 -149
  223. package/public/test/microcomponents.d.ts +0 -6
  224. package/public/test/microcomponents.d.ts.map +0 -1
  225. package/public/test/microcomponents.js +0 -7
  226. package/public/test/microcomponents.min.js +0 -1
  227. package/public/test/microcomponents.ts +0 -8
  228. package/public/test/myButton.css +0 -19
  229. package/public/test/observables.d.ts +0 -11
  230. package/public/test/observables.d.ts.map +0 -1
  231. package/public/test/observables.js +0 -244
  232. package/public/test/observables.min.js +0 -1
  233. package/public/test/observables.ts +0 -416
  234. package/public/test/style.css +0 -8
  235. package/public/test/test/child.d.ts +0 -2
  236. package/public/test/test/child.d.ts.map +0 -1
  237. package/public/test/test/child.js +0 -26
  238. package/public/test/test/child.js.map +0 -1
  239. package/public/test/test/child.ts +0 -36
  240. package/public/test/test/grandchild.d.ts +0 -2
  241. package/public/test/test/grandchild.d.ts.map +0 -1
  242. package/public/test/test/grandchild.js +0 -22
  243. package/public/test/test/grandchild.js.map +0 -1
  244. package/public/test/test/grandchild.ts +0 -31
  245. package/public/test/test/grandparent.d.ts +0 -2
  246. package/public/test/test/grandparent.d.ts.map +0 -1
  247. package/public/test/test/grandparent.js +0 -1
  248. package/public/test/test/grandparent.js.map +0 -1
  249. package/public/test/test/grandparent.ts +0 -43
  250. package/public/test/test/greatgrandchild.d.ts +0 -2
  251. package/public/test/test/greatgrandchild.d.ts.map +0 -1
  252. package/public/test/test/greatgrandchild.js +0 -36
  253. package/public/test/test/greatgrandchild.js.map +0 -1
  254. package/public/test/test/greatgrandchild.ts +0 -51
  255. package/public/test/test/parent.d.ts +0 -2
  256. package/public/test/test/parent.d.ts.map +0 -1
  257. package/public/test/test/parent.js +0 -25
  258. package/public/test/test/parent.js.map +0 -1
  259. package/public/test/test/parent.ts +0 -35
  260. package/public/test/test/testform.d.ts +0 -2
  261. package/public/test/test/testform.d.ts.map +0 -1
  262. package/public/test/test/testform.js +0 -1
  263. package/public/test/test/testform.js.map +0 -1
  264. package/public/test/test/testform.ts +0 -153
  265. package/public/test/test/testfunction.d.ts +0 -3
  266. package/public/test/test/testfunction.d.ts.map +0 -1
  267. package/public/test/test/testfunction.js +0 -7
  268. package/public/test/test/testfunction.js.map +0 -1
  269. package/public/test/test/testfunction.ts +0 -12
  270. package/public/test/test/testmc.d.ts +0 -3
  271. package/public/test/test/testmc.d.ts.map +0 -1
  272. package/public/test/test/testmc.js +0 -10
  273. package/public/test/test/testmc.js.map +0 -1
  274. package/public/test/test/testmc.ts +0 -16
  275. package/public/test/test/testsimpleclass.d.ts +0 -3
  276. package/public/test/test/testsimpleclass.d.ts.map +0 -1
  277. package/public/test/test/testsimpleclass.js +0 -9
  278. package/public/test/test/testsimpleclass.js.map +0 -1
  279. package/public/test/test/testsimpleclass.ts +0 -15
  280. package/public/test/test.d.ts +0 -2
  281. package/public/test/test.d.ts.map +0 -1
  282. package/public/test/test.html +0 -29
  283. package/public/test/test.js +0 -72
  284. package/public/test/test.js.map +0 -1
  285. package/public/test/test.ts +0 -176
  286. package/public/test/testform.css +0 -47
  287. package/public/test/testform.html +0 -56
  288. package/public/test/testform.json +0 -27
  289. package/public/typedoc/.nojekyll +0 -1
  290. package/public/typedoc/assets/highlight.css +0 -106
  291. package/public/typedoc/assets/icons.js +0 -18
  292. package/public/typedoc/assets/icons.svg +0 -1
  293. package/public/typedoc/assets/main.js +0 -60
  294. package/public/typedoc/assets/navigation.js +0 -1
  295. package/public/typedoc/assets/search.js +0 -1
  296. package/public/typedoc/assets/style.css +0 -1493
  297. package/public/typedoc/classes/MC.DC.html +0 -13
  298. package/public/typedoc/classes/MC.MC.html +0 -3
  299. package/public/typedoc/classes/MC.McBase.html +0 -3
  300. package/public/typedoc/functions/MC.autoload.html +0 -1
  301. package/public/typedoc/functions/MC.off.html +0 -1
  302. package/public/typedoc/functions/MC.on.html +0 -1
  303. package/public/typedoc/functions/MC.one.html +0 -1
  304. package/public/typedoc/functions/MC.trigger.html +0 -1
  305. package/public/typedoc/functions/elements.defineCE.html +0 -1
  306. package/public/typedoc/functions/elements.getCE.html +0 -1
  307. package/public/typedoc/functions/formValues.formValues.html +0 -1
  308. package/public/typedoc/functions/observables.observe.html +0 -1
  309. package/public/typedoc/hierarchy.html +0 -1
  310. package/public/typedoc/index.html +0 -122
  311. package/public/typedoc/interfaces/MC.HTMLMcElement.html +0 -758
  312. package/public/typedoc/media/MicroComponents.svg +0 -15
  313. package/public/typedoc/modules/MC.html +0 -10
  314. package/public/typedoc/modules/elements.html +0 -3
  315. package/public/typedoc/modules/formValues.html +0 -2
  316. package/public/typedoc/modules/observables.html +0 -3
  317. package/public/typedoc/modules.html +0 -5
  318. package/public/typedoc/types/observables.Observable.html +0 -1
  319. package/src/MC.ts +0 -431
  320. package/src/elements.ts +0 -119
  321. package/src/formValues.ts +0 -225
  322. package/src/helpers.ts +0 -149
  323. package/src/microcomponents.ts +0 -8
  324. package/src/observables.ts +0 -416
  325. package/src/selectors._ts +0 -1269
  326. package/src/test/grandparent.css +0 -14
  327. package/src/test/test/child.ts +0 -36
  328. package/src/test/test/grandchild.ts +0 -31
  329. package/src/test/test/grandparent.ts +0 -43
  330. package/src/test/test/greatgrandchild.ts +0 -51
  331. package/src/test/test/parent.ts +0 -35
  332. package/src/test/test/testform.ts +0 -153
  333. package/src/test/test/testfunction.ts +0 -12
  334. package/src/test/test/testmc.ts +0 -16
  335. package/src/test/test/testsimpleclass.ts +0 -15
  336. package/src/test/test.ts +0 -176
  337. package/src/test/testform.css +0 -47
  338. package/src/test/testform.html +0 -56
  339. package/src/test/testform.json +0 -27
  340. package/tasks.md +0 -36
  341. package/tsconfig.json +0 -107
  342. package/typedoc.json +0 -7
  343. package/webpack.config.js +0 -346
@@ -1,14 +0,0 @@
1
- test-grandparent,
2
- test-parent,
3
- test-child,
4
- test-grandchild,
5
- test-greatgrandchild {
6
- user-select: none;
7
- caret-color: transparent;
8
-
9
- display: inline-block;
10
- padding: 1px;
11
- margin: 1px;
12
- border: 1px solid darkslategray;
13
- border-radius: 2px;
14
- }
@@ -1,36 +0,0 @@
1
- import { DC, defineCE, getCE } from './../../microcomponents.js';
2
- import { Grandchild } from './grandchild.js';
3
- defineCE(
4
- 'test-child',
5
-
6
- class TestChild extends DC {
7
- constructor(target: HTMLElement) {
8
- super(target);
9
- }
10
-
11
- onConnected() {
12
- let that = this;
13
-
14
- for (let x = 0; x < 10; x++) {
15
- that.target.append(new Grandchild!());
16
- }
17
- }
18
-
19
- onClick(ev: Event){
20
- this.trigger('Up', null, 'lu');
21
- ev.stopImmediatePropagation();
22
- }
23
-
24
- onUp( ev: CustomEvent ){
25
- console.log( 'child "Up" handler' );
26
- ev.detail.control.stop();
27
- }
28
-
29
- onDown( ev: CustomEvent ){
30
- console.log( 'child "Down" handler' );
31
- }
32
-
33
- }
34
- );
35
-
36
- export const Child = getCE('test-child');
@@ -1,31 +0,0 @@
1
- import { DC, defineCE, getCE } from '../../microcomponents.js';
2
- import { Greatgrandchild } from './greatgrandchild.js';
3
- defineCE(
4
- 'test-grandchild',
5
-
6
- class TestGrandchild extends DC {
7
- constructor(target: HTMLElement) {
8
- super(target);
9
- }
10
-
11
- onConnected() {
12
- let that = this;
13
-
14
- for (let x = 0; x < 2; x++) {
15
- that.target.append(new Greatgrandchild!());
16
- }
17
- }
18
-
19
- onClick(ev: Event){
20
- this.trigger('Up', null, 'lu');
21
- ev.stopImmediatePropagation();
22
- }
23
-
24
- onUp( ev: CustomEvent ){
25
- console.log( 'grandchild "Up" handler' );
26
- }
27
-
28
- }
29
- );
30
-
31
- export const Grandchild = getCE('test-grandchild');
@@ -1,43 +0,0 @@
1
- import { DC, defineCE, getCE } from '../../microcomponents.js';
2
- import { Parent } from './parent.js';
3
- defineCE(
4
- 'test-grandparent',
5
-
6
- class TestGrandparent extends DC {
7
- constructor(target: HTMLElement) {
8
- super(target);
9
- }
10
-
11
- onConnected(ev:CustomEvent) {
12
- for (let x = 0; x < 5; x++) {
13
- this.target.append(new Parent!());
14
- }
15
- }
16
-
17
- onDisconnected(ev:CustomEvent) {
18
- }
19
-
20
- onAdopted(ev:CustomEvent) {
21
- }
22
-
23
- onAttributeChanged(ev:CustomEvent) {
24
- }
25
-
26
- onClick(ev: Event){
27
- this.trigger('Up', null, 'lu');
28
- ev.stopImmediatePropagation();
29
- }
30
-
31
- onUp( ev: CustomEvent ){
32
- console.log( 'grandparent "Up" handler' );
33
- this.trigger('Down', {}, 'ld');
34
- }
35
-
36
- onDown( ev: CustomEvent ){
37
- console.log( 'grandparent "Down" handler' );
38
- }
39
-
40
- }
41
- );
42
-
43
- export const GrandParent = getCE('test-grandparent');
@@ -1,51 +0,0 @@
1
- import { DC, defineCE, getCE } from '../../microcomponents.js';
2
-
3
- function random(min: number, max: number) {
4
- var random = Math.floor(Math.random() * (max - min + 1) + min);
5
- return random;
6
- }
7
-
8
- defineCE(
9
- 'test-greatgrandchild',
10
-
11
- class TestGreatgrandchild extends DC {
12
- constructor(target: HTMLElement) {
13
- super(target);
14
- }
15
-
16
- onConnected() {
17
- let that = this;
18
-
19
- that.updateStyle();
20
- }
21
-
22
- onClick(ev: Event){
23
- this.trigger('Up', null, 'lu');
24
- ev.stopImmediatePropagation();
25
- }
26
-
27
- onUp( ev: CustomEvent ){
28
- console.log( 'greatgrandchild "Up" handler' );
29
- }
30
-
31
- updateStyle() {
32
- var that = this;
33
-
34
- function randomBorderColor() {
35
- return (
36
- 'rgb(' +
37
- random(0, 255) +
38
- ',' +
39
- random(0, 255) +
40
- ',' +
41
- random(0, 255) +
42
- ')'
43
- );
44
- }
45
-
46
- that.target.setAttribute('style', 'border-color:' + randomBorderColor());
47
- }
48
- }
49
- );
50
-
51
- export const Greatgrandchild = getCE('test-greatgrandchild');
@@ -1,35 +0,0 @@
1
- import { DC, defineCE, getCE } from '../../microcomponents.js';
2
- import { Child } from './child.js';
3
- defineCE(
4
- 'test-parent',
5
-
6
- class Parent extends DC {
7
- constructor(target: HTMLElement) {
8
- super(target);
9
- }
10
-
11
- onConnected() {
12
- let that = this;
13
-
14
- for (let x = 0; x < 5; x++) {
15
- that.target.append(new Child!());
16
- }
17
- }
18
-
19
- onClick(ev: Event){
20
- this.trigger('Up', null, 'lu');
21
- ev.stopImmediatePropagation();
22
- }
23
-
24
- onUp( ev: CustomEvent ){
25
- console.log( 'parent "Up" handler' );
26
- }
27
-
28
- onDown( ev: CustomEvent ){
29
- console.log( 'parent "Down" handler' );
30
- }
31
-
32
- }
33
- );
34
-
35
- export const Parent = getCE('test-parent');
@@ -1,153 +0,0 @@
1
- 'use strict';
2
- import {
3
- DC,
4
- defineCE,
5
- Observable,
6
- formValues,
7
- LooseObject
8
- } from '../../microcomponents.js';
9
-
10
- defineCE(
11
- 'test-testform',
12
-
13
- class TestForm extends DC {
14
- data: unknown;
15
-
16
- constructor(target: HTMLElement) {
17
- super(target);
18
-
19
- let shadow = (this as DC).target.attachShadow({ mode: 'open' });
20
- shadow.innerHTML = `<style>${this.css}</style>${this.template}`;
21
-
22
- formValues(this, 'data', shadow); // create this.data formdata observable
23
-
24
- (this.data as Observable).bind(shadow); // 1 way bind formdata to the form DOM
25
-
26
- // load and display data
27
- fetch('./testform.json')
28
- .then( res => res.json())
29
- .then( data => {
30
- this.data = data;
31
- });
32
-
33
- }
34
-
35
- get template() {
36
- return /*html*/ `
37
- <form>
38
- <!-- sample form to start with -->
39
- <fieldset>
40
- <legend>Inputs</legend>
41
- <label>text</label><input type="text" name="textInput" value="Hallo" />&nbsp;<strong>2wB:&nbsp;</strong>{textInput}<br />
42
- <label>color</label><input type="color" name="colorInput" value="#000000" /><br />
43
- <label>date</label><input type="date" name="dateInput" value="" /><br />
44
- <label>datetime-local</label><input type="datetime-local" name="dtlInput" value="" /><br />
45
- <label>email</label><input type="email" name="email" value="" /><br />
46
- <label>file</label><input type="file" name="fileInput" value="" /><br />
47
- <label>hidden</label><input type="hidden" name="hiddenInput" value="hiddenVal" /><br />
48
- <label>month</label><input type="month" name="month" value="" /><br />
49
- <label>number</label><input type="number" name="number" value="" /><br />
50
- <label>password</label><input type="password" name="passInput" value="" /><br />
51
- <label>range</label><input type="range" name="rangeInput" value="" /><br />
52
- <label>search</label><input type="search" name="searchInput" value="" /><br />
53
- <label>tel</label><input type="tel" name="telInput" value="" /><br />
54
- <label>time</label><input type="time" name="timeInput" value="" /><br />
55
- <label>url</label><input type="url" name="urlInput" value="" /><br />
56
- <label>week</label><input type="week" name="weekInput" value="" /><br />
57
- </fieldset>
58
-
59
- <fieldset>
60
- <legend>Selects&nbsp;<strong>2wB:&nbsp;</strong>&nbsp;<span>"{singleSelect}"</span>&nbsp;<span>[{multiSelect}]</span></legend>
61
-
62
- <label>singleSelect</label>
63
- <select name="singleSelect">
64
- <option disabled selected value> -- select -- </option>
65
- <option value="1">Option 1</option>
66
- <option value="2">Option 2</option>
67
- <option value="3">Option 3</option>
68
- <option value="4">Option 4</option>
69
- </select><br />
70
-
71
- <label>multiSelect</label>
72
- <select name="multiSelect" multiple="multiple" type="select-multiple">
73
- <option value="1">Option 1</option>
74
- <option value="2" selected=true>Option 2</option>
75
- <option value="3">Option 3</option>
76
- <option value="4" selected=true>Option 4</option>
77
- </select>
78
-
79
- </fieldset>
80
-
81
- <fieldset>
82
- <legend>Radiobuttons&nbsp;<strong>2wB:&nbsp;</strong><span>"{myRadio}"</span></legend>
83
-
84
- <label>radio1</label><input type="radio" name="myRadio" value="radio1"><br />
85
- <label>radio2</label><input type="radio" name="myRadio" value="radio2"><br />
86
- <label>radio3</label><input type="radio" name="myRadio" value="radio3"><br />
87
-
88
- </fieldset>
89
-
90
- <fieldset>
91
- <legend>Checkboxes</legend>
92
- <label>cb1</label><input type="checkbox" name="cb1"><br />
93
- <label>cb2</label><input type="checkbox" name="cb2"><br />
94
- <label>cb3</label><input type="checkbox" name="cb3"><br />
95
- <label>cb4</label><input type="checkbox" name="cb4"><br />
96
- <label>cb5</label><input type="checkbox" name="cb5"><br />
97
-
98
- </fieldset>
99
-
100
- <fieldset>
101
- <legend>TextArea</legend>
102
- <label>textArea</label>
103
- <textarea name="textArea">abc</textarea>
104
- </fieldset>
105
-
106
- </form>
107
- `;
108
- }
109
-
110
- get css() {
111
- return /*css*/ `
112
- legend {
113
- display: inherit;
114
- margin: inherit;
115
- vertical-align: inherit;
116
- font-weight: bold;
117
- }
118
-
119
- label {
120
- display: inline-block;
121
- margin-top: 1em;
122
- margin-left: 5px;
123
- vertical-align: top;
124
- min-width:10em;
125
- text-align: right;
126
- }
127
-
128
- form input,
129
- form select,
130
- form textarea {
131
- display: inline-block;
132
- margin-left: 5px;
133
- margin-top: 1.1em;
134
- }
135
-
136
- input[type="radio"],
137
- input[type="checkbox"] {
138
- margin-top: 1.3em;
139
- }
140
-
141
- body > form {
142
- display: block;
143
- }
144
-
145
- form fieldset {
146
- border: 1px solid #aaaaaa;
147
- border-radius: 3px;
148
- margin: 0.5em 0;
149
- }
150
- `;
151
- }
152
- }
153
- );
@@ -1,12 +0,0 @@
1
- import { defineCE, getCE } from '../../microcomponents.js';
2
-
3
- console.log( 'testfunction.ts' );
4
-
5
- defineCE(
6
- 'test-testfunction',
7
- function testfunction( a: number, b:number ){
8
- return a + b;
9
- }
10
- );
11
-
12
- export default getCE( 'test-testfunction' );
@@ -1,16 +0,0 @@
1
- import { defineCE, getCE, DC } from '../../microcomponents.js';
2
-
3
- defineCE(
4
- 'test-testmc',
5
- class TestMc extends DC {
6
- constructor(target: HTMLElement) {
7
- super(target);
8
- }
9
-
10
- oneInit() {
11
- // console.log('testmc connected to DOM');
12
- }
13
- }
14
- );
15
-
16
- export default getCE( 'test-testmc' );
@@ -1,15 +0,0 @@
1
- import { defineCE, getCE, DC } from '../../microcomponents.js';
2
-
3
- defineCE(
4
- 'test-testsimpleclass',
5
- class TestSimpleClass {
6
- constructor(target: HTMLElement) {
7
- }
8
-
9
- oneInit() {
10
- // console.log('testmc connected to DOM');
11
- }
12
- }
13
- );
14
-
15
- export default getCE( 'test-testsimpleclass' );
package/src/test/test.ts DELETED
@@ -1,176 +0,0 @@
1
- import {
2
- LooseObject,
3
- DC,
4
- defineCE,
5
- getCE,
6
- observe,
7
- Observable,
8
- HTMLMcElement,
9
- } from '../microcomponents.js';
10
-
11
- class Translator extends DC {
12
- #translations: LooseObject = {};
13
-
14
- Language: unknown = 'en';
15
- Translation: unknown = {};
16
-
17
- constructor(
18
- target: HTMLElement | ShadowRoot | DocumentFragment,
19
- translations: LooseObject,
20
- translationTargetObject: HTMLElement
21
- ) {
22
- super(target as HTMLElement);
23
- let that = this; // minifier help
24
-
25
- // state
26
- that.Language = 'en';
27
- that.Translation = {};
28
-
29
- observe(that);
30
-
31
- // setup
32
- that.#translations = translations;
33
-
34
- // on language change switch translation object
35
- (that.Language as Observable).observe((lang) => {
36
- if (that.#translations.hasOwnProperty(lang)) {
37
- that.Translation = { lang: that.#translations[lang] }; // set translation
38
- }
39
- });
40
-
41
- (that.Translation as Observable).bind(translationTargetObject);
42
-
43
- (that.Language as Observable).notify();
44
- }
45
-
46
- }
47
-
48
- class MyButton extends DC {
49
- #template: string = '{lang.click} {counter}';
50
-
51
- #languages = {
52
- en: {
53
- click: 'click me',
54
- },
55
- de: {
56
- click: 'klick mich',
57
- },
58
- };
59
-
60
- Dom: LooseObject = {};
61
-
62
- constructor(target: HTMLElement) {
63
- super(target);
64
-
65
- // render
66
- target.innerHTML = this.#template;
67
-
68
- // state
69
- this.Dom = { counter: 0 };
70
-
71
- // state: convert all props defined so far into observables
72
- observe(this);
73
-
74
- // add translator
75
- DC.add(
76
- target,
77
- 'Translator',
78
- new Translator(target, this.#languages, target)
79
- );
80
-
81
- // bind Dom to target
82
- (this.Dom as Observable).bind(this.target);
83
- }
84
-
85
- onClick(ev: Event) {
86
- // console.log('button.myButton onClick()');
87
- const c = this.Dom.counter++;
88
- ev.stopPropagation();
89
- (this.target as HTMLElement).classList.remove('clicked');
90
- (this.target as HTMLElement).classList.add( this.Dom.counter > 9 ? 'overClicked' : 'clicked' );
91
- }
92
- }
93
-
94
- function makeButton(): HTMLMcElement {
95
- const button = document.createElement('button');
96
- button.classList.add('myButton');
97
- DC.add( button, 'MyButton', new MyButton(button) );
98
- return button as unknown as HTMLMcElement;
99
- }
100
-
101
- defineCE(
102
- 'make-button',
103
- makeButton
104
- );
105
-
106
- let fragment = new DocumentFragment();
107
-
108
- /*
109
- stress test
110
- */
111
-
112
- let start = new Date().getTime(),
113
- max = 1000;
114
-
115
- // create 1000 elements
116
- for (let x = 0; x < max; x++) {
117
- fragment.append( (getCE('make-button') as Function)());
118
- }
119
-
120
- let end = new Date().getTime();
121
-
122
- // and put them into the DOM
123
- document.body.appendChild(fragment);
124
-
125
- //document.querySelectorAll('my-tag').forEach((e) => e.remove());
126
-
127
- /*
128
- console test
129
- */
130
-
131
- setTimeout(() => {
132
- // console.clear();
133
-
134
- console.log(
135
- '%c \n\nStress Test:\n\n %cInstancing %s buttons containing %s MCs: %c %s ms.',
136
- 'font-weight: bold; color: black;',
137
- 'font-weight: normal;',
138
- max,
139
- max * 3,
140
- 'font-weight: bold; color: orange;',
141
- end - start
142
- );
143
-
144
- //document.body.appendChild(new MyTag());
145
-
146
- let element = document.querySelector('button');
147
-
148
- console.log(
149
- "\n\n%cInspect this tag:%c \n( ...to see the inner structure in the '._mc' property )\n\n %O %c %s",
150
- 'font-weight: bold;',
151
- 'font-weight: normal;',
152
- element,
153
- 'font-weight: bold;',
154
- '\n\nLook up code in the debugger: test.js\n'
155
- );
156
-
157
- let form = ( document.querySelector('test-testform') as any);
158
- let formInstance = form._mc.TestTestform;
159
-
160
- (window as any).form = formInstance;
161
- console.log(
162
- "\n\n%cAttached a global variable 'form':%c \n\n %O %c %s %c %s %c %s",
163
- 'font-weight: bold;',
164
- 'font-weight: normal;',
165
- formInstance,
166
- 'font-weight: bold;',
167
- '\n\nYou can use it to change input values, e.g. \n\n',
168
- 'font-weight: normal;',
169
- ' form.data.textInput="other value"',
170
- 'font-weight: bold;',
171
- '\n\nChanges will be reflected in the form contents, same as vice versa.\n'
172
- );
173
-
174
- // will trigger the event on all micro components contained in <my-tag>
175
- ( element as unknown as HTMLMcElement )._mc?.trigger('doSomething');
176
- }, 1000);
@@ -1,47 +0,0 @@
1
- legend {
2
- display: inherit;
3
- margin: inherit;
4
- vertical-align: inherit;
5
- }
6
-
7
- label {
8
- display: inline;
9
- margin-top: 5px;
10
- margin-left: 5px;
11
- vertical-align: top;
12
- width: 10em;
13
- text-align: right;
14
- }
15
-
16
- label::before {
17
- content: ' ';
18
- display: block;
19
- }
20
-
21
- form input,
22
- form select,
23
- form textarea {
24
- margin-left: 5px;
25
- margin-top: 0px;
26
- display: inline;
27
- }
28
-
29
- form label + textarea {
30
- display: inline-block;
31
- margin-top: 3px;
32
- }
33
-
34
- form input + label {
35
- width: inherit;
36
- margin-top: 3px;
37
- text-align: left;
38
- }
39
-
40
- body > form {
41
- display: block;
42
- }
43
-
44
- form fieldset {
45
- border: 1px solid darkslategrey;
46
- border-radius: 3px;
47
- }