@twobirds/microcomponents 0.1.1 → 0.1.2

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 (324) hide show
  1. package/dist/MC.min.js +33 -52
  2. package/dist/elements.min.js +1 -1
  3. package/dist/formValues.min.js +1 -1
  4. package/dist/microcomponents.min.js +1 -1
  5. package/dist/observables.min.js +1 -1
  6. package/package.json +11 -2
  7. package/.gitlab-ci.yml +0 -18
  8. package/.vscode/settings.json +0 -3
  9. package/MicroComponents.svg +0 -15
  10. package/assets/documentation/MC.md +0 -547
  11. package/assets/documentation/MicroComponents.svg +0 -15
  12. package/assets/documentation/ajaxian-1.png +0 -0
  13. package/assets/documentation/ajaxian-2.png +0 -0
  14. package/assets/documentation/ajaxian-3.png +0 -0
  15. package/assets/documentation/elements.md +0 -277
  16. package/assets/documentation/formvalues.md +0 -25
  17. package/assets/documentation/functional_requirements.md +0 -8
  18. package/assets/documentation/history.md +0 -436
  19. package/assets/documentation/klemmstein.png +0 -0
  20. package/assets/documentation/magic.md +0 -29
  21. package/assets/documentation/observables.md +0 -187
  22. package/assets/documentation/rnd0023-1.jpg +0 -0
  23. package/assets/documentation/rnd0023-2.jpg +0 -0
  24. package/assets/documentation/rnd0023-3.jpg +0 -0
  25. package/assets/documentation/tB_react.md +0 -207
  26. package/assets/documentation/usage.md +0 -142
  27. package/assets/documentation/why.md +0 -25
  28. package/assets/fiddle/MicroComponents.svg +0 -15
  29. package/assets/fiddle/fiddle.css +0 -0
  30. package/assets/fiddle/fiddle.js +0 -0
  31. package/assets/fiddle/index.html +0 -0
  32. package/assets/test/MicroComponents.svg +0 -15
  33. package/assets/test/grandparent.css +0 -16
  34. package/assets/test/myButton.css +0 -19
  35. package/assets/test/style.css +0 -8
  36. package/assets/test/test.html +0 -29
  37. package/assets/test/testform.json +0 -27
  38. package/public/.nojekyll +0 -1
  39. package/public/MC.d.ts +0 -39
  40. package/public/MC.d.ts.map +0 -1
  41. package/public/MC.js +0 -287
  42. package/public/MC.js.map +0 -1
  43. package/public/MC.min.js +0 -348
  44. package/public/MC.ts +0 -431
  45. package/public/MicroComponents.svg +0 -15
  46. package/public/documentation/MC.md +0 -547
  47. package/public/documentation/MicroComponents.svg +0 -15
  48. package/public/documentation/ajaxian-1.png +0 -0
  49. package/public/documentation/ajaxian-2.png +0 -0
  50. package/public/documentation/ajaxian-3.png +0 -0
  51. package/public/documentation/elements.md +0 -277
  52. package/public/documentation/formvalues.md +0 -25
  53. package/public/documentation/functional_requirements.md +0 -8
  54. package/public/documentation/history.md +0 -436
  55. package/public/documentation/klemmstein.png +0 -0
  56. package/public/documentation/magic.md +0 -29
  57. package/public/documentation/observables.md +0 -187
  58. package/public/documentation/rnd0023-1.jpg +0 -0
  59. package/public/documentation/rnd0023-2.jpg +0 -0
  60. package/public/documentation/rnd0023-3.jpg +0 -0
  61. package/public/documentation/tB_react.md +0 -207
  62. package/public/documentation/usage.md +0 -142
  63. package/public/documentation/why.md +0 -25
  64. package/public/elements.d.ts +0 -5
  65. package/public/elements.d.ts.map +0 -1
  66. package/public/elements.js +0 -68
  67. package/public/elements.js.map +0 -1
  68. package/public/elements.min.js +0 -1
  69. package/public/elements.ts +0 -119
  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.d.ts +0 -3
  75. package/public/formValues.d.ts.map +0 -1
  76. package/public/formValues.js +0 -162
  77. package/public/formValues.js.map +0 -1
  78. package/public/formValues.min.js +0 -1
  79. package/public/formValues.ts +0 -225
  80. package/public/helpers.d.ts +0 -14
  81. package/public/helpers.d.ts.map +0 -1
  82. package/public/helpers.js +0 -113
  83. package/public/helpers.js.map +0 -1
  84. package/public/helpers.ts +0 -149
  85. package/public/microcomponents.d.ts +0 -6
  86. package/public/microcomponents.d.ts.map +0 -1
  87. package/public/microcomponents.js +0 -7
  88. package/public/microcomponents.js.map +0 -1
  89. package/public/microcomponents.min.js +0 -1
  90. package/public/microcomponents.ts +0 -8
  91. package/public/observables.d.ts +0 -11
  92. package/public/observables.d.ts.map +0 -1
  93. package/public/observables.js +0 -244
  94. package/public/observables.js.map +0 -1
  95. package/public/observables.min.js +0 -1
  96. package/public/observables.ts +0 -416
  97. package/public/selectors._ts +0 -1269
  98. package/public/src/MC.d.ts +0 -39
  99. package/public/src/MC.d.ts.map +0 -1
  100. package/public/src/MC.js +0 -287
  101. package/public/src/MC.js.map +0 -1
  102. package/public/src/MC.ts +0 -431
  103. package/public/src/elements.d.ts +0 -5
  104. package/public/src/elements.d.ts.map +0 -1
  105. package/public/src/elements.js +0 -68
  106. package/public/src/elements.js.map +0 -1
  107. package/public/src/elements.ts +0 -119
  108. package/public/src/formValues.d.ts +0 -3
  109. package/public/src/formValues.d.ts.map +0 -1
  110. package/public/src/formValues.js +0 -162
  111. package/public/src/formValues.js.map +0 -1
  112. package/public/src/formValues.ts +0 -225
  113. package/public/src/helpers.d.ts +0 -14
  114. package/public/src/helpers.d.ts.map +0 -1
  115. package/public/src/helpers.js +0 -113
  116. package/public/src/helpers.js.map +0 -1
  117. package/public/src/helpers.ts +0 -149
  118. package/public/src/microcomponents.d.ts +0 -6
  119. package/public/src/microcomponents.d.ts.map +0 -1
  120. package/public/src/microcomponents.js +0 -7
  121. package/public/src/microcomponents.js.map +0 -1
  122. package/public/src/microcomponents.ts +0 -8
  123. package/public/src/observables.d.ts +0 -11
  124. package/public/src/observables.d.ts.map +0 -1
  125. package/public/src/observables.js +0 -244
  126. package/public/src/observables.js.map +0 -1
  127. package/public/src/observables.ts +0 -416
  128. package/public/src/selectors._ts +0 -1269
  129. package/public/src/test/grandparent.css +0 -14
  130. package/public/src/test/test/child.d.ts +0 -2
  131. package/public/src/test/test/child.d.ts.map +0 -1
  132. package/public/src/test/test/child.js +0 -26
  133. package/public/src/test/test/child.js.map +0 -1
  134. package/public/src/test/test/child.ts +0 -36
  135. package/public/src/test/test/grandchild.d.ts +0 -2
  136. package/public/src/test/test/grandchild.d.ts.map +0 -1
  137. package/public/src/test/test/grandchild.js +0 -22
  138. package/public/src/test/test/grandchild.js.map +0 -1
  139. package/public/src/test/test/grandchild.ts +0 -31
  140. package/public/src/test/test/grandparent.d.ts +0 -2
  141. package/public/src/test/test/grandparent.d.ts.map +0 -1
  142. package/public/src/test/test/grandparent.js +0 -1
  143. package/public/src/test/test/grandparent.js.map +0 -1
  144. package/public/src/test/test/grandparent.ts +0 -43
  145. package/public/src/test/test/greatgrandchild.d.ts +0 -2
  146. package/public/src/test/test/greatgrandchild.d.ts.map +0 -1
  147. package/public/src/test/test/greatgrandchild.js +0 -36
  148. package/public/src/test/test/greatgrandchild.js.map +0 -1
  149. package/public/src/test/test/greatgrandchild.ts +0 -51
  150. package/public/src/test/test/parent.d.ts +0 -2
  151. package/public/src/test/test/parent.d.ts.map +0 -1
  152. package/public/src/test/test/parent.js +0 -25
  153. package/public/src/test/test/parent.js.map +0 -1
  154. package/public/src/test/test/parent.ts +0 -35
  155. package/public/src/test/test/testform.d.ts +0 -2
  156. package/public/src/test/test/testform.d.ts.map +0 -1
  157. package/public/src/test/test/testform.js +0 -1
  158. package/public/src/test/test/testform.js.map +0 -1
  159. package/public/src/test/test/testform.ts +0 -153
  160. package/public/src/test/test/testfunction.d.ts +0 -3
  161. package/public/src/test/test/testfunction.d.ts.map +0 -1
  162. package/public/src/test/test/testfunction.js +0 -7
  163. package/public/src/test/test/testfunction.js.map +0 -1
  164. package/public/src/test/test/testfunction.ts +0 -12
  165. package/public/src/test/test/testmc.d.ts +0 -3
  166. package/public/src/test/test/testmc.d.ts.map +0 -1
  167. package/public/src/test/test/testmc.js +0 -10
  168. package/public/src/test/test/testmc.js.map +0 -1
  169. package/public/src/test/test/testmc.ts +0 -16
  170. package/public/src/test/test/testsimpleclass.d.ts +0 -3
  171. package/public/src/test/test/testsimpleclass.d.ts.map +0 -1
  172. package/public/src/test/test/testsimpleclass.js +0 -9
  173. package/public/src/test/test/testsimpleclass.js.map +0 -1
  174. package/public/src/test/test/testsimpleclass.ts +0 -15
  175. package/public/src/test/test.d.ts +0 -2
  176. package/public/src/test/test.d.ts.map +0 -1
  177. package/public/src/test/test.js +0 -72
  178. package/public/src/test/test.js.map +0 -1
  179. package/public/src/test/test.ts +0 -176
  180. package/public/src/test/testform.css +0 -47
  181. package/public/src/test/testform.html +0 -56
  182. package/public/src/test/testform.json +0 -27
  183. package/public/test/MC.d.ts +0 -39
  184. package/public/test/MC.d.ts.map +0 -1
  185. package/public/test/MC.js +0 -287
  186. package/public/test/MC.min.js +0 -348
  187. package/public/test/MC.ts +0 -431
  188. package/public/test/MicroComponents.svg +0 -15
  189. package/public/test/elements.d.ts +0 -5
  190. package/public/test/elements.d.ts.map +0 -1
  191. package/public/test/elements.js +0 -68
  192. package/public/test/elements.min.js +0 -1
  193. package/public/test/elements.ts +0 -119
  194. package/public/test/formValues.d.ts +0 -3
  195. package/public/test/formValues.d.ts.map +0 -1
  196. package/public/test/formValues.js +0 -162
  197. package/public/test/formValues.min.js +0 -1
  198. package/public/test/formValues.ts +0 -225
  199. package/public/test/grandparent.css +0 -14
  200. package/public/test/helpers.d.ts +0 -14
  201. package/public/test/helpers.d.ts.map +0 -1
  202. package/public/test/helpers.js +0 -113
  203. package/public/test/helpers.ts +0 -149
  204. package/public/test/microcomponents.d.ts +0 -6
  205. package/public/test/microcomponents.d.ts.map +0 -1
  206. package/public/test/microcomponents.js +0 -7
  207. package/public/test/microcomponents.min.js +0 -1
  208. package/public/test/microcomponents.ts +0 -8
  209. package/public/test/myButton.css +0 -19
  210. package/public/test/observables.d.ts +0 -11
  211. package/public/test/observables.d.ts.map +0 -1
  212. package/public/test/observables.js +0 -244
  213. package/public/test/observables.min.js +0 -1
  214. package/public/test/observables.ts +0 -416
  215. package/public/test/style.css +0 -8
  216. package/public/test/test/child.d.ts +0 -2
  217. package/public/test/test/child.d.ts.map +0 -1
  218. package/public/test/test/child.js +0 -26
  219. package/public/test/test/child.js.map +0 -1
  220. package/public/test/test/child.ts +0 -36
  221. package/public/test/test/grandchild.d.ts +0 -2
  222. package/public/test/test/grandchild.d.ts.map +0 -1
  223. package/public/test/test/grandchild.js +0 -22
  224. package/public/test/test/grandchild.js.map +0 -1
  225. package/public/test/test/grandchild.ts +0 -31
  226. package/public/test/test/grandparent.d.ts +0 -2
  227. package/public/test/test/grandparent.d.ts.map +0 -1
  228. package/public/test/test/grandparent.js +0 -1
  229. package/public/test/test/grandparent.js.map +0 -1
  230. package/public/test/test/grandparent.ts +0 -43
  231. package/public/test/test/greatgrandchild.d.ts +0 -2
  232. package/public/test/test/greatgrandchild.d.ts.map +0 -1
  233. package/public/test/test/greatgrandchild.js +0 -36
  234. package/public/test/test/greatgrandchild.js.map +0 -1
  235. package/public/test/test/greatgrandchild.ts +0 -51
  236. package/public/test/test/parent.d.ts +0 -2
  237. package/public/test/test/parent.d.ts.map +0 -1
  238. package/public/test/test/parent.js +0 -25
  239. package/public/test/test/parent.js.map +0 -1
  240. package/public/test/test/parent.ts +0 -35
  241. package/public/test/test/testform.d.ts +0 -2
  242. package/public/test/test/testform.d.ts.map +0 -1
  243. package/public/test/test/testform.js +0 -1
  244. package/public/test/test/testform.js.map +0 -1
  245. package/public/test/test/testform.ts +0 -153
  246. package/public/test/test/testfunction.d.ts +0 -3
  247. package/public/test/test/testfunction.d.ts.map +0 -1
  248. package/public/test/test/testfunction.js +0 -7
  249. package/public/test/test/testfunction.js.map +0 -1
  250. package/public/test/test/testfunction.ts +0 -12
  251. package/public/test/test/testmc.d.ts +0 -3
  252. package/public/test/test/testmc.d.ts.map +0 -1
  253. package/public/test/test/testmc.js +0 -10
  254. package/public/test/test/testmc.js.map +0 -1
  255. package/public/test/test/testmc.ts +0 -16
  256. package/public/test/test/testsimpleclass.d.ts +0 -3
  257. package/public/test/test/testsimpleclass.d.ts.map +0 -1
  258. package/public/test/test/testsimpleclass.js +0 -9
  259. package/public/test/test/testsimpleclass.js.map +0 -1
  260. package/public/test/test/testsimpleclass.ts +0 -15
  261. package/public/test/test.d.ts +0 -2
  262. package/public/test/test.d.ts.map +0 -1
  263. package/public/test/test.html +0 -29
  264. package/public/test/test.js +0 -72
  265. package/public/test/test.js.map +0 -1
  266. package/public/test/test.ts +0 -176
  267. package/public/test/testform.css +0 -47
  268. package/public/test/testform.html +0 -56
  269. package/public/test/testform.json +0 -27
  270. package/public/typedoc/.nojekyll +0 -1
  271. package/public/typedoc/assets/highlight.css +0 -106
  272. package/public/typedoc/assets/icons.js +0 -18
  273. package/public/typedoc/assets/icons.svg +0 -1
  274. package/public/typedoc/assets/main.js +0 -60
  275. package/public/typedoc/assets/navigation.js +0 -1
  276. package/public/typedoc/assets/search.js +0 -1
  277. package/public/typedoc/assets/style.css +0 -1493
  278. package/public/typedoc/classes/MC.DC.html +0 -13
  279. package/public/typedoc/classes/MC.MC.html +0 -3
  280. package/public/typedoc/classes/MC.McBase.html +0 -3
  281. package/public/typedoc/functions/MC.autoload.html +0 -1
  282. package/public/typedoc/functions/MC.off.html +0 -1
  283. package/public/typedoc/functions/MC.on.html +0 -1
  284. package/public/typedoc/functions/MC.one.html +0 -1
  285. package/public/typedoc/functions/MC.trigger.html +0 -1
  286. package/public/typedoc/functions/elements.defineCE.html +0 -1
  287. package/public/typedoc/functions/elements.getCE.html +0 -1
  288. package/public/typedoc/functions/formValues.formValues.html +0 -1
  289. package/public/typedoc/functions/observables.observe.html +0 -1
  290. package/public/typedoc/hierarchy.html +0 -1
  291. package/public/typedoc/index.html +0 -122
  292. package/public/typedoc/interfaces/MC.HTMLMcElement.html +0 -758
  293. package/public/typedoc/media/MicroComponents.svg +0 -15
  294. package/public/typedoc/modules/MC.html +0 -10
  295. package/public/typedoc/modules/elements.html +0 -3
  296. package/public/typedoc/modules/formValues.html +0 -2
  297. package/public/typedoc/modules/observables.html +0 -3
  298. package/public/typedoc/modules.html +0 -5
  299. package/public/typedoc/types/observables.Observable.html +0 -1
  300. package/src/MC.ts +0 -431
  301. package/src/elements.ts +0 -119
  302. package/src/formValues.ts +0 -225
  303. package/src/helpers.ts +0 -149
  304. package/src/microcomponents.ts +0 -8
  305. package/src/observables.ts +0 -416
  306. package/src/selectors._ts +0 -1269
  307. package/src/test/grandparent.css +0 -14
  308. package/src/test/test/child.ts +0 -36
  309. package/src/test/test/grandchild.ts +0 -31
  310. package/src/test/test/grandparent.ts +0 -43
  311. package/src/test/test/greatgrandchild.ts +0 -51
  312. package/src/test/test/parent.ts +0 -35
  313. package/src/test/test/testform.ts +0 -153
  314. package/src/test/test/testfunction.ts +0 -12
  315. package/src/test/test/testmc.ts +0 -16
  316. package/src/test/test/testsimpleclass.ts +0 -15
  317. package/src/test/test.ts +0 -176
  318. package/src/test/testform.css +0 -47
  319. package/src/test/testform.html +0 -56
  320. package/src/test/testform.json +0 -27
  321. package/tasks.md +0 -36
  322. package/tsconfig.json +0 -107
  323. package/typedoc.json +0 -7
  324. package/webpack.config.js +0 -346
