slicejs-web-framework 3.1.2 → 3.1.4

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 (222) hide show
  1. package/Slice/Slice.js +11 -6
  2. package/Slice/tests/build-bundled-component-without-category.test.js +103 -0
  3. package/package.json +1 -1
  4. package/.worktrees/bundling-v2-precompiled-registrars/LICENSE +0 -21
  5. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/ContextManager/ContextManager.js +0 -369
  6. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/ContextManager/ContextManagerDebugger.js +0 -297
  7. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Controller/Controller.js +0 -972
  8. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Debugger/Debugger.css +0 -620
  9. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Debugger/Debugger.html +0 -73
  10. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Debugger/Debugger.js +0 -1548
  11. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/EventManager/EventManager.js +0 -338
  12. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/EventManager/EventManagerDebugger.js +0 -361
  13. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Logger/Log.js +0 -10
  14. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Logger/Logger.js +0 -146
  15. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/Router/Router.js +0 -721
  16. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/StylesManager/StylesManager.js +0 -78
  17. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Components/Structural/StylesManager/ThemeManager/ThemeManager.js +0 -84
  18. package/.worktrees/bundling-v2-precompiled-registrars/Slice/Slice.js +0 -504
  19. package/.worktrees/bundling-v2-precompiled-registrars/Slice/tests/bundle-v2-runtime-contract.test.js +0 -268
  20. package/.worktrees/bundling-v2-precompiled-registrars/Slice/tests/router-loading-finally.test.js +0 -68
  21. package/.worktrees/bundling-v2-precompiled-registrars/api/index.js +0 -286
  22. package/.worktrees/bundling-v2-precompiled-registrars/api/middleware/securityMiddleware.js +0 -253
  23. package/.worktrees/bundling-v2-precompiled-registrars/package.json +0 -37
  24. package/.worktrees/bundling-v2-precompiled-registrars/sliceConfig.schema.json +0 -109
  25. package/.worktrees/bundling-v2-precompiled-registrars/src/App/index.html +0 -22
  26. package/.worktrees/bundling-v2-precompiled-registrars/src/App/index.js +0 -23
  27. package/.worktrees/bundling-v2-precompiled-registrars/src/App/style.css +0 -40
  28. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/HomePage/HomePage.css +0 -201
  29. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/HomePage/HomePage.html +0 -37
  30. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/HomePage/HomePage.js +0 -210
  31. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/Playground/Playground.css +0 -12
  32. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/Playground/Playground.html +0 -0
  33. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/AppComponents/Playground/Playground.js +0 -111
  34. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Service/FetchManager/FetchManager.js +0 -133
  35. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -141
  36. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Service/LocalStorageManager/LocalStorageManager.js +0 -45
  37. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Button/Button.css +0 -47
  38. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Button/Button.html +0 -5
  39. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Button/Button.js +0 -93
  40. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Card/Card.css +0 -68
  41. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Card/Card.html +0 -7
  42. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Card/Card.js +0 -107
  43. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Checkbox/Checkbox.css +0 -87
  44. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Checkbox/Checkbox.html +0 -8
  45. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Checkbox/Checkbox.js +0 -86
  46. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/CodeVisualizer/CodeVisualizer.css +0 -130
  47. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/CodeVisualizer/CodeVisualizer.html +0 -4
  48. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/CodeVisualizer/CodeVisualizer.js +0 -262
  49. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Details/Details.css +0 -70
  50. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Details/Details.html +0 -9
  51. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Details/Details.js +0 -76
  52. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/DropDown/DropDown.css +0 -60
  53. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/DropDown/DropDown.html +0 -5
  54. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/DropDown/DropDown.js +0 -63
  55. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Grid/Grid.css +0 -7
  56. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Grid/Grid.html +0 -1
  57. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Grid/Grid.js +0 -57
  58. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/Icon.css +0 -510
  59. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/Icon.html +0 -1
  60. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/Icon.js +0 -89
  61. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.eot +0 -0
  62. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.json +0 -555
  63. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.styl +0 -507
  64. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.svg +0 -1485
  65. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.symbol.svg +0 -1059
  66. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.ttf +0 -0
  67. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.woff +0 -0
  68. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Icon/slc.woff2 +0 -0
  69. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Input/Input.css +0 -91
  70. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Input/Input.html +0 -4
  71. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Input/Input.js +0 -215
  72. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Layout/Layout.css +0 -0
  73. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Layout/Layout.html +0 -0
  74. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Layout/Layout.js +0 -49
  75. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Link/Link.css +0 -8
  76. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Link/Link.html +0 -1
  77. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Link/Link.js +0 -63
  78. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Loading/Loading.css +0 -56
  79. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Loading/Loading.html +0 -83
  80. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Loading/Loading.js +0 -38
  81. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/MultiRoute/MultiRoute.js +0 -93
  82. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Navbar/Navbar.css +0 -115
  83. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Navbar/Navbar.html +0 -44
  84. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Navbar/Navbar.js +0 -141
  85. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/NotFound/NotFound.css +0 -117
  86. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/NotFound/NotFound.html +0 -24
  87. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/NotFound/NotFound.js +0 -16
  88. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Route/Route.js +0 -93
  89. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Select/Select.css +0 -84
  90. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Select/Select.html +0 -8
  91. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Select/Select.js +0 -195
  92. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Switch/Switch.css +0 -76
  93. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Switch/Switch.html +0 -8
  94. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/Switch/Switch.js +0 -102
  95. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeItem/TreeItem.css +0 -36
  96. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeItem/TreeItem.html +0 -1
  97. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeItem/TreeItem.js +0 -126
  98. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeView/TreeView.css +0 -8
  99. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeView/TreeView.html +0 -1
  100. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/Visual/TreeView/TreeView.js +0 -48
  101. package/.worktrees/bundling-v2-precompiled-registrars/src/Components/components.js +0 -27
  102. package/.worktrees/bundling-v2-precompiled-registrars/src/Styles/sliceStyles.css +0 -34
  103. package/.worktrees/bundling-v2-precompiled-registrars/src/Themes/Dark.css +0 -42
  104. package/.worktrees/bundling-v2-precompiled-registrars/src/Themes/Light.css +0 -31
  105. package/.worktrees/bundling-v2-precompiled-registrars/src/Themes/Slice.css +0 -47
  106. package/.worktrees/bundling-v2-precompiled-registrars/src/images/Slice.js-logo.png +0 -0
  107. package/.worktrees/bundling-v2-precompiled-registrars/src/images/favicon.ico +0 -0
  108. package/.worktrees/bundling-v2-precompiled-registrars/src/images/im2/Slice.js-logo.png +0 -0
  109. package/.worktrees/bundling-v2-precompiled-registrars/src/routes.js +0 -16
  110. package/.worktrees/bundling-v2-precompiled-registrars/src/sliceConfig.json +0 -73
  111. package/.worktrees/bundling-v2-precompiled-registrars/src/testing.js +0 -888
  112. package/.worktrees/public-env-browser-exposure/LICENSE +0 -21
  113. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/ContextManager/ContextManager.js +0 -369
  114. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/ContextManager/ContextManagerDebugger.js +0 -297
  115. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Controller/Controller.js +0 -972
  116. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Debugger/Debugger.css +0 -620
  117. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Debugger/Debugger.html +0 -73
  118. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Debugger/Debugger.js +0 -1548
  119. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/EventManager/EventManager.js +0 -338
  120. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/EventManager/EventManagerDebugger.js +0 -361
  121. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Logger/Log.js +0 -10
  122. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Logger/Logger.js +0 -146
  123. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/Router/Router.js +0 -721
  124. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/StylesManager/StylesManager.js +0 -78
  125. package/.worktrees/public-env-browser-exposure/Slice/Components/Structural/StylesManager/ThemeManager/ThemeManager.js +0 -84
  126. package/.worktrees/public-env-browser-exposure/Slice/Slice.js +0 -533
  127. package/.worktrees/public-env-browser-exposure/Slice/tests/bundle-v2-runtime-contract.test.js +0 -268
  128. package/.worktrees/public-env-browser-exposure/Slice/tests/public-env-runtime-accessors.test.js +0 -44
  129. package/.worktrees/public-env-browser-exposure/Slice/tests/router-loading-finally.test.js +0 -68
  130. package/.worktrees/public-env-browser-exposure/api/index.js +0 -286
  131. package/.worktrees/public-env-browser-exposure/api/middleware/securityMiddleware.js +0 -253
  132. package/.worktrees/public-env-browser-exposure/api/tests/public-env-resolver.test.js +0 -193
  133. package/.worktrees/public-env-browser-exposure/api/utils/publicEnvResolver.js +0 -117
  134. package/.worktrees/public-env-browser-exposure/package.json +0 -37
  135. package/.worktrees/public-env-browser-exposure/sliceConfig.schema.json +0 -109
  136. package/.worktrees/public-env-browser-exposure/src/App/index.html +0 -22
  137. package/.worktrees/public-env-browser-exposure/src/App/index.js +0 -23
  138. package/.worktrees/public-env-browser-exposure/src/App/style.css +0 -40
  139. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/HomePage/HomePage.css +0 -201
  140. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/HomePage/HomePage.html +0 -37
  141. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/HomePage/HomePage.js +0 -210
  142. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/Playground/Playground.css +0 -12
  143. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/Playground/Playground.html +0 -0
  144. package/.worktrees/public-env-browser-exposure/src/Components/AppComponents/Playground/Playground.js +0 -111
  145. package/.worktrees/public-env-browser-exposure/src/Components/Service/FetchManager/FetchManager.js +0 -133
  146. package/.worktrees/public-env-browser-exposure/src/Components/Service/IndexedDbManager/IndexedDbManager.js +0 -141
  147. package/.worktrees/public-env-browser-exposure/src/Components/Service/LocalStorageManager/LocalStorageManager.js +0 -45
  148. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Button/Button.css +0 -47
  149. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Button/Button.html +0 -5
  150. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Button/Button.js +0 -93
  151. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Card/Card.css +0 -68
  152. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Card/Card.html +0 -7
  153. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Card/Card.js +0 -107
  154. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Checkbox/Checkbox.css +0 -87
  155. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Checkbox/Checkbox.html +0 -8
  156. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Checkbox/Checkbox.js +0 -86
  157. package/.worktrees/public-env-browser-exposure/src/Components/Visual/CodeVisualizer/CodeVisualizer.css +0 -130
  158. package/.worktrees/public-env-browser-exposure/src/Components/Visual/CodeVisualizer/CodeVisualizer.html +0 -4
  159. package/.worktrees/public-env-browser-exposure/src/Components/Visual/CodeVisualizer/CodeVisualizer.js +0 -262
  160. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Details/Details.css +0 -70
  161. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Details/Details.html +0 -9
  162. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Details/Details.js +0 -76
  163. package/.worktrees/public-env-browser-exposure/src/Components/Visual/DropDown/DropDown.css +0 -60
  164. package/.worktrees/public-env-browser-exposure/src/Components/Visual/DropDown/DropDown.html +0 -5
  165. package/.worktrees/public-env-browser-exposure/src/Components/Visual/DropDown/DropDown.js +0 -63
  166. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Grid/Grid.css +0 -7
  167. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Grid/Grid.html +0 -1
  168. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Grid/Grid.js +0 -57
  169. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/Icon.css +0 -510
  170. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/Icon.html +0 -1
  171. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/Icon.js +0 -89
  172. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.eot +0 -0
  173. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.json +0 -555
  174. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.styl +0 -507
  175. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.svg +0 -1485
  176. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.symbol.svg +0 -1059
  177. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.ttf +0 -0
  178. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.woff +0 -0
  179. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Icon/slc.woff2 +0 -0
  180. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Input/Input.css +0 -91
  181. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Input/Input.html +0 -4
  182. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Input/Input.js +0 -215
  183. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Layout/Layout.css +0 -0
  184. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Layout/Layout.html +0 -0
  185. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Layout/Layout.js +0 -49
  186. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Link/Link.css +0 -8
  187. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Link/Link.html +0 -1
  188. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Link/Link.js +0 -63
  189. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Loading/Loading.css +0 -56
  190. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Loading/Loading.html +0 -83
  191. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Loading/Loading.js +0 -38
  192. package/.worktrees/public-env-browser-exposure/src/Components/Visual/MultiRoute/MultiRoute.js +0 -93
  193. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Navbar/Navbar.css +0 -115
  194. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Navbar/Navbar.html +0 -44
  195. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Navbar/Navbar.js +0 -141
  196. package/.worktrees/public-env-browser-exposure/src/Components/Visual/NotFound/NotFound.css +0 -117
  197. package/.worktrees/public-env-browser-exposure/src/Components/Visual/NotFound/NotFound.html +0 -24
  198. package/.worktrees/public-env-browser-exposure/src/Components/Visual/NotFound/NotFound.js +0 -16
  199. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Route/Route.js +0 -93
  200. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Select/Select.css +0 -84
  201. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Select/Select.html +0 -8
  202. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Select/Select.js +0 -195
  203. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Switch/Switch.css +0 -76
  204. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Switch/Switch.html +0 -8
  205. package/.worktrees/public-env-browser-exposure/src/Components/Visual/Switch/Switch.js +0 -102
  206. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeItem/TreeItem.css +0 -36
  207. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeItem/TreeItem.html +0 -1
  208. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeItem/TreeItem.js +0 -126
  209. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeView/TreeView.css +0 -8
  210. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeView/TreeView.html +0 -1
  211. package/.worktrees/public-env-browser-exposure/src/Components/Visual/TreeView/TreeView.js +0 -48
  212. package/.worktrees/public-env-browser-exposure/src/Components/components.js +0 -27
  213. package/.worktrees/public-env-browser-exposure/src/Styles/sliceStyles.css +0 -34
  214. package/.worktrees/public-env-browser-exposure/src/Themes/Dark.css +0 -42
  215. package/.worktrees/public-env-browser-exposure/src/Themes/Light.css +0 -31
  216. package/.worktrees/public-env-browser-exposure/src/Themes/Slice.css +0 -47
  217. package/.worktrees/public-env-browser-exposure/src/images/Slice.js-logo.png +0 -0
  218. package/.worktrees/public-env-browser-exposure/src/images/favicon.ico +0 -0
  219. package/.worktrees/public-env-browser-exposure/src/images/im2/Slice.js-logo.png +0 -0
  220. package/.worktrees/public-env-browser-exposure/src/routes.js +0 -16
  221. package/.worktrees/public-env-browser-exposure/src/sliceConfig.json +0 -73
  222. package/.worktrees/public-env-browser-exposure/src/testing.js +0 -888
