create-microact-app 1.0.1

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 (213) hide show
  1. package/index.js +95 -0
  2. package/package.json +21 -0
  3. package/templates/vanilla/.github/workflows/deploy.yml +38 -0
  4. package/templates/vanilla/index.html +13 -0
  5. package/templates/vanilla/node_modules/.package-lock.json +207 -0
  6. package/templates/vanilla/node_modules/@esbuild/darwin-x64/README.md +3 -0
  7. package/templates/vanilla/node_modules/@esbuild/darwin-x64/bin/esbuild +0 -0
  8. package/templates/vanilla/node_modules/@esbuild/darwin-x64/package.json +17 -0
  9. package/templates/vanilla/node_modules/@monygroupcorp/microact/README.md +154 -0
  10. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js +1749 -0
  11. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.cjs.js.map +1 -0
  12. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js +1743 -0
  13. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.esm.js.map +1 -0
  14. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js +2 -0
  15. package/templates/vanilla/node_modules/@monygroupcorp/microact/dist/microact.umd.js.map +1 -0
  16. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.html +13 -0
  17. package/templates/vanilla/node_modules/@monygroupcorp/microact/example/index.js +63 -0
  18. package/templates/vanilla/node_modules/@monygroupcorp/microact/package.json +38 -0
  19. package/templates/vanilla/node_modules/@monygroupcorp/microact/rollup.config.cjs +30 -0
  20. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Component.js +831 -0
  21. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/DOMUpdater.js +320 -0
  22. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/EventBus.js +123 -0
  23. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/Router.js +253 -0
  24. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/UpdateScheduler.js +218 -0
  25. package/templates/vanilla/node_modules/@monygroupcorp/microact/src/index.js +6 -0
  26. package/templates/vanilla/node_modules/esbuild/LICENSE.md +21 -0
  27. package/templates/vanilla/node_modules/esbuild/README.md +3 -0
  28. package/templates/vanilla/node_modules/esbuild/bin/esbuild +0 -0
  29. package/templates/vanilla/node_modules/esbuild/install.js +287 -0
  30. package/templates/vanilla/node_modules/esbuild/lib/main.d.ts +660 -0
  31. package/templates/vanilla/node_modules/esbuild/lib/main.js +2393 -0
  32. package/templates/vanilla/node_modules/esbuild/package.json +42 -0
  33. package/templates/vanilla/node_modules/nanoid/LICENSE +20 -0
  34. package/templates/vanilla/node_modules/nanoid/README.md +39 -0
  35. package/templates/vanilla/node_modules/nanoid/async/index.browser.cjs +69 -0
  36. package/templates/vanilla/node_modules/nanoid/async/index.browser.js +34 -0
  37. package/templates/vanilla/node_modules/nanoid/async/index.cjs +71 -0
  38. package/templates/vanilla/node_modules/nanoid/async/index.d.ts +56 -0
  39. package/templates/vanilla/node_modules/nanoid/async/index.js +35 -0
  40. package/templates/vanilla/node_modules/nanoid/async/index.native.js +26 -0
  41. package/templates/vanilla/node_modules/nanoid/async/package.json +12 -0
  42. package/templates/vanilla/node_modules/nanoid/bin/nanoid.cjs +55 -0
  43. package/templates/vanilla/node_modules/nanoid/index.browser.cjs +72 -0
  44. package/templates/vanilla/node_modules/nanoid/index.browser.js +34 -0
  45. package/templates/vanilla/node_modules/nanoid/index.cjs +85 -0
  46. package/templates/vanilla/node_modules/nanoid/index.d.cts +91 -0
  47. package/templates/vanilla/node_modules/nanoid/index.d.ts +91 -0
  48. package/templates/vanilla/node_modules/nanoid/index.js +45 -0
  49. package/templates/vanilla/node_modules/nanoid/nanoid.js +1 -0
  50. package/templates/vanilla/node_modules/nanoid/non-secure/index.cjs +34 -0
  51. package/templates/vanilla/node_modules/nanoid/non-secure/index.d.ts +33 -0
  52. package/templates/vanilla/node_modules/nanoid/non-secure/index.js +21 -0
  53. package/templates/vanilla/node_modules/nanoid/non-secure/package.json +6 -0
  54. package/templates/vanilla/node_modules/nanoid/package.json +89 -0
  55. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  56. package/templates/vanilla/node_modules/nanoid/url-alphabet/index.js +3 -0
  57. package/templates/vanilla/node_modules/nanoid/url-alphabet/package.json +6 -0
  58. package/templates/vanilla/node_modules/picocolors/LICENSE +15 -0
  59. package/templates/vanilla/node_modules/picocolors/README.md +21 -0
  60. package/templates/vanilla/node_modules/picocolors/package.json +25 -0
  61. package/templates/vanilla/node_modules/picocolors/picocolors.browser.js +4 -0
  62. package/templates/vanilla/node_modules/picocolors/picocolors.d.ts +5 -0
  63. package/templates/vanilla/node_modules/picocolors/picocolors.js +75 -0
  64. package/templates/vanilla/node_modules/picocolors/types.d.ts +51 -0
  65. package/templates/vanilla/node_modules/postcss/LICENSE +20 -0
  66. package/templates/vanilla/node_modules/postcss/README.md +29 -0
  67. package/templates/vanilla/node_modules/postcss/lib/at-rule.d.ts +140 -0
  68. package/templates/vanilla/node_modules/postcss/lib/at-rule.js +25 -0
  69. package/templates/vanilla/node_modules/postcss/lib/comment.d.ts +68 -0
  70. package/templates/vanilla/node_modules/postcss/lib/comment.js +13 -0
  71. package/templates/vanilla/node_modules/postcss/lib/container.d.ts +483 -0
  72. package/templates/vanilla/node_modules/postcss/lib/container.js +447 -0
  73. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.d.ts +248 -0
  74. package/templates/vanilla/node_modules/postcss/lib/css-syntax-error.js +133 -0
  75. package/templates/vanilla/node_modules/postcss/lib/declaration.d.ts +151 -0
  76. package/templates/vanilla/node_modules/postcss/lib/declaration.js +24 -0
  77. package/templates/vanilla/node_modules/postcss/lib/document.d.ts +69 -0
  78. package/templates/vanilla/node_modules/postcss/lib/document.js +33 -0
  79. package/templates/vanilla/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  80. package/templates/vanilla/node_modules/postcss/lib/fromJSON.js +54 -0
  81. package/templates/vanilla/node_modules/postcss/lib/input.d.ts +227 -0
  82. package/templates/vanilla/node_modules/postcss/lib/input.js +265 -0
  83. package/templates/vanilla/node_modules/postcss/lib/lazy-result.d.ts +190 -0
  84. package/templates/vanilla/node_modules/postcss/lib/lazy-result.js +550 -0
  85. package/templates/vanilla/node_modules/postcss/lib/list.d.ts +60 -0
  86. package/templates/vanilla/node_modules/postcss/lib/list.js +58 -0
  87. package/templates/vanilla/node_modules/postcss/lib/map-generator.js +368 -0
  88. package/templates/vanilla/node_modules/postcss/lib/no-work-result.d.ts +46 -0
  89. package/templates/vanilla/node_modules/postcss/lib/no-work-result.js +138 -0
  90. package/templates/vanilla/node_modules/postcss/lib/node.d.ts +556 -0
  91. package/templates/vanilla/node_modules/postcss/lib/node.js +449 -0
  92. package/templates/vanilla/node_modules/postcss/lib/parse.d.ts +9 -0
  93. package/templates/vanilla/node_modules/postcss/lib/parse.js +42 -0
  94. package/templates/vanilla/node_modules/postcss/lib/parser.js +611 -0
  95. package/templates/vanilla/node_modules/postcss/lib/postcss.d.mts +69 -0
  96. package/templates/vanilla/node_modules/postcss/lib/postcss.d.ts +458 -0
  97. package/templates/vanilla/node_modules/postcss/lib/postcss.js +101 -0
  98. package/templates/vanilla/node_modules/postcss/lib/postcss.mjs +30 -0
  99. package/templates/vanilla/node_modules/postcss/lib/previous-map.d.ts +81 -0
  100. package/templates/vanilla/node_modules/postcss/lib/previous-map.js +144 -0
  101. package/templates/vanilla/node_modules/postcss/lib/processor.d.ts +115 -0
  102. package/templates/vanilla/node_modules/postcss/lib/processor.js +67 -0
  103. package/templates/vanilla/node_modules/postcss/lib/result.d.ts +205 -0
  104. package/templates/vanilla/node_modules/postcss/lib/result.js +42 -0
  105. package/templates/vanilla/node_modules/postcss/lib/root.d.ts +87 -0
  106. package/templates/vanilla/node_modules/postcss/lib/root.js +61 -0
  107. package/templates/vanilla/node_modules/postcss/lib/rule.d.ts +126 -0
  108. package/templates/vanilla/node_modules/postcss/lib/rule.js +27 -0
  109. package/templates/vanilla/node_modules/postcss/lib/stringifier.d.ts +46 -0
  110. package/templates/vanilla/node_modules/postcss/lib/stringifier.js +353 -0
  111. package/templates/vanilla/node_modules/postcss/lib/stringify.d.ts +9 -0
  112. package/templates/vanilla/node_modules/postcss/lib/stringify.js +11 -0
  113. package/templates/vanilla/node_modules/postcss/lib/symbols.js +5 -0
  114. package/templates/vanilla/node_modules/postcss/lib/terminal-highlight.js +70 -0
  115. package/templates/vanilla/node_modules/postcss/lib/tokenize.js +266 -0
  116. package/templates/vanilla/node_modules/postcss/lib/warn-once.js +13 -0
  117. package/templates/vanilla/node_modules/postcss/lib/warning.d.ts +147 -0
  118. package/templates/vanilla/node_modules/postcss/lib/warning.js +37 -0
  119. package/templates/vanilla/node_modules/postcss/package.json +88 -0
  120. package/templates/vanilla/node_modules/rollup/LICENSE.md +695 -0
  121. package/templates/vanilla/node_modules/rollup/README.md +125 -0
  122. package/templates/vanilla/node_modules/rollup/dist/bin/rollup +1715 -0
  123. package/templates/vanilla/node_modules/rollup/dist/es/getLogFilter.js +64 -0
  124. package/templates/vanilla/node_modules/rollup/dist/es/package.json +1 -0
  125. package/templates/vanilla/node_modules/rollup/dist/es/rollup.js +17 -0
  126. package/templates/vanilla/node_modules/rollup/dist/es/shared/node-entry.js +27273 -0
  127. package/templates/vanilla/node_modules/rollup/dist/es/shared/watch.js +4857 -0
  128. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.d.ts +5 -0
  129. package/templates/vanilla/node_modules/rollup/dist/getLogFilter.js +69 -0
  130. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.d.ts +20 -0
  131. package/templates/vanilla/node_modules/rollup/dist/loadConfigFile.js +29 -0
  132. package/templates/vanilla/node_modules/rollup/dist/rollup.d.ts +1012 -0
  133. package/templates/vanilla/node_modules/rollup/dist/rollup.js +31 -0
  134. package/templates/vanilla/node_modules/rollup/dist/shared/fsevents-importer.js +37 -0
  135. package/templates/vanilla/node_modules/rollup/dist/shared/index.js +4571 -0
  136. package/templates/vanilla/node_modules/rollup/dist/shared/loadConfigFile.js +546 -0
  137. package/templates/vanilla/node_modules/rollup/dist/shared/rollup.js +27351 -0
  138. package/templates/vanilla/node_modules/rollup/dist/shared/watch-cli.js +561 -0
  139. package/templates/vanilla/node_modules/rollup/dist/shared/watch-proxy.js +87 -0
  140. package/templates/vanilla/node_modules/rollup/dist/shared/watch.js +316 -0
  141. package/templates/vanilla/node_modules/rollup/package.json +181 -0
  142. package/templates/vanilla/node_modules/source-map-js/LICENSE +28 -0
  143. package/templates/vanilla/node_modules/source-map-js/README.md +765 -0
  144. package/templates/vanilla/node_modules/source-map-js/lib/array-set.js +121 -0
  145. package/templates/vanilla/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  146. package/templates/vanilla/node_modules/source-map-js/lib/base64.js +67 -0
  147. package/templates/vanilla/node_modules/source-map-js/lib/binary-search.js +111 -0
  148. package/templates/vanilla/node_modules/source-map-js/lib/mapping-list.js +79 -0
  149. package/templates/vanilla/node_modules/source-map-js/lib/quick-sort.js +132 -0
  150. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  151. package/templates/vanilla/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  152. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  153. package/templates/vanilla/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  154. package/templates/vanilla/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  155. package/templates/vanilla/node_modules/source-map-js/lib/source-node.js +413 -0
  156. package/templates/vanilla/node_modules/source-map-js/lib/util.js +594 -0
  157. package/templates/vanilla/node_modules/source-map-js/package.json +71 -0
  158. package/templates/vanilla/node_modules/source-map-js/source-map.d.ts +104 -0
  159. package/templates/vanilla/node_modules/source-map-js/source-map.js +8 -0
  160. package/templates/vanilla/node_modules/vite/LICENSE.md +3396 -0
  161. package/templates/vanilla/node_modules/vite/README.md +20 -0
  162. package/templates/vanilla/node_modules/vite/bin/openChrome.applescript +95 -0
  163. package/templates/vanilla/node_modules/vite/bin/vite.js +61 -0
  164. package/templates/vanilla/node_modules/vite/client.d.ts +281 -0
  165. package/templates/vanilla/node_modules/vite/dist/client/client.mjs +725 -0
  166. package/templates/vanilla/node_modules/vite/dist/client/client.mjs.map +1 -0
  167. package/templates/vanilla/node_modules/vite/dist/client/env.mjs +30 -0
  168. package/templates/vanilla/node_modules/vite/dist/client/env.mjs.map +1 -0
  169. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-7ec6f216.js +914 -0
  170. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-827b23df.js +66713 -0
  171. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-c423598f.js +561 -0
  172. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f0c7dae0.js +7930 -0
  173. package/templates/vanilla/node_modules/vite/dist/node/chunks/dep-f1e8587f.js +7646 -0
  174. package/templates/vanilla/node_modules/vite/dist/node/cli.js +929 -0
  175. package/templates/vanilla/node_modules/vite/dist/node/constants.js +130 -0
  176. package/templates/vanilla/node_modules/vite/dist/node/index.d.ts +3548 -0
  177. package/templates/vanilla/node_modules/vite/dist/node/index.js +158 -0
  178. package/templates/vanilla/node_modules/vite/dist/node-cjs/publicUtils.cjs +4555 -0
  179. package/templates/vanilla/node_modules/vite/index.cjs +34 -0
  180. package/templates/vanilla/node_modules/vite/package.json +173 -0
  181. package/templates/vanilla/node_modules/vite/types/customEvent.d.ts +35 -0
  182. package/templates/vanilla/node_modules/vite/types/hmrPayload.d.ts +61 -0
  183. package/templates/vanilla/node_modules/vite/types/hot.d.ts +32 -0
  184. package/templates/vanilla/node_modules/vite/types/importGlob.d.ts +97 -0
  185. package/templates/vanilla/node_modules/vite/types/importMeta.d.ts +26 -0
  186. package/templates/vanilla/node_modules/vite/types/metadata.d.ts +10 -0
  187. package/templates/vanilla/node_modules/vite/types/package.json +4 -0
  188. package/templates/vanilla/package-lock.json +589 -0
  189. package/templates/vanilla/package.json +17 -0
  190. package/templates/vanilla/src/components/App.js +60 -0
  191. package/templates/vanilla/src/components/Card.js +21 -0
  192. package/templates/vanilla/src/components/Hero.js +15 -0
  193. package/templates/vanilla/src/components/InteractiveDemo.js +59 -0
  194. package/templates/vanilla/src/main.js +9 -0
  195. package/templates/vanilla/src/style/main.css +172 -0
  196. package/templates/vanilla/vite.config.js +8 -0
  197. package/templates/web3/.env.example +15 -0
  198. package/templates/web3/.github/workflows/deploy.yml +38 -0
  199. package/templates/web3/README.md +33 -0
  200. package/templates/web3/contracts/foundry.toml +11 -0
  201. package/templates/web3/contracts/script/Deploy.s.sol +13 -0
  202. package/templates/web3/contracts/src/Counter.sol +21 -0
  203. package/templates/web3/index.html +13 -0
  204. package/templates/web3/package.json +25 -0
  205. package/templates/web3/scripts/chain-start.mjs +305 -0
  206. package/templates/web3/scripts/chain-stop.mjs +34 -0
  207. package/templates/web3/scripts/deploy.mjs +155 -0
  208. package/templates/web3/scripts/setup.mjs +42 -0
  209. package/templates/web3/src/components/App.js +49 -0
  210. package/templates/web3/src/components/CounterCard.js +111 -0
  211. package/templates/web3/src/main.js +54 -0
  212. package/templates/web3/src/style/main.css +345 -0
  213. package/templates/web3/vite.config.js +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microact.esm.js","sources":["../src/EventBus.js","../src/DOMUpdater.js","../src/UpdateScheduler.js","../src/Component.js","../src/Router.js"],"sourcesContent":["class EventBus {\n constructor() {\n this.listeners = new Map();\n this.debugMode = false;\n }\n\n /**\n * Enable or disable debug logging\n * @param {boolean} enabled \n */\n setDebugMode(enabled) {\n this.debugMode = enabled;\n }\n\n /**\n * Subscribe to an event\n * @param {string} eventName \n * @param {Function} callback \n * @returns {Function} Unsubscribe function\n */\n on(eventName, callback) {\n if (!this.listeners.has(eventName)) {\n this.listeners.set(eventName, new Set());\n }\n \n this.listeners.get(eventName).add(callback);\n \n if (this.debugMode) {\n console.log(`[EventBus] Listener added for \"${eventName}\"`);\n }\n\n // Return unsubscribe function\n return () => this.off(eventName, callback);\n }\n\n /**\n * Remove a specific event listener\n * @param {string} eventName \n * @param {Function} callback \n */\n off(eventName, callback) {\n if (!this.listeners.has(eventName)) return;\n \n this.listeners.get(eventName).delete(callback);\n \n if (this.debugMode) {\n console.log(`[EventBus] Listener removed for \"${eventName}\"`);\n }\n\n // Cleanup empty event sets\n if (this.listeners.get(eventName).size === 0) {\n this.listeners.delete(eventName);\n }\n }\n\n /**\n * Remove all listeners for an event\n * @param {string} eventName \n */\n removeAllListeners(eventName) {\n if (eventName) {\n this.listeners.delete(eventName);\n if (this.debugMode) {\n console.log(`[EventBus] All listeners removed for \"${eventName}\"`);\n }\n } else {\n this.listeners.clear();\n if (this.debugMode) {\n console.log('[EventBus] All listeners removed');\n }\n }\n }\n\n /**\n * Emit an event with data\n * @param {string} eventName \n * @param {any} data \n */\n emit(eventName, data) {\n if (!this.listeners.has(eventName)) {\n return;\n }\n\n if (this.debugMode) {\n console.log(`[EventBus] Emitting \"${eventName}\"`, data);\n }\n\n this.listeners.get(eventName).forEach(callback => {\n try {\n callback(data);\n } catch (error) {\n console.error(`[EventBus] Error in listener for \"${eventName}\":`, error);\n }\n });\n }\n\n /**\n * Subscribe to an event for one-time use\n * @param {string} eventName \n * @param {Function} callback \n * @returns {Function} Unsubscribe function\n */\n once(eventName, callback) {\n // Create a wrapper that will call the callback and then unsubscribe\n const wrappedCallback = (data) => {\n // Unsubscribe first to prevent issues if the callback triggers the same event\n this.off(eventName, wrappedCallback);\n // Call the original callback\n try {\n callback(data);\n } catch (error) {\n console.error(`[EventBus] Error in once callback for \"${eventName}\":`, error);\n }\n };\n \n // Register the wrapped callback\n const unsubscribe = this.on(eventName, wrappedCallback);\n return unsubscribe;\n }\n}\n\n// Create a single instance for the application\nexport const eventBus = new EventBus(); ","/**\n * DOMUpdater - Utility for granular DOM updates\n * Preserves focus state, scroll position, and form input values during updates\n */\nexport class DOMUpdater {\n constructor() {\n this._activeElement = null;\n this._activeElementPath = null;\n this._scrollPositions = new Map();\n }\n\n /**\n * Save the currently focused element and scroll positions\n * @param {HTMLElement} rootElement - Root element to save state from\n */\n saveState(rootElement) {\n // Save active element\n const activeElement = document.activeElement;\n if (activeElement && rootElement.contains(activeElement)) {\n this._activeElement = activeElement;\n this._activeElementPath = this._getElementPath(activeElement, rootElement);\n } else {\n this._activeElement = null;\n this._activeElementPath = null;\n }\n\n // Save scroll positions for all scrollable containers\n this._scrollPositions.clear();\n const scrollableElements = rootElement.querySelectorAll('[data-scroll-container], [style*=\"overflow\"]');\n scrollableElements.forEach(el => {\n if (el.scrollTop !== undefined || el.scrollLeft !== undefined) {\n const path = this._getElementPath(el, rootElement);\n this._scrollPositions.set(path, {\n scrollTop: el.scrollTop,\n scrollLeft: el.scrollLeft\n });\n }\n });\n }\n\n /**\n * Restore focus and scroll positions after DOM update\n * @param {HTMLElement} rootElement - Root element to restore state in\n */\n restoreState(rootElement) {\n // Restore focus\n if (this._activeElementPath) {\n const element = this._getElementByPath(rootElement, this._activeElementPath);\n if (element && element.focus) {\n try {\n // Restore cursor position if it's an input/textarea\n if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {\n const selectionStart = element.selectionStart || 0;\n element.focus();\n if (element.setSelectionRange) {\n element.setSelectionRange(selectionStart, selectionStart);\n }\n } else {\n element.focus();\n }\n } catch (e) {\n // Focus may fail if element is not focusable, ignore\n }\n }\n }\n\n // Restore scroll positions\n this._scrollPositions.forEach((position, path) => {\n const element = this._getElementByPath(rootElement, path);\n if (element) {\n element.scrollTop = position.scrollTop;\n element.scrollLeft = position.scrollLeft;\n }\n });\n }\n\n /**\n * Get a path string to identify an element within its root\n * @private\n */\n _getElementPath(element, root) {\n const path = [];\n let current = element;\n \n while (current && current !== root && current.parentNode) {\n const parent = current.parentNode;\n const index = Array.from(parent.children).indexOf(current);\n path.unshift(index);\n current = parent;\n }\n \n return path.join('/');\n }\n\n /**\n * Get an element by its path within root\n * @private\n */\n _getElementByPath(root, path) {\n const indices = path.split('/').map(Number);\n let current = root;\n \n for (const index of indices) {\n if (!current.children || !current.children[index]) {\n return null;\n }\n current = current.children[index];\n }\n \n return current;\n }\n\n /**\n * Compare two HTML strings and determine if they're structurally different\n * @param {string} oldHTML - Previous HTML\n * @param {string} newHTML - New HTML\n * @returns {boolean} - True if structure is significantly different\n */\n diffHTML(oldHTML, newHTML) {\n if (oldHTML === newHTML) return false;\n \n // Simple heuristic: if length difference is > 50%, likely structural change\n const lengthDiff = Math.abs(oldHTML.length - newHTML.length);\n const avgLength = (oldHTML.length + newHTML.length) / 2;\n if (lengthDiff / avgLength > 0.5) {\n return true;\n }\n \n // Check for tag changes (simplified)\n const oldTags = oldHTML.match(/<[^>]+>/g) || [];\n const newTags = newHTML.match(/<[^>]+>/g) || [];\n if (oldTags.length !== newTags.length) {\n return true;\n }\n \n return false;\n }\n\n /**\n * Update text content of a node\n * @param {Node} node - Node to update\n * @param {string} newText - New text content\n */\n updateText(node, newText) {\n if (node.nodeType === Node.TEXT_NODE) {\n node.textContent = newText;\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n // For elements, update only if it's a text-only element\n if (node.children.length === 0) {\n node.textContent = newText;\n }\n }\n }\n\n /**\n * Update attributes of an element\n * @param {HTMLElement} element - Element to update\n * @param {Object} newAttrs - New attributes object\n */\n updateAttributes(element, newAttrs) {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n \n // Get current attributes\n const currentAttrs = {};\n Array.from(element.attributes).forEach(attr => {\n currentAttrs[attr.name] = attr.value;\n });\n \n // Update changed attributes\n Object.keys(newAttrs).forEach(name => {\n const newValue = newAttrs[name];\n if (currentAttrs[name] !== newValue) {\n if (newValue === null || newValue === undefined) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, newValue);\n }\n }\n });\n \n // Remove attributes that are no longer present\n Object.keys(currentAttrs).forEach(name => {\n if (!(name in newAttrs)) {\n element.removeAttribute(name);\n }\n });\n }\n\n /**\n * Update children of a parent element using a simple reconciliation algorithm\n * @param {HTMLElement} parent - Parent element\n * @param {NodeList|Array} oldChildren - Current children\n * @param {DocumentFragment|HTMLElement} newChildrenContainer - Container with new children\n */\n updateChildren(parent, oldChildren, newChildrenContainer) {\n const oldArray = Array.from(oldChildren);\n const newArray = Array.from(newChildrenContainer.children || []);\n \n // If structure is too different, replace entirely\n if (Math.abs(oldArray.length - newArray.length) > oldArray.length * 0.3) {\n return false; // Signal to fall back to full replacement\n }\n \n // Simple reconciliation: update in place where possible\n const maxLength = Math.max(oldArray.length, newArray.length);\n \n for (let i = 0; i < maxLength; i++) {\n const oldChild = oldArray[i];\n const newChild = newArray[i];\n \n if (!oldChild && newChild) {\n // New child - append\n parent.appendChild(newChild);\n } else if (oldChild && !newChild) {\n // Old child removed\n oldChild.remove();\n } else if (oldChild && newChild) {\n // Both exist - try to update in place\n if (this._canUpdateInPlace(oldChild, newChild)) {\n this._updateNodeInPlace(oldChild, newChild);\n } else {\n // Replace\n parent.replaceChild(newChild, oldChild);\n }\n }\n }\n \n return true; // Successfully updated\n }\n\n /**\n * Check if two nodes can be updated in place\n * @private\n */\n _canUpdateInPlace(oldNode, newNode) {\n if (oldNode.nodeType !== newNode.nodeType) return false;\n if (oldNode.nodeType === Node.TEXT_NODE) return true;\n if (oldNode.nodeType === Node.ELEMENT_NODE) {\n return oldNode.tagName === newNode.tagName;\n }\n return false;\n }\n\n /**\n * Update a node in place with new content\n * @private\n */\n _updateNodeInPlace(oldNode, newNode) {\n if (oldNode.nodeType === Node.TEXT_NODE) {\n oldNode.textContent = newNode.textContent;\n return;\n }\n \n if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update attributes\n const newAttrs = {};\n Array.from(newNode.attributes).forEach(attr => {\n newAttrs[attr.name] = attr.value;\n });\n this.updateAttributes(oldNode, newAttrs);\n \n // Update children recursively\n const oldChildren = oldNode.childNodes;\n const newChildren = newNode.childNodes;\n \n // For simple text-only updates\n if (oldChildren.length === 1 && newChildren.length === 1 &&\n oldChildren[0].nodeType === Node.TEXT_NODE &&\n newChildren[0].nodeType === Node.TEXT_NODE) {\n oldChildren[0].textContent = newChildren[0].textContent;\n return;\n }\n \n // For more complex structures, try to reconcile\n if (!this.updateChildren(oldNode, oldChildren, newNode)) {\n // Fall back to replacing content\n oldNode.innerHTML = newNode.innerHTML;\n }\n }\n }\n\n /**\n * Perform a granular update of an element's content\n * @param {HTMLElement} element - Element to update\n * @param {string} newHTML - New HTML content\n * @returns {boolean} - True if granular update succeeded, false if fallback needed\n */\n updateGranular(element, newHTML) {\n // Save state before update\n this.saveState(element);\n \n // Create temporary container for new HTML\n const temp = document.createElement('div');\n temp.innerHTML = newHTML;\n \n // Try to update children granularly\n const oldHTML = element.innerHTML;\n const isStructuralChange = this.diffHTML(oldHTML, newHTML);\n \n if (isStructuralChange) {\n // Structural change detected - fall back to full replacement\n return false;\n }\n \n // Try granular update\n try {\n const success = this.updateChildren(element, element.childNodes, temp);\n if (success) {\n // Restore state after successful update\n this.restoreState(element);\n return true;\n }\n } catch (e) {\n console.warn('[DOMUpdater] Granular update failed, falling back:', e);\n }\n \n return false;\n }\n}\n\n","/**\n * UpdateScheduler - Coordinates component updates using requestAnimationFrame batching\n * \n * Prevents UI blocking by batching multiple component updates into a single frame.\n * Components can opt-in to batching for non-critical updates, while critical updates\n * (user input, errors) can execute immediately.\n * \n * Usage:\n * // In Component.js\n * this.scheduleUpdate(); // Batched (default)\n * this.scheduleUpdate({ immediate: true }); // Immediate\n */\nexport class UpdateScheduler {\n constructor() {\n // Queue of components waiting to be updated\n this._queue = new Set();\n \n // Flag to track if requestAnimationFrame is already scheduled\n this._scheduled = false;\n \n // Performance metrics (only tracked in dev mode)\n this._metrics = {\n frames: 0,\n updates: 0,\n maxFrameTime: 0,\n totalFrameTime: 0,\n maxUpdatesPerFrame: 0\n };\n \n // Dev mode flag (can be enabled for performance monitoring)\n this._devMode = false;\n \n // Track if scheduler is enabled (can be disabled for debugging)\n this._enabled = true;\n }\n \n /**\n * Get singleton instance\n * @returns {UpdateScheduler}\n */\n static getInstance() {\n if (!UpdateScheduler._instance) {\n UpdateScheduler._instance = new UpdateScheduler();\n }\n return UpdateScheduler._instance;\n }\n \n /**\n * Enable or disable dev mode (performance tracking)\n * @param {boolean} enabled\n */\n setDevMode(enabled) {\n this._devMode = enabled;\n }\n \n /**\n * Enable or disable the scheduler (for debugging)\n * @param {boolean} enabled\n */\n setEnabled(enabled) {\n this._enabled = enabled;\n if (!enabled && this._scheduled) {\n // Cancel pending frame if disabling\n this._queue.clear();\n this._scheduled = false;\n }\n }\n \n /**\n * Queue a component for batched update\n * @param {Component} component - Component instance to update\n */\n queue(component) {\n if (!this._enabled) {\n // If scheduler is disabled, execute immediately\n try {\n component.update();\n } catch (error) {\n console.error('[UpdateScheduler] Error updating component (immediate):', error);\n }\n return;\n }\n \n if (!component || typeof component.update !== 'function') {\n console.warn('[UpdateScheduler] Invalid component queued:', component);\n return;\n }\n \n // Add to queue (Set automatically deduplicates)\n this._queue.add(component);\n \n // Schedule flush if not already scheduled\n if (!this._scheduled) {\n this._scheduled = true;\n requestAnimationFrame(() => this._flush());\n }\n }\n \n /**\n * Execute all queued updates in a single frame\n * @private\n */\n _flush() {\n if (this._queue.size === 0) {\n this._scheduled = false;\n return;\n }\n \n const start = performance.now();\n const updates = Array.from(this._queue);\n const updateCount = updates.length;\n \n // Clear queue and reset scheduled flag\n this._queue.clear();\n this._scheduled = false;\n \n // Execute all updates\n updates.forEach(component => {\n try {\n // Check if component is still mounted/valid before updating\n if (component && component.element && typeof component.update === 'function') {\n component.update();\n }\n } catch (error) {\n // Log error but continue with other updates\n console.error('[UpdateScheduler] Error updating component:', error);\n console.error('[UpdateScheduler] Component:', component);\n }\n });\n \n const duration = performance.now() - start;\n \n // Track metrics in dev mode\n if (this._devMode) {\n this._metrics.frames++;\n this._metrics.updates += updateCount;\n this._metrics.totalFrameTime += duration;\n this._metrics.maxFrameTime = Math.max(this._metrics.maxFrameTime, duration);\n this._metrics.maxUpdatesPerFrame = Math.max(this._metrics.maxUpdatesPerFrame, updateCount);\n \n // Warn if frame took too long (>16ms for 60fps)\n if (duration > 16) {\n console.warn(\n `[UpdateScheduler] Frame took ${duration.toFixed(2)}ms (>16ms target). ` +\n `Updated ${updateCount} component(s).`\n );\n }\n }\n \n // Handle nested updates (components that schedule updates during their update)\n // If new updates were queued during this flush, schedule another frame\n if (this._queue.size > 0) {\n this._scheduled = true;\n requestAnimationFrame(() => this._flush());\n }\n }\n \n /**\n * Get performance metrics\n * @returns {Object} Metrics object\n */\n getMetrics() {\n if (!this._devMode) {\n return { enabled: false };\n }\n \n const avgFrameTime = this._metrics.frames > 0\n ? this._metrics.totalFrameTime / this._metrics.frames\n : 0;\n \n const avgUpdatesPerFrame = this._metrics.frames > 0\n ? this._metrics.updates / this._metrics.frames\n : 0;\n \n return {\n enabled: true,\n frames: this._metrics.frames,\n totalUpdates: this._metrics.updates,\n maxFrameTime: this._metrics.maxFrameTime,\n avgFrameTime: avgFrameTime,\n maxUpdatesPerFrame: this._metrics.maxUpdatesPerFrame,\n avgUpdatesPerFrame: avgUpdatesPerFrame\n };\n }\n \n /**\n * Reset performance metrics\n */\n resetMetrics() {\n this._metrics = {\n frames: 0,\n updates: 0,\n maxFrameTime: 0,\n totalFrameTime: 0,\n maxUpdatesPerFrame: 0\n };\n }\n \n /**\n * Clear the update queue (useful for cleanup or testing)\n */\n clear() {\n this._queue.clear();\n this._scheduled = false;\n }\n \n /**\n * Get current queue size (for debugging)\n * @returns {number}\n */\n getQueueSize() {\n return this._queue.size;\n }\n}\n\n// Export singleton instance getter\nexport const getUpdateScheduler = () => UpdateScheduler.getInstance();\n\n","import { eventBus } from './EventBus.js';\nimport { DOMUpdater } from './DOMUpdater.js';\nimport { getUpdateScheduler } from './UpdateScheduler.js';\n\nexport class Component {\n constructor() {\n this.element = null;\n this.state = {};\n this.mounted = false;\n this.boundEvents = new Map();\n // Cleanup registry for tracking all cleanup functions\n this._cleanupRegistry = new Set();\n // Child components registry for automatic cleanup\n this._children = new Map();\n // Event subscriptions registry for automatic cleanup\n this._subscriptions = new Set();\n // DOM updater for granular updates\n this._domUpdater = new DOMUpdater();\n // Element reference cache\n this._refs = new Map();\n // Context storage\n this._context = new Map();\n // Parent component reference for context traversal\n this._parent = null;\n }\n\n /**\n * Initialize state with default values\n * @param {Object} initialState \n */\n setState(newState) {\n const oldState = {...this.state};\n this.state = { ...this.state, ...newState };\n \n // Only update if we should based on state changes\n if (this.shouldUpdate(oldState, this.state)) {\n this.update();\n this.onStateUpdate(oldState, this.state);\n }\n }\n\n /**\n * Determines if the component should update based on state changes\n * Override in child classes for custom comparison logic\n * @param {Object} oldState - Previous state\n * @param {Object} newState - New state \n * @returns {boolean} - Whether component should update\n */\n shouldUpdate(oldState, newState) {\n // Default shallow comparison of top-level state properties\n // Check if any properties have changed\n if (!oldState || !newState) return true;\n \n // Check if object references are the same\n if (oldState === newState) return false;\n \n // Do a shallow comparison of properties\n const oldKeys = Object.keys(oldState);\n const newKeys = Object.keys(newState);\n \n // If they have different number of keys, they changed\n if (oldKeys.length !== newKeys.length) return true;\n \n // Check if any key's value has changed\n return oldKeys.some(key => oldState[key] !== newState[key]);\n }\n \n /**\n * Lifecycle hook called after state is updated but before rendering\n * Override in child classes to handle state updates\n * @param {Object} oldState \n * @param {Object} newState \n */\n onStateUpdate(oldState, newState) {\n // Default implementation does nothing\n }\n\n /**\n * Mount component to DOM\n * @param {HTMLElement} container \n */\n mount(element) {\n try {\n this.element = element;\n this.mounted = true;\n \n // Apply styles if they exist\n if (this.constructor.styles) {\n const styleElement = document.createElement('style');\n styleElement.textContent = this.constructor.styles;\n document.head.appendChild(styleElement);\n this.styleElement = styleElement;\n \n // Register cleanup for style element\n this.registerCleanup(() => {\n if (this.styleElement && this.styleElement.parentNode) {\n this.styleElement.remove();\n }\n });\n }\n\n this.update();\n if (this.onMount) {\n this.onMount();\n }\n } catch (error) {\n this._handleError(error, { phase: 'mount' });\n }\n }\n\n /**\n * Remove component from DOM\n */\n unmount() {\n if (!this.mounted) return;\n\n\n \n // Execute all registered cleanup functions\n this._executeCleanup();\n \n // Unbind all events\n this.unbindEvents();\n \n // Clear all refs\n this.invalidateRefs();\n \n // Remove element if it exists\n if (this.element) {\n this.element.innerHTML = '';\n }\n this.element = null;\n \n // Call lifecycle method\n this.mounted = false;\n if (this.onUnmount) {\n this.onUnmount();\n }\n }\n\n /**\n * Bind DOM events based on this.events()\n */\n bindEvents() {\n // First unbind any existing events\n this.unbindEvents();\n\n if (!this.element || typeof this.events !== 'function') {\n return;\n }\n \n const events = this.events();\n if (!events) return;\n\n const entries = events instanceof Map ? Array.from(events.entries()) : Object.entries(events);\n\n for (const [eventSelector, handlerReference] of entries) {\n if (!eventSelector) continue;\n\n const descriptor = eventSelector.trim();\n if (!descriptor) continue;\n\n const [eventName, ...selectorParts] = descriptor.split(/\\s+/);\n if (!eventName) {\n console.warn(`[Component] Invalid event descriptor '${eventSelector}' in component '${this.constructor.name}'.`);\n continue;\n }\n const selector = selectorParts.join(' ');\n\n const handler = this._resolveEventHandler(handlerReference, eventSelector);\n if (!handler) {\n continue;\n }\n \n if (selector) {\n // Delegated event\n const eventHandler = (e) => {\n const target = e?.target;\n if (!target) return;\n const matchedTarget = typeof target.closest === 'function'\n ? target.closest(selector)\n : (target.matches(selector) ? target : null);\n if (matchedTarget && this.element.contains(matchedTarget)) {\n handler(e);\n }\n };\n this.element.addEventListener(eventName, eventHandler);\n this.boundEvents.set(eventSelector, eventHandler);\n } else {\n // Direct event\n this.element.addEventListener(eventName, handler);\n this.boundEvents.set(eventSelector, handler);\n }\n }\n }\n\n /**\n * Resolve event handler definitions passed via this.events()\n * Supports both handler name strings and direct function references.\n * @private\n */\n _resolveEventHandler(handlerReference, eventSelector) {\n let handler = handlerReference;\n\n if (typeof handlerReference === 'string') {\n handler = this[handlerReference];\n }\n\n if (typeof handler !== 'function') {\n console.warn(`[Component] Event handler '${handlerReference}' for event '${eventSelector}' is not a function on component '${this.constructor.name}'.`);\n return null;\n }\n\n // Bind handler to component instance when possible\n if (typeof handler.bind === 'function') {\n return handler.bind(this);\n }\n\n return (...args) => handler.apply(this, args);\n }\n\n /**\n * Unbind all DOM events\n */\n unbindEvents() {\n if (!this.element) {\n this.boundEvents.clear();\n return;\n }\n\n for (const [eventSelector, handler] of this.boundEvents.entries()) {\n const [eventName] = eventSelector.trim().split(/\\s+/);\n if (!eventName) continue;\n this.element.removeEventListener(eventName, handler);\n }\n this.boundEvents.clear();\n }\n\n /**\n * Update component after state change\n */\n update() {\n if (!this.element) return;\n \n try {\n // Get new content\n const newContent = this.render();\n \n // Always update on first render or when content changes\n // First render is detected by checking if innerHTML is empty\n if (!this.element.innerHTML || this.element.innerHTML !== newContent) {\n // Try granular update first (preserves focus/scroll)\n const granularSuccess = this._domUpdater.updateGranular(this.element, newContent);\n \n if (!granularSuccess) {\n // Fall back to full replacement for complex structural changes\n // Note: This will destroy child components, so they need to be re-mounted\n this.element.innerHTML = newContent;\n }\n \n // Invalidate refs cache after DOM update\n this.invalidateRefs();\n\n // Mount child components\n this._mountChildren();\n \n // Bind events if events() method exists\n if (this.events && typeof this.events === 'function') {\n this.bindEvents();\n }\n }\n } catch (error) {\n this._handleError(error, { phase: 'update' });\n }\n }\n\n /**\n * Mount declared child components.\n * This method is called after the parent component's DOM is updated.\n * @private\n */\n _mountChildren() {\n if (typeof this.children !== 'function') {\n return;\n }\n const childrenToMount = this.children();\n if (!childrenToMount) {\n return;\n }\n\n for (const selector in childrenToMount) {\n const container = this.getRef(selector);\n if (container) {\n const child = childrenToMount[selector];\n \n // If a different component is already in this container, unmount it.\n if (container.component && container.component !== child) {\n container.component.unmount();\n }\n\n // If the child is not already mounted in this specific container, mount it.\n if (child.element !== container) {\n child.mount(container);\n container.component = child; // Associate component with element for cleanup.\n this.registerCleanup(() => child.unmount());\n }\n }\n }\n }\n\n /**\n * Declares child components for the component.\n * @returns {Object.<string, Component>} A map where keys are CSS selectors \n * for the container elements and values are the child component instances.\n * e.g., { '#child-container': this.childComponent }\n */\n children() {\n return {};\n }\n\n /**\n * Schedule a component update with optional priority\n * \n * This method allows components to opt-in to requestAnimationFrame batching\n * for better performance when multiple components update simultaneously.\n * \n * @param {Object} options - Update options\n * @param {boolean} options.immediate - If true, update immediately (bypass batching).\n * Use for critical updates (user input, errors).\n * Default: false (batched)\n * \n * @example\n * // Batched update (default) - good for price updates, balance updates\n * this.scheduleUpdate();\n * \n * // Immediate update - good for user input, error displays\n * this.scheduleUpdate({ immediate: true });\n */\n scheduleUpdate(options = {}) {\n if (options.immediate) {\n // Critical update - execute immediately\n this.update();\n } else {\n // Non-critical update - queue for batching\n const scheduler = getUpdateScheduler();\n scheduler.queue(this);\n }\n }\n\n // Lifecycle methods (to be overridden by child classes)\n onMount() {}\n onUnmount() {}\n onUpdate(oldState) {}\n \n /**\n * Error handler lifecycle hook\n * Override in child classes to handle errors\n * @param {Error} error - The error that occurred\n * @param {Object} errorInfo - Additional error information\n */\n onError(error, errorInfo) {\n // Default implementation does nothing\n // Child classes can override to handle errors\n }\n\n // Methods to be implemented by child classes\n render() {\n try {\n return this.template ? this.template() : '';\n } catch (error) {\n this._handleError(error, { phase: 'render' });\n return '<div class=\"component-error\">Error rendering component</div>';\n }\n }\n \n /**\n * Handle errors and propagate to nearest ErrorBoundary\n * @private\n */\n _handleError(error, errorInfo = {}) {\n // Call component's error handler if it exists\n if (this.onError) {\n try {\n this.onError(error, errorInfo);\n } catch (handlerError) {\n console.error('[Component] Error in onError handler:', handlerError);\n }\n }\n \n // Propagate to parent ErrorBoundary if it exists\n // Check by constructor name to avoid circular dependency\n let parent = this._parent;\n while (parent) {\n if (parent.constructor && parent.constructor.name === 'ErrorBoundary') {\n if (parent._errorHandler) {\n parent._errorHandler(error, { ...errorInfo, component: this.constructor.name });\n }\n return;\n }\n parent = parent._parent;\n }\n \n // If no ErrorBoundary found, log to console\n console.error(`[Component] Unhandled error in ${this.constructor.name}:`, error, errorInfo);\n }\n\n events() {\n return {};\n }\n\n /**\n * Register a cleanup function to be called on unmount\n * @param {Function} cleanupFn - Function to call during cleanup\n * @returns {Function} - Unregister function to remove this cleanup\n */\n registerCleanup(cleanupFn) {\n if (typeof cleanupFn !== 'function') {\n console.warn('[Component] registerCleanup called with non-function:', cleanupFn);\n return () => {};\n }\n \n this._cleanupRegistry.add(cleanupFn);\n \n // Return unregister function\n return () => {\n this._cleanupRegistry.delete(cleanupFn);\n };\n }\n\n /**\n * Execute all registered cleanup functions\n * @private\n */\n _executeCleanup() {\n this._cleanupRegistry.forEach(cleanupFn => {\n try {\n cleanupFn();\n } catch (error) {\n console.error('[Component] Error during cleanup:', error);\n }\n });\n this._cleanupRegistry.clear();\n }\n\n /**\n * Unmount all child components\n * @private\n */\n _unmountChildren() {\n for (const [key, child] of this._children.entries()) {\n try {\n if (child && typeof child.unmount === 'function') {\n child.unmount();\n }\n } catch (error) {\n console.error(`[Component] Error unmounting child \"${key}\":`, error);\n }\n }\n this._children.clear();\n }\n\n /**\n * Create and track a child component\n * @param {string} key - Unique key for this child component\n * @param {Component} childComponent - Child component instance\n * @returns {Component} - The child component\n */\n createChild(key, childComponent) {\n if (this._children.has(key)) {\n console.warn(`[Component] Child with key \"${key}\" already exists, unmounting previous instance`);\n const previous = this._children.get(key);\n if (previous && typeof previous.unmount === 'function') {\n previous.unmount();\n }\n }\n \n // Set parent reference for context traversal\n childComponent._parent = this;\n \n // Inherit parent context\n this._context.forEach((value, key) => {\n childComponent._context.set(key, value);\n });\n \n this._children.set(key, childComponent);\n \n // Register cleanup to unmount child\n this.registerCleanup(() => {\n if (childComponent && typeof childComponent.unmount === 'function') {\n childComponent.unmount();\n }\n this._children.delete(key);\n });\n \n return childComponent;\n }\n\n /**\n * Wrapper for setTimeout that automatically registers cleanup\n * @param {Function} callback - Function to call after delay\n * @param {number} delay - Delay in milliseconds\n * @returns {number} - Timer ID (can be used with clearTimeout)\n */\n setTimeout(callback, delay) {\n const timerId = window.setTimeout(callback, delay);\n \n // Register cleanup to clear the timer\n this.registerCleanup(() => {\n window.clearTimeout(timerId);\n });\n \n return timerId;\n }\n\n /**\n * Wrapper for setInterval that automatically registers cleanup\n * @param {Function} callback - Function to call repeatedly\n * @param {number} delay - Interval in milliseconds\n * @returns {number} - Timer ID (can be used with clearInterval)\n */\n setInterval(callback, delay) {\n const timerId = window.setInterval(callback, delay);\n \n // Register cleanup to clear the interval\n this.registerCleanup(() => {\n window.clearInterval(timerId);\n });\n \n return timerId;\n }\n\n /**\n * Subscribe to an event with automatic cleanup on unmount\n * @param {string} eventName - Name of the event to subscribe to\n * @param {Function} callback - Callback function to call when event is emitted\n * @returns {Function} - Unsubscribe function (also auto-called on unmount)\n */\n subscribe(eventName, callback) {\n // Subscribe to the event\n const unsubscribe = eventBus.on(eventName, callback);\n \n // Track the subscription for automatic cleanup\n this._subscriptions.add(unsubscribe);\n \n // Register cleanup to unsubscribe\n this.registerCleanup(() => {\n unsubscribe();\n this._subscriptions.delete(unsubscribe);\n });\n \n return unsubscribe;\n }\n\n /**\n * Subscribe to an event for one-time use with automatic cleanup\n * @param {string} eventName - Name of the event to subscribe to\n * @param {Function} callback - Callback function to call when event is emitted (once)\n * @returns {Function} - Unsubscribe function (also auto-called on unmount or after first call)\n */\n subscribeOnce(eventName, callback) {\n // Subscribe to the event once\n const unsubscribe = eventBus.once(eventName, callback);\n \n // Track the subscription for automatic cleanup\n this._subscriptions.add(unsubscribe);\n \n // Register cleanup\n this.registerCleanup(() => {\n unsubscribe();\n this._subscriptions.delete(unsubscribe);\n });\n \n return unsubscribe;\n }\n\n /**\n * Hook to subscribe to store state changes\n * Automatically updates component when selected store state changes\n * \n * STATE OWNERSHIP RULES:\n * - UI-only state (focus, hover, temporary UI state) → use this.state\n * - Shared/global state (balances, price, wallet, contract data) → use store\n * - Derived state → use selectors\n * \n * Usage examples:\n * // Using a selector method\n * const isPhase2 = this.useStore(tradingStore, () => tradingStore.selectIsPhase2());\n * \n * // Using a direct state selector\n * const price = this.useStore(tradingStore, (state) => state.price.current);\n * \n * // With update callback\n * this.useStore(tradingStore, () => tradingStore.selectIsPhase2(), (newValue, oldValue) => {\n * console.log('Phase 2 changed:', newValue);\n * });\n * \n * @param {Store} store - Store instance to subscribe to\n * @param {Function} selector - Function that selects state (can be store method or state selector)\n * @param {Function} onUpdate - Optional callback when selected state changes\n * @returns {any} - Current selected state value\n */\n useStore(store, selector, onUpdate) {\n if (!store || typeof selector !== 'function') {\n console.warn('[Component] useStore called with invalid arguments');\n return null;\n }\n\n // Store the last value for comparison\n if (!this._storeValues) {\n this._storeValues = new Map();\n }\n \n const selectorKey = selector.toString(); // Use function string as key (not perfect but works)\n let lastValue = this._storeValues.get(selectorKey);\n \n // Get initial value\n const getCurrentValue = () => {\n // Try calling as store method first (e.g., tradingStore.selectIsPhase2())\n try {\n const result = selector.call(store);\n if (result !== undefined) {\n return result;\n }\n } catch (e) {\n // Not a method, try as state selector\n }\n \n // Try as state selector (e.g., (state) => state.price)\n return selector(store.getState());\n };\n \n const currentValue = getCurrentValue();\n this._storeValues.set(selectorKey, currentValue);\n \n // Subscribe to store changes\n const unsubscribe = store.subscribe(() => {\n const newValue = getCurrentValue();\n const oldValue = lastValue;\n \n // Only update if value actually changed (shallow comparison)\n if (this._hasValueChanged(oldValue, newValue)) {\n // Update stored value\n this._storeValues.set(selectorKey, newValue);\n lastValue = newValue;\n \n // Call optional update callback\n if (typeof onUpdate === 'function') {\n onUpdate(newValue, oldValue);\n }\n \n // Trigger component update\n this.update();\n }\n });\n \n // Register cleanup to unsubscribe\n this.registerCleanup(() => {\n unsubscribe();\n if (this._storeValues) {\n this._storeValues.delete(selectorKey);\n }\n });\n \n return currentValue;\n }\n\n /**\n * Check if two values have changed (shallow comparison)\n * @private\n */\n _hasValueChanged(oldValue, newValue) {\n // Primitive comparison\n if (oldValue === newValue) return false;\n \n // Null/undefined handling\n if (oldValue == null || newValue == null) return oldValue !== newValue;\n \n // Object comparison (shallow)\n if (typeof oldValue === 'object' && typeof newValue === 'object') {\n const oldKeys = Object.keys(oldValue);\n const newKeys = Object.keys(newValue);\n \n if (oldKeys.length !== newKeys.length) return true;\n \n return oldKeys.some(key => oldValue[key] !== newValue[key]);\n }\n \n return true;\n }\n\n /**\n * Get a cached element reference by name and selector\n * @param {string} name - Reference name (for caching)\n * @param {string} selector - CSS selector to find element\n * @returns {HTMLElement|null} - Element or null if not found\n */\n _getRefCached(name, selector) {\n if (!this.element) return null;\n \n // Check cache first\n if (this._refs.has(name)) {\n const cached = this._refs.get(name);\n // Verify element is still in DOM\n if (cached && this.element.contains(cached)) {\n return cached;\n }\n // Stale reference, remove from cache\n this._refs.delete(name);\n }\n \n // Query DOM if not cached\n const element = this.element.querySelector(selector);\n if (element) {\n this._refs.set(name, element);\n }\n \n return element;\n }\n\n /**\n * Manually update a cached reference\n * @param {string} name - Reference name\n * @param {HTMLElement} element - Element to cache\n */\n updateRef(name, element) {\n if (element) {\n this._refs.set(name, element);\n } else {\n this._refs.delete(name);\n }\n }\n\n /**\n * Invalidate all cached references\n * Should be called when DOM structure changes significantly\n */\n invalidateRefs() {\n this._refs.clear();\n }\n\n /**\n * Invalidate a specific cached reference\n * @param {string} name - Reference name to invalidate\n */\n invalidateRef(name) {\n this._refs.delete(name);\n }\n\n /**\n * Get a single DOM element within this component's element\n * Convenience wrapper around querySelector with null-safety check\n * @param {string} selector - CSS selector to query\n * @returns {HTMLElement|null} The first matching element or null\n */\n getRef(selector) {\n if (!this.element) {\n console.warn(`[Component] getRef called on ${this.constructor.name} before element exists`);\n return null;\n }\n return this.element.querySelector(selector);\n }\n\n /**\n * Get multiple DOM elements within this component's element\n * Convenience wrapper around querySelectorAll with null-safety check\n * @param {string} selector - CSS selector to query\n * @returns {Array<HTMLElement>} Array of matching elements (empty array if none found)\n */\n getRefs(selector) {\n if (!this.element) {\n console.warn(`[Component] getRefs called on ${this.constructor.name} before element exists`);\n return [];\n }\n // Convert NodeList to Array for easier manipulation\n return Array.from(this.element.querySelectorAll(selector));\n }\n\n /**\n * Provide a context value to child components\n * @param {string} key - Context key\n * @param {any} value - Context value\n */\n provideContext(key, value) {\n this._context.set(key, value);\n \n // Propagate to existing children\n this._children.forEach(child => {\n if (child && typeof child._context !== 'undefined') {\n child._context.set(key, value);\n }\n });\n }\n\n /**\n * Get a context value, searching up the component tree\n * @param {string} key - Context key\n * @returns {any} - Context value or undefined if not found\n */\n getContext(key) {\n // Check own context first\n if (this._context.has(key)) {\n return this._context.get(key);\n }\n \n // Search up the tree\n let parent = this._parent;\n while (parent) {\n if (parent._context && parent._context.has(key)) {\n return parent._context.get(key);\n }\n parent = parent._parent;\n }\n \n return undefined;\n }\n\n /**\n * Remove a context value\n * @param {string} key - Context key to remove\n */\n removeContext(key) {\n this._context.delete(key);\n \n // Remove from children\n this._children.forEach(child => {\n if (child && typeof child._context !== 'undefined') {\n child._context.delete(key);\n }\n });\n }\n} \n","/**\n * Simple client-side router for SPA navigation\n * Supports static routes and browser history\n */\nclass Router {\n constructor() {\n this.routes = new Map();\n this.currentRoute = null;\n this.currentHandler = null;\n this.notFoundHandler = null;\n \n // Bind methods\n this.handleRoute = this.handleRoute.bind(this);\n this.navigate = this.navigate.bind(this);\n \n // Listen for browser back/forward\n window.addEventListener('popstate', async (e) => {\n await this.handleRoute(window.location.pathname);\n });\n }\n \n /**\n * Register a route\n * @param {string} path - Route path (e.g., '/', '/cultexecs')\n * @param {Function} handler - Route handler function\n */\n on(path, handler) {\n this.routes.set(path, handler);\n }\n \n /**\n * Register a 404 handler\n * @param {Function} handler - Handler for unmatched routes\n */\n notFound(handler) {\n this.notFoundHandler = handler;\n }\n \n /**\n * Navigate to a route\n * @param {string} path - Route path\n * @param {boolean} replace - Whether to replace history entry\n */\n async navigate(path, replace = false) {\n if (path === window.location.pathname) {\n return; // Already on this route\n }\n \n if (replace) {\n window.history.replaceState({ path }, '', path);\n } else {\n window.history.pushState({ path }, '', path);\n }\n \n await this.handleRoute(path);\n \n\n }\n \n /**\n * Match a path against a route pattern\n * @param {string} pattern - Route pattern (e.g., '/project/:id')\n * @param {string} path - Actual path to match\n * @returns {object|null} Matched params or null if no match\n * @private\n */\n _matchRoute(pattern, path) {\n // Exact match for static routes\n if (pattern === path) {\n return {};\n }\n \n // Split into parts, filtering empty strings\n const patternParts = pattern.split('/').filter(p => p);\n const pathParts = path.split('/').filter(p => p);\n \n // Must have same number of parts\n if (patternParts.length !== pathParts.length) {\n return null;\n }\n \n const params = {};\n for (let i = 0; i < patternParts.length; i++) {\n const patternPart = patternParts[i];\n const pathPart = pathParts[i];\n \n // Check if this is a parameter (starts with :)\n if (patternPart.startsWith(':')) {\n const paramName = patternPart.slice(1);\n // Decode URL component\n try {\n params[paramName] = decodeURIComponent(pathPart);\n } catch (e) {\n // If decoding fails, use raw value\n params[paramName] = pathPart;\n }\n } else if (patternPart !== pathPart) {\n // Static part doesn't match\n return null;\n }\n }\n \n return params;\n }\n \n /**\n * Find matching route handler\n * @param {string} path - Route path\n * @returns {object|null} { handler, params } or null\n * @private\n */\n _findRoute(path) {\n // First check for exact static route match (static routes take precedence)\n if (this.routes.has(path)) {\n return {\n handler: this.routes.get(path),\n params: {}\n };\n }\n \n // Collect all dynamic routes and sort by specificity\n const dynamicRoutes = [];\n for (const [pattern, handler] of this.routes.entries()) {\n // Skip if it's an exact match (already checked above)\n if (pattern === path) {\n continue;\n }\n \n // Check if pattern contains dynamic parameters\n if (pattern.includes(':')) {\n const paramCount = (pattern.match(/:/g) || []).length;\n // Count literal (non-param) parts for better specificity\n const literalCount = pattern.split('/').filter(p => p && !p.startsWith(':')).length;\n dynamicRoutes.push({ pattern, handler, paramCount, literalCount });\n }\n }\n \n // Sort by literal count first (more literals = more specific), then by param count\n // This ensures routes with literal parts (like /create) are matched before fully dynamic routes\n dynamicRoutes.sort((a, b) => {\n if (b.literalCount !== a.literalCount) {\n return b.literalCount - a.literalCount;\n }\n return b.paramCount - a.paramCount;\n });\n \n // Try each route in order of specificity\n for (const { pattern, handler } of dynamicRoutes) {\n const params = this._matchRoute(pattern, path);\n if (params !== null) {\n return { handler, params };\n }\n }\n \n return null;\n }\n \n /**\n * Handle route change\n * @param {string} path - Route path\n */\n async handleRoute(path) {\n // Clean up current handler if it exists\n if (this.currentHandler && typeof this.currentHandler.cleanup === 'function') {\n this.currentHandler.cleanup();\n }\n \n // Find matching route\n const match = this._findRoute(path);\n \n if (match) {\n this.currentRoute = path;\n // Call handler with params and store the result (which may include cleanup function)\n // Handle both sync and async handlers\n const result = await Promise.resolve(match.handler(match.params));\n this.currentHandler = result || null;\n \n\n } else if (this.notFoundHandler) {\n this.currentRoute = null;\n this.currentHandler = null;\n this.notFoundHandler(path);\n } else {\n console.warn(`No route handler for: ${path}`);\n }\n }\n \n /**\n * Start the router\n */\n async start() {\n // Handle initial route\n await this.handleRoute(window.location.pathname);\n }\n \n /**\n * Get current route\n */\n getCurrentRoute() {\n return this.currentRoute || window.location.pathname;\n }\n \n /**\n * Encode a title for use in URL (slug)\n * @param {string} title - Title to encode\n * @returns {string} URL-safe slug\n */\n _encodeTitle(title) {\n if (!title) return '';\n return title\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphens\n .replace(/^-+|-+$/g, ''); // Remove leading/trailing hyphens\n }\n \n /**\n * Decode a URL slug back to title (approximate)\n * @param {string} slug - URL slug\n * @returns {string} Decoded title\n */\n _decodeTitle(slug) {\n if (!slug) return '';\n return slug\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n \n /**\n * Generate URL from chain ID, factory title, instance name, and optional piece title\n * @param {string|number} chainId - Chain ID (e.g., 1 for Ethereum mainnet)\n * @param {string} factoryTitle - Factory title\n * @param {string} instanceName - Instance name\n * @param {string} [pieceTitle] - Optional piece title (for ERC1155)\n * @returns {string} URL path\n */\n generateURL(chainId, factoryTitle, instanceName, pieceTitle = null) {\n const chainIdStr = String(chainId || '1'); // Default to 1 (Ethereum mainnet)\n const factorySlug = this._encodeTitle(factoryTitle);\n const instanceSlug = this._encodeTitle(instanceName);\n \n if (pieceTitle) {\n const pieceSlug = this._encodeTitle(pieceTitle);\n return `/${chainIdStr}/${factorySlug}/${instanceSlug}/${pieceSlug}`;\n }\n \n return `/${chainIdStr}/${factorySlug}/${instanceSlug}`;\n }\n}\n\nexport default Router;\n\n"],"names":[],"mappings":"AAAA,MAAM,QAAQ,CAAC;AACf,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE;AAClC,QAAQ,IAAI,CAAC,SAAS,GAAG,KAAK;AAC9B,IAAI;;AAEJ;AACA;AACA;AACA;AACA,IAAI,YAAY,CAAC,OAAO,EAAE;AAC1B,QAAQ,IAAI,CAAC,SAAS,GAAG,OAAO;AAChC,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE;AAC5B,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AAC5C,YAAY,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC;AACpD,QAAQ;AACR;AACA,QAAQ,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;AACnD;AACA,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;AAC5B,YAAY,OAAO,CAAC,GAAG,CAAC,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACvE,QAAQ;;AAER;AACA,QAAQ,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC;AAClD,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA,IAAI,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE;AAC7B,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;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AC3D,QAAQ,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;AAC5D;AACA,QAAQ,IAAI,UAAU,EAAE;AACxB,YAAY,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;AAC3D,YAAY,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AAC/E,QAAQ;AACR;AACA,QAAQ,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAC9D,IAAI;AACJ;;;;"}
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).microact={})}(this,function(e){"use strict";const t=new class{constructor(){this.listeners=new Map,this.debugMode=!1}setDebugMode(e){this.debugMode=e}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),this.debugMode&&console.log(`[EventBus] Listener added for "${e}"`),()=>this.off(e,t)}off(e,t){this.listeners.has(e)&&(this.listeners.get(e).delete(t),this.debugMode&&console.log(`[EventBus] Listener removed for "${e}"`),0===this.listeners.get(e).size&&this.listeners.delete(e))}removeAllListeners(e){e?(this.listeners.delete(e),this.debugMode&&console.log(`[EventBus] All listeners removed for "${e}"`)):(this.listeners.clear(),this.debugMode&&console.log("[EventBus] All listeners removed"))}emit(e,t){this.listeners.has(e)&&(this.debugMode&&console.log(`[EventBus] Emitting "${e}"`,t),this.listeners.get(e).forEach(n=>{try{n(t)}catch(t){console.error(`[EventBus] Error in listener for "${e}":`,t)}}))}once(e,t){const n=s=>{this.off(e,n);try{t(s)}catch(t){console.error(`[EventBus] Error in once callback for "${e}":`,t)}};return this.on(e,n)}};class n{constructor(){this._activeElement=null,this._activeElementPath=null,this._scrollPositions=new Map}saveState(e){const t=document.activeElement;t&&e.contains(t)?(this._activeElement=t,this._activeElementPath=this._getElementPath(t,e)):(this._activeElement=null,this._activeElementPath=null),this._scrollPositions.clear();e.querySelectorAll('[data-scroll-container], [style*="overflow"]').forEach(t=>{if(void 0!==t.scrollTop||void 0!==t.scrollLeft){const n=this._getElementPath(t,e);this._scrollPositions.set(n,{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})}})}restoreState(e){if(this._activeElementPath){const t=this._getElementByPath(e,this._activeElementPath);if(t&&t.focus)try{if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){const e=t.selectionStart||0;t.focus(),t.setSelectionRange&&t.setSelectionRange(e,e)}else t.focus()}catch(e){}}this._scrollPositions.forEach((t,n)=>{const s=this._getElementByPath(e,n);s&&(s.scrollTop=t.scrollTop,s.scrollLeft=t.scrollLeft)})}_getElementPath(e,t){const n=[];let s=e;for(;s&&s!==t&&s.parentNode;){const e=s.parentNode,t=Array.from(e.children).indexOf(s);n.unshift(t),s=e}return n.join("/")}_getElementByPath(e,t){const n=t.split("/").map(Number);let s=e;for(const e of n){if(!s.children||!s.children[e])return null;s=s.children[e]}return s}diffHTML(e,t){if(e===t)return!1;if(Math.abs(e.length-t.length)/((e.length+t.length)/2)>.5)return!0;const n=e.match(/<[^>]+>/g)||[],s=t.match(/<[^>]+>/g)||[];return n.length!==s.length}updateText(e,t){(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.ELEMENT_NODE&&0===e.children.length)&&(e.textContent=t)}updateAttributes(e,t){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const n={};Array.from(e.attributes).forEach(e=>{n[e.name]=e.value}),Object.keys(t).forEach(s=>{const r=t[s];n[s]!==r&&(null==r?e.removeAttribute(s):e.setAttribute(s,r))}),Object.keys(n).forEach(n=>{n in t||e.removeAttribute(n)})}updateChildren(e,t,n){const s=Array.from(t),r=Array.from(n.children||[]);if(Math.abs(s.length-r.length)>.3*s.length)return!1;const i=Math.max(s.length,r.length);for(let t=0;t<i;t++){const n=s[t],i=r[t];!n&&i?e.appendChild(i):n&&!i?n.remove():n&&i&&(this._canUpdateInPlace(n,i)?this._updateNodeInPlace(n,i):e.replaceChild(i,n))}return!0}_canUpdateInPlace(e,t){return e.nodeType===t.nodeType&&(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.ELEMENT_NODE&&e.tagName===t.tagName)}_updateNodeInPlace(e,t){if(e.nodeType!==Node.TEXT_NODE){if(e.nodeType===Node.ELEMENT_NODE){const n={};Array.from(t.attributes).forEach(e=>{n[e.name]=e.value}),this.updateAttributes(e,n);const s=e.childNodes,r=t.childNodes;if(1===s.length&&1===r.length&&s[0].nodeType===Node.TEXT_NODE&&r[0].nodeType===Node.TEXT_NODE)return void(s[0].textContent=r[0].textContent);this.updateChildren(e,s,t)||(e.innerHTML=t.innerHTML)}}else e.textContent=t.textContent}updateGranular(e,t){this.saveState(e);const n=document.createElement("div");n.innerHTML=t;const s=e.innerHTML;if(this.diffHTML(s,t))return!1;try{if(this.updateChildren(e,e.childNodes,n))return this.restoreState(e),!0}catch(e){console.warn("[DOMUpdater] Granular update failed, falling back:",e)}return!1}}class s{constructor(){this._queue=new Set,this._scheduled=!1,this._metrics={frames:0,updates:0,maxFrameTime:0,totalFrameTime:0,maxUpdatesPerFrame:0},this._devMode=!1,this._enabled=!0}static getInstance(){return s._instance||(s._instance=new s),s._instance}setDevMode(e){this._devMode=e}setEnabled(e){this._enabled=e,!e&&this._scheduled&&(this._queue.clear(),this._scheduled=!1)}queue(e){if(this._enabled)e&&"function"==typeof e.update?(this._queue.add(e),this._scheduled||(this._scheduled=!0,requestAnimationFrame(()=>this._flush()))):console.warn("[UpdateScheduler] Invalid component queued:",e);else try{e.update()}catch(e){console.error("[UpdateScheduler] Error updating component (immediate):",e)}}_flush(){if(0===this._queue.size)return void(this._scheduled=!1);const e=performance.now(),t=Array.from(this._queue),n=t.length;this._queue.clear(),this._scheduled=!1,t.forEach(e=>{try{e&&e.element&&"function"==typeof e.update&&e.update()}catch(t){console.error("[UpdateScheduler] Error updating component:",t),console.error("[UpdateScheduler] Component:",e)}});const s=performance.now()-e;this._devMode&&(this._metrics.frames++,this._metrics.updates+=n,this._metrics.totalFrameTime+=s,this._metrics.maxFrameTime=Math.max(this._metrics.maxFrameTime,s),this._metrics.maxUpdatesPerFrame=Math.max(this._metrics.maxUpdatesPerFrame,n),s>16&&console.warn(`[UpdateScheduler] Frame took ${s.toFixed(2)}ms (>16ms target). Updated ${n} component(s).`)),this._queue.size>0&&(this._scheduled=!0,requestAnimationFrame(()=>this._flush()))}getMetrics(){if(!this._devMode)return{enabled:!1};const e=this._metrics.frames>0?this._metrics.totalFrameTime/this._metrics.frames:0,t=this._metrics.frames>0?this._metrics.updates/this._metrics.frames:0;return{enabled:!0,frames:this._metrics.frames,totalUpdates:this._metrics.updates,maxFrameTime:this._metrics.maxFrameTime,avgFrameTime:e,maxUpdatesPerFrame:this._metrics.maxUpdatesPerFrame,avgUpdatesPerFrame:t}}resetMetrics(){this._metrics={frames:0,updates:0,maxFrameTime:0,totalFrameTime:0,maxUpdatesPerFrame:0}}clear(){this._queue.clear(),this._scheduled=!1}getQueueSize(){return this._queue.size}}const r=()=>s.getInstance();e.Component=class{constructor(){this.element=null,this.state={},this.mounted=!1,this.boundEvents=new Map,this._cleanupRegistry=new Set,this._children=new Map,this._subscriptions=new Set,this._domUpdater=new n,this._refs=new Map,this._context=new Map,this._parent=null}setState(e){const t={...this.state};this.state={...this.state,...e},this.shouldUpdate(t,this.state)&&(this.update(),this.onStateUpdate(t,this.state))}shouldUpdate(e,t){if(!e||!t)return!0;if(e===t)return!1;const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length||n.some(n=>e[n]!==t[n])}onStateUpdate(e,t){}mount(e){try{if(this.element=e,this.mounted=!0,this.constructor.styles){const e=document.createElement("style");e.textContent=this.constructor.styles,document.head.appendChild(e),this.styleElement=e,this.registerCleanup(()=>{this.styleElement&&this.styleElement.parentNode&&this.styleElement.remove()})}this.update(),this.onMount&&this.onMount()}catch(e){this._handleError(e,{phase:"mount"})}}unmount(){this.mounted&&(this._executeCleanup(),this.unbindEvents(),this.invalidateRefs(),this.element&&(this.element.innerHTML=""),this.element=null,this.mounted=!1,this.onUnmount&&this.onUnmount())}bindEvents(){if(this.unbindEvents(),!this.element||"function"!=typeof this.events)return;const e=this.events();if(!e)return;const t=e instanceof Map?Array.from(e.entries()):Object.entries(e);for(const[e,n]of t){if(!e)continue;const t=e.trim();if(!t)continue;const[s,...r]=t.split(/\s+/);if(!s){console.warn(`[Component] Invalid event descriptor '${e}' in component '${this.constructor.name}'.`);continue}const i=r.join(" "),o=this._resolveEventHandler(n,e);if(o)if(i){const t=e=>{const t=e?.target;if(!t)return;const n="function"==typeof t.closest?t.closest(i):t.matches(i)?t:null;n&&this.element.contains(n)&&o(e)};this.element.addEventListener(s,t),this.boundEvents.set(e,t)}else this.element.addEventListener(s,o),this.boundEvents.set(e,o)}}_resolveEventHandler(e,t){let n=e;return"string"==typeof e&&(n=this[e]),"function"!=typeof n?(console.warn(`[Component] Event handler '${e}' for event '${t}' is not a function on component '${this.constructor.name}'.`),null):"function"==typeof n.bind?n.bind(this):(...e)=>n.apply(this,e)}unbindEvents(){if(this.element){for(const[e,t]of this.boundEvents.entries()){const[n]=e.trim().split(/\s+/);n&&this.element.removeEventListener(n,t)}this.boundEvents.clear()}else this.boundEvents.clear()}update(){if(this.element)try{const e=this.render();if(!this.element.innerHTML||this.element.innerHTML!==e){this._domUpdater.updateGranular(this.element,e)||(this.element.innerHTML=e),this.invalidateRefs(),this._mountChildren(),this.events&&"function"==typeof this.events&&this.bindEvents()}}catch(e){this._handleError(e,{phase:"update"})}}_mountChildren(){if("function"!=typeof this.children)return;const e=this.children();if(e)for(const t in e){const n=this.getRef(t);if(n){const s=e[t];n.component&&n.component!==s&&n.component.unmount(),s.element!==n&&(s.mount(n),n.component=s,this.registerCleanup(()=>s.unmount()))}}}children(){return{}}scheduleUpdate(e={}){if(e.immediate)this.update();else{r().queue(this)}}onMount(){}onUnmount(){}onUpdate(e){}onError(e,t){}render(){try{return this.template?this.template():""}catch(e){return this._handleError(e,{phase:"render"}),'<div class="component-error">Error rendering component</div>'}}_handleError(e,t={}){if(this.onError)try{this.onError(e,t)}catch(e){console.error("[Component] Error in onError handler:",e)}let n=this._parent;for(;n;){if(n.constructor&&"ErrorBoundary"===n.constructor.name)return void(n._errorHandler&&n._errorHandler(e,{...t,component:this.constructor.name}));n=n._parent}console.error(`[Component] Unhandled error in ${this.constructor.name}:`,e,t)}events(){return{}}registerCleanup(e){return"function"!=typeof e?(console.warn("[Component] registerCleanup called with non-function:",e),()=>{}):(this._cleanupRegistry.add(e),()=>{this._cleanupRegistry.delete(e)})}_executeCleanup(){this._cleanupRegistry.forEach(e=>{try{e()}catch(e){console.error("[Component] Error during cleanup:",e)}}),this._cleanupRegistry.clear()}_unmountChildren(){for(const[e,t]of this._children.entries())try{t&&"function"==typeof t.unmount&&t.unmount()}catch(t){console.error(`[Component] Error unmounting child "${e}":`,t)}this._children.clear()}createChild(e,t){if(this._children.has(e)){console.warn(`[Component] Child with key "${e}" already exists, unmounting previous instance`);const t=this._children.get(e);t&&"function"==typeof t.unmount&&t.unmount()}return t._parent=this,this._context.forEach((e,n)=>{t._context.set(n,e)}),this._children.set(e,t),this.registerCleanup(()=>{t&&"function"==typeof t.unmount&&t.unmount(),this._children.delete(e)}),t}setTimeout(e,t){const n=window.setTimeout(e,t);return this.registerCleanup(()=>{window.clearTimeout(n)}),n}setInterval(e,t){const n=window.setInterval(e,t);return this.registerCleanup(()=>{window.clearInterval(n)}),n}subscribe(e,n){const s=t.on(e,n);return this._subscriptions.add(s),this.registerCleanup(()=>{s(),this._subscriptions.delete(s)}),s}subscribeOnce(e,n){const s=t.once(e,n);return this._subscriptions.add(s),this.registerCleanup(()=>{s(),this._subscriptions.delete(s)}),s}useStore(e,t,n){if(!e||"function"!=typeof t)return console.warn("[Component] useStore called with invalid arguments"),null;this._storeValues||(this._storeValues=new Map);const s=t.toString();let r=this._storeValues.get(s);const i=()=>{try{const n=t.call(e);if(void 0!==n)return n}catch(e){}return t(e.getState())},o=i();this._storeValues.set(s,o);const a=e.subscribe(()=>{const e=i(),t=r;this._hasValueChanged(t,e)&&(this._storeValues.set(s,e),r=e,"function"==typeof n&&n(e,t),this.update())});return this.registerCleanup(()=>{a(),this._storeValues&&this._storeValues.delete(s)}),o}_hasValueChanged(e,t){if(e===t)return!1;if(null==e||null==t)return e!==t;if("object"==typeof e&&"object"==typeof t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length||n.some(n=>e[n]!==t[n])}return!0}_getRefCached(e,t){if(!this.element)return null;if(this._refs.has(e)){const t=this._refs.get(e);if(t&&this.element.contains(t))return t;this._refs.delete(e)}const n=this.element.querySelector(t);return n&&this._refs.set(e,n),n}updateRef(e,t){t?this._refs.set(e,t):this._refs.delete(e)}invalidateRefs(){this._refs.clear()}invalidateRef(e){this._refs.delete(e)}getRef(e){return this.element?this.element.querySelector(e):(console.warn(`[Component] getRef called on ${this.constructor.name} before element exists`),null)}getRefs(e){return this.element?Array.from(this.element.querySelectorAll(e)):(console.warn(`[Component] getRefs called on ${this.constructor.name} before element exists`),[])}provideContext(e,t){this._context.set(e,t),this._children.forEach(n=>{n&&void 0!==n._context&&n._context.set(e,t)})}getContext(e){if(this._context.has(e))return this._context.get(e);let t=this._parent;for(;t;){if(t._context&&t._context.has(e))return t._context.get(e);t=t._parent}}removeContext(e){this._context.delete(e),this._children.forEach(t=>{t&&void 0!==t._context&&t._context.delete(e)})}},e.DOMUpdater=n,e.Router=class{constructor(){this.routes=new Map,this.currentRoute=null,this.currentHandler=null,this.notFoundHandler=null,this.handleRoute=this.handleRoute.bind(this),this.navigate=this.navigate.bind(this),window.addEventListener("popstate",async e=>{await this.handleRoute(window.location.pathname)})}on(e,t){this.routes.set(e,t)}notFound(e){this.notFoundHandler=e}async navigate(e,t=!1){e!==window.location.pathname&&(t?window.history.replaceState({path:e},"",e):window.history.pushState({path:e},"",e),await this.handleRoute(e))}_matchRoute(e,t){if(e===t)return{};const n=e.split("/").filter(e=>e),s=t.split("/").filter(e=>e);if(n.length!==s.length)return null;const r={};for(let e=0;e<n.length;e++){const t=n[e],i=s[e];if(t.startsWith(":")){const e=t.slice(1);try{r[e]=decodeURIComponent(i)}catch(t){r[e]=i}}else if(t!==i)return null}return r}_findRoute(e){if(this.routes.has(e))return{handler:this.routes.get(e),params:{}};const t=[];for(const[n,s]of this.routes.entries())if(n!==e&&n.includes(":")){const e=(n.match(/:/g)||[]).length,r=n.split("/").filter(e=>e&&!e.startsWith(":")).length;t.push({pattern:n,handler:s,paramCount:e,literalCount:r})}t.sort((e,t)=>t.literalCount!==e.literalCount?t.literalCount-e.literalCount:t.paramCount-e.paramCount);for(const{pattern:n,handler:s}of t){const t=this._matchRoute(n,e);if(null!==t)return{handler:s,params:t}}return null}async handleRoute(e){this.currentHandler&&"function"==typeof this.currentHandler.cleanup&&this.currentHandler.cleanup();const t=this._findRoute(e);if(t){this.currentRoute=e;const n=await Promise.resolve(t.handler(t.params));this.currentHandler=n||null}else this.notFoundHandler?(this.currentRoute=null,this.currentHandler=null,this.notFoundHandler(e)):console.warn(`No route handler for: ${e}`)}async start(){await this.handleRoute(window.location.pathname)}getCurrentRoute(){return this.currentRoute||window.location.pathname}_encodeTitle(e){return e?e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):""}_decodeTitle(e){return e?e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}generateURL(e,t,n,s=null){const r=String(e||"1"),i=this._encodeTitle(t),o=this._encodeTitle(n);if(s){return`/${r}/${i}/${o}/${this._encodeTitle(s)}`}return`/${r}/${i}/${o}`}},e.eventBus=t,e.getUpdateScheduler=r});
2
+ //# sourceMappingURL=microact.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microact.umd.js","sources":["../src/EventBus.js","../src/DOMUpdater.js","../src/UpdateScheduler.js","../src/Component.js","../src/Router.js"],"sourcesContent":["class EventBus {\n constructor() {\n this.listeners = new Map();\n this.debugMode = false;\n }\n\n /**\n * Enable or disable debug logging\n * @param {boolean} enabled \n */\n setDebugMode(enabled) {\n this.debugMode = enabled;\n }\n\n /**\n * Subscribe to an event\n * @param {string} eventName \n * @param {Function} callback \n * @returns {Function} Unsubscribe function\n */\n on(eventName, callback) {\n if (!this.listeners.has(eventName)) {\n this.listeners.set(eventName, new Set());\n }\n \n this.listeners.get(eventName).add(callback);\n \n if (this.debugMode) {\n console.log(`[EventBus] Listener added for \"${eventName}\"`);\n }\n\n // Return unsubscribe function\n return () => this.off(eventName, callback);\n }\n\n /**\n * Remove a specific event listener\n * @param {string} eventName \n * @param {Function} callback \n */\n off(eventName, callback) {\n if (!this.listeners.has(eventName)) return;\n \n this.listeners.get(eventName).delete(callback);\n \n if (this.debugMode) {\n console.log(`[EventBus] Listener removed for \"${eventName}\"`);\n }\n\n // Cleanup empty event sets\n if (this.listeners.get(eventName).size === 0) {\n this.listeners.delete(eventName);\n }\n }\n\n /**\n * Remove all listeners for an event\n * @param {string} eventName \n */\n removeAllListeners(eventName) {\n if (eventName) {\n this.listeners.delete(eventName);\n if (this.debugMode) {\n console.log(`[EventBus] All listeners removed for \"${eventName}\"`);\n }\n } else {\n this.listeners.clear();\n if (this.debugMode) {\n console.log('[EventBus] All listeners removed');\n }\n }\n }\n\n /**\n * Emit an event with data\n * @param {string} eventName \n * @param {any} data \n */\n emit(eventName, data) {\n if (!this.listeners.has(eventName)) {\n return;\n }\n\n if (this.debugMode) {\n console.log(`[EventBus] Emitting \"${eventName}\"`, data);\n }\n\n this.listeners.get(eventName).forEach(callback => {\n try {\n callback(data);\n } catch (error) {\n console.error(`[EventBus] Error in listener for \"${eventName}\":`, error);\n }\n });\n }\n\n /**\n * Subscribe to an event for one-time use\n * @param {string} eventName \n * @param {Function} callback \n * @returns {Function} Unsubscribe function\n */\n once(eventName, callback) {\n // Create a wrapper that will call the callback and then unsubscribe\n const wrappedCallback = (data) => {\n // Unsubscribe first to prevent issues if the callback triggers the same event\n this.off(eventName, wrappedCallback);\n // Call the original callback\n try {\n callback(data);\n } catch (error) {\n console.error(`[EventBus] Error in once callback for \"${eventName}\":`, error);\n }\n };\n \n // Register the wrapped callback\n const unsubscribe = this.on(eventName, wrappedCallback);\n return unsubscribe;\n }\n}\n\n// Create a single instance for the application\nexport const eventBus = new EventBus(); ","/**\n * DOMUpdater - Utility for granular DOM updates\n * Preserves focus state, scroll position, and form input values during updates\n */\nexport class DOMUpdater {\n constructor() {\n this._activeElement = null;\n this._activeElementPath = null;\n this._scrollPositions = new Map();\n }\n\n /**\n * Save the currently focused element and scroll positions\n * @param {HTMLElement} rootElement - Root element to save state from\n */\n saveState(rootElement) {\n // Save active element\n const activeElement = document.activeElement;\n if (activeElement && rootElement.contains(activeElement)) {\n this._activeElement = activeElement;\n this._activeElementPath = this._getElementPath(activeElement, rootElement);\n } else {\n this._activeElement = null;\n this._activeElementPath = null;\n }\n\n // Save scroll positions for all scrollable containers\n this._scrollPositions.clear();\n const scrollableElements = rootElement.querySelectorAll('[data-scroll-container], [style*=\"overflow\"]');\n scrollableElements.forEach(el => {\n if (el.scrollTop !== undefined || el.scrollLeft !== undefined) {\n const path = this._getElementPath(el, rootElement);\n this._scrollPositions.set(path, {\n scrollTop: el.scrollTop,\n scrollLeft: el.scrollLeft\n });\n }\n });\n }\n\n /**\n * Restore focus and scroll positions after DOM update\n * @param {HTMLElement} rootElement - Root element to restore state in\n */\n restoreState(rootElement) {\n // Restore focus\n if (this._activeElementPath) {\n const element = this._getElementByPath(rootElement, this._activeElementPath);\n if (element && element.focus) {\n try {\n // Restore cursor position if it's an input/textarea\n if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {\n const selectionStart = element.selectionStart || 0;\n element.focus();\n if (element.setSelectionRange) {\n element.setSelectionRange(selectionStart, selectionStart);\n }\n } else {\n element.focus();\n }\n } catch (e) {\n // Focus may fail if element is not focusable, ignore\n }\n }\n }\n\n // Restore scroll positions\n this._scrollPositions.forEach((position, path) => {\n const element = this._getElementByPath(rootElement, path);\n if (element) {\n element.scrollTop = position.scrollTop;\n element.scrollLeft = position.scrollLeft;\n }\n });\n }\n\n /**\n * Get a path string to identify an element within its root\n * @private\n */\n _getElementPath(element, root) {\n const path = [];\n let current = element;\n \n while (current && current !== root && current.parentNode) {\n const parent = current.parentNode;\n const index = Array.from(parent.children).indexOf(current);\n path.unshift(index);\n current = parent;\n }\n \n return path.join('/');\n }\n\n /**\n * Get an element by its path within root\n * @private\n */\n _getElementByPath(root, path) {\n const indices = path.split('/').map(Number);\n let current = root;\n \n for (const index of indices) {\n if (!current.children || !current.children[index]) {\n return null;\n }\n current = current.children[index];\n }\n \n return current;\n }\n\n /**\n * Compare two HTML strings and determine if they're structurally different\n * @param {string} oldHTML - Previous HTML\n * @param {string} newHTML - New HTML\n * @returns {boolean} - True if structure is significantly different\n */\n diffHTML(oldHTML, newHTML) {\n if (oldHTML === newHTML) return false;\n \n // Simple heuristic: if length difference is > 50%, likely structural change\n const lengthDiff = Math.abs(oldHTML.length - newHTML.length);\n const avgLength = (oldHTML.length + newHTML.length) / 2;\n if (lengthDiff / avgLength > 0.5) {\n return true;\n }\n \n // Check for tag changes (simplified)\n const oldTags = oldHTML.match(/<[^>]+>/g) || [];\n const newTags = newHTML.match(/<[^>]+>/g) || [];\n if (oldTags.length !== newTags.length) {\n return true;\n }\n \n return false;\n }\n\n /**\n * Update text content of a node\n * @param {Node} node - Node to update\n * @param {string} newText - New text content\n */\n updateText(node, newText) {\n if (node.nodeType === Node.TEXT_NODE) {\n node.textContent = newText;\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n // For elements, update only if it's a text-only element\n if (node.children.length === 0) {\n node.textContent = newText;\n }\n }\n }\n\n /**\n * Update attributes of an element\n * @param {HTMLElement} element - Element to update\n * @param {Object} newAttrs - New attributes object\n */\n updateAttributes(element, newAttrs) {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n \n // Get current attributes\n const currentAttrs = {};\n Array.from(element.attributes).forEach(attr => {\n currentAttrs[attr.name] = attr.value;\n });\n \n // Update changed attributes\n Object.keys(newAttrs).forEach(name => {\n const newValue = newAttrs[name];\n if (currentAttrs[name] !== newValue) {\n if (newValue === null || newValue === undefined) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, newValue);\n }\n }\n });\n \n // Remove attributes that are no longer present\n Object.keys(currentAttrs).forEach(name => {\n if (!(name in newAttrs)) {\n element.removeAttribute(name);\n }\n });\n }\n\n /**\n * Update children of a parent element using a simple reconciliation algorithm\n * @param {HTMLElement} parent - Parent element\n * @param {NodeList|Array} oldChildren - Current children\n * @param {DocumentFragment|HTMLElement} newChildrenContainer - Container with new children\n */\n updateChildren(parent, oldChildren, newChildrenContainer) {\n const oldArray = Array.from(oldChildren);\n const newArray = Array.from(newChildrenContainer.children || []);\n \n // If structure is too different, replace entirely\n if (Math.abs(oldArray.length - newArray.length) > oldArray.length * 0.3) {\n return false; // Signal to fall back to full replacement\n }\n \n // Simple reconciliation: update in place where possible\n const maxLength = Math.max(oldArray.length, newArray.length);\n \n for (let i = 0; i < maxLength; i++) {\n const oldChild = oldArray[i];\n const newChild = newArray[i];\n \n if (!oldChild && newChild) {\n // New child - append\n parent.appendChild(newChild);\n } else if (oldChild && !newChild) {\n // Old child removed\n oldChild.remove();\n } else if (oldChild && newChild) {\n // Both exist - try to update in place\n if (this._canUpdateInPlace(oldChild, newChild)) {\n this._updateNodeInPlace(oldChild, newChild);\n } else {\n // Replace\n parent.replaceChild(newChild, oldChild);\n }\n }\n }\n \n return true; // Successfully updated\n }\n\n /**\n * Check if two nodes can be updated in place\n * @private\n */\n _canUpdateInPlace(oldNode, newNode) {\n if (oldNode.nodeType !== newNode.nodeType) return false;\n if (oldNode.nodeType === Node.TEXT_NODE) return true;\n if (oldNode.nodeType === Node.ELEMENT_NODE) {\n return oldNode.tagName === newNode.tagName;\n }\n return false;\n }\n\n /**\n * Update a node in place with new content\n * @private\n */\n _updateNodeInPlace(oldNode, newNode) {\n if (oldNode.nodeType === Node.TEXT_NODE) {\n oldNode.textContent = newNode.textContent;\n return;\n }\n \n if (oldNode.nodeType === Node.ELEMENT_NODE) {\n // Update attributes\n const newAttrs = {};\n Array.from(newNode.attributes).forEach(attr => {\n newAttrs[attr.name] = attr.value;\n });\n this.updateAttributes(oldNode, newAttrs);\n \n // Update children recursively\n const oldChildren = oldNode.childNodes;\n const newChildren = newNode.childNodes;\n \n // For simple text-only updates\n if (oldChildren.length === 1 && newChildren.length === 1 &&\n oldChildren[0].nodeType === Node.TEXT_NODE &&\n newChildren[0].nodeType === Node.TEXT_NODE) {\n oldChildren[0].textContent = newChildren[0].textContent;\n return;\n }\n \n // For more complex structures, try to reconcile\n if (!this.updateChildren(oldNode, oldChildren, newNode)) {\n // Fall back to replacing content\n oldNode.innerHTML = newNode.innerHTML;\n }\n }\n }\n\n /**\n * Perform a granular update of an element's content\n * @param {HTMLElement} element - Element to update\n * @param {string} newHTML - New HTML content\n * @returns {boolean} - True if granular update succeeded, false if fallback needed\n */\n updateGranular(element, newHTML) {\n // Save state before update\n this.saveState(element);\n \n // Create temporary container for new HTML\n const temp = document.createElement('div');\n temp.innerHTML = newHTML;\n \n // Try to update children granularly\n const oldHTML = element.innerHTML;\n const isStructuralChange = this.diffHTML(oldHTML, newHTML);\n \n if (isStructuralChange) {\n // Structural change detected - fall back to full replacement\n return false;\n }\n \n // Try granular update\n try {\n const success = this.updateChildren(element, element.childNodes, temp);\n if (success) {\n // Restore state after successful update\n this.restoreState(element);\n return true;\n }\n } catch (e) {\n console.warn('[DOMUpdater] Granular update failed, falling back:', e);\n }\n \n return false;\n }\n}\n\n","/**\n * UpdateScheduler - Coordinates component updates using requestAnimationFrame batching\n * \n * Prevents UI blocking by batching multiple component updates into a single frame.\n * Components can opt-in to batching for non-critical updates, while critical updates\n * (user input, errors) can execute immediately.\n * \n * Usage:\n * // In Component.js\n * this.scheduleUpdate(); // Batched (default)\n * this.scheduleUpdate({ immediate: true }); // Immediate\n */\nexport class UpdateScheduler {\n constructor() {\n // Queue of components waiting to be updated\n this._queue = new Set();\n \n // Flag to track if requestAnimationFrame is already scheduled\n this._scheduled = false;\n \n // Performance metrics (only tracked in dev mode)\n this._metrics = {\n frames: 0,\n updates: 0,\n maxFrameTime: 0,\n totalFrameTime: 0,\n maxUpdatesPerFrame: 0\n };\n \n // Dev mode flag (can be enabled for performance monitoring)\n this._devMode = false;\n \n // Track if scheduler is enabled (can be disabled for debugging)\n this._enabled = true;\n }\n \n /**\n * Get singleton instance\n * @returns {UpdateScheduler}\n */\n static getInstance() {\n if (!UpdateScheduler._instance) {\n UpdateScheduler._instance = new UpdateScheduler();\n }\n return UpdateScheduler._instance;\n }\n \n /**\n * Enable or disable dev mode (performance tracking)\n * @param {boolean} enabled\n */\n setDevMode(enabled) {\n this._devMode = enabled;\n }\n \n /**\n * Enable or disable the scheduler (for debugging)\n * @param {boolean} enabled\n */\n setEnabled(enabled) {\n this._enabled = enabled;\n if (!enabled && this._scheduled) {\n // Cancel pending frame if disabling\n this._queue.clear();\n this._scheduled = false;\n }\n }\n \n /**\n * Queue a component for batched update\n * @param {Component} component - Component instance to update\n */\n queue(component) {\n if (!this._enabled) {\n // If scheduler is disabled, execute immediately\n try {\n component.update();\n } catch (error) {\n console.error('[UpdateScheduler] Error updating component (immediate):', error);\n }\n return;\n }\n \n if (!component || typeof component.update !== 'function') {\n console.warn('[UpdateScheduler] Invalid component queued:', component);\n return;\n }\n \n // Add to queue (Set automatically deduplicates)\n this._queue.add(component);\n \n // Schedule flush if not already scheduled\n if (!this._scheduled) {\n this._scheduled = true;\n requestAnimationFrame(() => this._flush());\n }\n }\n \n /**\n * Execute all queued updates in a single frame\n * @private\n */\n _flush() {\n if (this._queue.size === 0) {\n this._scheduled = false;\n return;\n }\n \n const start = performance.now();\n const updates = Array.from(this._queue);\n const updateCount = updates.length;\n \n // Clear queue and reset scheduled flag\n this._queue.clear();\n this._scheduled = false;\n \n // Execute all updates\n updates.forEach(component => {\n try {\n // Check if component is still mounted/valid before updating\n if (component && component.element && typeof component.update === 'function') {\n component.update();\n }\n } catch (error) {\n // Log error but continue with other updates\n console.error('[UpdateScheduler] Error updating component:', error);\n console.error('[UpdateScheduler] Component:', component);\n }\n });\n \n const duration = performance.now() - start;\n \n // Track metrics in dev mode\n if (this._devMode) {\n this._metrics.frames++;\n this._metrics.updates += updateCount;\n this._metrics.totalFrameTime += duration;\n this._metrics.maxFrameTime = Math.max(this._metrics.maxFrameTime, duration);\n this._metrics.maxUpdatesPerFrame = Math.max(this._metrics.maxUpdatesPerFrame, updateCount);\n \n // Warn if frame took too long (>16ms for 60fps)\n if (duration > 16) {\n console.warn(\n `[UpdateScheduler] Frame took ${duration.toFixed(2)}ms (>16ms target). ` +\n `Updated ${updateCount} component(s).`\n );\n }\n }\n \n // Handle nested updates (components that schedule updates during their update)\n // If new updates were queued during this flush, schedule another frame\n if (this._queue.size > 0) {\n this._scheduled = true;\n requestAnimationFrame(() => this._flush());\n }\n }\n \n /**\n * Get performance metrics\n * @returns {Object} Metrics object\n */\n getMetrics() {\n if (!this._devMode) {\n return { enabled: false };\n }\n \n const avgFrameTime = this._metrics.frames > 0\n ? this._metrics.totalFrameTime / this._metrics.frames\n : 0;\n \n const avgUpdatesPerFrame = this._metrics.frames > 0\n ? this._metrics.updates / this._metrics.frames\n : 0;\n \n return {\n enabled: true,\n frames: this._metrics.frames,\n totalUpdates: this._metrics.updates,\n maxFrameTime: this._metrics.maxFrameTime,\n avgFrameTime: avgFrameTime,\n maxUpdatesPerFrame: this._metrics.maxUpdatesPerFrame,\n avgUpdatesPerFrame: avgUpdatesPerFrame\n };\n }\n \n /**\n * Reset performance metrics\n */\n resetMetrics() {\n this._metrics = {\n frames: 0,\n updates: 0,\n maxFrameTime: 0,\n totalFrameTime: 0,\n maxUpdatesPerFrame: 0\n };\n }\n \n /**\n * Clear the update queue (useful for cleanup or testing)\n */\n clear() {\n this._queue.clear();\n this._scheduled = false;\n }\n \n /**\n * Get current queue size (for debugging)\n * @returns {number}\n */\n getQueueSize() {\n return this._queue.size;\n }\n}\n\n// Export singleton instance getter\nexport const getUpdateScheduler = () => UpdateScheduler.getInstance();\n\n","import { eventBus } from './EventBus.js';\nimport { DOMUpdater } from './DOMUpdater.js';\nimport { getUpdateScheduler } from './UpdateScheduler.js';\n\nexport class Component {\n constructor() {\n this.element = null;\n this.state = {};\n this.mounted = false;\n this.boundEvents = new Map();\n // Cleanup registry for tracking all cleanup functions\n this._cleanupRegistry = new Set();\n // Child components registry for automatic cleanup\n this._children = new Map();\n // Event subscriptions registry for automatic cleanup\n this._subscriptions = new Set();\n // DOM updater for granular updates\n this._domUpdater = new DOMUpdater();\n // Element reference cache\n this._refs = new Map();\n // Context storage\n this._context = new Map();\n // Parent component reference for context traversal\n this._parent = null;\n }\n\n /**\n * Initialize state with default values\n * @param {Object} initialState \n */\n setState(newState) {\n const oldState = {...this.state};\n this.state = { ...this.state, ...newState };\n \n // Only update if we should based on state changes\n if (this.shouldUpdate(oldState, this.state)) {\n this.update();\n this.onStateUpdate(oldState, this.state);\n }\n }\n\n /**\n * Determines if the component should update based on state changes\n * Override in child classes for custom comparison logic\n * @param {Object} oldState - Previous state\n * @param {Object} newState - New state \n * @returns {boolean} - Whether component should update\n */\n shouldUpdate(oldState, newState) {\n // Default shallow comparison of top-level state properties\n // Check if any properties have changed\n if (!oldState || !newState) return true;\n \n // Check if object references are the same\n if (oldState === newState) return false;\n \n // Do a shallow comparison of properties\n const oldKeys = Object.keys(oldState);\n const newKeys = Object.keys(newState);\n \n // If they have different number of keys, they changed\n if (oldKeys.length !== newKeys.length) return true;\n \n // Check if any key's value has changed\n return oldKeys.some(key => oldState[key] !== newState[key]);\n }\n \n /**\n * Lifecycle hook called after state is updated but before rendering\n * Override in child classes to handle state updates\n * @param {Object} oldState \n * @param {Object} newState \n */\n onStateUpdate(oldState, newState) {\n // Default implementation does nothing\n }\n\n /**\n * Mount component to DOM\n * @param {HTMLElement} container \n */\n mount(element) {\n try {\n this.element = element;\n this.mounted = true;\n \n // Apply styles if they exist\n if (this.constructor.styles) {\n const styleElement = document.createElement('style');\n styleElement.textContent = this.constructor.styles;\n document.head.appendChild(styleElement);\n this.styleElement = styleElement;\n \n // Register cleanup for style element\n this.registerCleanup(() => {\n if (this.styleElement && this.styleElement.parentNode) {\n this.styleElement.remove();\n }\n });\n }\n\n this.update();\n if (this.onMount) {\n this.onMount();\n }\n } catch (error) {\n this._handleError(error, { phase: 'mount' });\n }\n }\n\n /**\n * Remove component from DOM\n */\n unmount() {\n if (!this.mounted) return;\n\n\n \n // Execute all registered cleanup functions\n this._executeCleanup();\n \n // Unbind all events\n this.unbindEvents();\n \n // Clear all refs\n this.invalidateRefs();\n \n // Remove element if it exists\n if (this.element) {\n this.element.innerHTML = '';\n }\n this.element = null;\n \n // Call lifecycle method\n this.mounted = false;\n if (this.onUnmount) {\n this.onUnmount();\n }\n }\n\n /**\n * Bind DOM events based on this.events()\n */\n bindEvents() {\n // First unbind any existing events\n this.unbindEvents();\n\n if (!this.element || typeof this.events !== 'function') {\n return;\n }\n \n const events = this.events();\n if (!events) return;\n\n const entries = events instanceof Map ? Array.from(events.entries()) : Object.entries(events);\n\n for (const [eventSelector, handlerReference] of entries) {\n if (!eventSelector) continue;\n\n const descriptor = eventSelector.trim();\n if (!descriptor) continue;\n\n const [eventName, ...selectorParts] = descriptor.split(/\\s+/);\n if (!eventName) {\n console.warn(`[Component] Invalid event descriptor '${eventSelector}' in component '${this.constructor.name}'.`);\n continue;\n }\n const selector = selectorParts.join(' ');\n\n const handler = this._resolveEventHandler(handlerReference, eventSelector);\n if (!handler) {\n continue;\n }\n \n if (selector) {\n // Delegated event\n const eventHandler = (e) => {\n const target = e?.target;\n if (!target) return;\n const matchedTarget = typeof target.closest === 'function'\n ? target.closest(selector)\n : (target.matches(selector) ? target : null);\n if (matchedTarget && this.element.contains(matchedTarget)) {\n handler(e);\n }\n };\n this.element.addEventListener(eventName, eventHandler);\n this.boundEvents.set(eventSelector, eventHandler);\n } else {\n // Direct event\n this.element.addEventListener(eventName, handler);\n this.boundEvents.set(eventSelector, handler);\n }\n }\n }\n\n /**\n * Resolve event handler definitions passed via this.events()\n * Supports both handler name strings and direct function references.\n * @private\n */\n _resolveEventHandler(handlerReference, eventSelector) {\n let handler = handlerReference;\n\n if (typeof handlerReference === 'string') {\n handler = this[handlerReference];\n }\n\n if (typeof handler !== 'function') {\n console.warn(`[Component] Event handler '${handlerReference}' for event '${eventSelector}' is not a function on component '${this.constructor.name}'.`);\n return null;\n }\n\n // Bind handler to component instance when possible\n if (typeof handler.bind === 'function') {\n return handler.bind(this);\n }\n\n return (...args) => handler.apply(this, args);\n }\n\n /**\n * Unbind all DOM events\n */\n unbindEvents() {\n if (!this.element) {\n this.boundEvents.clear();\n return;\n }\n\n for (const [eventSelector, handler] of this.boundEvents.entries()) {\n const [eventName] = eventSelector.trim().split(/\\s+/);\n if (!eventName) continue;\n this.element.removeEventListener(eventName, handler);\n }\n this.boundEvents.clear();\n }\n\n /**\n * Update component after state change\n */\n update() {\n if (!this.element) return;\n \n try {\n // Get new content\n const newContent = this.render();\n \n // Always update on first render or when content changes\n // First render is detected by checking if innerHTML is empty\n if (!this.element.innerHTML || this.element.innerHTML !== newContent) {\n // Try granular update first (preserves focus/scroll)\n const granularSuccess = this._domUpdater.updateGranular(this.element, newContent);\n \n if (!granularSuccess) {\n // Fall back to full replacement for complex structural changes\n // Note: This will destroy child components, so they need to be re-mounted\n this.element.innerHTML = newContent;\n }\n \n // Invalidate refs cache after DOM update\n this.invalidateRefs();\n\n // Mount child components\n this._mountChildren();\n \n // Bind events if events() method exists\n if (this.events && typeof this.events === 'function') {\n this.bindEvents();\n }\n }\n } catch (error) {\n this._handleError(error, { phase: 'update' });\n }\n }\n\n /**\n * Mount declared child components.\n * This method is called after the parent component's DOM is updated.\n * @private\n */\n _mountChildren() {\n if (typeof this.children !== 'function') {\n return;\n }\n const childrenToMount = this.children();\n if (!childrenToMount) {\n return;\n }\n\n for (const selector in childrenToMount) {\n const container = this.getRef(selector);\n if (container) {\n const child = childrenToMount[selector];\n \n // If a different component is already in this container, unmount it.\n if (container.component && container.component !== child) {\n container.component.unmount();\n }\n\n // If the child is not already mounted in this specific container, mount it.\n if (child.element !== container) {\n child.mount(container);\n container.component = child; // Associate component with element for cleanup.\n this.registerCleanup(() => child.unmount());\n }\n }\n }\n }\n\n /**\n * Declares child components for the component.\n * @returns {Object.<string, Component>} A map where keys are CSS selectors \n * for the container elements and values are the child component instances.\n * e.g., { '#child-container': this.childComponent }\n */\n children() {\n return {};\n }\n\n /**\n * Schedule a component update with optional priority\n * \n * This method allows components to opt-in to requestAnimationFrame batching\n * for better performance when multiple components update simultaneously.\n * \n * @param {Object} options - Update options\n * @param {boolean} options.immediate - If true, update immediately (bypass batching).\n * Use for critical updates (user input, errors).\n * Default: false (batched)\n * \n * @example\n * // Batched update (default) - good for price updates, balance updates\n * this.scheduleUpdate();\n * \n * // Immediate update - good for user input, error displays\n * this.scheduleUpdate({ immediate: true });\n */\n scheduleUpdate(options = {}) {\n if (options.immediate) {\n // Critical update - execute immediately\n this.update();\n } else {\n // Non-critical update - queue for batching\n const scheduler = getUpdateScheduler();\n scheduler.queue(this);\n }\n }\n\n // Lifecycle methods (to be overridden by child classes)\n onMount() {}\n onUnmount() {}\n onUpdate(oldState) {}\n \n /**\n * Error handler lifecycle hook\n * Override in child classes to handle errors\n * @param {Error} error - The error that occurred\n * @param {Object} errorInfo - Additional error information\n */\n onError(error, errorInfo) {\n // Default implementation does nothing\n // Child classes can override to handle errors\n }\n\n // Methods to be implemented by child classes\n render() {\n try {\n return this.template ? this.template() : '';\n } catch (error) {\n this._handleError(error, { phase: 'render' });\n return '<div class=\"component-error\">Error rendering component</div>';\n }\n }\n \n /**\n * Handle errors and propagate to nearest ErrorBoundary\n * @private\n */\n _handleError(error, errorInfo = {}) {\n // Call component's error handler if it exists\n if (this.onError) {\n try {\n this.onError(error, errorInfo);\n } catch (handlerError) {\n console.error('[Component] Error in onError handler:', handlerError);\n }\n }\n \n // Propagate to parent ErrorBoundary if it exists\n // Check by constructor name to avoid circular dependency\n let parent = this._parent;\n while (parent) {\n if (parent.constructor && parent.constructor.name === 'ErrorBoundary') {\n if (parent._errorHandler) {\n parent._errorHandler(error, { ...errorInfo, component: this.constructor.name });\n }\n return;\n }\n parent = parent._parent;\n }\n \n // If no ErrorBoundary found, log to console\n console.error(`[Component] Unhandled error in ${this.constructor.name}:`, error, errorInfo);\n }\n\n events() {\n return {};\n }\n\n /**\n * Register a cleanup function to be called on unmount\n * @param {Function} cleanupFn - Function to call during cleanup\n * @returns {Function} - Unregister function to remove this cleanup\n */\n registerCleanup(cleanupFn) {\n if (typeof cleanupFn !== 'function') {\n console.warn('[Component] registerCleanup called with non-function:', cleanupFn);\n return () => {};\n }\n \n this._cleanupRegistry.add(cleanupFn);\n \n // Return unregister function\n return () => {\n this._cleanupRegistry.delete(cleanupFn);\n };\n }\n\n /**\n * Execute all registered cleanup functions\n * @private\n */\n _executeCleanup() {\n this._cleanupRegistry.forEach(cleanupFn => {\n try {\n cleanupFn();\n } catch (error) {\n console.error('[Component] Error during cleanup:', error);\n }\n });\n this._cleanupRegistry.clear();\n }\n\n /**\n * Unmount all child components\n * @private\n */\n _unmountChildren() {\n for (const [key, child] of this._children.entries()) {\n try {\n if (child && typeof child.unmount === 'function') {\n child.unmount();\n }\n } catch (error) {\n console.error(`[Component] Error unmounting child \"${key}\":`, error);\n }\n }\n this._children.clear();\n }\n\n /**\n * Create and track a child component\n * @param {string} key - Unique key for this child component\n * @param {Component} childComponent - Child component instance\n * @returns {Component} - The child component\n */\n createChild(key, childComponent) {\n if (this._children.has(key)) {\n console.warn(`[Component] Child with key \"${key}\" already exists, unmounting previous instance`);\n const previous = this._children.get(key);\n if (previous && typeof previous.unmount === 'function') {\n previous.unmount();\n }\n }\n \n // Set parent reference for context traversal\n childComponent._parent = this;\n \n // Inherit parent context\n this._context.forEach((value, key) => {\n childComponent._context.set(key, value);\n });\n \n this._children.set(key, childComponent);\n \n // Register cleanup to unmount child\n this.registerCleanup(() => {\n if (childComponent && typeof childComponent.unmount === 'function') {\n childComponent.unmount();\n }\n this._children.delete(key);\n });\n \n return childComponent;\n }\n\n /**\n * Wrapper for setTimeout that automatically registers cleanup\n * @param {Function} callback - Function to call after delay\n * @param {number} delay - Delay in milliseconds\n * @returns {number} - Timer ID (can be used with clearTimeout)\n */\n setTimeout(callback, delay) {\n const timerId = window.setTimeout(callback, delay);\n \n // Register cleanup to clear the timer\n this.registerCleanup(() => {\n window.clearTimeout(timerId);\n });\n \n return timerId;\n }\n\n /**\n * Wrapper for setInterval that automatically registers cleanup\n * @param {Function} callback - Function to call repeatedly\n * @param {number} delay - Interval in milliseconds\n * @returns {number} - Timer ID (can be used with clearInterval)\n */\n setInterval(callback, delay) {\n const timerId = window.setInterval(callback, delay);\n \n // Register cleanup to clear the interval\n this.registerCleanup(() => {\n window.clearInterval(timerId);\n });\n \n return timerId;\n }\n\n /**\n * Subscribe to an event with automatic cleanup on unmount\n * @param {string} eventName - Name of the event to subscribe to\n * @param {Function} callback - Callback function to call when event is emitted\n * @returns {Function} - Unsubscribe function (also auto-called on unmount)\n */\n subscribe(eventName, callback) {\n // Subscribe to the event\n const unsubscribe = eventBus.on(eventName, callback);\n \n // Track the subscription for automatic cleanup\n this._subscriptions.add(unsubscribe);\n \n // Register cleanup to unsubscribe\n this.registerCleanup(() => {\n unsubscribe();\n this._subscriptions.delete(unsubscribe);\n });\n \n return unsubscribe;\n }\n\n /**\n * Subscribe to an event for one-time use with automatic cleanup\n * @param {string} eventName - Name of the event to subscribe to\n * @param {Function} callback - Callback function to call when event is emitted (once)\n * @returns {Function} - Unsubscribe function (also auto-called on unmount or after first call)\n */\n subscribeOnce(eventName, callback) {\n // Subscribe to the event once\n const unsubscribe = eventBus.once(eventName, callback);\n \n // Track the subscription for automatic cleanup\n this._subscriptions.add(unsubscribe);\n \n // Register cleanup\n this.registerCleanup(() => {\n unsubscribe();\n this._subscriptions.delete(unsubscribe);\n });\n \n return unsubscribe;\n }\n\n /**\n * Hook to subscribe to store state changes\n * Automatically updates component when selected store state changes\n * \n * STATE OWNERSHIP RULES:\n * - UI-only state (focus, hover, temporary UI state) → use this.state\n * - Shared/global state (balances, price, wallet, contract data) → use store\n * - Derived state → use selectors\n * \n * Usage examples:\n * // Using a selector method\n * const isPhase2 = this.useStore(tradingStore, () => tradingStore.selectIsPhase2());\n * \n * // Using a direct state selector\n * const price = this.useStore(tradingStore, (state) => state.price.current);\n * \n * // With update callback\n * this.useStore(tradingStore, () => tradingStore.selectIsPhase2(), (newValue, oldValue) => {\n * console.log('Phase 2 changed:', newValue);\n * });\n * \n * @param {Store} store - Store instance to subscribe to\n * @param {Function} selector - Function that selects state (can be store method or state selector)\n * @param {Function} onUpdate - Optional callback when selected state changes\n * @returns {any} - Current selected state value\n */\n useStore(store, selector, onUpdate) {\n if (!store || typeof selector !== 'function') {\n console.warn('[Component] useStore called with invalid arguments');\n return null;\n }\n\n // Store the last value for comparison\n if (!this._storeValues) {\n this._storeValues = new Map();\n }\n \n const selectorKey = selector.toString(); // Use function string as key (not perfect but works)\n let lastValue = this._storeValues.get(selectorKey);\n \n // Get initial value\n const getCurrentValue = () => {\n // Try calling as store method first (e.g., tradingStore.selectIsPhase2())\n try {\n const result = selector.call(store);\n if (result !== undefined) {\n return result;\n }\n } catch (e) {\n // Not a method, try as state selector\n }\n \n // Try as state selector (e.g., (state) => state.price)\n return selector(store.getState());\n };\n \n const currentValue = getCurrentValue();\n this._storeValues.set(selectorKey, currentValue);\n \n // Subscribe to store changes\n const unsubscribe = store.subscribe(() => {\n const newValue = getCurrentValue();\n const oldValue = lastValue;\n \n // Only update if value actually changed (shallow comparison)\n if (this._hasValueChanged(oldValue, newValue)) {\n // Update stored value\n this._storeValues.set(selectorKey, newValue);\n lastValue = newValue;\n \n // Call optional update callback\n if (typeof onUpdate === 'function') {\n onUpdate(newValue, oldValue);\n }\n \n // Trigger component update\n this.update();\n }\n });\n \n // Register cleanup to unsubscribe\n this.registerCleanup(() => {\n unsubscribe();\n if (this._storeValues) {\n this._storeValues.delete(selectorKey);\n }\n });\n \n return currentValue;\n }\n\n /**\n * Check if two values have changed (shallow comparison)\n * @private\n */\n _hasValueChanged(oldValue, newValue) {\n // Primitive comparison\n if (oldValue === newValue) return false;\n \n // Null/undefined handling\n if (oldValue == null || newValue == null) return oldValue !== newValue;\n \n // Object comparison (shallow)\n if (typeof oldValue === 'object' && typeof newValue === 'object') {\n const oldKeys = Object.keys(oldValue);\n const newKeys = Object.keys(newValue);\n \n if (oldKeys.length !== newKeys.length) return true;\n \n return oldKeys.some(key => oldValue[key] !== newValue[key]);\n }\n \n return true;\n }\n\n /**\n * Get a cached element reference by name and selector\n * @param {string} name - Reference name (for caching)\n * @param {string} selector - CSS selector to find element\n * @returns {HTMLElement|null} - Element or null if not found\n */\n _getRefCached(name, selector) {\n if (!this.element) return null;\n \n // Check cache first\n if (this._refs.has(name)) {\n const cached = this._refs.get(name);\n // Verify element is still in DOM\n if (cached && this.element.contains(cached)) {\n return cached;\n }\n // Stale reference, remove from cache\n this._refs.delete(name);\n }\n \n // Query DOM if not cached\n const element = this.element.querySelector(selector);\n if (element) {\n this._refs.set(name, element);\n }\n \n return element;\n }\n\n /**\n * Manually update a cached reference\n * @param {string} name - Reference name\n * @param {HTMLElement} element - Element to cache\n */\n updateRef(name, element) {\n if (element) {\n this._refs.set(name, element);\n } else {\n this._refs.delete(name);\n }\n }\n\n /**\n * Invalidate all cached references\n * Should be called when DOM structure changes significantly\n */\n invalidateRefs() {\n this._refs.clear();\n }\n\n /**\n * Invalidate a specific cached reference\n * @param {string} name - Reference name to invalidate\n */\n invalidateRef(name) {\n this._refs.delete(name);\n }\n\n /**\n * Get a single DOM element within this component's element\n * Convenience wrapper around querySelector with null-safety check\n * @param {string} selector - CSS selector to query\n * @returns {HTMLElement|null} The first matching element or null\n */\n getRef(selector) {\n if (!this.element) {\n console.warn(`[Component] getRef called on ${this.constructor.name} before element exists`);\n return null;\n }\n return this.element.querySelector(selector);\n }\n\n /**\n * Get multiple DOM elements within this component's element\n * Convenience wrapper around querySelectorAll with null-safety check\n * @param {string} selector - CSS selector to query\n * @returns {Array<HTMLElement>} Array of matching elements (empty array if none found)\n */\n getRefs(selector) {\n if (!this.element) {\n console.warn(`[Component] getRefs called on ${this.constructor.name} before element exists`);\n return [];\n }\n // Convert NodeList to Array for easier manipulation\n return Array.from(this.element.querySelectorAll(selector));\n }\n\n /**\n * Provide a context value to child components\n * @param {string} key - Context key\n * @param {any} value - Context value\n */\n provideContext(key, value) {\n this._context.set(key, value);\n \n // Propagate to existing children\n this._children.forEach(child => {\n if (child && typeof child._context !== 'undefined') {\n child._context.set(key, value);\n }\n });\n }\n\n /**\n * Get a context value, searching up the component tree\n * @param {string} key - Context key\n * @returns {any} - Context value or undefined if not found\n */\n getContext(key) {\n // Check own context first\n if (this._context.has(key)) {\n return this._context.get(key);\n }\n \n // Search up the tree\n let parent = this._parent;\n while (parent) {\n if (parent._context && parent._context.has(key)) {\n return parent._context.get(key);\n }\n parent = parent._parent;\n }\n \n return undefined;\n }\n\n /**\n * Remove a context value\n * @param {string} key - Context key to remove\n */\n removeContext(key) {\n this._context.delete(key);\n \n // Remove from children\n this._children.forEach(child => {\n if (child && typeof child._context !== 'undefined') {\n child._context.delete(key);\n }\n });\n }\n} \n","/**\n * Simple client-side router for SPA navigation\n * Supports static routes and browser history\n */\nclass Router {\n constructor() {\n this.routes = new Map();\n this.currentRoute = null;\n this.currentHandler = null;\n this.notFoundHandler = null;\n \n // Bind methods\n this.handleRoute = this.handleRoute.bind(this);\n this.navigate = this.navigate.bind(this);\n \n // Listen for browser back/forward\n window.addEventListener('popstate', async (e) => {\n await this.handleRoute(window.location.pathname);\n });\n }\n \n /**\n * Register a route\n * @param {string} path - Route path (e.g., '/', '/cultexecs')\n * @param {Function} handler - Route handler function\n */\n on(path, handler) {\n this.routes.set(path, handler);\n }\n \n /**\n * Register a 404 handler\n * @param {Function} handler - Handler for unmatched routes\n */\n notFound(handler) {\n this.notFoundHandler = handler;\n }\n \n /**\n * Navigate to a route\n * @param {string} path - Route path\n * @param {boolean} replace - Whether to replace history entry\n */\n async navigate(path, replace = false) {\n if (path === window.location.pathname) {\n return; // Already on this route\n }\n \n if (replace) {\n window.history.replaceState({ path }, '', path);\n } else {\n window.history.pushState({ path }, '', path);\n }\n \n await this.handleRoute(path);\n \n\n }\n \n /**\n * Match a path against a route pattern\n * @param {string} pattern - Route pattern (e.g., '/project/:id')\n * @param {string} path - Actual path to match\n * @returns {object|null} Matched params or null if no match\n * @private\n */\n _matchRoute(pattern, path) {\n // Exact match for static routes\n if (pattern === path) {\n return {};\n }\n \n // Split into parts, filtering empty strings\n const patternParts = pattern.split('/').filter(p => p);\n const pathParts = path.split('/').filter(p => p);\n \n // Must have same number of parts\n if (patternParts.length !== pathParts.length) {\n return null;\n }\n \n const params = {};\n for (let i = 0; i < patternParts.length; i++) {\n const patternPart = patternParts[i];\n const pathPart = pathParts[i];\n \n // Check if this is a parameter (starts with :)\n if (patternPart.startsWith(':')) {\n const paramName = patternPart.slice(1);\n // Decode URL component\n try {\n params[paramName] = decodeURIComponent(pathPart);\n } catch (e) {\n // If decoding fails, use raw value\n params[paramName] = pathPart;\n }\n } else if (patternPart !== pathPart) {\n // Static part doesn't match\n return null;\n }\n }\n \n return params;\n }\n \n /**\n * Find matching route handler\n * @param {string} path - Route path\n * @returns {object|null} { handler, params } or null\n * @private\n */\n _findRoute(path) {\n // First check for exact static route match (static routes take precedence)\n if (this.routes.has(path)) {\n return {\n handler: this.routes.get(path),\n params: {}\n };\n }\n \n // Collect all dynamic routes and sort by specificity\n const dynamicRoutes = [];\n for (const [pattern, handler] of this.routes.entries()) {\n // Skip if it's an exact match (already checked above)\n if (pattern === path) {\n continue;\n }\n \n // Check if pattern contains dynamic parameters\n if (pattern.includes(':')) {\n const paramCount = (pattern.match(/:/g) || []).length;\n // Count literal (non-param) parts for better specificity\n const literalCount = pattern.split('/').filter(p => p && !p.startsWith(':')).length;\n dynamicRoutes.push({ pattern, handler, paramCount, literalCount });\n }\n }\n \n // Sort by literal count first (more literals = more specific), then by param count\n // This ensures routes with literal parts (like /create) are matched before fully dynamic routes\n dynamicRoutes.sort((a, b) => {\n if (b.literalCount !== a.literalCount) {\n return b.literalCount - a.literalCount;\n }\n return b.paramCount - a.paramCount;\n });\n \n // Try each route in order of specificity\n for (const { pattern, handler } of dynamicRoutes) {\n const params = this._matchRoute(pattern, path);\n if (params !== null) {\n return { handler, params };\n }\n }\n \n return null;\n }\n \n /**\n * Handle route change\n * @param {string} path - Route path\n */\n async handleRoute(path) {\n // Clean up current handler if it exists\n if (this.currentHandler && typeof this.currentHandler.cleanup === 'function') {\n this.currentHandler.cleanup();\n }\n \n // Find matching route\n const match = this._findRoute(path);\n \n if (match) {\n this.currentRoute = path;\n // Call handler with params and store the result (which may include cleanup function)\n // Handle both sync and async handlers\n const result = await Promise.resolve(match.handler(match.params));\n this.currentHandler = result || null;\n \n\n } else if (this.notFoundHandler) {\n this.currentRoute = null;\n this.currentHandler = null;\n this.notFoundHandler(path);\n } else {\n console.warn(`No route handler for: ${path}`);\n }\n }\n \n /**\n * Start the router\n */\n async start() {\n // Handle initial route\n await this.handleRoute(window.location.pathname);\n }\n \n /**\n * Get current route\n */\n getCurrentRoute() {\n return this.currentRoute || window.location.pathname;\n }\n \n /**\n * Encode a title for use in URL (slug)\n * @param {string} title - Title to encode\n * @returns {string} URL-safe slug\n */\n _encodeTitle(title) {\n if (!title) return '';\n return title\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphens\n .replace(/^-+|-+$/g, ''); // Remove leading/trailing hyphens\n }\n \n /**\n * Decode a URL slug back to title (approximate)\n * @param {string} slug - URL slug\n * @returns {string} Decoded title\n */\n _decodeTitle(slug) {\n if (!slug) return '';\n return slug\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n \n /**\n * Generate URL from chain ID, factory title, instance name, and optional piece title\n * @param {string|number} chainId - Chain ID (e.g., 1 for Ethereum mainnet)\n * @param {string} factoryTitle - Factory title\n * @param {string} instanceName - Instance name\n * @param {string} [pieceTitle] - Optional piece title (for ERC1155)\n * @returns {string} URL path\n */\n generateURL(chainId, factoryTitle, instanceName, pieceTitle = null) {\n const chainIdStr = String(chainId || '1'); // Default to 1 (Ethereum mainnet)\n const factorySlug = this._encodeTitle(factoryTitle);\n const instanceSlug = this._encodeTitle(instanceName);\n \n if (pieceTitle) {\n const pieceSlug = this._encodeTitle(pieceTitle);\n return `/${chainIdStr}/${factorySlug}/${instanceSlug}/${pieceSlug}`;\n }\n \n return `/${chainIdStr}/${factorySlug}/${instanceSlug}`;\n }\n}\n\nexport default Router;\n\n"],"names":["eventBus","constructor","this","listeners","Map","debugMode","setDebugMode","enabled","on","eventName","callback","has","set","Set","get","add","console","log","off","delete","size","removeAllListeners","clear","emit","data","forEach","error","once","wrappedCallback","DOMUpdater","_activeElement","_activeElementPath","_scrollPositions","saveState","rootElement","activeElement","document","contains","_getElementPath","querySelectorAll","el","undefined","scrollTop","scrollLeft","path","restoreState","element","_getElementByPath","focus","HTMLInputElement","HTMLTextAreaElement","selectionStart","setSelectionRange","e","position","root","current","parentNode","parent","index","Array","from","children","indexOf","unshift","join","indices","split","map","Number","diffHTML","oldHTML","newHTML","Math","abs","length","oldTags","match","newTags","updateText","node","newText","nodeType","Node","TEXT_NODE","ELEMENT_NODE","textContent","updateAttributes","newAttrs","currentAttrs","attributes","attr","name","value","Object","keys","newValue","removeAttribute","setAttribute","updateChildren","oldChildren","newChildrenContainer","oldArray","newArray","maxLength","max","i","oldChild","newChild","appendChild","remove","_canUpdateInPlace","_updateNodeInPlace","replaceChild","oldNode","newNode","tagName","childNodes","newChildren","innerHTML","updateGranular","temp","createElement","warn","UpdateScheduler","_queue","_scheduled","_metrics","frames","updates","maxFrameTime","totalFrameTime","maxUpdatesPerFrame","_devMode","_enabled","getInstance","_instance","setDevMode","setEnabled","queue","component","update","requestAnimationFrame","_flush","start","performance","now","updateCount","duration","toFixed","getMetrics","avgFrameTime","avgUpdatesPerFrame","totalUpdates","resetMetrics","getQueueSize","getUpdateScheduler","state","mounted","boundEvents","_cleanupRegistry","_children","_subscriptions","_domUpdater","_refs","_context","_parent","setState","newState","oldState","shouldUpdate","onStateUpdate","oldKeys","newKeys","some","key","mount","styles","styleElement","head","registerCleanup","onMount","_handleError","phase","unmount","_executeCleanup","unbindEvents","invalidateRefs","onUnmount","bindEvents","events","entries","eventSelector","handlerReference","descriptor","trim","selectorParts","selector","handler","_resolveEventHandler","eventHandler","target","matchedTarget","closest","matches","addEventListener","bind","args","apply","removeEventListener","newContent","render","_mountChildren","childrenToMount","container","getRef","child","scheduleUpdate","options","immediate","onUpdate","onError","errorInfo","template","handlerError","_errorHandler","cleanupFn","_unmountChildren","createChild","childComponent","previous","setTimeout","delay","timerId","window","clearTimeout","setInterval","clearInterval","subscribe","unsubscribe","subscribeOnce","useStore","store","_storeValues","selectorKey","toString","lastValue","getCurrentValue","result","call","getState","currentValue","oldValue","_hasValueChanged","_getRefCached","cached","querySelector","updateRef","invalidateRef","getRefs","provideContext","getContext","removeContext","routes","currentRoute","currentHandler","notFoundHandler","handleRoute","navigate","async","location","pathname","notFound","replace","history","replaceState","pushState","_matchRoute","pattern","patternParts","filter","p","pathParts","params","patternPart","pathPart","startsWith","paramName","slice","decodeURIComponent","_findRoute","dynamicRoutes","includes","paramCount","literalCount","push","sort","a","b","cleanup","Promise","resolve","getCurrentRoute","_encodeTitle","title","toLowerCase","_decodeTitle","slug","word","charAt","toUpperCase","generateURL","chainId","factoryTitle","instanceName","pieceTitle","chainIdStr","String","factorySlug","instanceSlug"],"mappings":"+OA0HY,MAACA,EAAW,IA1HxB,MACI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A,YAAAiC,CAAaC,GACT,OAAKA,EACEA,EACFhP,MAAM,KACNC,IAAIgP,GAAQA,EAAKC,OAAO,GAAGC,cAAgBF,EAAKpB,MAAM,IACtD/N,KAAK,KAJQ,EAKtB,CAUA,WAAAsP,CAAYC,EAASC,EAAcC,EAAcC,EAAa,MAC1D,MAAMC,EAAaC,OAAOL,GAAW,KAC/BM,EAAc5T,KAAK6S,aAAaU,GAChCM,EAAe7T,KAAK6S,aAAaW,GAEvC,GAAIC,EAAY,CAEZ,MAAO,IAAIC,KAAcE,KAAeC,KADtB7T,KAAK6S,aAAaY,IAExC,CAEA,MAAO,IAAIC,KAAcE,KAAeC,GAC5C"}
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Microact Example</title>
7
+ </head>
8
+ <body>
9
+ <div id="app-root"></div>
10
+ <div id="event-display"></div>
11
+ <script type="module" src="index.js"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,63 @@
1
+ import { Component, eventBus } from '../dist/microact.esm.js';
2
+
3
+ class Counter extends Component {
4
+ constructor(element) {
5
+ super(element);
6
+ this.state = {
7
+ count: 0,
8
+ };
9
+ }
10
+
11
+ events() {
12
+ return {
13
+ 'click button': 'incrementCount',
14
+ };
15
+ }
16
+
17
+ incrementCount() {
18
+ const newCount = this.state.count + 1;
19
+ this.setState({ count: newCount });
20
+ eventBus.emit('countIncremented', { count: newCount });
21
+ }
22
+
23
+ render() {
24
+ return `
25
+ <div>
26
+ <h1>Counter</h1>
27
+ <p>Count: ${this.state.count}</p>
28
+ <button>Increment</button>
29
+ </div>
30
+ `;
31
+ }
32
+ }
33
+
34
+ class EventDisplay extends Component {
35
+ constructor(element) {
36
+ super(element);
37
+ this.state = {
38
+ message: 'Waiting for event...',
39
+ };
40
+
41
+ this.subscribe('countIncremented', (data) => {
42
+ this.setState({ message: `Count is now: ${data.count}` });
43
+ });
44
+ }
45
+
46
+ render() {
47
+ return `
48
+ <div>
49
+ <h2>Event Display</h2>
50
+ <p>${this.state.message}</p>
51
+ </div>
52
+ `;
53
+ }
54
+ }
55
+
56
+ const counterRoot = document.getElementById('app-root');
57
+ const eventDisplayRoot = document.getElementById('event-display');
58
+
59
+ const counter = new Counter(counterRoot);
60
+ counter.mount(counterRoot);
61
+
62
+ const eventDisplay = new EventDisplay(eventDisplayRoot);
63
+ eventDisplay.mount(eventDisplayRoot);
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@monygroupcorp/microact",
3
+ "version": "0.1.1",
4
+ "description": "A lean, minimal React-like framework for client-side applications.",
5
+ "main": "dist/microact.cjs.js",
6
+ "module": "dist/microact.esm.js",
7
+ "unpkg": "dist/microact.umd.js",
8
+ "jsdelivr": "dist/microact.umd.js",
9
+ "type": "module",
10
+ "scripts": {
11
+ "clean": "rm -rf dist",
12
+ "prebuild": "npm run clean",
13
+ "build": "rollup -c"
14
+ },
15
+ "keywords": [
16
+ "react",
17
+ "minimal",
18
+ "framework",
19
+ "client-side",
20
+ "microact"
21
+ ],
22
+ "author": "arthurt <mony.group.corporation@gmail.com>",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/your-username/microact.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/your-username/microact/issues"
30
+ },
31
+ "homepage": "https://miladystation.net",
32
+ "devDependencies": {
33
+ "@rollup/plugin-commonjs": "^29.0.0",
34
+ "@rollup/plugin-node-resolve": "^16.0.3",
35
+ "@rollup/plugin-terser": "^0.4.4",
36
+ "rollup": "^4.55.1"
37
+ }
38
+ }