@@ -1,436 +0,0 @@
1
- ## History
2
-
3
- ### Content
4
-
5
- - [Before 2006](#before-2006)
6
- - [DOM and Javascript in 2006](#dom-and-javascript-in-2006)
7
- - [How it started](#how-it-started)
8
- - [Initial Specification](#initial-specification)
9
- - [Unforeseen Problems](#unforeseen-problems)
10
- - [The Result](#the-result)
11
- - [Release on Ajaxian](#release-on-ajaxian)
12
- - [First SPA ever](#first-spa-ever)
13
- - [Some Code Snippets](#some-code-snippets)
14
- - [The Fallout](#the-fallout)
15
-
16
-
17
- ## Before 2006
18
-
19
- Starting 1980, I programmed client-server or standalone applications for DOS and MS Windows.
20
-
21
- Around 1995 I switched to web programming.
22
-
23
- Before 2006 I was working on server side modular components using PHP, with little client side automation using Javascript.
24
-
25
- Starting 2004 I developed twoBirds v1, vaguely centered around a web component idea.
26
-
27
-
28
- ## DOM and Javascript in 2006
29
-
30
- The Internet has just existed for a couple of years for private use.
31
-
32
- Douglas Crockford had released the [JSON specification](https://en.wikipedia.org/wiki/JSON) in 2000.
33
-
34
- The [XMLHttpRequest](https://en.wikipedia.org/wiki/XMLHttpRequest) was specified by Microsoft in 2001. As of IE7 (2006) it was adopted by every browser, albeit buggy in IE(!).
35
-
36
- The Javascript engines and the DOM model in contemporary browsers slightly differed from each other then.
37
-
38
- John Resig had released [jQuery](https://en.wikipedia.org/wiki/JQuery). [Prototype](https://en.wikipedia.org/wiki/Prototype_JavaScript_Framework) was its main competitor then.
39
-
40
- Both of these libraries were immensely helpful, since they allowed for cross-browser access to the DOM and leveraged Javascript inconsistencies.
41
-
42
- I was a self-employed full-stack programmer then. **PHP** and **Javascript** knowledge was all it took in these lucky days to call yourself a full stack programmer.
43
-
44
-
45
- ## How it started
46
-
47
- With a call, obviously. The requirements were: convert an Excel sheet into a web application, so insurance company staff could plan customer appointments and the company could automate monthly travel expense refunds.
48
-
49
- Easy, of course I can do that. LAMP and jQuery will do it for me. Until it didn't.
50
-
51
- jQuery doesn't help you in any way structuring complex code. But my existing twoBirds v1 could. I saw the chance to let this project fund twoBirds v2.
52
-
53
- I called back the customer and explained. In essence we agreed to this: the customer will pay the same sum, but it will take double as long. The updated twoBirds v2 library will continue to be my royalty, but he is given a lifelong license to it.
54
-
55
- The project was a grossly underestimated, as I found out. Estimated at 6 month, it finally took 12 and most of this was twoBirds, especially the cross-browser part. Spoiler: it worked in the end.
56
-
57
-
58
- ## Initial Specification
59
-
60
- twoBirds was to fulfill these requirements:
61
-
62
- - **cross browser**.
63
-
64
- This led to some unforseen consequences, which I will describe below.
65
- - **on-demand loading** of Javascript files.
66
-
67
- Also on-demand loading of associated **HTML templates** and **CSS**. This must be **recursive**, so MCs can recursively load other MCs and their requirements.
68
- - **internal Micro Component repository** in the resulting application to avoid multiple loading for multiple instances of a MC in the page.
69
- - **leverage XMLHttpRequest inconsistencies**, especially the famous "closure bug" that led to memory leaks in IE.
70
- - **jQuery** as the selector engine.
71
-
72
- Thanks again John, without your code it would have been much harder. We all stand on the shoulders of giants.
73
-
74
-
75
- ## Unforseen Problems
76
-
77
- Browsers tested:
78
- - **IE5.5**+
79
- - **Netscape Communicator**, later **Firefox** also
80
- - **Chrome**
81
- - **Opera**
82
- - **Safari** ( Safari for Windows at least, see below)
83
- - **Konqueror**, since I was working on OpenSUSE.
84
-
85
- This resulted in some problems, i.e. (list is not complete):
86
-
87
- ### No debuggers
88
-
89
- Firebug wasn't there yet. When it finally arrived as a firefox extension, I was really cooking.
90
-
91
- Other than that there was no reflection mechanism, so no runtime introspection for most browsers. The Proxy() class didn't exist yet.
92
-
93
- Microsofts skript debugger didnt help a lot with other browsers.
94
-
95
- ### Missing equipment
96
-
97
- Since I had no Apple hardware, I couldn't reliably test for Safari on MAC. Safari for Windows was slightly different from Safari on MAC.
98
-
99
- At least I got it working there but could not promise for MAC hardware. I was told by others it worked there as well, though.
100
-
101
- ### Meager internal documentation for browsers
102
-
103
- It took me month to find out the best way to on-demand load Javascript code, templates and CSS, and how to avoid FOUC.
104
-
105
- ### timeout()
106
-
107
- Cross-browser support in 2006 meant Konqueror also.
108
-
109
- But Konqueror v1 had a funny bug: it could only handle one (1) timeout via setTimeout() at a time. I had to come up with a workaround.
110
-
111
- So I implemented tb.timer() which used a single timeout to poll a list of timestamped callbacks every 100 ms.
112
-
113
- ```javascript
114
- tb.timer = {
115
- destroylist: [],
116
- addlist: [],
117
- list: [],
118
- ms: 100,
119
-
120
- // public
121
-
122
- add: function( pCallback, pTimeMs ) {
123
- var myDate = new Date();
124
- var myIdentifier = '_to'+tb.misc.getid();
125
- var myTime = myDate.getTime() + pTimeMs;
126
- var myArray = [ myTime, '( '+pCallback+' )', myIdentifier ];
127
- tb.timer.addlist.push( myArray );
128
- if (tb.timer.list.length === 0 ) {
129
- window.setTimeout( 'tb.timer.timeout()', 10);
130
- }
131
- return myIdentifier;
132
- },
133
-
134
- abort: function( pIdentifier ) {
135
- tb.timer.destroylist.push( pIdentifier );
136
- },
137
-
138
- //private
139
-
140
- destroy: function( pIdentifier ) {
141
- var myNewlist = [];
142
- var i=0;
143
- for ( i in tb.timer.list ) {
144
- if ( tb.timer.list[i][2] !== pIdentifier ) {
145
- var myObj = tb.misc.cloneObj( tb.timer.list[i] );
146
- myNewlist.push( myObj );
147
- }
148
- }
149
- tb.timer.list = myNewlist;
150
- },
151
-
152
- timeout: function() {
153
- while ( tb.timer.addlist.length > 0 ) {
154
- tb.timer.list.push( tb.timer.addlist.pop() );
155
- }
156
- while ( tb.timer.destroylist.length > 0 ) {
157
- tb.timer.destroy( tb.timer.destroylist.pop() );
158
- }
159
- if ( tb.timer.list.length < 1 ) {
160
- tb.timer.ms = 100;
161
- return;
162
- }
163
- else {
164
- var myNewList = [];
165
- var myMinVal = 0;
166
- while ( tb.timer.list.length > 0 ) {
167
- var myDate = new Date();
168
- var myTime = myDate.getTime();
169
- if ( tb.timer.list[0][0] <= myTime ) {
170
- var myEval = tb.timer.list[0][1];
171
- eval( '( ' + myEval + ' )' );
172
- }
173
- else {
174
- if ( tb.timer.list[0][1] < myMinVal || myMinVal === 0 ) {
175
- myMinVal = tb.timer.list[0][1];
176
- }
177
- myNewList.push( tb.timer.list[0] );
178
- }
179
- tb.timer.list.shift();
180
- }
181
- tb.timer.list = myNewList;
182
- if ( myMinVal > 0 ) {
183
- myDate = new Date();
184
- tb.timer.ms = myMinVal - myDate.getTime();
185
- }
186
- else {
187
- tb.timer.ms = 100;
188
- }
189
- while ( tb.timer.addlist.length > 0 ) {
190
- tb.timer.list.push( tb.timer.addlist.pop() );
191
- }
192
- window.setTimeout( 'tb.timer.timeout()', tb.timer.ms);
193
- }
194
- }
195
-
196
- };
197
- window.setTimeout( 'tb.timer.timeout()', 0);
198
- ```
199
-
200
- Then I implemented ...
201
- - **tb.timeout()** to use tb.timer().
202
-
203
- - **tb.interval()** also, which used tb.timeout(). This I did with the added benefit that my implementation avoided runovers if the implemented functionality lasted longer than the interval.
204
-
205
- While I was at it, I also implemented...
206
- - **tb.wait()**, which used tb.interval() to wait for a condition to be true, and then called the callback.
207
-
208
- - **tb.observe()**, which was a tb.interval() implementation of tb.wait().
209
-
210
- At this point I had a solution polling **Observables** in 2006.
211
-
212
-
213
- ## The Result
214
-
215
- So far I had a solution for **requirement loading**, **templating**, **observables** and **web components** as early as 2006.
216
-
217
- - **tb.require()** probably influenced [requireJs](https://requirejs.org/) and in turn the CommonJS specification.
218
-
219
- - **Templates** are now a coding standard and implemented in various ways using backtick strings ( `string with ${placeholder}` ) and the DOM template tag.
220
-
221
- - **Observables** are now a coding standard and implemented in various ways using getters/setters or the Proxy() object.
222
-
223
- - [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) initially contained a definition for user built in custom elements, which was a functional copy of twoBirds web components.
224
-
225
- Look at the screenshots attached at the end of this document. That is the application I developed, with a code example attached.
226
-
227
- ## Release on Ajaxian
228
-
229
- twoBirds v2 was open sourced and anounced on ajaxian.com on April 2nd 2007, you can find the original article on archive.org.
230
-
231
- ![Ajaxian Screenshot 1](./ajaxian-1.png)
232
- ![Ajaxian Screenshot 2](./ajaxian-2.png)
233
-
234
- Which led to this comment:
235
-
236
- ![Ajaxian Screenshot 3](./ajaxian-3.png)
237
-
238
- RTFM, man. Oh nevermind, Dean. I forget to add one. Autists...
239
-
240
- twoBirds as a framework will be dissolved into modular micro component based functionality. RIP. It served me well for 20 years.
241
-
242
-
243
- ## First SPA ever
244
-
245
- The first web component based single page application (SPA) that ever existed - to my knowledge. Prove me otherwise ;-).
246
-
247
- ![app1](./rnd0023-1.jpg);
248
- ![app2](./rnd0023-2.jpg);
249
- ![app3](./rnd0023-3.jpg);
250
-
251
- Yes, I contemplated programming a web based Excel, as in Google Calc.
252
-
253
- And web component based cockpit instruments for airplanes.
254
-
255
- As I think of it: **SpaceX** uses **Web Components** for cockpit instruments in their **Dragon Capsule**. ;-)
256
-
257
- ## Some Code Snippets
258
-
259
- This is the code for the left part of the table shown in the pictures above.
260
-
261
- ```javascript
262
- self.tourtable.leftcolumn = { // new object
263
-
264
- showcounter: 0,
265
- datecache: [], // cache für HTML code
266
-
267
- init: function (pDivId) {
268
- //tb.element.show( null, 'tourtable', 'leftcolumnline'); // preload line code
269
- tb.element.require(
270
- [ [ 'css', 'tourtable', 'leftcolumn'],
271
- [ 'tpl', 'tourtable', 'leftcolumn'] ],
272
- 'tourtable.leftcolumn.display("' + pDivId + '")',
273
- true );
274
- },
275
-
276
- display: function (pDivId) {
277
-
278
- if ( tourtable.middlecolumn.day == -1 ) { // clear HTML array
279
- tourtable.leftcolumn.datecache = [];
280
- }
281
- else {
282
- tourtable.leftcolumn.datecache[tourtable.middlecolumn.day] = '';
283
- var pDay = tourtable.middlecolumn.day;
284
- }
285
-
286
- try {
287
- var myDiv = document.getElementById( pDivId );
288
- }
289
- catch (e) {
290
- tb.timer.add( 'tourtable.leftcolumn.display("'+pDivId+'")', 100 );
291
- return;
292
- }
293
- tourtable.leftcolumn.showcounter = 1;
294
- //tb.debug.add("<p>Element <font color='magenta'><b> display: </b></font> tourtable.leftcolumn in " + pDivId + "</p>");
295
- var myHtml = tb.loader.tplget('tourtable','leftcolumn');
296
- var myNewRegEx = new RegExp('%tourtableleftrows%');
297
- myHtml = myHtml.replace(myNewRegEx, '');
298
- tb.div.replace(pDivId,myHtml);
299
- myHtml = tb.loader.tplget('tourtable','leftcolumn');
300
-
301
- var myDate = new tb.tbDate();
302
- myDate.setDate(1);
303
- var myMonth = myDate.getMonth();
304
- var myRows = '';
305
- var myDateRows = '';
306
- var myId = 1;
307
- var myLastDate='';
308
- var createDate='';
309
-
310
- //tb.debug.add('<p>leftcolumn <font color="blue">Act:</font> '+middlecolumn.getlength()+'</p>');
311
-
312
- //var myDateList = '';
313
- if ( tourtable.middlecolumn.getlength() > 0 )
314
- for ( x=0; x < tourtable.middlecolumn.getlength(); x++ ) {
315
- var thisRecord = tourtable.middlecolumn.act.Data.data[0][x];
316
- if ( tourtable.middlecolumn.currentId == null ) {
317
- tourtable.middlecolumn.currentId = thisRecord.id;
318
- }
319
- var myDate = new tb.tbDate();
320
- myDate.setFromMysqlDateString( thisRecord.datum );
321
- var thisDateIndex = myDate.getDate();
322
- if ( ! tourtable.leftcolumn.datecache[thisDateIndex] ) { // create if necessary
323
- tourtable.leftcolumn.datecache[thisDateIndex] = '';
324
- }
325
- if ( tourtable.leftcolumn.datecache[thisDateIndex] == '') { // create if necessary
326
- createDate = thisDateIndex;
327
- }
328
- var myNextDate = ( x == tourtable.middlecolumn.getlength()-1 || tourtable.middlecolumn.act.Data.data[0][x+1].datum != thisRecord.datum ) ? true : false;
329
- if ( !pDay || thisDateIndex == pDay || createDate == thisDateIndex ) { // pdate not given or this is the given date
330
- tourtable.leftcolumn.datecache[thisDateIndex] += tourtable.leftcolumnline.make( thisRecord.id, ( myLastDate == thisRecord.datum ? false : true ), myNextDate, myDate, thisRecord.ort );
331
- }
332
- myLastDate = thisRecord.datum;
333
- }
334
-
335
- myRows = tourtable.leftcolumn.datecache.join('');
336
-
337
- myNewRegEx = new RegExp('%tourtableleftrows%');
338
- myHtml = myHtml.replace(myNewRegEx, myRows);
339
-
340
- //tb.div.replace(pDivId,myHtml);
341
- tb.misc.innerHTML(pDivId,myHtml);
342
-
343
- tourtable.leftcolumn.showcounter = 0;
344
- }
345
-
346
- };
347
- ```
348
-
349
- This is the example code they referred to on ajaxian.com:
350
-
351
- ```javascript
352
- index = {};
353
-
354
- user = {};
355
-
356
- tourtable = {};
357
-
358
- index.index_body = {
359
-
360
- init: function (pDivId) {
361
- tb.element.require(
362
- [ [ 'css', 'index', 'index_body'],
363
- [ 'tpl', 'index', 'index_body']
364
- ],
365
- 'index.index_body.display("' + pDivId + '")',
366
- true );
367
- },
368
-
369
- display: function (pDivId) {
370
- var myHtml = tb.loader.tplget('index','index_body');
371
- tb.div.replace( pDivId, myHtml );
372
- tb.element.require(
373
- [ [ 'js', 'tourtable', 'ddata'] ,
374
- [ 'js', 'tourtable', 'rightcolumn'] ,
375
- [ 'js', 'tourtable', 'leftcolumn'] ,
376
- [ 'js', 'tourtable', 'leftcolumnline'] ,
377
- [ 'js', 'tourtable', 'middlecolumn1line'] ,
378
- [ 'js', 'tourtable', 'middlecolumn2line'] ,
379
- [ 'js', 'tourtable', 'middlecolumn3line'] ,
380
- [ 'js', 'tourtable', 'middlecolumn1'] ,
381
- [ 'js', 'tourtable', 'middlecolumn2'] ,
382
- [ 'js', 'tourtable', 'middlecolumn3'] ,
383
- [ 'js', 'user', 'user_login'] ,
384
- [ 'js', 'tb', 'pos'] ,
385
- [ 'js', 'tb', 'md5'] ,
386
- [ 'js', 'tb', 'tbDate'] ,
387
- [ 'js', 'tb', 'tbCurrency'] ,
388
- [ 'css', 'tourtable', 'middlecolumn'] ,
389
- [ 'css', 'tourtable', 'rightcolumn'] ,
390
- [ 'css', 'tourtable', 'leftcolumn'] ,
391
- [ 'css', 'tourtable', 'leftcolumnline'] ,
392
- [ 'css', 'tourtable', 'middlecolumn1'] ,
393
- [ 'css', 'tourtable', 'middlecolumn2'] ,
394
- [ 'css', 'tourtable', 'middlecolumn3'] ,
395
- [ 'css', 'tourtable', 'middlecolumn1line'] ,
396
- [ 'css', 'tourtable', 'middlecolumn2line'] ,
397
- [ 'css', 'tourtable', 'middlecolumn3line'] ,
398
- [ 'tpl', 'tourtable', 'rightcolumn'] ,
399
- [ 'tpl', 'tourtable', 'leftcolumn'] ,
400
- [ 'tpl', 'tourtable', 'leftcolumnline'] ,
401
- [ 'tpl', 'tourtable', 'middlecolumn1line'] ,
402
- [ 'tpl', 'tourtable', 'middlecolumn2line'] ,
403
- [ 'tpl', 'tourtable', 'middlecolumn3line'] ,
404
- [ 'tpl', 'tourtable', 'middlecolumn1'] ,
405
- [ 'tpl', 'tourtable', 'middlecolumn2'] ,
406
- [ 'tpl', 'tourtable', 'middlecolumn3'] ,
407
- [ 'tpl', 'tourtable', 'middlecolumn'] ,
408
- [ 'js', 'tourtable', 'middlecolumn']
409
- ] );
410
- tb.element.show( 'toprightcontainer', 'user', 'user_login' );
411
- }
412
-
413
- };
414
-
415
- ```
416
-
417
- When I find the time I will turn into standalone web component using local storage, since it is a historic archievement IMHO. For now I have more pressing tasks to do.
418
-
419
-
420
- ## The Fallout
421
-
422
- I am an autist, which I didn't know back then BTW.
423
-
424
- Above all that means, if you focus on something, you keep focussed for life. And I focused on twoBirds, really.
425
-
426
- So I was burnt as a programmer, because I have a hard time working with the current standard frameworks.
427
-
428
- Now try to find a programmer job without using standard frameworks.
429
-
430
- In the end I lost my existence 3 times over the past 20 years, with all the consequences.
431
-
432
- No pity requested, I always pulled myself out of the mud. Thats just the way things go. But if feel tempted, you can [fund this](https://gofund.me/076c614c).
433
-
434
- I really want **Micro Components** to become a web standard also.
435
-
436
- I don't regret still working on the basic idea. As long as I can, I will continue doing so.
Binary file
@@ -1,29 +0,0 @@
1
- # Things I already did with this...
2
-
3
- - `encapsulated and modular 3D rendering` in an HTMLElement viewport.
4
- - `Data Driven Workflow` with micro components using observables.
5
- - `DOM handling` in general, lots of `UI functionality`
6
- - `1 way Data Binding` from data observables to the DOM
7
- - `2 way Data Binding` between forms and observables representing the form data
8
- - `progressive enhancement` / `graceful degradation` on standard websites
9
- - `Loose Coupling` via custom event objects
10
- - `Rule Engines`
11
- - `Complex Runtime Templating` without JSX or virtual DOM
12
- - `Single Page Applications`
13
- - `Micro Frontends`
14
- - `Electron Apps`
15
- - `Progressive Web Apps`
16
- - `Complex Native Web Components`, that comprised of a set of modular `UI` and `business logic` micro components
17
-
18
- - `server side` structure in general.
19
-
20
-
21
- Funny stuff:
22
-
23
- - `Vending Machine Frontend` ( selling lottery tickets )
24
- - `UI for ocean going container ships` ( a wave impact stress simulator frontend )
25
-
26
-
27
- Not from me, but somehow based on my ideas:
28
-
29
- - `SpaceX` uses web components as an interface in their `Dragon Capsule`. I regard myself to be a co-inventor of web components, since I announced my idea on ajaxian.com in 2007. Much later, [User defined built in elements](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#customized_built-in_elements) were a copy of what I already had back then. So in a way, this already goes to space.
@@ -1,187 +0,0 @@
1
- ![logo](./MicroComponents.svg)
2
-
3
- # Observables
4
-
5
- This module provides utilities for observing and binding data to DOM elements using placeholders. It supports reactive updates when data changes.
6
-
7
- ## Table of Contents
8
-
9
- - [Overview](#overview)
10
- - [Functions](#functions)
11
- - [Types](#types)
12
- - [Example](#example)
13
-
14
- ---
15
-
16
- ## Overview
17
-
18
- The module defines an `observe` function that makes object properties observable.
19
-
20
- You can use this function to turn a single property or all properties of an object into observables.
21
-
22
- This functionality can be used standalone in any framework.
23
-
24
- ## Functions
25
-
26
- ### `observe( target: LooseObject, propertyName?: string ): LooseObject`
27
-
28
- **Description**
29
-
30
- Registers a distinct property or all object properties as an observable, making them reactive.
31
-
32
- Those properties are dual use:
33
-
34
- - **Direct Assign Native Values**:
35
- - Directly assign native values to the property, and the observable will be notified of the change and its callbacks will be run.
36
-
37
- - **Use as an Instance of Observable**
38
- - Use the property as an instance of the `Observable` class. This allows you to attach callbacks and react to changes. You can bind the property to DOM elements.
39
-
40
- ## Types
41
-
42
- ### `Observable`
43
-
44
- **Type**
45
- ```typescript
46
- export type Observable = {
47
- observe: (cb: Callback) => void; // attach a callback to be notified of changes
48
- notify: () => void; // mostly internal use, but can be called to trigger all callbacks
49
- bind: (target: HTMLElement | DocumentFragment | ShadowRoot) => void; // the target DOM element to bind the observable to. {placeholder} will be replaced with the actual data value.
50
- };
51
- ```
52
-
53
- **Methods**
54
-
55
- - `observe(cb: Callback)`
56
- - Registers a callback to be notified of changes.
57
-
58
- - `notify( enable?: boolean)`
59
- - Enables / Disables notifications.
60
- - By default, notifications are enabled.
61
- - If `enable` is `false`, notifications are disabled. You need to explicitly call `notify(true)` to re-enable notifications.
62
- - Otherwise calls all registered callbacks with the current data.
63
-
64
- - `bind(target: HTMLElement | DocumentFragment | ShadowRoot)`
65
- - Binds the observable to a DOM element, replacing placeholders with data values.
66
-
67
-
68
- ## Examples
69
-
70
- ### How to use observables in native JS Code
71
-
72
- HTML:
73
- ```html
74
- <div id="user-card">
75
- <p>Hello, {name}</p>
76
- <p>Age: {age}</p>
77
- </div>
78
- ```
79
-
80
- JavaScript:
81
- ```javascript
82
- import { observe } from './observables.js';
83
-
84
- // define an object
85
- const address = {
86
- data: {
87
- name: 'John',
88
- age: 30,
89
- },
90
-
91
- otherData: {
92
- whatever: true
93
- }
94
-
95
- };
96
-
97
- // make all properties of the object observable
98
- observe(address);
99
-
100
- // OR: make one property of the object observable
101
- observe(address, 'data');
102
-
103
- // connect the observable to DOM structure placeholders
104
- const element = document.getElementById('user-card');
105
- address.data.bind(element);
106
- ```
107
-
108
- When `address.data.name` or `address.data.age` changes, or you reassign `address.data` completely, the DOM updates automatically.
109
-
110
- ---
111
-
112
- ### How to use observables in Micro Components
113
-
114
- HTML:
115
- ```html
116
- <div id="user-card">
117
- <p>Hello, {name}</p>
118
- <p>Age: {age}</p>
119
- </div>
120
- ```
121
-
122
- Micro Components are instances of classes. So you can store the class in the CustomElementRegistry:
123
-
124
- JavaScript: (**define** the micro component)
125
- `./user/card/data.js`
126
- ```javascript
127
- import {
128
- DC,
129
- defineCE,
130
- getCE,
131
- Observable,
132
- observe
133
- } from './microcomponents.js';
134
-
135
- // define the micro component
136
- defineCE(
137
- 'user-card-data',
138
-
139
- class UserCardData extends DC {
140
- data: unknown;
141
-
142
- constructor(target: HTMLElement, data?: { name: string = '', age: number = 0 }) {
143
- super(target);
144
-
145
- this.data = data;
146
-
147
- // create this.data observable
148
- observe(this);
149
-
150
- // 1 way bind formdata to the form DOM
151
- (this.data as Observable).bind(target);
152
- }
153
-
154
- }
155
- );
156
-
157
- export default getCE('user-card-data');
158
- ```
159
-
160
- JavaScript: (**use** the micro component)
161
- ```javascript
162
- import {
163
- getCE,
164
- } from './microcomponents.js';
165
-
166
- const element = document.getElementById('user-card');
167
- const Dc = getCE('user-card-data');
168
- const dc = new Dc( element, { name: 'Sarah', age: 33 } );
169
-
170
- // add the micro component to the DOM element
171
- DC.add(
172
- element,
173
- 'userCardData',
174
- dc
175
- );
176
-
177
- // change data
178
- element._mc.userCardData.data = { name: 'John', age: 27 };
179
- ```
180
-
181
- ---
182
-
183
- ## Hints
184
-
185
- - Native values (strings, numbers, booleans) can be made observable.
186
- - Only objects can be bound to the DOM.
187
- - Changes to observable properties trigger updates in bound DOM elements.
Binary file
Binary file
Binary file