@@ -1,972 +0,0 @@
1
- import components from '/Components/components.js';
2
-
3
- export default class Controller {
4
- constructor() {
5
- this.componentCategories = new Map(Object.entries(components));
6
- this.templates = new Map();
7
- this.classes = new Map();
8
- this.requestedStyles = new Set(); // ✅ CRÍTICO: Para tracking de CSS cargados
9
- this.activeComponents = new Map();
10
-
11
- // 🚀 OPTIMIZACIÓN: Índice inverso para búsqueda rápida de hijos
12
- // parentSliceId → Set<childSliceId>
13
- this.childrenIndex = new Map();
14
-
15
- // 📦 Bundle system
16
- this.loadedBundles = new Set();
17
- this.bundleConfig = null;
18
- this.criticalBundleLoaded = false;
19
- this.bundleImportPromises = new Map();
20
-
21
- this.idCounter = 0;
22
- }
23
-
24
- /**
25
- * 📦 Initializes bundle system (called automatically when config is loaded)
26
- */
27
- initializeBundles(config = null) {
28
- if (config) {
29
- this.bundleConfig = config;
30
-
31
- // Register critical bundle components if available
32
- if (config.bundles?.critical) {
33
- // Critical bundle will be loaded explicitly
34
- }
35
- this.criticalBundleLoaded = false;
36
- } else {
37
- // No bundles available, will use individual component loading
38
- this.bundleConfig = null;
39
- this.criticalBundleLoaded = false;
40
- }
41
- }
42
-
43
- /**
44
- * Import a bundle URL once per page session.
45
- * Reuses the same Promise for concurrent callers.
46
- * @param {string} bundlePath
47
- * @returns {Promise<any>}
48
- */
49
- importBundleOnce(bundlePath) {
50
- if (!bundlePath) {
51
- return Promise.reject(new Error('Bundle path is required'));
52
- }
53
-
54
- if (this.bundleImportPromises.has(bundlePath)) {
55
- return this.bundleImportPromises.get(bundlePath);
56
- }
57
-
58
- const importPromise = import(bundlePath).catch((error) => {
59
- this.bundleImportPromises.delete(bundlePath);
60
- throw error;
61
- });
62
-
63
- this.bundleImportPromises.set(bundlePath, importPromise);
64
- return importPromise;
65
- }
66
-
67
- /**
68
- * Validate Bundling V2 module contract.
69
- * Requires named exports: SLICE_BUNDLE_META and registerAll.
70
- * @param {any} bundleModule
71
- * @param {string} [bundleName]
72
- * @returns {{metadata: object, registerAll: Function}}
73
- */
74
- async validateBundleModule(bundleModule, bundleName = 'unknown') {
75
- const metadata = bundleModule?.SLICE_BUNDLE_META;
76
- const registerAll = bundleModule?.registerAll;
77
-
78
- if (!metadata || typeof metadata !== 'object' || typeof registerAll !== 'function') {
79
- throw new Error(
80
- `Bundle "${bundleName}" missing Bundling V2 exports contract: requires SLICE_BUNDLE_META and registerAll`
81
- );
82
- }
83
-
84
- return { metadata, registerAll };
85
- }
86
-
87
- /**
88
- * 📦 Loads a bundle by name or category
89
- */
90
- async loadBundle(bundleName) {
91
- if (this.loadedBundles.has(bundleName)) {
92
- return; // Already loaded
93
- }
94
-
95
- let bundleInfo = null;
96
-
97
- if (bundleName === 'critical') {
98
- bundleInfo = this.bundleConfig?.bundles?.critical;
99
- } else {
100
- bundleInfo = this.bundleConfig?.bundles?.routes?.[bundleName];
101
- }
102
-
103
- if (!bundleInfo && this.bundleConfig?.bundles?.routes && bundleName !== 'critical') {
104
- const normalizedName = bundleName?.toLowerCase();
105
- const matchedKey = Object.keys(this.bundleConfig.bundles.routes).find(
106
- (key) => key.toLowerCase() === normalizedName
107
- );
108
- if (matchedKey) {
109
- bundleInfo = this.bundleConfig.bundles.routes[matchedKey];
110
- }
111
- }
112
-
113
- if (!bundleInfo) {
114
- console.warn(`Bundle ${bundleName} not found in configuration`);
115
- return;
116
- }
117
-
118
- const bundlePath = `/bundles/${bundleInfo.file}`;
119
-
120
- const bundleModule = await this.importBundleOnce(bundlePath);
121
- const { metadata, registerAll } = await this.validateBundleModule(bundleModule, bundleName);
122
-
123
- await registerAll(this, slice.stylesManager);
124
-
125
- this.loadedBundles.add(bundleName);
126
- const loadedBundleKey = metadata.bundleKey;
127
- if (loadedBundleKey && loadedBundleKey !== bundleName) {
128
- this.loadedBundles.add(loadedBundleKey);
129
- }
130
-
131
- if (metadata.type === 'critical' || bundleName === 'critical') {
132
- this.criticalBundleLoaded = true;
133
- }
134
- }
135
-
136
- /**
137
- * 📦 Registers a bundle's components (called automatically by bundle files)
138
- */
139
- registerBundleLegacy(bundle) {
140
- const { components, metadata } = bundle;
141
-
142
- console.log(`📦 Registering bundle: ${metadata.type} (${metadata.componentCount} components)`);
143
-
144
- // Phase 1: Register templates and CSS for all components first
145
- for (const [componentName, componentData] of Object.entries(components)) {
146
- try {
147
- // Register HTML template
148
- if (componentData.html !== undefined && !this.templates.has(componentName)) {
149
- const template = document.createElement('template');
150
- template.innerHTML = componentData.html || '';
151
- this.templates.set(componentName, template);
152
- }
153
-
154
- // Register CSS styles
155
- if (componentData.css !== undefined && !this.requestedStyles.has(componentName)) {
156
- // Use the existing stylesManager to register component styles
157
- if (window.slice && window.slice.stylesManager) {
158
- window.slice.stylesManager.registerComponentStyles(componentName, componentData.css || '');
159
- this.requestedStyles.add(componentName);
160
- }
161
- }
162
- } catch (error) {
163
- console.warn(`❌ Failed to register assets for ${componentName}:`, error);
164
- }
165
- }
166
-
167
- // Phase 2: Evaluate all external file dependencies
168
- const processedDeps = new Set();
169
- for (const [componentName, componentData] of Object.entries(components)) {
170
- if (componentData.dependencies) {
171
- for (const [depName, depContent] of Object.entries(componentData.dependencies)) {
172
- if (!processedDeps.has(depName)) {
173
- try {
174
- // Convert ES6 exports to global assignments
175
- let processedContent = depContent
176
- .replace(/export\s+const\s+(\w+)\s*=/g, 'window.$1 =')
177
- .replace(/export\s+let\s+(\w+)\s*=/g, 'window.$1 =')
178
- .replace(/export\s+var\s+(\w+)\s*=/g, 'window.$1 =')
179
- .replace(/export\s+function\s+(\w+)/g, 'window.$1 = function')
180
- .replace(/export\s+default\s+/g, 'window.defaultExport =')
181
- .replace(/export\s*{\s*([^}]+)\s*}/g, (match, exports) => {
182
- return exports
183
- .split(',')
184
- .map((exp) => {
185
- const cleanExp = exp.trim();
186
- const varName = cleanExp.split(' as ')[0].trim();
187
- return `window.${varName} = ${varName};`;
188
- })
189
- .join('\n');
190
- })
191
- // Remove any remaining export keywords
192
- .replace(/^\s*export\s+/gm, '');
193
-
194
- // Evaluate the dependency
195
- try {
196
- new Function('slice', 'customElements', 'window', 'document', processedContent)(
197
- window.slice,
198
- window.customElements,
199
- window,
200
- window.document
201
- );
202
- } catch (evalError) {
203
- console.warn(`❌ Failed to evaluate processed dependency ${depName}:`, evalError);
204
- console.warn('Processed content preview:', processedContent.substring(0, 200));
205
- // Try evaluating the original content as fallback
206
- try {
207
- new Function('slice', 'customElements', 'window', 'document', depContent)(
208
- window.slice,
209
- window.customElements,
210
- window,
211
- window.document
212
- );
213
- console.log(`✅ Fallback evaluation succeeded for ${depName}`);
214
- } catch (fallbackError) {
215
- console.warn(`❌ Fallback evaluation also failed for ${depName}:`, fallbackError);
216
- }
217
- }
218
-
219
- processedDeps.add(depName);
220
- console.log(`📄 Dependency loaded: ${depName}`);
221
- } catch (depError) {
222
- console.warn(`⚠️ Failed to load dependency ${depName} for ${componentName}:`, depError);
223
- }
224
- }
225
- }
226
- }
227
- }
228
-
229
- // Phase 3: Evaluate all component classes (now that dependencies are available)
230
- for (const [componentName, componentData] of Object.entries(components)) {
231
- // For JavaScript classes, we need to evaluate the code
232
- if (componentData.js && !this.classes.has(componentName)) {
233
- try {
234
- // Create evaluation context with dependencies
235
- let evalCode = componentData.js;
236
-
237
- // Prepend dependencies to make them available
238
- if (componentData.dependencies) {
239
- const depCode = Object.entries(componentData.dependencies)
240
- .map(([depName, depContent]) => {
241
- // Convert ES6 exports to global assignments
242
- return depContent
243
- .replace(/export\s+const\s+(\w+)\s*=/g, 'window.$1 =')
244
- .replace(/export\s+let\s+(\w+)\s*=/g, 'window.$1 =')
245
- .replace(/export\s+function\s+(\w+)/g, 'window.$1 = function')
246
- .replace(/export\s+default\s+/g, 'window.defaultExport =')
247
- .replace(/export\s*{\s*([^}]+)\s*}/g, (match, exports) => {
248
- return exports
249
- .split(',')
250
- .map((exp) => {
251
- const cleanExp = exp.trim();
252
- return `window.${cleanExp} = ${cleanExp};`;
253
- })
254
- .join('\n');
255
- });
256
- })
257
- .join('\n\n');
258
-
259
- evalCode = depCode + '\n\n' + evalCode;
260
- }
261
-
262
- // Evaluate the complete code
263
- const componentClass = new Function(
264
- 'slice',
265
- 'customElements',
266
- 'window',
267
- 'document',
268
- `
269
- "use strict";
270
- ${evalCode}
271
- return ${componentName};
272
- `
273
- )(window.slice, window.customElements, window, window.document);
274
-
275
- if (componentClass) {
276
- this.classes.set(componentName, componentClass);
277
- console.log(`📝 Class registered for: ${componentName}`);
278
- }
279
- } catch (error) {
280
- console.warn(`❌ Failed to evaluate class for ${componentName}:`, error);
281
- console.warn('Code that failed:', componentData.js.substring(0, 200) + '...');
282
- }
283
- }
284
- }
285
- }
286
-
287
- /**
288
- * 📦 New bundle registration method (simplified and robust)
289
- */
290
- registerBundle(bundle) {
291
- const validation = this.validateBundle(bundle);
292
- if (!validation.isValid) {
293
- console.warn(`❌ Bundle validation failed: ${validation.error}`);
294
- return Promise.resolve(false);
295
- }
296
-
297
- // Set tracking flags synchronously before any async work, so callers that
298
- // await import() see the flags set immediately when the Promise resolves.
299
- const { components, metadata } = bundle;
300
- const bundleKey = metadata?.bundleKey;
301
- if (bundleKey) {
302
- this.loadedBundles.add(bundleKey);
303
- if (metadata?.type === 'critical') {
304
- this.criticalBundleLoaded = true;
305
- }
306
- }
307
-
308
- console.log(`📦 Registering bundle: ${metadata.type} (${metadata.componentCount} components)`);
309
-
310
- const entries = Object.entries(components);
311
- const chunkSize = 50;
312
- let index = 0;
313
-
314
- return new Promise((resolve) => {
315
- const processChunk = () => {
316
- const sliceEntries = entries.slice(index, index + chunkSize);
317
-
318
- for (const [componentName, componentData] of sliceEntries) {
319
- try {
320
- if (componentData.html !== undefined && !this.templates.has(componentName)) {
321
- const template = document.createElement('template');
322
- template.innerHTML = componentData.html || '';
323
- this.templates.set(componentName, template);
324
- }
325
-
326
- if (componentData.css !== undefined && !this.requestedStyles.has(componentName)) {
327
- if (window.slice && window.slice.stylesManager) {
328
- window.slice.stylesManager.registerComponentStyles(componentName, componentData.css || '');
329
- this.requestedStyles.add(componentName);
330
- }
331
- }
332
-
333
- if (componentData.class && !this.classes.has(componentName)) {
334
- const registeredName = componentData.isFramework
335
- ? `Framework/Structural/${componentName}`
336
- : componentName;
337
- this.classes.set(registeredName, componentData.class);
338
- if (componentName === 'Loading') {
339
- console.log('🔎 Bundle class registered: Loading', {
340
- registeredName,
341
- type: typeof componentData.class,
342
- isFunction: typeof componentData.class === 'function'
343
- });
344
- }
345
- if (componentName === 'InputSearchDocs' || componentName === 'MainMenu') {
346
- console.log(`🔎 Bundle class registered: ${componentName}`, {
347
- registeredName,
348
- type: typeof componentData.class,
349
- isFunction: typeof componentData.class === 'function'
350
- });
351
- }
352
- }
353
- } catch (error) {
354
- console.warn(`❌ Failed to register component ${componentName}:`, error);
355
- }
356
- }
357
-
358
- index += chunkSize;
359
- if (index < entries.length) {
360
- if (typeof requestIdleCallback === 'function') {
361
- requestIdleCallback(processChunk);
362
- } else {
363
- setTimeout(processChunk, 0);
364
- }
365
- return;
366
- }
367
-
368
- console.log(`✅ Bundle registration completed: ${metadata.componentCount} components processed`);
369
- resolve(true);
370
- };
371
-
372
- processChunk();
373
- });
374
- }
375
-
376
- /**
377
- * Validates bundle structure before registering.
378
- * @param {object} bundle
379
- * @returns {{isValid: boolean, error?: string}}
380
- */
381
- validateBundle(bundle) {
382
- if (!bundle || typeof bundle !== 'object') {
383
- return { isValid: false, error: 'Bundle payload is invalid' };
384
- }
385
-
386
- if (!bundle.metadata || typeof bundle.metadata !== 'object') {
387
- return { isValid: false, error: 'Bundle metadata missing' };
388
- }
389
-
390
- if (!bundle.components || typeof bundle.components !== 'object') {
391
- return { isValid: false, error: 'Bundle components missing' };
392
- }
393
-
394
- if (typeof bundle.metadata.componentCount !== 'number') {
395
- return { isValid: false, error: 'Bundle metadata missing componentCount' };
396
- }
397
-
398
- if (bundle.metadata.componentCount !== Object.keys(bundle.components).length) {
399
- return { isValid: false, error: 'Bundle component count mismatch' };
400
- }
401
-
402
- const maxComponents = 5000;
403
- if (bundle.metadata.componentCount > maxComponents) {
404
- return { isValid: false, error: 'Bundle component count exceeds limit' };
405
- }
406
-
407
- return { isValid: true };
408
- }
409
-
410
- /**
411
- * 📦 Determines which bundle to load for a component
412
- */
413
- getBundleForComponent(componentName) {
414
- if (!this.bundleConfig?.bundles) return null;
415
-
416
- // Check if component is in critical bundle
417
- if (this.bundleConfig.bundles.critical?.components?.includes(componentName)) {
418
- return 'critical';
419
- }
420
-
421
- // Find component in route bundles
422
- if (this.bundleConfig.bundles.routes) {
423
- for (const [bundleName, bundleInfo] of Object.entries(this.bundleConfig.bundles.routes)) {
424
- if (bundleInfo.components?.includes(componentName)) {
425
- return bundleName;
426
- }
427
- }
428
- }
429
-
430
- return null;
431
- }
432
-
433
- /**
434
- * 📦 Checks if a component is available from loaded bundles
435
- */
436
- isComponentFromBundle(componentName) {
437
- if (!this.bundleConfig?.bundles) return false;
438
-
439
- // Check critical bundle
440
- if (this.bundleConfig.bundles.critical?.components?.includes(componentName)) {
441
- return this.criticalBundleLoaded;
442
- }
443
-
444
- // Check route bundles
445
- if (this.bundleConfig.bundles.routes) {
446
- for (const [bundleName, bundleInfo] of Object.entries(this.bundleConfig.bundles.routes)) {
447
- if (bundleInfo.components?.includes(componentName)) {
448
- return this.loadedBundles.has(bundleName);
449
- }
450
- }
451
- }
452
-
453
- return false;
454
- }
455
-
456
- /**
457
- * 📦 Gets component data from loaded bundles
458
- */
459
- getComponentFromBundle(componentName) {
460
- if (!this.bundleConfig?.bundles) return null;
461
-
462
- // Find component in any loaded bundle
463
- const allBundles = [
464
- { name: 'critical', data: this.bundleConfig.bundles.critical },
465
- ...Object.entries(this.bundleConfig.bundles.routes || {}).map(([name, data]) => ({ name, data })),
466
- ];
467
-
468
- for (const { name: bundleName, data: bundleData } of allBundles) {
469
- if (bundleData?.components?.includes(componentName) && this.loadedBundles.has(bundleName)) {
470
- // Find the bundle file and extract component data
471
- // This is a simplified version - in practice you'd need to access the loaded bundle data
472
- return { bundleName, componentName };
473
- }
474
- }
475
-
476
- return null;
477
- }
478
-
479
- logActiveComponents() {
480
- this.activeComponents.forEach((component) => {
481
- let parent = component.parentComponent;
482
- let parentName = parent ? parent.constructor.name : null;
483
- });
484
- }
485
-
486
- getTopParentsLinkedToActiveComponents() {
487
- let topParentsLinkedToActiveComponents = new Map();
488
- this.activeComponents.forEach((component) => {
489
- let parent = component.parentComponent;
490
- while (parent && parent.parentComponent) {
491
- parent = parent.parentComponent;
492
- }
493
- if (!topParentsLinkedToActiveComponents.has(parent)) {
494
- topParentsLinkedToActiveComponents.set(parent, []);
495
- }
496
- topParentsLinkedToActiveComponents.get(parent).push(component);
497
- });
498
- return topParentsLinkedToActiveComponents;
499
- }
500
-
501
- verifyComponentIds(component) {
502
- const htmlId = component.id;
503
-
504
- if (htmlId && htmlId.trim() !== '') {
505
- if (this.activeComponents.has(htmlId)) {
506
- slice.logger.logError(
507
- 'Controller',
508
- `A component with the same html id attribute is already registered: ${htmlId}`
509
- );
510
- return false;
511
- }
512
- }
513
-
514
- let sliceId = component.sliceId;
515
-
516
- if (sliceId && sliceId.trim() !== '') {
517
- if (this.activeComponents.has(sliceId)) {
518
- slice.logger.logError(
519
- 'Controller',
520
- `A component with the same slice id attribute is already registered: ${sliceId}`
521
- );
522
- return false;
523
- }
524
- } else {
525
- sliceId = `${component.constructor.name[0].toLowerCase()}${component.constructor.name.slice(1)}-${this.idCounter}`;
526
- component.sliceId = sliceId;
527
- this.idCounter++;
528
- }
529
-
530
- component.sliceId = sliceId;
531
- return true;
532
- }
533
-
534
- /**
535
- * Registra un componente y actualiza el índice de relaciones padre-hijo
536
- * 🚀 OPTIMIZADO: Ahora mantiene childrenIndex y precalcula profundidad
537
- */
538
- registerComponent(component, parent = null) {
539
- component.parentComponent = parent;
540
-
541
- // 🚀 OPTIMIZACIÓN: Precalcular y guardar profundidad
542
- component._depth = parent ? (parent._depth || 0) + 1 : 0;
543
-
544
- // Registrar en activeComponents
545
- this.activeComponents.set(component.sliceId, component);
546
-
547
- // 🚀 OPTIMIZACIÓN: Actualizar índice inverso de hijos
548
- if (parent) {
549
- if (!this.childrenIndex.has(parent.sliceId)) {
550
- this.childrenIndex.set(parent.sliceId, new Set());
551
- }
552
- this.childrenIndex.get(parent.sliceId).add(component.sliceId);
553
- }
554
-
555
- return true;
556
- }
557
-
558
- registerComponentsRecursively(component, parent = null) {
559
- // Assign parent if not already set
560
- if (!component.parentComponent) {
561
- component.parentComponent = parent;
562
- }
563
-
564
- // Recursively assign parent to children
565
- component.querySelectorAll('*').forEach((child) => {
566
- if (child.tagName.startsWith('SLICE-')) {
567
- if (!child.parentComponent) {
568
- child.parentComponent = component;
569
- }
570
- this.registerComponentsRecursively(child, component);
571
- }
572
- });
573
- }
574
-
575
- /**
576
- * Get a registered component by sliceId.
577
- * @param {string} sliceId
578
- * @returns {HTMLElement|undefined}
579
- */
580
- getComponent(sliceId) {
581
- return this.activeComponents.get(sliceId);
582
- }
583
-
584
- loadTemplateToComponent(component) {
585
- const className = component.constructor.name;
586
- const template = this.templates.get(className);
587
-
588
- if (!template) {
589
- slice.logger.logError(`Template not found for component: ${className}`);
590
- return;
591
- }
592
-
593
- component.innerHTML = template.innerHTML;
594
- return component;
595
- }
596
-
597
- getComponentCategory(componentSliceId) {
598
- return this.componentCategories.get(componentSliceId);
599
- }
600
-
601
- /**
602
- * Fetch component resources (html, css, styles, theme).
603
- * @param {string} componentName
604
- * @param {'html'|'css'|'theme'|'styles'} resourceType
605
- * @param {string} [componentCategory]
606
- * @param {string} [customPath]
607
- * @returns {Promise<string>}
608
- */
609
- async fetchText(componentName, resourceType, componentCategory, customPath) {
610
- try {
611
- const baseUrl = window.location.origin;
612
- let path;
613
-
614
- if (!componentCategory) {
615
- componentCategory = this.componentCategories.get(componentName);
616
- }
617
-
618
- let isVisual = resourceType === 'html' || resourceType === 'css';
619
-
620
- if (isVisual) {
621
- if (slice.paths.components[componentCategory]) {
622
- path = `${baseUrl}${slice.paths.components[componentCategory].path}/${componentName}`;
623
- resourceType === 'html' ? (path += `/${componentName}.html`) : (path += `/${componentName}.css`);
624
- } else {
625
- if (componentCategory === 'Structural') {
626
- path = `${baseUrl}/Slice/Components/Structural/${componentName}`;
627
- resourceType === 'html' ? (path += `/${componentName}.html`) : (path += `/${componentName}.css`);
628
- } else {
629
- throw new Error(`Component category '${componentCategory}' not found in paths configuration`);
630
- }
631
- }
632
- }
633
-
634
- if (resourceType === 'theme') {
635
- path = `${baseUrl}${slice.paths.themes}/${componentName}.css`;
636
- }
637
-
638
- if (resourceType === 'styles') {
639
- path = `${baseUrl}${slice.paths.styles}/${componentName}.css`;
640
- }
641
-
642
- if (customPath) {
643
- path = customPath;
644
- }
645
-
646
- slice.logger.logInfo('Controller', `Fetching ${resourceType} from: ${path}`);
647
-
648
- const response = await fetch(path);
649
-
650
- if (!response.ok) {
651
- throw new Error(`Failed to fetch ${path}: ${response.statusText}`);
652
- }
653
-
654
- const content = await response.text();
655
- slice.logger.logInfo('Controller', `Successfully fetched ${resourceType} for ${componentName}`);
656
- return content;
657
- } catch (error) {
658
- slice.logger.logError('Controller', `Error fetching ${resourceType} for component ${componentName}:`, error);
659
- throw error;
660
- }
661
- }
662
-
663
- /**
664
- * Apply props to a component using static defaults and setters.
665
- * @param {HTMLElement} component
666
- * @param {Object} props
667
- * @returns {void}
668
- */
669
- setComponentProps(component, props) {
670
- const ComponentClass = component.constructor;
671
- const componentName = ComponentClass.name;
672
-
673
- // Aplicar defaults si tiene static props
674
- if (ComponentClass.props) {
675
- this.applyDefaultProps(component, ComponentClass.props, props);
676
- }
677
-
678
- // Validar solo en desarrollo
679
- if (ComponentClass.props && !slice.isProduction()) {
680
- this.validatePropsInDevelopment(ComponentClass, props, componentName);
681
- }
682
-
683
- // Aplicar props
684
- for (const prop in props) {
685
- component[`_${prop}`] = null;
686
- component[prop] = props[prop];
687
- }
688
- }
689
-
690
- getComponentPropsForDebugger(component) {
691
- const ComponentClass = component.constructor;
692
-
693
- if (ComponentClass.props) {
694
- return {
695
- availableProps: Object.keys(ComponentClass.props),
696
- propsConfig: ComponentClass.props,
697
- usedProps: this.extractUsedProps(component, ComponentClass.props),
698
- };
699
- } else {
700
- return {
701
- availableProps: this.extractUsedProps(component),
702
- propsConfig: null,
703
- usedProps: this.extractUsedProps(component),
704
- };
705
- }
706
- }
707
-
708
- applyDefaultProps(component, staticProps, providedProps) {
709
- Object.entries(staticProps).forEach(([prop, config]) => {
710
- if (config.default !== undefined && !(prop in (providedProps || {}))) {
711
- component[`_${prop}`] = null;
712
- component[prop] = config.default;
713
- }
714
- });
715
- }
716
-
717
- validatePropsInDevelopment(ComponentClass, providedProps, componentName) {
718
- const staticProps = ComponentClass.props;
719
- const usedProps = Object.keys(providedProps || {});
720
-
721
- const availableProps = Object.keys(staticProps);
722
- const unknownProps = usedProps.filter((prop) => !availableProps.includes(prop));
723
-
724
- if (unknownProps.length > 0) {
725
- slice.logger.logWarning(
726
- 'PropsValidator',
727
- `${componentName}: Unknown props [${unknownProps.join(', ')}]. Available: [${availableProps.join(', ')}]`
728
- );
729
- }
730
-
731
- const requiredProps = Object.entries(staticProps)
732
- .filter(([_, config]) => config.required)
733
- .map(([prop, _]) => prop);
734
-
735
- const missingRequired = requiredProps.filter((prop) => !(prop in (providedProps || {})));
736
- if (missingRequired.length > 0) {
737
- slice.logger.logError(componentName, `Missing required props: [${missingRequired.join(', ')}]`);
738
- }
739
- }
740
-
741
- extractUsedProps(component, staticProps = null) {
742
- const usedProps = {};
743
-
744
- if (staticProps) {
745
- Object.keys(staticProps).forEach((prop) => {
746
- if (component[prop] !== undefined) {
747
- usedProps[prop] = component[prop];
748
- }
749
- });
750
- } else {
751
- Object.getOwnPropertyNames(component).forEach((key) => {
752
- if (key.startsWith('_') && key !== '_isActive') {
753
- const propName = key.substring(1);
754
- usedProps[propName] = component[propName];
755
- }
756
- });
757
- }
758
-
759
- return usedProps;
760
- }
761
-
762
- // ============================================================================
763
- // 🚀 MÉTODOS DE DESTRUCCIÓN OPTIMIZADOS
764
- // ============================================================================
765
-
766
- /**
767
- * Encuentra recursivamente todos los hijos de un componente
768
- * 🚀 OPTIMIZADO: O(m) en lugar de O(n*d) - usa childrenIndex
769
- * @param {string} parentSliceId - sliceId del componente padre
770
- * @param {Set<string>} collected - Set de sliceIds ya recolectados
771
- * @returns {Set<string>} Set de todos los sliceIds de componentes hijos
772
- */
773
- findAllChildComponents(parentSliceId, collected = new Set()) {
774
- // 🚀 Buscar directamente en el índice: O(1)
775
- const children = this.childrenIndex.get(parentSliceId);
776
-
777
- if (!children) return collected;
778
-
779
- // 🚀 Iterar solo los hijos directos: O(k) donde k = número de hijos
780
- for (const childSliceId of children) {
781
- collected.add(childSliceId);
782
- // Recursión solo sobre hijos, no todos los componentes
783
- this.findAllChildComponents(childSliceId, collected);
784
- }
785
-
786
- return collected;
787
- }
788
-
789
- /**
790
- * Encuentra recursivamente todos los componentes dentro de un contenedor DOM
791
- * Útil para destroyByContainer cuando no tenemos el sliceId del padre
792
- * @param {HTMLElement} container - Elemento contenedor
793
- * @param {Set<string>} collected - Set de sliceIds ya recolectados
794
- * @returns {Set<string>} Set de todos los sliceIds encontrados
795
- */
796
- findAllNestedComponentsInContainer(container, collected = new Set()) {
797
- // Buscar todos los elementos con slice-id en el contenedor
798
- const sliceComponents = container.querySelectorAll('[slice-id]');
799
-
800
- sliceComponents.forEach((element) => {
801
- const sliceId = element.getAttribute('slice-id') || element.sliceId;
802
- if (sliceId && this.activeComponents.has(sliceId)) {
803
- collected.add(sliceId);
804
- // 🚀 Usar índice para buscar hijos recursivamente
805
- this.findAllChildComponents(sliceId, collected);
806
- }
807
- });
808
-
809
- return collected;
810
- }
811
-
812
- /**
813
- * Destruye uno o múltiples componentes DE FORMA RECURSIVA
814
- * 🚀 OPTIMIZADO: O(m log m) en lugar de O(n*d + m log m)
815
- * @param {HTMLElement|Array<HTMLElement>|string|Array<string>} components
816
- * @returns {number} Cantidad de componentes destruidos (incluyendo hijos)
817
- */
818
- destroyComponent(components) {
819
- const toDestroy = Array.isArray(components) ? components : [components];
820
- const allSliceIdsToDestroy = new Set();
821
-
822
- // PASO 1: Recolectar todos los componentes padres y sus hijos recursivamente
823
- for (const item of toDestroy) {
824
- let sliceId = null;
825
-
826
- if (typeof item === 'string') {
827
- if (!this.activeComponents.has(item)) {
828
- slice.logger.logWarning('Controller', `Component with sliceId "${item}" not found`);
829
- continue;
830
- }
831
- sliceId = item;
832
- } else if (item && item.sliceId) {
833
- sliceId = item.sliceId;
834
- } else {
835
- slice.logger.logWarning('Controller', `Invalid component or sliceId provided to destroyComponent`);
836
- continue;
837
- }
838
-
839
- allSliceIdsToDestroy.add(sliceId);
840
-
841
- // 🚀 OPTIMIZADO: Usa childrenIndex en lugar de recorrer todos los componentes
842
- this.findAllChildComponents(sliceId, allSliceIdsToDestroy);
843
- }
844
-
845
- // PASO 2: Ordenar por profundidad (más profundos primero)
846
- // 🚀 OPTIMIZADO: Usa _depth precalculada en lugar de calcularla cada vez
847
- const sortedSliceIds = Array.from(allSliceIdsToDestroy).sort((a, b) => {
848
- const compA = this.activeComponents.get(a);
849
- const compB = this.activeComponents.get(b);
850
-
851
- if (!compA || !compB) return 0;
852
-
853
- // 🚀 O(1) en lugar de O(d) - usa profundidad precalculada
854
- return (compB._depth || 0) - (compA._depth || 0);
855
- });
856
-
857
- let destroyedCount = 0;
858
-
859
- // PASO 3: Destruir en orden correcto (hijos antes que padres)
860
- for (const sliceId of sortedSliceIds) {
861
- const component = this.activeComponents.get(sliceId);
862
-
863
- if (!component) continue;
864
-
865
- // Ejecutar hook beforeDestroy si existe
866
- if (typeof component.beforeDestroy === 'function') {
867
- try {
868
- component.beforeDestroy();
869
- } catch (error) {
870
- slice.logger.logError('Controller', `Error in beforeDestroy for ${sliceId}`, error);
871
- }
872
- }
873
-
874
- // Limpiar suscripciones de eventos del componente
875
- if (slice.events) {
876
- slice.events.cleanupComponent(sliceId);
877
- }
878
-
879
- // 🚀 Limpiar del índice de hijos
880
- this.childrenIndex.delete(sliceId);
881
-
882
- // Si tiene padre, remover de la lista de hijos del padre
883
- if (component.parentComponent) {
884
- const parentChildren = this.childrenIndex.get(component.parentComponent.sliceId);
885
- if (parentChildren) {
886
- parentChildren.delete(sliceId);
887
- // Si el padre no tiene más hijos, eliminar entrada vacía
888
- if (parentChildren.size === 0) {
889
- this.childrenIndex.delete(component.parentComponent.sliceId);
890
- }
891
- }
892
- }
893
-
894
- // Eliminar del mapa de componentes activos
895
- this.activeComponents.delete(sliceId);
896
-
897
- // Remover del DOM si está conectado
898
- if (component.isConnected) {
899
- component.remove();
900
- }
901
-
902
- destroyedCount++;
903
- }
904
-
905
- if (destroyedCount > 0) {
906
- slice.logger.logInfo('Controller', `Destroyed ${destroyedCount} component(s) recursively`);
907
- }
908
-
909
- return destroyedCount;
910
- }
911
-
912
- /**
913
- * Destruye todos los componentes Slice dentro de un contenedor (RECURSIVO)
914
- * 🚀 OPTIMIZADO: Usa el índice inverso para búsqueda rápida
915
- * @param {HTMLElement} container - Elemento contenedor
916
- * @returns {number} Cantidad de componentes destruidos
917
- */
918
- destroyByContainer(container) {
919
- if (!container) {
920
- slice.logger.logWarning('Controller', 'No container provided to destroyByContainer');
921
- return 0;
922
- }
923
-
924
- // 🚀 Recolectar componentes usando índice optimizado
925
- const allSliceIds = this.findAllNestedComponentsInContainer(container);
926
-
927
- if (allSliceIds.size === 0) {
928
- return 0;
929
- }
930
-
931
- // Destruir usando el método principal optimizado
932
- const count = this.destroyComponent(Array.from(allSliceIds));
933
-
934
- if (count > 0) {
935
- slice.logger.logInfo('Controller', `Destroyed ${count} component(s) from container (including nested)`);
936
- }
937
-
938
- return count;
939
- }
940
-
941
- /**
942
- * Destruye componentes cuyos sliceId coincidan con un patrón (RECURSIVO)
943
- * 🚀 OPTIMIZADO: Usa destrucción optimizada
944
- * @param {string|RegExp} pattern - Patrón a buscar
945
- * @returns {number} Cantidad de componentes destruidos
946
- */
947
- destroyByPattern(pattern) {
948
- const componentsToDestroy = [];
949
- const regex = pattern instanceof RegExp ? pattern : new RegExp(pattern);
950
-
951
- for (const [sliceId, component] of this.activeComponents) {
952
- if (regex.test(sliceId)) {
953
- componentsToDestroy.push(component);
954
- }
955
- }
956
-
957
- if (componentsToDestroy.length === 0) {
958
- return 0;
959
- }
960
-
961
- const count = this.destroyComponent(componentsToDestroy);
962
-
963
- if (count > 0) {
964
- slice.logger.logInfo(
965
- 'Controller',
966
- `Destroyed ${count} component(s) matching pattern: ${pattern} (including nested)`
967
- );
968
- }
969
-
970
- return count;
971
- }
972
- }