@adaas/are-html 0.0.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 (365) hide show
  1. package/.conf/tsconfig.base.json +87 -0
  2. package/.conf/tsconfig.browser.json +34 -0
  3. package/.conf/tsconfig.node.json +35 -0
  4. package/.nvmrc +1 -0
  5. package/LICENSE +13 -0
  6. package/README.md +678 -0
  7. package/dist/browser/index.d.mts +521 -0
  8. package/dist/browser/index.mjs +1782 -0
  9. package/dist/browser/index.mjs.map +1 -0
  10. package/dist/node/AreBinding.attribute-C6JasbJL.d.ts +110 -0
  11. package/dist/node/AreBinding.attribute-C6qrxN8K.d.mts +110 -0
  12. package/dist/node/attributes/AreBinding.attribute.d.mts +4 -0
  13. package/dist/node/attributes/AreBinding.attribute.d.ts +4 -0
  14. package/dist/node/attributes/AreBinding.attribute.js +15 -0
  15. package/dist/node/attributes/AreBinding.attribute.js.map +1 -0
  16. package/dist/node/attributes/AreBinding.attribute.mjs +14 -0
  17. package/dist/node/attributes/AreBinding.attribute.mjs.map +1 -0
  18. package/dist/node/attributes/AreDirective.attribute.d.mts +4 -0
  19. package/dist/node/attributes/AreDirective.attribute.d.ts +4 -0
  20. package/dist/node/attributes/AreDirective.attribute.js +20 -0
  21. package/dist/node/attributes/AreDirective.attribute.js.map +1 -0
  22. package/dist/node/attributes/AreDirective.attribute.mjs +19 -0
  23. package/dist/node/attributes/AreDirective.attribute.mjs.map +1 -0
  24. package/dist/node/attributes/AreEvent.attribute.d.mts +4 -0
  25. package/dist/node/attributes/AreEvent.attribute.d.ts +4 -0
  26. package/dist/node/attributes/AreEvent.attribute.js +10 -0
  27. package/dist/node/attributes/AreEvent.attribute.js.map +1 -0
  28. package/dist/node/attributes/AreEvent.attribute.mjs +9 -0
  29. package/dist/node/attributes/AreEvent.attribute.mjs.map +1 -0
  30. package/dist/node/attributes/AreStatic.attribute.d.mts +4 -0
  31. package/dist/node/attributes/AreStatic.attribute.d.ts +4 -0
  32. package/dist/node/attributes/AreStatic.attribute.js +10 -0
  33. package/dist/node/attributes/AreStatic.attribute.js.map +1 -0
  34. package/dist/node/attributes/AreStatic.attribute.mjs +9 -0
  35. package/dist/node/attributes/AreStatic.attribute.mjs.map +1 -0
  36. package/dist/node/chunk-EQQGB2QZ.mjs +15 -0
  37. package/dist/node/chunk-EQQGB2QZ.mjs.map +1 -0
  38. package/dist/node/directives/AreComponent.directive.d.mts +2 -0
  39. package/dist/node/directives/AreComponent.directive.d.ts +2 -0
  40. package/dist/node/directives/AreComponent.directive.js +4 -0
  41. package/dist/node/directives/AreComponent.directive.js.map +1 -0
  42. package/dist/node/directives/AreComponent.directive.mjs +3 -0
  43. package/dist/node/directives/AreComponent.directive.mjs.map +1 -0
  44. package/dist/node/directives/AreDirectiveFor.directive.d.mts +41 -0
  45. package/dist/node/directives/AreDirectiveFor.directive.d.ts +41 -0
  46. package/dist/node/directives/AreDirectiveFor.directive.js +206 -0
  47. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -0
  48. package/dist/node/directives/AreDirectiveFor.directive.mjs +196 -0
  49. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -0
  50. package/dist/node/directives/AreDirectiveIf.directive.d.mts +15 -0
  51. package/dist/node/directives/AreDirectiveIf.directive.d.ts +15 -0
  52. package/dist/node/directives/AreDirectiveIf.directive.js +91 -0
  53. package/dist/node/directives/AreDirectiveIf.directive.js.map +1 -0
  54. package/dist/node/directives/AreDirectiveIf.directive.mjs +81 -0
  55. package/dist/node/directives/AreDirectiveIf.directive.mjs.map +1 -0
  56. package/dist/node/engine/AreHTML.compiler.d.mts +27 -0
  57. package/dist/node/engine/AreHTML.compiler.d.ts +27 -0
  58. package/dist/node/engine/AreHTML.compiler.js +150 -0
  59. package/dist/node/engine/AreHTML.compiler.js.map +1 -0
  60. package/dist/node/engine/AreHTML.compiler.mjs +140 -0
  61. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -0
  62. package/dist/node/engine/AreHTML.constants.d.mts +2 -0
  63. package/dist/node/engine/AreHTML.constants.d.ts +2 -0
  64. package/dist/node/engine/AreHTML.constants.js +4 -0
  65. package/dist/node/engine/AreHTML.constants.js.map +1 -0
  66. package/dist/node/engine/AreHTML.constants.mjs +3 -0
  67. package/dist/node/engine/AreHTML.constants.mjs.map +1 -0
  68. package/dist/node/engine/AreHTML.context.d.mts +108 -0
  69. package/dist/node/engine/AreHTML.context.d.ts +108 -0
  70. package/dist/node/engine/AreHTML.context.js +155 -0
  71. package/dist/node/engine/AreHTML.context.js.map +1 -0
  72. package/dist/node/engine/AreHTML.context.mjs +154 -0
  73. package/dist/node/engine/AreHTML.context.mjs.map +1 -0
  74. package/dist/node/engine/AreHTML.engine.d.mts +21 -0
  75. package/dist/node/engine/AreHTML.engine.d.ts +21 -0
  76. package/dist/node/engine/AreHTML.engine.js +191 -0
  77. package/dist/node/engine/AreHTML.engine.js.map +1 -0
  78. package/dist/node/engine/AreHTML.engine.mjs +181 -0
  79. package/dist/node/engine/AreHTML.engine.mjs.map +1 -0
  80. package/dist/node/engine/AreHTML.interpreter.d.mts +28 -0
  81. package/dist/node/engine/AreHTML.interpreter.d.ts +28 -0
  82. package/dist/node/engine/AreHTML.interpreter.js +340 -0
  83. package/dist/node/engine/AreHTML.interpreter.js.map +1 -0
  84. package/dist/node/engine/AreHTML.interpreter.mjs +330 -0
  85. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -0
  86. package/dist/node/engine/AreHTML.lifecycle.d.mts +17 -0
  87. package/dist/node/engine/AreHTML.lifecycle.d.ts +17 -0
  88. package/dist/node/engine/AreHTML.lifecycle.js +91 -0
  89. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -0
  90. package/dist/node/engine/AreHTML.lifecycle.mjs +79 -0
  91. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -0
  92. package/dist/node/engine/AreHTML.tokenizer.d.mts +13 -0
  93. package/dist/node/engine/AreHTML.tokenizer.d.ts +13 -0
  94. package/dist/node/engine/AreHTML.tokenizer.js +83 -0
  95. package/dist/node/engine/AreHTML.tokenizer.js.map +1 -0
  96. package/dist/node/engine/AreHTML.tokenizer.mjs +71 -0
  97. package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -0
  98. package/dist/node/engine/AreHTML.transformer.d.mts +11 -0
  99. package/dist/node/engine/AreHTML.transformer.d.ts +11 -0
  100. package/dist/node/engine/AreHTML.transformer.js +44 -0
  101. package/dist/node/engine/AreHTML.transformer.js.map +1 -0
  102. package/dist/node/engine/AreHTML.transformer.mjs +32 -0
  103. package/dist/node/engine/AreHTML.transformer.mjs.map +1 -0
  104. package/dist/node/engine/AreHTML.types.d.mts +6 -0
  105. package/dist/node/engine/AreHTML.types.d.ts +6 -0
  106. package/dist/node/engine/AreHTML.types.js +4 -0
  107. package/dist/node/engine/AreHTML.types.js.map +1 -0
  108. package/dist/node/engine/AreHTML.types.mjs +3 -0
  109. package/dist/node/engine/AreHTML.types.mjs.map +1 -0
  110. package/dist/node/index.d.mts +39 -0
  111. package/dist/node/index.d.ts +39 -0
  112. package/dist/node/index.js +294 -0
  113. package/dist/node/index.js.map +1 -0
  114. package/dist/node/index.mjs +43 -0
  115. package/dist/node/index.mjs.map +1 -0
  116. package/dist/node/instructions/AddAttribute.instruction.d.mts +9 -0
  117. package/dist/node/instructions/AddAttribute.instruction.d.ts +9 -0
  118. package/dist/node/instructions/AddAttribute.instruction.js +32 -0
  119. package/dist/node/instructions/AddAttribute.instruction.js.map +1 -0
  120. package/dist/node/instructions/AddAttribute.instruction.mjs +25 -0
  121. package/dist/node/instructions/AddAttribute.instruction.mjs.map +1 -0
  122. package/dist/node/instructions/AddComment.instruction.d.mts +9 -0
  123. package/dist/node/instructions/AddComment.instruction.d.ts +9 -0
  124. package/dist/node/instructions/AddComment.instruction.js +35 -0
  125. package/dist/node/instructions/AddComment.instruction.js.map +1 -0
  126. package/dist/node/instructions/AddComment.instruction.mjs +28 -0
  127. package/dist/node/instructions/AddComment.instruction.mjs.map +1 -0
  128. package/dist/node/instructions/AddElement.instruction.d.mts +8 -0
  129. package/dist/node/instructions/AddElement.instruction.d.ts +8 -0
  130. package/dist/node/instructions/AddElement.instruction.js +32 -0
  131. package/dist/node/instructions/AddElement.instruction.js.map +1 -0
  132. package/dist/node/instructions/AddElement.instruction.mjs +25 -0
  133. package/dist/node/instructions/AddElement.instruction.mjs.map +1 -0
  134. package/dist/node/instructions/AddInterpolation.instruction.d.mts +8 -0
  135. package/dist/node/instructions/AddInterpolation.instruction.d.ts +8 -0
  136. package/dist/node/instructions/AddInterpolation.instruction.js +32 -0
  137. package/dist/node/instructions/AddInterpolation.instruction.js.map +1 -0
  138. package/dist/node/instructions/AddInterpolation.instruction.mjs +25 -0
  139. package/dist/node/instructions/AddInterpolation.instruction.mjs.map +1 -0
  140. package/dist/node/instructions/AddListener.instruction.d.mts +8 -0
  141. package/dist/node/instructions/AddListener.instruction.d.ts +8 -0
  142. package/dist/node/instructions/AddListener.instruction.js +32 -0
  143. package/dist/node/instructions/AddListener.instruction.js.map +1 -0
  144. package/dist/node/instructions/AddListener.instruction.mjs +25 -0
  145. package/dist/node/instructions/AddListener.instruction.mjs.map +1 -0
  146. package/dist/node/instructions/AddStyle.instruction.d.mts +8 -0
  147. package/dist/node/instructions/AddStyle.instruction.d.ts +8 -0
  148. package/dist/node/instructions/AddStyle.instruction.js +32 -0
  149. package/dist/node/instructions/AddStyle.instruction.js.map +1 -0
  150. package/dist/node/instructions/AddStyle.instruction.mjs +25 -0
  151. package/dist/node/instructions/AddStyle.instruction.mjs.map +1 -0
  152. package/dist/node/instructions/AddText.instruction.d.mts +8 -0
  153. package/dist/node/instructions/AddText.instruction.d.ts +8 -0
  154. package/dist/node/instructions/AddText.instruction.js +32 -0
  155. package/dist/node/instructions/AddText.instruction.js.map +1 -0
  156. package/dist/node/instructions/AddText.instruction.mjs +25 -0
  157. package/dist/node/instructions/AddText.instruction.mjs.map +1 -0
  158. package/dist/node/instructions/AreHTML.instructions.constants.d.mts +11 -0
  159. package/dist/node/instructions/AreHTML.instructions.constants.d.ts +11 -0
  160. package/dist/node/instructions/AreHTML.instructions.constants.js +15 -0
  161. package/dist/node/instructions/AreHTML.instructions.constants.js.map +1 -0
  162. package/dist/node/instructions/AreHTML.instructions.constants.mjs +15 -0
  163. package/dist/node/instructions/AreHTML.instructions.constants.mjs.map +1 -0
  164. package/dist/node/instructions/AreHTML.instructions.types.d.mts +46 -0
  165. package/dist/node/instructions/AreHTML.instructions.types.d.ts +46 -0
  166. package/dist/node/instructions/AreHTML.instructions.types.js +4 -0
  167. package/dist/node/instructions/AreHTML.instructions.types.js.map +1 -0
  168. package/dist/node/instructions/AreHTML.instructions.types.mjs +3 -0
  169. package/dist/node/instructions/AreHTML.instructions.types.mjs.map +1 -0
  170. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +4 -0
  171. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +4 -0
  172. package/dist/node/lib/AreDirective/AreDirective.component.js +117 -0
  173. package/dist/node/lib/AreDirective/AreDirective.component.js.map +1 -0
  174. package/dist/node/lib/AreDirective/AreDirective.component.mjs +107 -0
  175. package/dist/node/lib/AreDirective/AreDirective.component.mjs.map +1 -0
  176. package/dist/node/lib/AreDirective/AreDirective.constants.d.mts +16 -0
  177. package/dist/node/lib/AreDirective/AreDirective.constants.d.ts +16 -0
  178. package/dist/node/lib/AreDirective/AreDirective.constants.js +20 -0
  179. package/dist/node/lib/AreDirective/AreDirective.constants.js.map +1 -0
  180. package/dist/node/lib/AreDirective/AreDirective.constants.mjs +20 -0
  181. package/dist/node/lib/AreDirective/AreDirective.constants.mjs.map +1 -0
  182. package/dist/node/lib/AreDirective/AreDirective.context.d.mts +9 -0
  183. package/dist/node/lib/AreDirective/AreDirective.context.d.ts +9 -0
  184. package/dist/node/lib/AreDirective/AreDirective.context.js +14 -0
  185. package/dist/node/lib/AreDirective/AreDirective.context.js.map +1 -0
  186. package/dist/node/lib/AreDirective/AreDirective.context.mjs +13 -0
  187. package/dist/node/lib/AreDirective/AreDirective.context.mjs.map +1 -0
  188. package/dist/node/lib/AreDirective/AreDirective.meta.d.mts +7 -0
  189. package/dist/node/lib/AreDirective/AreDirective.meta.d.ts +7 -0
  190. package/dist/node/lib/AreDirective/AreDirective.meta.js +14 -0
  191. package/dist/node/lib/AreDirective/AreDirective.meta.js.map +1 -0
  192. package/dist/node/lib/AreDirective/AreDirective.meta.mjs +13 -0
  193. package/dist/node/lib/AreDirective/AreDirective.meta.mjs.map +1 -0
  194. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +17 -0
  195. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +17 -0
  196. package/dist/node/lib/AreDirective/AreDirective.types.js +4 -0
  197. package/dist/node/lib/AreDirective/AreDirective.types.js.map +1 -0
  198. package/dist/node/lib/AreDirective/AreDirective.types.mjs +3 -0
  199. package/dist/node/lib/AreDirective/AreDirective.types.mjs.map +1 -0
  200. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +13 -0
  201. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +13 -0
  202. package/dist/node/lib/AreHTML/AreHTML.tokenizer.js +82 -0
  203. package/dist/node/lib/AreHTML/AreHTML.tokenizer.js.map +1 -0
  204. package/dist/node/lib/AreHTML/AreHTML.tokenizer.mjs +70 -0
  205. package/dist/node/lib/AreHTML/AreHTML.tokenizer.mjs.map +1 -0
  206. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +4 -0
  207. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +4 -0
  208. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js +13 -0
  209. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js.map +1 -0
  210. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs +12 -0
  211. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs.map +1 -0
  212. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +4 -0
  213. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +4 -0
  214. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +82 -0
  215. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -0
  216. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +75 -0
  217. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -0
  218. package/dist/node/lib/AreRoot/AreRoot.component.d.mts +13 -0
  219. package/dist/node/lib/AreRoot/AreRoot.component.d.ts +13 -0
  220. package/dist/node/lib/AreRoot/AreRoot.component.js +117 -0
  221. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -0
  222. package/dist/node/lib/AreRoot/AreRoot.component.mjs +107 -0
  223. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -0
  224. package/dist/node/lib/AreStyle/AreStyle.context.d.mts +8 -0
  225. package/dist/node/lib/AreStyle/AreStyle.context.d.ts +8 -0
  226. package/dist/node/lib/AreStyle/AreStyle.context.js +16 -0
  227. package/dist/node/lib/AreStyle/AreStyle.context.js.map +1 -0
  228. package/dist/node/lib/AreStyle/AreStyle.context.mjs +15 -0
  229. package/dist/node/lib/AreStyle/AreStyle.context.mjs.map +1 -0
  230. package/dist/node/lib/AreStyle/AreStyle.types.d.mts +2 -0
  231. package/dist/node/lib/AreStyle/AreStyle.types.d.ts +2 -0
  232. package/dist/node/lib/AreStyle/AreStyle.types.js +4 -0
  233. package/dist/node/lib/AreStyle/AreStyle.types.js.map +1 -0
  234. package/dist/node/lib/AreStyle/AreStyle.types.mjs +3 -0
  235. package/dist/node/lib/AreStyle/AreStyle.types.mjs.map +1 -0
  236. package/dist/node/lib/AreWatcher/AreWatcher.component.d.mts +18 -0
  237. package/dist/node/lib/AreWatcher/AreWatcher.component.d.ts +18 -0
  238. package/dist/node/lib/AreWatcher/AreWatcher.component.js +78 -0
  239. package/dist/node/lib/AreWatcher/AreWatcher.component.js.map +1 -0
  240. package/dist/node/lib/AreWatcher/AreWatcher.component.mjs +71 -0
  241. package/dist/node/lib/AreWatcher/AreWatcher.component.mjs.map +1 -0
  242. package/dist/node/nodes/AreComment.d.mts +10 -0
  243. package/dist/node/nodes/AreComment.d.ts +10 -0
  244. package/dist/node/nodes/AreComment.js +19 -0
  245. package/dist/node/nodes/AreComment.js.map +1 -0
  246. package/dist/node/nodes/AreComment.mjs +18 -0
  247. package/dist/node/nodes/AreComment.mjs.map +1 -0
  248. package/dist/node/nodes/AreComponent.d.mts +17 -0
  249. package/dist/node/nodes/AreComponent.d.ts +17 -0
  250. package/dist/node/nodes/AreComponent.js +35 -0
  251. package/dist/node/nodes/AreComponent.js.map +1 -0
  252. package/dist/node/nodes/AreComponent.mjs +28 -0
  253. package/dist/node/nodes/AreComponent.mjs.map +1 -0
  254. package/dist/node/nodes/AreInterpolation.d.mts +10 -0
  255. package/dist/node/nodes/AreInterpolation.d.ts +10 -0
  256. package/dist/node/nodes/AreInterpolation.js +19 -0
  257. package/dist/node/nodes/AreInterpolation.js.map +1 -0
  258. package/dist/node/nodes/AreInterpolation.mjs +18 -0
  259. package/dist/node/nodes/AreInterpolation.mjs.map +1 -0
  260. package/dist/node/nodes/AreRoot.d.mts +21 -0
  261. package/dist/node/nodes/AreRoot.d.ts +21 -0
  262. package/dist/node/nodes/AreRoot.js +41 -0
  263. package/dist/node/nodes/AreRoot.js.map +1 -0
  264. package/dist/node/nodes/AreRoot.mjs +34 -0
  265. package/dist/node/nodes/AreRoot.mjs.map +1 -0
  266. package/dist/node/nodes/AreText.d.mts +10 -0
  267. package/dist/node/nodes/AreText.d.ts +10 -0
  268. package/dist/node/nodes/AreText.js +19 -0
  269. package/dist/node/nodes/AreText.js.map +1 -0
  270. package/dist/node/nodes/AreText.mjs +18 -0
  271. package/dist/node/nodes/AreText.mjs.map +1 -0
  272. package/dist/node/signals/AreRoute.signal.d.mts +12 -0
  273. package/dist/node/signals/AreRoute.signal.d.ts +12 -0
  274. package/dist/node/signals/AreRoute.signal.js +25 -0
  275. package/dist/node/signals/AreRoute.signal.js.map +1 -0
  276. package/dist/node/signals/AreRoute.signal.mjs +24 -0
  277. package/dist/node/signals/AreRoute.signal.mjs.map +1 -0
  278. package/docs/a-logo-docs.png +0 -0
  279. package/examples/dashboard/concept.ts +60 -0
  280. package/examples/dashboard/containers/UI.container.ts +233 -0
  281. package/examples/dashboard/dist/index.html +22 -0
  282. package/examples/dashboard/dist/mnzfypsd-6zjt7w.js +11454 -0
  283. package/examples/dashboard/dist/styles.css +792 -0
  284. package/examples/dashboard/public/index.html +22 -0
  285. package/examples/dashboard/public/styles.css +792 -0
  286. package/examples/dashboard/src/components/DashboardApp.component.ts +31 -0
  287. package/examples/dashboard/src/components/DashboardHeader.component.ts +40 -0
  288. package/examples/dashboard/src/components/DashboardLogo.component.ts +29 -0
  289. package/examples/dashboard/src/components/DashboardMain.component.ts +57 -0
  290. package/examples/dashboard/src/components/DashboardMenu.component.ts +94 -0
  291. package/examples/dashboard/src/components/DashboardNav.component.ts +28 -0
  292. package/examples/dashboard/src/components/DashboardNavItem.component.ts +32 -0
  293. package/examples/dashboard/src/components/DashboardSidebar.component.ts +43 -0
  294. package/examples/dashboard/src/components/DashboardStatCard.component.ts +71 -0
  295. package/examples/dashboard/src/components/DashboardStats.component.ts +28 -0
  296. package/examples/dashboard/src/components/DashboardTable.component.ts +138 -0
  297. package/examples/dashboard/src/components/DashboardUserCard.component.ts +39 -0
  298. package/examples/dashboard/src/concept.ts +93 -0
  299. package/examples/jumpstart/concept.ts +60 -0
  300. package/examples/jumpstart/containers/UI.container.ts +233 -0
  301. package/examples/jumpstart/dist/index.html +104 -0
  302. package/examples/jumpstart/dist/mnpl1g4i-nobz9g.js +10882 -0
  303. package/examples/jumpstart/dist/static/css/main.css +40 -0
  304. package/examples/jumpstart/dist/static/img/test.png +0 -0
  305. package/examples/jumpstart/public/index.html +104 -0
  306. package/examples/jumpstart/public/static/css/main.css +40 -0
  307. package/examples/jumpstart/public/static/img/test.png +0 -0
  308. package/examples/jumpstart/src/components/A-Btn.component.ts +150 -0
  309. package/examples/jumpstart/src/components/A-Input.component.ts +78 -0
  310. package/examples/jumpstart/src/components/A-Navigation.component.ts +167 -0
  311. package/examples/jumpstart/src/components/List.component.ts +138 -0
  312. package/examples/jumpstart/src/components/PromptTextArea.component.ts +359 -0
  313. package/examples/jumpstart/src/components/SignInComponent.component.ts +127 -0
  314. package/examples/jumpstart/src/concept.ts +105 -0
  315. package/jest.config.ts +61 -0
  316. package/package.json +110 -0
  317. package/src/attributes/AreBinding.attribute.ts +19 -0
  318. package/src/attributes/AreDirective.attribute.ts +26 -0
  319. package/src/attributes/AreEvent.attribute.ts +5 -0
  320. package/src/attributes/AreStatic.attribute.ts +6 -0
  321. package/src/directives/AreComponent.directive.ts +0 -0
  322. package/src/directives/AreDirectiveFor.directive.ts +322 -0
  323. package/src/directives/AreDirectiveIf.directive.ts +130 -0
  324. package/src/engine/AreHTML.compiler.ts +226 -0
  325. package/src/engine/AreHTML.constants.ts +2 -0
  326. package/src/engine/AreHTML.context.ts +196 -0
  327. package/src/engine/AreHTML.engine.ts +210 -0
  328. package/src/engine/AreHTML.interpreter.ts +466 -0
  329. package/src/engine/AreHTML.lifecycle.ts +96 -0
  330. package/src/engine/AreHTML.tokenizer.ts +90 -0
  331. package/src/engine/AreHTML.transformer.ts +37 -0
  332. package/src/engine/AreHTML.types.ts +6 -0
  333. package/src/index.ts +80 -0
  334. package/src/instructions/AddAttribute.instruction.ts +25 -0
  335. package/src/instructions/AddComment.instruction.ts +27 -0
  336. package/src/instructions/AddElement.instruction.ts +22 -0
  337. package/src/instructions/AddInterpolation.instruction.ts +24 -0
  338. package/src/instructions/AddListener.instruction.ts +24 -0
  339. package/src/instructions/AddStyle.instruction.ts +24 -0
  340. package/src/instructions/AddText.instruction.ts +21 -0
  341. package/src/instructions/AreHTML.instructions.constants.ts +11 -0
  342. package/src/instructions/AreHTML.instructions.types.ts +51 -0
  343. package/src/lib/AreDirective/AreDirective.component.ts +124 -0
  344. package/src/lib/AreDirective/AreDirective.constants.ts +16 -0
  345. package/src/lib/AreDirective/AreDirective.context.ts +16 -0
  346. package/src/lib/AreDirective/AreDirective.meta.ts +9 -0
  347. package/src/lib/AreDirective/AreDirective.types.ts +14 -0
  348. package/src/lib/AreHTML/AreHTML.tokenizer.ts +86 -0
  349. package/src/lib/AreHTMLAttribute/AreHTML.attribute.ts +13 -0
  350. package/src/lib/AreHTMLNode/AreHTMLNode.ts +84 -0
  351. package/src/lib/AreRoot/AreRoot.component.ts +134 -0
  352. package/src/lib/AreStyle/AreStyle.context.ts +20 -0
  353. package/src/lib/AreStyle/AreStyle.types.ts +0 -0
  354. package/src/lib/AreWatcher/AreWatcher.component.ts +84 -0
  355. package/src/nodes/AreComment.ts +17 -0
  356. package/src/nodes/AreComponent.ts +25 -0
  357. package/src/nodes/AreInterpolation.ts +16 -0
  358. package/src/nodes/AreRoot.ts +29 -0
  359. package/src/nodes/AreText.ts +17 -0
  360. package/src/signals/AreRoute.signal.ts +27 -0
  361. package/tests/AreTokenizer.test.ts +260 -0
  362. package/tests/jest.setup.ts +30 -0
  363. package/tsconfig.json +60 -0
  364. package/tslint.json +98 -0
  365. package/tsup.config.ts +108 -0
@@ -0,0 +1,130 @@
1
+ import { A_Caller, A_Inject, A_Scope } from "@adaas/a-concept";
2
+ import { A_Logger } from "@adaas/a-utils/a-logger";
3
+ import { AreDirectiveAttribute } from "@adaas/are-html/attributes/AreDirective.attribute";
4
+ import { AreScene, AreStore, AreSyntax } from "@adaas/are";
5
+ import { AreDirective } from "@adaas/are-html/directive/AreDirective.component";
6
+ import { AddCommentInstruction } from "@adaas/are-html/instructions/AddComment.instruction";
7
+ import { AreDirectiveContext } from "@adaas/are-html/directive/AreDirective.context";
8
+
9
+
10
+
11
+ @AreDirective.Priority(2)
12
+ export class AreDirectiveIf extends AreDirective {
13
+
14
+
15
+ @AreDirective.Transform
16
+ transform(
17
+ @A_Inject(A_Caller) attribute: AreDirectiveAttribute,
18
+ @A_Inject(A_Scope) scope: A_Scope,
19
+
20
+ @A_Inject(AreStore) store: AreStore,
21
+ @A_Inject(AreScene) scene: AreScene,
22
+ @A_Inject(A_Logger) logger: A_Logger,
23
+ ...args: any[]
24
+ ) {
25
+ logger.debug(`[Transform] directive $IF for <${attribute.owner.aseid.toString()}>`)
26
+
27
+ const node = attribute.owner;
28
+
29
+ /**
30
+ * We have to keep this node as a group node, and copy all data into the child node that would be actual node.
31
+ */
32
+ const ifTemplate = node.cloneWithScope();
33
+
34
+ const ifAttr = ifTemplate.attributes.find(d => d.name === attribute.name);
35
+
36
+ if (ifAttr) {
37
+ ifTemplate.scope.deregister(ifAttr);
38
+ node.scope.register(ifAttr);
39
+ }
40
+
41
+ node.init();
42
+
43
+ node.addChild(ifTemplate);
44
+
45
+ /**
46
+ * Resolve or create a directive context for the item node. This is needed to hold the item-specific store values (e.g. the "item" and "index" in a "for" loop) that the template's bindings will reference during compile and update. The context is shared among all clones of the same template, but that's fine because each clone gets its own scope values assigned here.
47
+ */
48
+ // let directiveContext = ifTemplate.scope.resolveFlat(AreDirectiveContext);
49
+
50
+ // if (!directiveContext) {
51
+ // directiveContext = new AreDirectiveContext(ifTemplate.aseid);
52
+ // ifTemplate.scope.register(directiveContext);
53
+ // }
54
+
55
+ ifTemplate.scene.deactivate();
56
+
57
+ attribute.template = ifTemplate;
58
+
59
+ }
60
+
61
+
62
+ @AreDirective.Compile
63
+ compile(
64
+ @A_Inject(A_Caller) attribute: AreDirectiveAttribute,
65
+ @A_Inject(AreStore) store: AreStore,
66
+ @A_Inject(AreScene) scene: AreScene,
67
+ @A_Inject(AreSyntax) syntax: AreSyntax,
68
+
69
+ @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,
70
+ ...args: any[]
71
+ ): void {
72
+
73
+ console.log('Compiling directive "if" with attribute content:', attribute);
74
+
75
+ /**
76
+ * 1. Extract the value from the store based on the attribute content
77
+ * (which is the path to the value in the store)
78
+ */
79
+ attribute.value = syntax.evaluate(attribute.content, store, {
80
+ ...(directiveContext?.scope || {}),
81
+ });
82
+
83
+ /**
84
+ * 2. If the value is falsy, remove the node from the scene by planning a RemoveElement instruction.
85
+ * If the value is truthy, ensure the node is in the scene by planning an AddElement instruction if it's not already planned.
86
+ */
87
+ const hostInstruction = scene.host!;
88
+ const commentIdentifier = ` --- if: ${attribute.template!.id} --- `;
89
+ const declaration = new AddCommentInstruction({ content: commentIdentifier })
90
+
91
+ scene.setHost(declaration);
92
+ scene.planBefore(declaration, hostInstruction);
93
+ scene.unPlan(hostInstruction);
94
+
95
+ if (attribute.value)
96
+ attribute.template!.scene.activate();
97
+ else
98
+ attribute.template!.scene.deactivate();
99
+ }
100
+
101
+
102
+
103
+ @AreDirective.Update
104
+ update(
105
+ @A_Inject(A_Caller) attribute: AreDirectiveAttribute,
106
+ @A_Inject(AreStore) store: AreStore,
107
+ @A_Inject(A_Scope) scope: A_Scope,
108
+ @A_Inject(AreSyntax) syntax: AreSyntax,
109
+ @A_Inject(AreScene) scene: AreScene,
110
+ ...args: any[]
111
+ ): void {
112
+ /**
113
+ * 1. Extract the value from the store based on the attribute content
114
+ * (which is the path to the value in the store)
115
+ */
116
+ attribute.value = syntax.evaluate(attribute.content, store);
117
+
118
+ if (attribute.value) {
119
+ attribute.template!.scene.activate();
120
+
121
+ attribute.template!.mount()
122
+ }
123
+ else {
124
+ attribute.template!.unmount();
125
+
126
+ attribute.template!.scene.deactivate();
127
+ }
128
+ }
129
+
130
+ }
@@ -0,0 +1,226 @@
1
+ import { A_Caller, A_Dependency, A_Feature, A_FormatterHelper, A_Inject } from "@adaas/a-concept";
2
+ import { A_Logger } from "@adaas/a-utils/a-logger";
3
+ import { A_Frame } from "@adaas/a-frame";
4
+ import { AreCompiler, AreScene, AreCompilerError, AreStore } from "@adaas/are";
5
+ import { AreDirectiveAttribute } from "@adaas/are-html/attributes/AreDirective.attribute";
6
+ import { AreStaticAttribute } from "@adaas/are-html/attributes/AreStatic.attribute";
7
+ import { AreDirectiveFeatures } from "@adaas/are-html/directive/AreDirective.constants";
8
+ import { AreEventAttribute } from "@adaas/are-html/attributes/AreEvent.attribute";
9
+ import { AreBindingAttribute } from "@adaas/are-html/attributes/AreBinding.attribute";
10
+ import { AreInterpolation } from "@adaas/are-html/nodes/AreInterpolation";
11
+ import { AreText } from "@adaas/are-html/nodes/AreText";
12
+ import { AddAttributeInstruction} from "@adaas/are-html/instructions/AddAttribute.instruction";
13
+ import { AddTextInstruction} from "@adaas/are-html/instructions/AddText.instruction";
14
+ import { AddListenerInstruction} from "@adaas/are-html/instructions/AddListener.instruction";
15
+
16
+
17
+
18
+
19
+ @A_Frame.Component({
20
+ namespace: 'A-ARE',
21
+ name: 'AreHTMLCompiler',
22
+ description: 'HTML-specific compiler for A-Concept Rendering Engine (ARE) components, extending the base AreCompiler to handle HTML templates, styles, and rendering logic tailored for web environments.'
23
+ })
24
+ export class AreHTMLCompiler extends AreCompiler {
25
+
26
+ // compile(
27
+ // @A_Inject(A_Caller) node: AreHTMLNode,
28
+ // @A_Inject(AreScene) scene: AreScene,
29
+ // ...args: any[]
30
+ // ): void {
31
+ // super.compile(node, scene, ...args);
32
+ // }
33
+
34
+ // -----------------------------------------------------------------------------------------
35
+ // -------------------------Are-Interpolation Compile Section-----------------------------------
36
+ // -----------------------------------------------------------------------------------------
37
+ /**
38
+ * Default compile method for interpolations, which can be overridden by specific implementations if needed.
39
+ *
40
+ * @param interpolation
41
+ * @param scope
42
+ * @param scene
43
+ * @param store
44
+ * @param feature
45
+ */
46
+ @AreCompiler.Compile(AreInterpolation)
47
+ compileInterpolation(
48
+ @A_Inject(A_Caller) interpolation: AreInterpolation,
49
+ @A_Inject(AreScene) scene: AreScene,
50
+
51
+ @A_Inject(AreStore) store: AreStore,
52
+ @A_Inject(A_Logger) logger?: A_Logger,
53
+ ...args: any[]
54
+ ) {
55
+ // if (scene.host)
56
+ // console.log('Scene Host: ', scene.host);
57
+
58
+ // let content = '';
59
+
60
+ // logger?.debug('green', `AreHTMLCompiler: compile interpolation <${interpolation.aseid.toString()}> with key: "${interpolation.content}"`, store.get(interpolation.content));
61
+
62
+ // try {
63
+ // content = AreCommonHelper.evaluate(interpolation.content, store);
64
+
65
+ // } catch (error) {
66
+ // content = ''
67
+ // }
68
+
69
+ scene.plan(new AddTextInstruction({ content: interpolation.content, evaluate: true }));
70
+ }
71
+
72
+ // -----------------------------------------------------------------------------------------
73
+ // ------------------------------Are-Text Compile Section-----------------------------------
74
+ // -----------------------------------------------------------------------------------------
75
+ @AreCompiler.Compile(AreText)
76
+ compileText(
77
+ @A_Inject(A_Caller) text: AreText,
78
+ @A_Inject(AreScene) scene: AreScene,
79
+ @A_Inject(A_Logger) logger?: A_Logger,
80
+ ...args: any[]
81
+ ) {
82
+ logger?.debug('cyan', `AreHTMLCompiler: compile text node <${text.aseid.toString()}> with content: "${text.content}"`);
83
+ if (scene.host)
84
+ scene.unPlan(scene.host);
85
+
86
+ scene.plan(new AddTextInstruction({ content: text.content }));
87
+
88
+ }
89
+
90
+ // -----------------------------------------------------------------------------------------
91
+ // -------------------------Are-Attribute Compile Section-----------------------------------
92
+ // -----------------------------------------------------------------------------------------
93
+
94
+ @AreCompiler.Compile(AreStaticAttribute)
95
+ compileStaticAttribute(
96
+ @A_Inject(A_Caller) attribute: AreStaticAttribute,
97
+ @A_Inject(AreScene) scene: AreScene,
98
+ ...args: any[]
99
+ ) {
100
+ if (!scene.host)
101
+ throw new AreCompilerError({
102
+ title: 'Scene Host Not Found',
103
+ description: `No host found for the scene with id: ${scene.id}. Please ensure that the scene is properly initialized and has a host before compiling binding attributes.`
104
+ });
105
+ /**
106
+ * Default case when attribute was not able to be identified as a binding, directive, or event, we just want to add it as a regular attribute to the node. This is the most basic case for attributes that don't have any special behavior or processing logic, and it ensures that they are still rendered on the node even if they don't have any dynamic functionality.
107
+ */
108
+ scene.plan(new AddAttributeInstruction(scene.host, {
109
+ name: attribute.name,
110
+ content: attribute.content
111
+ }));
112
+ }
113
+
114
+ @AreCompiler.Compile(AreDirectiveAttribute)
115
+ compileDirectiveAttribute(
116
+ @A_Inject(A_Caller) directive: AreDirectiveAttribute,
117
+ @A_Inject(AreStore) store: AreStore,
118
+ @A_Inject(A_Feature) feature: A_Feature,
119
+ @A_Inject(A_Logger) logger?: A_Logger,
120
+ ...args: any[]
121
+ ) {
122
+ store.watch(directive);
123
+
124
+ /**
125
+ * 3. If the attribute is a directive, then we should find a component that is responsible for
126
+ * the directive compiling logic, and call it.
127
+ * In case component is not found we just want to log a warning,
128
+ * since the directive may be handled by some parent component or simply is a mistake in the template.
129
+ */
130
+ if (directive.component) {
131
+ feature.chain(directive.component, AreDirectiveFeatures.Compile, directive.owner.scope);
132
+ } else {
133
+ logger?.warning(`Directive handler component not found for directive: ${directive.name}. Make sure to create a component named "AreDirective${A_FormatterHelper.toPascalCase(directive.name)}" to handle this directive.`);
134
+ }
135
+
136
+ store.unwatch(directive);
137
+ }
138
+
139
+
140
+ @AreCompiler.Compile(AreEventAttribute)
141
+ compileEventAttribute(
142
+ @A_Inject(A_Caller) attribute: AreEventAttribute,
143
+ @A_Inject(AreScene) scene: AreScene,
144
+ ...args: any[]
145
+ ) {
146
+
147
+ if (!scene.host)
148
+ throw new AreCompilerError({
149
+ title: 'Scene Host Not Found',
150
+ description: `No host found for the scene with id: ${scene.id}. Please ensure that the scene is properly initialized and has a host before compiling binding attributes.`
151
+ });
152
+ /**
153
+ * 2. In case the attribute is an event listener, then
154
+ * we should simply add a callback handler that will be used to proxy an event
155
+ * into the ComponentNode component.
156
+ *[!] In this case AreAttribute is AreEventAttribute that has prepared callback function to be used
157
+ * in the event listener. It is important to store callback function once
158
+ * to prevent duplicated functions in case of multiple compilations during development.
159
+ */
160
+ scene.plan(new AddListenerInstruction(scene.host, {
161
+ name: attribute.name,
162
+ handler: attribute.content
163
+ }));
164
+ }
165
+
166
+
167
+ @AreCompiler.Compile(AreBindingAttribute)
168
+ compileBindingAttribute(
169
+ @A_Inject(A_Caller) attribute: AreBindingAttribute,
170
+ @A_Inject(AreScene) scene: AreScene,
171
+ @A_Dependency.Parent()
172
+ @A_Inject(AreStore) parentStore: AreStore,
173
+ @A_Inject(AreStore) store: AreStore,
174
+ ...args: any[]
175
+ ) {
176
+ if (!scene.host)
177
+ throw new AreCompilerError({
178
+ title: 'Scene Host Not Found',
179
+ description: `No host found for the scene with id: ${scene.id}. Please ensure that the scene is properly initialized and has a host before compiling binding attributes.`
180
+ });
181
+
182
+
183
+ const node = attribute.owner;
184
+
185
+ /**
186
+ * 1. If the binding is related to a component prop, then we should set the value to the component props, so it can be used in the component logic and rendering.
187
+ * This is a special case for component props, since they are not regular attributes and have a special meaning and usage in the component. By setting the value directly to the component props, we can ensure that it is properly reactive and can influence the component's behavior and rendering based on its value.
188
+ */
189
+ if (node.component && node.component.props[attribute.name]) {
190
+ const propDefinition = node.component.props[attribute.name];
191
+ let value = parentStore.get(attribute.content);
192
+
193
+ if (propDefinition.type) {
194
+ switch (propDefinition.type) {
195
+ case 'string':
196
+ value = String(value);
197
+ break;
198
+ case 'number':
199
+ value = Number(value);
200
+ break;
201
+ case 'boolean':
202
+ value = Boolean(value);
203
+ break;
204
+ default:
205
+ break;
206
+ }
207
+ }
208
+
209
+ store.set(attribute.name, value);
210
+ }
211
+ /**
212
+ * 2. In other cases, we just want to add it as a regular attribute to the node, since it can be used in the template and rendering as a dynamic value that can change based on the store value. By adding it as a regular attribute, we can ensure that it is properly rendered and updated in the DOM based on its value in the store.
213
+ */
214
+ else {
215
+ const instruction = new AddAttributeInstruction(scene.host, {
216
+ name: attribute.name,
217
+ content: attribute.content,
218
+ evaluate: true
219
+ })
220
+
221
+ scene.plan(instruction);
222
+ }
223
+ }
224
+
225
+
226
+ }
@@ -0,0 +1,2 @@
1
+
2
+
@@ -0,0 +1,196 @@
1
+ import { AreContext, AreInstruction, AreNode } from "@adaas/are";
2
+ import { AreHTMLContextConstructor } from "./AreHTML.types";
3
+
4
+
5
+ export class AreHTMLEngineContext extends AreContext {
6
+
7
+ /**
8
+ * Index structure mapping:
9
+ *
10
+ * Node -> Group ID -> Element
11
+ * -----------------------------------------------------------------------------------
12
+ * | - Attribute | group: string | Node
13
+ * | - Directive (e.g. for) | | Node
14
+ */
15
+
16
+ protected index = {
17
+ /**
18
+ * 1 AreNode = 1 Dom Node
19
+ *
20
+ * uses ASEID
21
+ */
22
+ nodeToHostElements: new Map<string, Node>(),
23
+ /**
24
+ * 1 Group Instruction = MANY Dom Nodes (e.g. for loop)
25
+ *
26
+ * uses ASEID
27
+ */
28
+ groupToElements: new Map<string, Set<Node>>(),
29
+ /**
30
+ * 1 Dom Node = 1 Instruction
31
+ *
32
+ * uses ASEID
33
+ */
34
+ elementToInstruction: new WeakMap<Node, string>(),
35
+ /**
36
+ * 1 Instruction = 1 Dom Node (for CreateElement instructions, for example)
37
+ *
38
+ * uses ASEID
39
+ */
40
+ instructionToElement: new Map<string, Node>(),
41
+ /**
42
+ * Event listeners attached to elements, used for proper cleanup when reverting instructions. Maps a DOM element to a map of event names and their corresponding listeners, allowing the engine to track which listeners are attached to which elements and remove them when necessary (e.g., when an instruction is reverted).
43
+ */
44
+ elementListeners: new WeakMap<Node, Map<string, EventListenerOrEventListenerObject>>()
45
+ }
46
+
47
+ /**
48
+ * The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.
49
+ */
50
+ protected _container: Document;
51
+
52
+
53
+ constructor(props: Partial<AreHTMLContextConstructor>) {
54
+ super(props.container?.body.innerHTML || props.source || '');
55
+ this._container = props.container!;
56
+ }
57
+
58
+ get container(): Document {
59
+ return this._container;
60
+ }
61
+
62
+
63
+ /**
64
+ * Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.
65
+ *
66
+ * @param nodeASEID
67
+ */
68
+ getNodeElement(nodeASEID: string): Node | undefined
69
+ getNodeElement(node: AreNode): Node | undefined
70
+ getNodeElement(node: AreNode | string): Node | undefined {
71
+ if (typeof node === 'string') {
72
+ return this.index.nodeToHostElements.get(node);
73
+ } else {
74
+ return this.index.nodeToHostElements.get(node.aseid.toString());
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Associates a DOM element with a given instruction and its owner node. This method updates the context's index to map the instruction's ASEID to the provided DOM element, and also maps the element back to the instruction's ASEID for reverse lookup. If the instruction has an owner node, it also maps the node's ASEID to the element. Additionally, if the instruction belongs to a group, it adds the element to the set of elements associated with that group. This indexing allows the engine to efficiently manage and update DOM elements based on instructions and their corresponding nodes, enabling dynamic rendering and interaction in response to application state changes.
80
+ *
81
+ * @param instruction
82
+ * @param element
83
+ */
84
+ setInstructionElement(instruction: AreInstruction, element: Node): void {
85
+ const node = instruction.owner;
86
+
87
+ this.index.instructionToElement.set(instruction.aseid.toString(), element);
88
+ this.index.elementToInstruction.set(element, instruction.aseid.toString());
89
+
90
+ if (node) {
91
+ this.index.nodeToHostElements.set(node.aseid.toString(), element);
92
+ }
93
+
94
+ if (instruction.group) {
95
+ const groupId = instruction.group;
96
+ if (!this.index.groupToElements.has(groupId)) {
97
+ this.index.groupToElements.set(groupId, new Set());
98
+ }
99
+ this.index.groupToElements.get(groupId)!.add(element);
100
+ }
101
+ }
102
+
103
+
104
+ /**
105
+ * Retrieves the DOM element associated with a given instruction. This method looks up the instruction's ASEID in the instructionToElement map to find the corresponding DOM element. If the instruction is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific instructions, enabling dynamic updates and interactions based on the application state.
106
+ *
107
+ * @param instructionASEID
108
+ */
109
+ getElementByInstruction(instructionASEID: string): Node | undefined
110
+ getElementByInstruction(instruction: AreInstruction): Node | undefined
111
+ getElementByInstruction(instruction: AreInstruction | string): Node | undefined {
112
+ if (typeof instruction === 'string') {
113
+ return this.index.instructionToElement.get(instruction);
114
+ } else {
115
+ return this.index.instructionToElement.get(instruction.aseid.toString());
116
+ }
117
+ }
118
+
119
+
120
+ /**
121
+ * Removes the association between a given instruction and its corresponding DOM element. This method looks up the instruction's ASEID to find the associated DOM element, and if found, it deletes the mapping from both instructionToElement and elementToInstruction. If the instruction has an owner node, it also removes the mapping from nodeToHostElements. Additionally, if the instruction belongs to a group, it removes the element from the set of elements associated with that group, and if the group has no more elements, it deletes the group from the index. This cleanup is essential for maintaining an accurate and efficient mapping of instructions to DOM elements, especially when instructions are reverted or when nodes are removed from the DOM.
122
+ *
123
+ * @param instruction
124
+ */
125
+ removeInstructionElement(instruction: AreInstruction): void {
126
+ const element = this.index.instructionToElement.get(instruction.aseid.toString());
127
+ if (element) {
128
+ this.index.instructionToElement.delete(instruction.aseid.toString());
129
+ this.index.elementToInstruction.delete(element);
130
+
131
+ const node = instruction.owner;
132
+ if (node) {
133
+ this.index.nodeToHostElements.delete(node.aseid.toString());
134
+ }
135
+
136
+ if (instruction.group) {
137
+ const groupId = instruction.group;
138
+ const groupElements = this.index.groupToElements.get(groupId);
139
+ if (groupElements) {
140
+ groupElements.delete(element);
141
+ if (groupElements.size === 0) {
142
+ this.index.groupToElements.delete(groupId);
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+
149
+ /**
150
+ * Retrieves the set of DOM elements associated with a given group. This method looks up the group name or instruction's ASEID in the groupToElements map to find the corresponding set of DOM elements. If the group is not found, it returns undefined. This allows the engine to efficiently access and manipulate all DOM elements that belong to a specific group (e.g., all elements generated by a particular loop instruction), enabling dynamic updates and interactions based on the application state.
151
+ *
152
+ * @param groupName
153
+ */
154
+ getElementsByGroup(groupName: string): Set<Node> | undefined
155
+ getElementsByGroup(instruction: AreInstruction): Set<Node> | undefined
156
+ getElementsByGroup(instruction: AreInstruction | string): Set<Node> | undefined {
157
+ if (typeof instruction === 'string') {
158
+ return this.index.groupToElements.get(instruction);
159
+ } else {
160
+ return this.index.groupToElements.get(instruction.aseid.toString());
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Adds an event listener to a specific DOM element and keeps track of it in the context's index for proper cleanup later. This method takes a DOM element, an event name, and a listener function or object, and stores this information in the elementListeners map. This allows the engine to efficiently manage event listeners attached to dynamically created elements, ensuring that they can be removed when the associated instructions are reverted or when nodes are removed from the DOM, preventing memory leaks and unintended behavior.
166
+ *
167
+ * @param element
168
+ * @param eventName
169
+ * @param listener
170
+ */
171
+ addListener(element: Node, eventName: string, listener: EventListenerOrEventListenerObject): void {
172
+ if (!this.index.elementListeners.has(element)) {
173
+ this.index.elementListeners.set(element, new Map());
174
+ }
175
+ this.index.elementListeners.get(element)!.set(eventName, listener);
176
+ }
177
+ /**
178
+ * Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
179
+ *
180
+ * @param element
181
+ * @param eventName
182
+ * @returns
183
+ */
184
+ getListener(element: Node, eventName: string): EventListenerOrEventListenerObject | undefined {
185
+ return this.index.elementListeners.get(element)?.get(eventName);
186
+ }
187
+ /**
188
+ * Removes an event listener from a specific DOM element and updates the context's index accordingly. This method looks up the element in the elementListeners map and deletes the listener for the specified event name. This is typically called when an instruction is reverted or when a node is removed from the DOM, ensuring that any attached event listeners are properly cleaned up to prevent memory leaks and unintended behavior.
189
+ *
190
+ * @param element
191
+ * @param eventName
192
+ */
193
+ removeListener(element: Node, eventName: string): void {
194
+ this.index.elementListeners.get(element)?.delete(eventName);
195
+ }
196
+ }