lithent 1.25.5 → 1.25.7

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 (332) hide show
  1. package/devHelper/dist/componentMapControl.d.cts +1 -1
  2. package/devHelper/dist/componentMapControl.d.ts +1 -1
  3. package/devHelper/dist/createBoundary.d.cts +2 -2
  4. package/devHelper/dist/createBoundary.d.ts +2 -2
  5. package/devHelper/dist/lithentDevHelper.cjs +2 -2
  6. package/devHelper/dist/lithentDevHelper.cjs.map +1 -1
  7. package/devHelper/dist/lithentDevHelper.mjs +102 -112
  8. package/devHelper/dist/lithentDevHelper.mjs.map +1 -1
  9. package/devHelper/dist/lithentDevHelper.umd.js +2 -2
  10. package/devHelper/dist/lithentDevHelper.umd.js.map +1 -1
  11. package/devHelper/dist/tests/boundary-lifecycle.test.d.cts +1 -0
  12. package/devHelper/dist/tests/boundary-lifecycle.test.d.ts +1 -0
  13. package/devHelper/dist/tests/boundary-regressions.test.d.cts +1 -0
  14. package/devHelper/dist/tests/boundary-regressions.test.d.ts +1 -0
  15. package/devHelper/dist/tests/createBoundaryRetry.test.d.cts +1 -0
  16. package/devHelper/dist/tests/createBoundaryRetry.test.d.ts +1 -0
  17. package/devHelper/dist/tests/hmrBoundary.d.cts +14 -0
  18. package/devHelper/dist/tests/hmrBoundary.d.ts +14 -0
  19. package/dist/index.d.cts +2 -3
  20. package/dist/index.d.ts +2 -3
  21. package/dist/lithent-agent-addon.md +1 -1
  22. package/dist/lithent.cjs +2 -2
  23. package/dist/lithent.cjs.map +1 -1
  24. package/dist/lithent.mjs +501 -657
  25. package/dist/lithent.mjs.map +1 -1
  26. package/dist/lithent.umd.js +2 -2
  27. package/dist/lithent.umd.js.map +1 -1
  28. package/dist/skills/lithent/SKILL.md +1 -1
  29. package/dist/skills/lithent/constraints/mistakes.md +1 -1
  30. package/dist/skills/lithent/constraints/rules.md +1 -1
  31. package/dist/skills/lithent/constraints/troubleshooting.md +1 -1
  32. package/dist/skills/lithent/examples/quick-examples.md +1 -1
  33. package/dist/skills/lithent/reference/children-type.md +1 -1
  34. package/dist/skills/lithent/reference/concurrent.md +1 -1
  35. package/dist/skills/lithent/reference/element.md +1 -1
  36. package/dist/skills/lithent/reference/lstore-inference.md +1 -1
  37. package/dist/skills/lithent/reference/props-types.md +1 -1
  38. package/dist/tests/core-accessorUpgrade.test.d.cts +1 -0
  39. package/dist/tests/core-accessorUpgrade.test.d.ts +1 -0
  40. package/dist/tests/core-addedSubtrees.test.d.cts +1 -0
  41. package/dist/tests/core-addedSubtrees.test.d.ts +1 -0
  42. package/dist/tests/core-bulkRemoval.test.d.cts +1 -0
  43. package/dist/tests/core-bulkRemoval.test.d.ts +1 -0
  44. package/dist/tests/core-cachedIdentity.test.d.cts +1 -0
  45. package/dist/tests/core-cachedIdentity.test.d.ts +1 -0
  46. package/dist/tests/core-callback.d.cts +1 -0
  47. package/dist/tests/core-callback.d.ts +1 -0
  48. package/dist/tests/core-checkbox.d.cts +1 -0
  49. package/dist/tests/core-checkbox.d.ts +1 -0
  50. package/dist/tests/core-childrentest.d.cts +1 -0
  51. package/dist/tests/core-childrentest.d.ts +1 -0
  52. package/dist/tests/core-cleanupErrors.test.d.cts +1 -0
  53. package/dist/tests/core-cleanupErrors.test.d.ts +1 -0
  54. package/dist/tests/core-complexRootFragment.d.cts +1 -0
  55. package/dist/tests/core-complexRootFragment.d.ts +1 -0
  56. package/dist/tests/core-component-remount.test.d.cts +1 -0
  57. package/dist/tests/core-component-remount.test.d.ts +1 -0
  58. package/dist/tests/core-composedRenew.test.d.cts +1 -0
  59. package/dist/tests/core-composedRenew.test.d.ts +1 -0
  60. package/dist/tests/core-destroy.d.cts +1 -0
  61. package/dist/tests/core-destroy.d.ts +1 -0
  62. package/dist/tests/core-destroyForLoop.d.cts +1 -0
  63. package/dist/tests/core-destroyForLoop.d.ts +1 -0
  64. package/dist/tests/core-destroyUnmount.test.d.cts +1 -0
  65. package/dist/tests/core-destroyUnmount.test.d.ts +1 -0
  66. package/dist/tests/core-discardedListeners.test.d.cts +1 -0
  67. package/dist/tests/core-discardedListeners.test.d.ts +1 -0
  68. package/dist/tests/core-edgeRegressions.test.d.cts +1 -0
  69. package/dist/tests/core-edgeRegressions.test.d.ts +1 -0
  70. package/dist/tests/core-eventContract.test.d.cts +1 -0
  71. package/dist/tests/core-eventContract.test.d.ts +1 -0
  72. package/dist/tests/core-eventDispatch.test.d.cts +1 -0
  73. package/dist/tests/core-eventDispatch.test.d.ts +1 -0
  74. package/dist/tests/core-fragment.d.cts +1 -0
  75. package/dist/tests/core-fragment.d.ts +1 -0
  76. package/dist/tests/core-functional-vdom.test.d.cts +1 -0
  77. package/dist/tests/core-functional-vdom.test.d.ts +1 -0
  78. package/dist/tests/core-hoc.d.cts +1 -0
  79. package/dist/tests/core-hoc.d.ts +1 -0
  80. package/dist/tests/core-innerhtml.d.cts +1 -0
  81. package/dist/tests/core-innerhtml.d.ts +1 -0
  82. package/dist/tests/core-input.d.cts +1 -0
  83. package/dist/tests/core-input.d.ts +1 -0
  84. package/dist/tests/core-insert.d.cts +1 -0
  85. package/dist/tests/core-insert.d.ts +1 -0
  86. package/dist/tests/core-keyedConsumption.test.d.cts +1 -0
  87. package/dist/tests/core-keyedConsumption.test.d.ts +1 -0
  88. package/dist/tests/core-keyedFastPath.test.d.cts +1 -0
  89. package/dist/tests/core-keyedFastPath.test.d.ts +1 -0
  90. package/dist/tests/core-keyedPositional.test.d.cts +1 -0
  91. package/dist/tests/core-keyedPositional.test.d.ts +1 -0
  92. package/dist/tests/core-lmount.d.cts +1 -0
  93. package/dist/tests/core-lmount.d.ts +1 -0
  94. package/dist/tests/core-loop.d.cts +1 -0
  95. package/dist/tests/core-loop.d.ts +1 -0
  96. package/dist/tests/core-loopDomReuseWithoutKey.d.cts +1 -0
  97. package/dist/tests/core-loopDomReuseWithoutKey.d.ts +1 -0
  98. package/dist/tests/core-loopLifecycleOrder.d.cts +1 -0
  99. package/dist/tests/core-loopLifecycleOrder.d.ts +1 -0
  100. package/dist/tests/core-loopMoveOrder.d.cts +1 -0
  101. package/dist/tests/core-loopMoveOrder.d.ts +1 -0
  102. package/dist/tests/core-loopWithoutKey.d.cts +1 -0
  103. package/dist/tests/core-loopWithoutKey.d.ts +1 -0
  104. package/dist/tests/core-loopkey.d.cts +1 -0
  105. package/dist/tests/core-loopkey.d.ts +1 -0
  106. package/dist/tests/core-mixedComponentUpdate.d.cts +1 -0
  107. package/dist/tests/core-mixedComponentUpdate.d.ts +1 -0
  108. package/dist/tests/core-mountreadycallback.d.cts +1 -0
  109. package/dist/tests/core-mountreadycallback.d.ts +1 -0
  110. package/dist/tests/core-nested.d.cts +1 -0
  111. package/dist/tests/core-nested.d.ts +1 -0
  112. package/dist/tests/core-nestedUnmount.d.cts +1 -0
  113. package/dist/tests/core-nestedUnmount.d.ts +1 -0
  114. package/dist/tests/core-nullUpdater.test.d.cts +1 -0
  115. package/dist/tests/core-nullUpdater.test.d.ts +1 -0
  116. package/dist/tests/core-parentChildSync.d.cts +1 -0
  117. package/dist/tests/core-parentChildSync.d.ts +1 -0
  118. package/dist/tests/core-parentPosition.test.d.cts +1 -0
  119. package/dist/tests/core-parentPosition.test.d.ts +1 -0
  120. package/dist/tests/core-parentUpdateContract.test.d.cts +1 -0
  121. package/dist/tests/core-parentUpdateContract.test.d.ts +1 -0
  122. package/dist/tests/core-placementProof.test.d.cts +1 -0
  123. package/dist/tests/core-placementProof.test.d.ts +1 -0
  124. package/dist/tests/core-portal-events.test.d.cts +1 -0
  125. package/dist/tests/core-portal-events.test.d.ts +1 -0
  126. package/dist/tests/core-portal.d.cts +1 -0
  127. package/dist/tests/core-portal.d.ts +1 -0
  128. package/dist/tests/core-portalSiblings.test.d.cts +1 -0
  129. package/dist/tests/core-portalSiblings.test.d.ts +1 -0
  130. package/dist/tests/core-props-enumeration.test.d.cts +1 -0
  131. package/dist/tests/core-props-enumeration.test.d.ts +1 -0
  132. package/dist/tests/core-radio.d.cts +1 -0
  133. package/dist/tests/core-radio.d.ts +1 -0
  134. package/dist/tests/core-redrawRecovery.test.d.cts +1 -0
  135. package/dist/tests/core-redrawRecovery.test.d.ts +1 -0
  136. package/dist/tests/core-ref.d.cts +1 -0
  137. package/dist/tests/core-ref.d.ts +1 -0
  138. package/dist/tests/core-removedRedraw.test.d.cts +1 -0
  139. package/dist/tests/core-removedRedraw.test.d.ts +1 -0
  140. package/dist/tests/core-renderFuzz.test.d.cts +1 -0
  141. package/dist/tests/core-renderFuzz.test.d.ts +1 -0
  142. package/dist/tests/core-renderMatrix.test.d.cts +1 -0
  143. package/dist/tests/core-renderMatrix.test.d.ts +1 -0
  144. package/dist/tests/core-renew.d.cts +1 -0
  145. package/dist/tests/core-renew.d.ts +1 -0
  146. package/dist/tests/core-renewEventTest.d.cts +1 -0
  147. package/dist/tests/core-renewEventTest.d.ts +1 -0
  148. package/dist/tests/core-rootFragmentUpdate.d.cts +1 -0
  149. package/dist/tests/core-rootFragmentUpdate.d.ts +1 -0
  150. package/dist/tests/core-selectbox.d.cts +1 -0
  151. package/dist/tests/core-selectbox.d.ts +1 -0
  152. package/dist/tests/core-structuralRegressions.test.d.cts +1 -0
  153. package/dist/tests/core-structuralRegressions.test.d.ts +1 -0
  154. package/dist/tests/core-styleUpdate.d.cts +1 -0
  155. package/dist/tests/core-styleUpdate.d.ts +1 -0
  156. package/dist/tests/core-svg.d.cts +1 -0
  157. package/dist/tests/core-svg.d.ts +1 -0
  158. package/dist/tests/core-textarea.d.cts +1 -0
  159. package/dist/tests/core-textarea.d.ts +1 -0
  160. package/dist/tests/core-thrillProps.d.cts +1 -0
  161. package/dist/tests/core-thrillProps.d.ts +1 -0
  162. package/dist/tests/core-unmount.d.cts +1 -0
  163. package/dist/tests/core-unmount.d.ts +1 -0
  164. package/dist/tests/core-updatePaths.test.d.cts +1 -0
  165. package/dist/tests/core-updatePaths.test.d.ts +1 -0
  166. package/dist/tests/helpers/renderSpec.d.cts +131 -0
  167. package/dist/tests/helpers/renderSpec.d.ts +131 -0
  168. package/dist/tests/loopWithoutKey.d.cts +1 -0
  169. package/dist/tests/loopWithoutKey.d.ts +1 -0
  170. package/dist/utils/createWDom.d.cts +2 -2
  171. package/dist/utils/createWDom.d.ts +2 -2
  172. package/dist/utils/index.d.cts +3 -3
  173. package/dist/utils/index.d.ts +3 -3
  174. package/dist/utils/predicator.d.cts +3 -3
  175. package/dist/utils/predicator.d.ts +3 -3
  176. package/dist/wDom.d.cts +1 -1
  177. package/dist/wDom.d.ts +1 -1
  178. package/element/dist/index.d.cts +1 -1
  179. package/element/dist/index.d.ts +1 -1
  180. package/element/dist/lithentElement.cjs +3 -3
  181. package/element/dist/lithentElement.cjs.map +1 -1
  182. package/element/dist/lithentElement.mjs +86 -98
  183. package/element/dist/lithentElement.mjs.map +1 -1
  184. package/element/dist/lithentElement.umd.js +3 -3
  185. package/element/dist/lithentElement.umd.js.map +1 -1
  186. package/element/dist/tests/element-attributes.test.d.cts +1 -0
  187. package/element/dist/tests/element-attributes.test.d.ts +1 -0
  188. package/element/dist/tests/element-boundaries.test.d.cts +1 -0
  189. package/element/dist/tests/element-boundaries.test.d.ts +1 -0
  190. package/element/dist/tests/element-cleanupErrors.test.d.cts +1 -0
  191. package/element/dist/tests/element-cleanupErrors.test.d.ts +1 -0
  192. package/element/dist/tests/element-events.test.d.cts +1 -0
  193. package/element/dist/tests/element-events.test.d.ts +1 -0
  194. package/element/dist/tests/element-hardening.test.d.cts +1 -0
  195. package/element/dist/tests/element-hardening.test.d.ts +1 -0
  196. package/element/dist/tests/element-lifecycle.test.d.cts +1 -0
  197. package/element/dist/tests/element-lifecycle.test.d.ts +1 -0
  198. package/element/dist/tests/element-move.test.d.cts +1 -0
  199. package/element/dist/tests/element-move.test.d.ts +1 -0
  200. package/element/dist/tests/element-properties.test.d.cts +1 -0
  201. package/element/dist/tests/element-properties.test.d.ts +1 -0
  202. package/element/dist/tests/element-shadow.test.d.cts +1 -0
  203. package/element/dist/tests/element-shadow.test.d.ts +1 -0
  204. package/element/dist/tests/element-smoke.test.d.cts +1 -0
  205. package/element/dist/tests/element-smoke.test.d.ts +1 -0
  206. package/element/dist/tests/element-ssr.test.d.cts +1 -0
  207. package/element/dist/tests/element-ssr.test.d.ts +1 -0
  208. package/element/dist/tests/element-types.test.d.cts +4 -0
  209. package/element/dist/tests/element-types.test.d.ts +4 -0
  210. package/element/src/tests/element-cleanupErrors.test.ts +96 -0
  211. package/examples/dist/assets/index-C65xYpD_.js +2 -0
  212. package/examples/dist/assets/index-C65xYpD_.js.map +1 -0
  213. package/examples/dist/complextest.d.ts +1 -0
  214. package/examples/dist/htm.d.ts +1 -0
  215. package/examples/dist/index.d.ts +1 -0
  216. package/examples/dist/index.html +1 -1
  217. package/examples/dist/mdx.d.ts +1 -0
  218. package/examples/dist/sharedStore.d.ts +1 -0
  219. package/ftags/dist/index.d.cts +6 -6
  220. package/ftags/dist/index.d.ts +6 -6
  221. package/ftags/dist/lithentFTags.cjs +2 -2
  222. package/ftags/dist/lithentFTags.cjs.map +1 -1
  223. package/ftags/dist/lithentFTags.mjs +22 -30
  224. package/ftags/dist/lithentFTags.mjs.map +1 -1
  225. package/ftags/dist/lithentFTags.umd.js +2 -2
  226. package/ftags/dist/lithentFTags.umd.js.map +1 -1
  227. package/ftags/dist/tests/ftags.d.cts +1 -0
  228. package/ftags/dist/tests/ftags.d.ts +1 -0
  229. package/helper/dist/hook/context.d.cts +1 -2
  230. package/helper/dist/hook/context.d.ts +1 -2
  231. package/helper/dist/hook/lstore.d.cts +2 -2
  232. package/helper/dist/hook/lstore.d.ts +2 -2
  233. package/helper/dist/hook/store.d.cts +1 -1
  234. package/helper/dist/hook/store.d.ts +1 -1
  235. package/helper/dist/lifecycle/activity.d.cts +1 -1
  236. package/helper/dist/lifecycle/activity.d.ts +1 -1
  237. package/helper/dist/lifecycle/host.d.cts +3 -3
  238. package/helper/dist/lifecycle/host.d.ts +3 -3
  239. package/helper/dist/lifecycle/latest.d.cts +2 -2
  240. package/helper/dist/lifecycle/latest.d.ts +2 -2
  241. package/helper/dist/lifecycle/lithent.d.cts +1 -1
  242. package/helper/dist/lifecycle/lithent.d.ts +1 -1
  243. package/helper/dist/lifecycle/renderProtocol.d.cts +5 -5
  244. package/helper/dist/lifecycle/renderProtocol.d.ts +5 -5
  245. package/helper/dist/lifecycle/retainedView.d.cts +2 -2
  246. package/helper/dist/lifecycle/retainedView.d.ts +2 -2
  247. package/helper/dist/lifecycle/scopedTask.d.cts +2 -2
  248. package/helper/dist/lifecycle/scopedTask.d.ts +2 -2
  249. package/helper/dist/lithentHelper.cjs +2 -2
  250. package/helper/dist/lithentHelper.cjs.map +1 -1
  251. package/helper/dist/lithentHelper.mjs +604 -716
  252. package/helper/dist/lithentHelper.mjs.map +1 -1
  253. package/helper/dist/lithentHelper.umd.js +2 -2
  254. package/helper/dist/lithentHelper.umd.js.map +1 -1
  255. package/helper/dist/tests/cacheupdate-contract.d.cts +1 -0
  256. package/helper/dist/tests/cacheupdate-contract.d.ts +1 -0
  257. package/helper/dist/tests/cacheupdate.d.cts +1 -0
  258. package/helper/dist/tests/cacheupdate.d.ts +1 -0
  259. package/helper/dist/tests/computed.d.cts +1 -0
  260. package/helper/dist/tests/computed.d.ts +1 -0
  261. package/helper/dist/tests/context.d.cts +1 -0
  262. package/helper/dist/tests/context.d.ts +1 -0
  263. package/helper/dist/tests/contextRemoval.d.cts +1 -0
  264. package/helper/dist/tests/contextRemoval.d.ts +1 -0
  265. package/helper/dist/tests/effect.d.cts +1 -0
  266. package/helper/dist/tests/effect.d.ts +1 -0
  267. package/helper/dist/tests/laneInteraction.d.cts +1 -0
  268. package/helper/dist/tests/laneInteraction.d.ts +1 -0
  269. package/helper/dist/tests/lcontext.d.cts +1 -0
  270. package/helper/dist/tests/lcontext.d.ts +1 -0
  271. package/helper/dist/tests/lstore.d.cts +1 -0
  272. package/helper/dist/tests/lstore.d.ts +1 -0
  273. package/helper/dist/tests/renderprops.d.cts +1 -0
  274. package/helper/dist/tests/renderprops.d.ts +1 -0
  275. package/helper/dist/tests/state.d.cts +1 -0
  276. package/helper/dist/tests/state.d.ts +1 -0
  277. package/helper/dist/tests/store.d.cts +1 -0
  278. package/helper/dist/tests/store.d.ts +1 -0
  279. package/helper/dist/tests/store2.d.cts +1 -0
  280. package/helper/dist/tests/store2.d.ts +1 -0
  281. package/helper/dist/tests/storeObserver.d.cts +1 -0
  282. package/helper/dist/tests/storeObserver.d.ts +1 -0
  283. package/helper/dist/tests/storeOneValue.d.cts +1 -0
  284. package/helper/dist/tests/storeOneValue.d.ts +1 -0
  285. package/helper/dist/tests/storeVersion.d.cts +1 -0
  286. package/helper/dist/tests/storeVersion.d.ts +1 -0
  287. package/helper/dist/utils/children.d.cts +2 -2
  288. package/helper/dist/utils/children.d.ts +2 -2
  289. package/helper/dist/utils/types.d.cts +1 -1
  290. package/helper/dist/utils/types.d.ts +1 -1
  291. package/jsx-runtime/dist/index.d.cts +7 -8
  292. package/jsx-runtime/dist/index.d.ts +7 -8
  293. package/jsx-runtime/dist/jsxRuntime.cjs +2 -2
  294. package/jsx-runtime/dist/jsxRuntime.cjs.map +1 -1
  295. package/jsx-runtime/dist/jsxRuntime.mjs +20 -18
  296. package/jsx-runtime/dist/jsxRuntime.mjs.map +1 -1
  297. package/jsx-runtime/dist/jsxRuntime.umd.js +2 -2
  298. package/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  299. package/package.json +9 -5
  300. package/src/index.ts +1 -3
  301. package/src/tests/core-cleanupErrors.test.ts +310 -0
  302. package/src/utils/universalRef.ts +16 -1
  303. package/ssr/dist/helper/index.d.cts +1 -1
  304. package/ssr/dist/helper/index.d.ts +1 -1
  305. package/ssr/dist/hydration.d.cts +1 -1
  306. package/ssr/dist/hydration.d.ts +1 -1
  307. package/ssr/dist/index.d.cts +1 -1
  308. package/ssr/dist/index.d.ts +1 -1
  309. package/ssr/dist/lithentSsr.cjs +3 -3
  310. package/ssr/dist/lithentSsr.cjs.map +1 -1
  311. package/ssr/dist/lithentSsr.mjs +187 -182
  312. package/ssr/dist/lithentSsr.mjs.map +1 -1
  313. package/ssr/dist/lithentSsr.umd.js +3 -3
  314. package/ssr/dist/lithentSsr.umd.js.map +1 -1
  315. package/ssr/dist/renderToString.d.cts +1 -1
  316. package/ssr/dist/renderToString.d.ts +1 -1
  317. package/ssr/dist/tests/laneHydration.d.cts +1 -0
  318. package/ssr/dist/tests/laneHydration.d.ts +1 -0
  319. package/ssr/dist/tests/renderToString.test.d.cts +1 -0
  320. package/ssr/dist/tests/renderToString.test.d.ts +1 -0
  321. package/ssr/dist/tests/tostring.d.cts +1 -1
  322. package/ssr/dist/tests/tostring.d.ts +1 -1
  323. package/tag/dist/index.d.cts +8 -8
  324. package/tag/dist/index.d.ts +8 -8
  325. package/tag/dist/lithentTag.cjs +3 -3
  326. package/tag/dist/lithentTag.cjs.map +1 -1
  327. package/tag/dist/lithentTag.mjs +27 -27
  328. package/tag/dist/lithentTag.mjs.map +1 -1
  329. package/tag/dist/lithentTag.umd.js +3 -3
  330. package/tag/dist/lithentTag.umd.js.map +1 -1
  331. package/examples/dist/assets/index-Bs54zCvq.js +0 -2
  332. package/examples/dist/assets/index-Bs54zCvq.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { CompKey } from 'lithent';
1
+ import { CompKey } from 'lithent';
2
2
  export declare const enableComponentMapManualMode: () => void;
3
3
  export declare const disableComponentMapManualMode: () => void;
4
4
  export declare const removeComponentEntry: (compKey: CompKey) => void;
@@ -1,4 +1,4 @@
1
- import type { CompKey } from 'lithent';
1
+ import { CompKey } from 'lithent';
2
2
  export declare const enableComponentMapManualMode: () => void;
3
3
  export declare const disableComponentMapManualMode: () => void;
4
4
  export declare const removeComponentEntry: (compKey: CompKey) => void;
@@ -1,4 +1,4 @@
1
- import type { CompKey, TagFunction } from 'lithent';
1
+ import { CompKey, TagFunction } from 'lithent';
2
2
  export type BoundaryController = {
3
3
  register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;
4
4
  update: (nextCtor: TagFunction) => boolean;
@@ -7,4 +7,4 @@ export type BoundaryController = {
7
7
  export declare const registerBoundaryInstance: (moduleId: string, compKey: CompKey, callerCtor?: TagFunction) => () => void;
8
8
  export declare const disposeBoundary: (moduleId: string) => void;
9
9
  export declare const applyBoundaryUpdate: (moduleId: string, nextCtor: TagFunction) => boolean;
10
- export declare const createBoundary: (moduleId: string, onFailure?: ((reason: string) => void) | undefined, onApplied?: () => void) => BoundaryController;
10
+ export declare const createBoundary: (moduleId: string, onFailure?: (reason: string) => void, onApplied?: () => void) => BoundaryController;
@@ -1,4 +1,4 @@
1
- import type { CompKey, TagFunction } from 'lithent';
1
+ import { CompKey, TagFunction } from 'lithent';
2
2
  export type BoundaryController = {
3
3
  register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;
4
4
  update: (nextCtor: TagFunction) => boolean;
@@ -7,4 +7,4 @@ export type BoundaryController = {
7
7
  export declare const registerBoundaryInstance: (moduleId: string, compKey: CompKey, callerCtor?: TagFunction) => () => void;
8
8
  export declare const disposeBoundary: (moduleId: string) => void;
9
9
  export declare const applyBoundaryUpdate: (moduleId: string, nextCtor: TagFunction) => boolean;
10
- export declare const createBoundary: (moduleId: string, onFailure?: ((reason: string) => void) | undefined, onApplied?: () => void) => BoundaryController;
10
+ export declare const createBoundary: (moduleId: string, onFailure?: (reason: string) => void, onApplied?: () => void) => BoundaryController;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lithent");let M=0;const U=()=>{M+=1,d.setComponentMapManualMode(!0)},B=()=>{M=Math.max(0,M-1),M===0&&d.setComponentMapManualMode(!1)},g=n=>{d.disposeComponentEntry(n)},$=3,i=new Map,v=n=>{let e=i.get(n);return e||(e={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},i.set(n,e),U()),e},A=(n,e,t)=>{const a=v(n),l={callerCtor:t};return a.registrations.set(e,l),a.instances.add(e),queueMicrotask(()=>{var u;const s=d.componentMap.get(e),r=((u=s==null?void 0:s.vd)==null?void 0:u.value)??null;r&&i.get(n)===a&&a.registrations.get(e)===l&&a.domMap.set(e,r)}),()=>{const s=i.get(n);s!==a||s.registrations.get(e)!==l||(s.registrations.delete(e),s.instances.delete(e),s.domMap.delete(e))}},E=n=>{const e=i.get(n);if(e){i.delete(n);for(const[t,a]of Array.from(e.registrations))a.callerCtor||g(t);e.instances.clear(),e.registrations.clear(),e.domMap.clear(),B()}},q=(n,e)=>{const t=i.get(n);return t!=null&&t.instances.size?(t.pendingUpdate={ctor:e,instances:new Map(t.registrations),retryCount:0,updated:!1},t.scheduled||(t.scheduled=!0,queueMicrotask(()=>b(n,t))),!0):!1},b=(n,e)=>{var s,r,u;if(i.get(n)!==e)return;e.scheduled=!1;const t=e.pendingUpdate;if(!t)return;e.pendingUpdate=void 0;let a=!1;const l=Array.from(t.instances,([p,o])=>{var c,f;return{compKey:p,wDom:((f=(c=d.componentMap.get(p))==null?void 0:c.vd)==null?void 0:f.value)||e.domMap.get(p),registration:o}});if(t.instances.clear(),l.forEach(({compKey:p,wDom:o,registration:c})=>{if(i.get(n)!==e||e.registrations.get(p)!==c||o!=null&&o.il)return;if(!o||!o.el){t.instances.set(p,c);return}const{compProps:f,compChild:C}=o;if(!f||!C){t.instances.set(p,c);return}const h=c.callerCtor||t.ctor,w=o.ctor;!c.callerCtor&&w===h&&(o.ctor=void 0);try{c.callerCtor||g(p),d.replaceWDom(h,f,C,o),t.updated=!0}catch(R){a=!0,console.warn(`[Lithent HMR] boundary update 실패: ${n}`,R)}finally{o.ctor=w}}),i.get(n)===e){if(a?(s=e.onFailure)==null||s.call(e,`replacement failed: ${n}`):t.updated&&!t.instances.size&&((r=e.onApplied)==null||r.call(e)),!e.pendingUpdate&&!a&&t.instances.size){if(t.retryCount+=1,t.retryCount>$){console.warn(`[Lithent HMR] boundary update failed after ${t.retryCount} attempts; aborting: ${n}`),(u=e.onFailure)==null||u.call(e,`missing DOM after ${t.retryCount} attempts: ${n}`);return}e.pendingUpdate=t}e.pendingUpdate&&!e.scheduled&&(e.scheduled=!0,setTimeout(()=>b(n,e),0))}},z=(n,e,t)=>{const a=v(n);a.owners+=1,a.onFailure=e,a.onApplied=t;let l=!1;const s=()=>!l&&i.get(n)===a;return{register:(r,u)=>s()?A(n,r,u):()=>{},update:r=>s()&&q(n,r),dispose:()=>{s()&&(l=!0,a.owners-=1,a.owners||E(n))}}};exports.createBoundary=z;
2
- //# sourceMappingURL=lithentDevHelper.cjs.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("lithent");var t=0,n=()=>{t+=1,(0,e.setComponentMapManualMode)(!0)},r=()=>{t=Math.max(0,t-1),t===0&&(0,e.setComponentMapManualMode)(!1)},i=t=>{(0,e.disposeComponentEntry)(t)},a=3,o=new Map,s=e=>{let t=o.get(e);return t||(t={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},o.set(e,t),n()),t},c=(t,n,r)=>{let i=s(t),a={callerCtor:r};return i.registrations.set(n,a),i.instances.add(n),queueMicrotask(()=>{var r;let s=e.componentMap.get(n),c=(s==null||(r=s.vd)==null?void 0:r.value)??null;c&&o.get(t)===i&&i.registrations.get(n)===a&&i.domMap.set(n,c)}),()=>{let e=o.get(t);e===i&&e.registrations.get(n)===a&&(e.registrations.delete(n),e.instances.delete(n),e.domMap.delete(n))}},l=e=>{let t=o.get(e);if(t){o.delete(e);for(let[e,n]of Array.from(t.registrations))n.callerCtor||i(e);t.instances.clear(),t.registrations.clear(),t.domMap.clear(),r()}},u=(e,t)=>{let n=o.get(e);return n!=null&&n.instances.size?(n.pendingUpdate={ctor:t,instances:new Map(n.registrations),retryCount:0,updated:!1},n.scheduled||(n.scheduled=!0,queueMicrotask(()=>d(e,n))),!0):!1},d=(t,n)=>{var r,s;if(o.get(t)!==n)return;n.scheduled=!1;let c=n.pendingUpdate;if(!c)return;n.pendingUpdate=void 0;let l=!1,u=Array.from(c.instances,([t,r])=>{var i;return{compKey:t,wDom:((i=e.componentMap.get(t))==null||(i=i.vd)==null?void 0:i.value)||n.domMap.get(t),registration:r}});if(c.instances.clear(),u.forEach(({compKey:r,wDom:a,registration:s})=>{if(o.get(t)!==n||n.registrations.get(r)!==s||a!=null&&a.il)return;if(!a||!a.el){c.instances.set(r,s);return}let{compProps:u,compChild:d}=a;if(!u||!d){c.instances.set(r,s);return}let f=s.callerCtor||c.ctor,p=a.ctor;!s.callerCtor&&p===f&&(a.ctor=void 0);try{s.callerCtor||i(r),(0,e.replaceWDom)(f,u,d,a),c.updated=!0}catch(e){l=!0,console.warn(`[Lithent HMR] boundary update 실패: ${t}`,e)}finally{a.ctor=p}}),o.get(t)===n){if(l?(r=n.onFailure)==null||r.call(n,`replacement failed: ${t}`):c.updated&&!c.instances.size&&((s=n.onApplied)==null||s.call(n)),!n.pendingUpdate&&!l&&c.instances.size){if(c.retryCount+=1,c.retryCount>a){var f;console.warn(`[Lithent HMR] boundary update failed after ${c.retryCount} attempts; aborting: ${t}`),(f=n.onFailure)==null||f.call(n,`missing DOM after ${c.retryCount} attempts: ${t}`);return}n.pendingUpdate=c}n.pendingUpdate&&!n.scheduled&&(n.scheduled=!0,setTimeout(()=>d(t,n),0))}},f=(e,t,n)=>{let r=s(e);r.owners+=1,r.onFailure=t,r.onApplied=n;let i=!1,a=()=>!i&&o.get(e)===r;return{register:(t,n)=>a()?c(e,t,n):()=>{},update:t=>a()&&u(e,t),dispose:()=>{a()&&(i=!0,--r.owners,r.owners||l(e))}}};exports.createBoundary=f;
2
+ //# sourceMappingURL=lithentDevHelper.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithentDevHelper.cjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":"2GAGA,IAAIA,EAAqB,EAElB,MAAMC,EAA+B,IAAY,CAChCD,GAAA,EACtBE,EAAA,0BAA0B,EAAI,CAChC,EAEaC,EAAgC,IAAY,CACvDH,EAAqB,KAAK,IAAI,EAAGA,EAAqB,CAAC,EACnDA,IAAuB,GACzBE,EAAA,0BAA0B,EAAK,CAEnC,EAEaE,EAAwBC,GAA2B,CAC9DC,EAAA,sBAAsBD,CAAO,CAC/B,ECXME,EAAY,EAsBZC,MAAuB,IAEvBC,EAAeC,GAAuC,CACtD,IAAAC,EAAWH,EAAiB,IAAIE,CAAQ,EAE5C,OAAKC,IACQA,EAAA,CACT,cAAe,IACf,WAAY,IACZ,UAAW,GACX,OAAQ,EACR,kBAAmB,GAAI,EAERH,EAAA,IAAIE,EAAUC,CAAQ,EACVV,KAGxBU,CACT,EAQaC,EAA2B,CACtCF,EACAL,EACAQ,IACG,CACG,MAAAF,EAAWF,EAAYC,CAAQ,EAE/BI,EAAe,CAAE,WAAAD,GACd,OAAAF,EAAA,cAAc,IAAIN,EAASS,CAAY,EACvCH,EAAA,UAAU,IAAIN,CAAO,EAE9B,eAAe,IAAM,OACb,MAAAU,EAAQC,EAAAA,aAAa,IAAIX,CAAO,EAChCY,IAAcC,EAAAH,GAAA,YAAAA,EAAO,KAAP,YAAAG,EAAW,QAAS,KAGtCD,GAC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,WAAajB,EAAW,CACzB,QAAA,KACN,8CAA8CiB,EAAO,UAAU,wBAAwBd,CAAQ,EAAA,GAGxFuB,EAAAtB,EAAA,YAAA,MAAAsB,EAAA,KAAAtB,EACP,qBAAqBa,EAAO,UAAU,cAAcd,CAAQ,IAG9D,MACF,CACAC,EAAS,cAAgBa,CAC3B,CAEIb,EAAS,eAAiB,CAACA,EAAS,YACtCA,EAAS,UAAY,GACrB,WAAW,IAAMY,EAAcb,EAAUC,CAAQ,EAAG,CAAC,GAEzD,EAEauB,EAAiB,CAC5BxB,EACAyB,EACAC,IACuB,CACjB,MAAAzB,EAAWF,EAAYC,CAAQ,EACrCC,EAAS,QAAU,EACnBA,EAAS,UAAYwB,EACrBxB,EAAS,UAAYyB,EAErB,IAAIC,EAAW,GACf,MAAMC,EAAS,IAAM,CAACD,GAAY7B,EAAiB,IAAIE,CAAQ,IAAMC,EAC9D,MAAA,CACL,SAAU,CAACN,EAAkBQ,IAC3ByB,EAAA,EACI1B,EAAyBF,EAAUL,EAASQ,CAAU,EACtD,IAAM,CAAC,EACb,OAASS,GACPgB,EAAY,GAAAjB,EAAoBX,EAAUY,CAAQ,EACpD,QAAS,IAAM,CACRgB,MACMD,EAAA,GACX1B,EAAS,QAAU,EACdA,EAAS,QAAQS,EAAgBV,CAAQ,EAChD,CAAA,CAEJ"}
1
+ {"version":3,"file":"lithentDevHelper.cjs","names":["componentMap","lithent","manualModeRefCount","enableComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","error","_registry$onFailure2","createBoundary","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":"A,4FAGA,IAAIE,EAAqB,EAEZC,MAA2C,CACtD,GAAsB,GACtB,EAAAF,EAAA,0BAAA,CAA0B,EAAI,CAChC,EAEaG,MAA4C,CACvD,EAAqB,KAAK,IAAI,EAAGF,EAAqB,CAAC,EACnDA,IAAuB,IACzB,EAAAD,EAAA,0BAAA,CAA0B,EAAK,CAEnC,EAEaI,EAAwB,GAA2B,EAC9D,EAAAJ,EAAA,sBAAA,CAAsBK,CAAO,CAC/B,ECXMC,EAAY,EAsBZC,EAAmB,IAAI,IAEvBC,EAAe,GAAuC,CAC1D,IAAIC,EAAWF,EAAiB,IAAIG,CAAQ,EAc5C,OAZKD,IACH,EAAW,CACT,UAAW,IAAI,IACf,OAAQ,IAAI,IACZ,UAAW,GACX,OAAQ,EACR,cAAe,IAAI,GACrB,EACAF,EAAiB,IAAIG,EAAUD,CAAQ,EACvCP,EAA6B,GAGxBO,CACT,EAQaE,GACX,EACA,EACA,IACG,CACH,IAAMF,EAAWD,EAAYE,CAAQ,EAE/BE,EAAe,CAAE,YAAW,EAiBlC,OAhBAH,EAAS,cAAc,IAAIJ,EAASO,CAAY,EAChDH,EAAS,UAAU,IAAIJ,CAAO,EAE9B,mBAAqB,C,MACnB,IAAMS,EAAQf,EAAAA,aAAa,IAAIM,CAAO,EAChCU,GAAAD,GAAA,OAAA,EAAcA,EAAO,KAAA,KAAA,IAAA,GAAAD,EAAI,QAAS,KAGtCE,GACAR,EAAiB,IAAIG,CAAQ,IAAMD,GACnCA,EAAS,cAAc,IAAIJ,CAAO,IAAMO,GAExCH,EAAS,OAAO,IAAIJ,EAASU,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AuB,EAAA,KAAAvB,EACP,qBAAqBc,EAAO,WAAW,aAAab,GACtD,EAEA,MACF,CACA,EAAS,cAAgBa,CAC3B,CAEId,EAAS,eAAiB,CAACA,EAAS,YACtC,EAAS,UAAY,GACrB,eAAiBW,EAAcV,EAAUD,CAAQ,EAAG,CAAC,EAtBiB,CAwB1E,EAEawB,GACX,EACA,EACA,IACuB,CACvB,IAAMxB,EAAWD,EAAYE,CAAQ,EACrC,EAAS,QAAU,EACnB,EAAS,UAAYwB,EACrB,EAAS,UAAYC,EAErB,IAAIC,EAAW,GACTC,MAAe,CAACD,GAAY7B,EAAiB,IAAIG,CAAQ,IAAMD,EACrE,MAAO,CACL,UAAW,EAAkB,IAC3B4B,EAAO,EACH1B,EAAyBD,EAAUL,EAASiC,CAAU,MAChD,CAAC,EACb,OAAS,GACPD,EAAO,GAAKnB,EAAoBR,EAAUS,CAAQ,EACpD,YAAe,CACRkB,EAAO,IACZ,EAAW,GACX,IAAS,OACJ5B,EAAS,QAAQQ,EAAgBP,CAAQ,EAChD,CACF,CACF,E"}
@@ -1,113 +1,103 @@
1
- import { setComponentMapManualMode as w, disposeComponentEntry as $, componentMap as g, replaceWDom as A } from "lithent";
2
- let u = 0;
3
- const B = () => {
4
- u += 1, w(!0);
5
- }, E = () => {
6
- u = Math.max(0, u - 1), u === 0 && w(!1);
7
- }, v = (n) => {
8
- $(n);
9
- }, z = 3, i = /* @__PURE__ */ new Map(), R = (n) => {
10
- let e = i.get(n);
11
- return e || (e = {
12
- instances: /* @__PURE__ */ new Set(),
13
- domMap: /* @__PURE__ */ new Map(),
14
- scheduled: !1,
15
- owners: 0,
16
- registrations: /* @__PURE__ */ new Map()
17
- }, i.set(n, e), B()), e;
18
- }, F = (n, e, t) => {
19
- const a = R(n), l = { callerCtor: t };
20
- return a.registrations.set(e, l), a.instances.add(e), queueMicrotask(() => {
21
- var f;
22
- const s = g.get(e), r = ((f = s == null ? void 0 : s.vd) == null ? void 0 : f.value) ?? null;
23
- r && i.get(n) === a && a.registrations.get(e) === l && a.domMap.set(e, r);
24
- }), () => {
25
- const s = i.get(n);
26
- s !== a || s.registrations.get(e) !== l || (s.registrations.delete(e), s.instances.delete(e), s.domMap.delete(e));
27
- };
28
- }, k = (n) => {
29
- const e = i.get(n);
30
- if (e) {
31
- i.delete(n);
32
- for (const [t, a] of Array.from(e.registrations))
33
- a.callerCtor || v(t);
34
- e.instances.clear(), e.registrations.clear(), e.domMap.clear(), E();
35
- }
36
- }, q = (n, e) => {
37
- const t = i.get(n);
38
- return t != null && t.instances.size ? (t.pendingUpdate = {
39
- ctor: e,
40
- instances: new Map(t.registrations),
41
- retryCount: 0,
42
- updated: !1
43
- }, t.scheduled || (t.scheduled = !0, queueMicrotask(() => U(n, t))), !0) : !1;
44
- }, U = (n, e) => {
45
- var s, r, f;
46
- if (i.get(n) !== e) return;
47
- e.scheduled = !1;
48
- const t = e.pendingUpdate;
49
- if (!t) return;
50
- e.pendingUpdate = void 0;
51
- let a = !1;
52
- const l = Array.from(t.instances, ([p, o]) => {
53
- var c, d;
54
- return {
55
- compKey: p,
56
- wDom: ((d = (c = g.get(p)) == null ? void 0 : c.vd) == null ? void 0 : d.value) || e.domMap.get(p),
57
- registration: o
58
- };
59
- });
60
- if (t.instances.clear(), l.forEach(({ compKey: p, wDom: o, registration: c }) => {
61
- if (i.get(n) !== e || e.registrations.get(p) !== c || o != null && o.il)
62
- return;
63
- if (!o || !o.el) {
64
- t.instances.set(p, c);
65
- return;
66
- }
67
- const { compProps: d, compChild: M } = o;
68
- if (!d || !M) {
69
- t.instances.set(p, c);
70
- return;
71
- }
72
- const C = c.callerCtor || t.ctor, h = o.ctor;
73
- !c.callerCtor && h === C && (o.ctor = void 0);
74
- try {
75
- c.callerCtor || v(p), A(C, d, M, o), t.updated = !0;
76
- } catch (b) {
77
- a = !0, console.warn(`[Lithent HMR] boundary update 실패: ${n}`, b);
78
- } finally {
79
- o.ctor = h;
80
- }
81
- }), i.get(n) === e) {
82
- if (a ? (s = e.onFailure) == null || s.call(e, `replacement failed: ${n}`) : t.updated && !t.instances.size && ((r = e.onApplied) == null || r.call(e)), !e.pendingUpdate && !a && t.instances.size) {
83
- if (t.retryCount += 1, t.retryCount > z) {
84
- console.warn(
85
- `[Lithent HMR] boundary update failed after ${t.retryCount} attempts; aborting: ${n}`
86
- ), (f = e.onFailure) == null || f.call(
87
- e,
88
- `missing DOM after ${t.retryCount} attempts: ${n}`
89
- );
90
- return;
91
- }
92
- e.pendingUpdate = t;
93
- }
94
- e.pendingUpdate && !e.scheduled && (e.scheduled = !0, setTimeout(() => U(n, e), 0));
95
- }
96
- }, H = (n, e, t) => {
97
- const a = R(n);
98
- a.owners += 1, a.onFailure = e, a.onApplied = t;
99
- let l = !1;
100
- const s = () => !l && i.get(n) === a;
101
- return {
102
- register: (r, f) => s() ? F(n, r, f) : () => {
103
- },
104
- update: (r) => s() && q(n, r),
105
- dispose: () => {
106
- s() && (l = !0, a.owners -= 1, a.owners || k(n));
107
- }
108
- };
1
+ import { componentMap as e, disposeComponentEntry as t, replaceWDom as n, setComponentMapManualMode as r } from "lithent";
2
+ // src/componentMapControl.ts
3
+ var i = 0, a = () => {
4
+ i += 1, r(!0);
5
+ }, o = () => {
6
+ i = Math.max(0, i - 1), i === 0 && r(!1);
7
+ }, s = (e) => {
8
+ t(e);
9
+ }, c = 3, l = /* @__PURE__ */ new Map(), u = (e) => {
10
+ let t = l.get(e);
11
+ return t || (t = {
12
+ instances: /* @__PURE__ */ new Set(),
13
+ domMap: /* @__PURE__ */ new Map(),
14
+ scheduled: !1,
15
+ owners: 0,
16
+ registrations: /* @__PURE__ */ new Map()
17
+ }, l.set(e, t), a()), t;
18
+ }, d = (t, n, r) => {
19
+ let i = u(t), a = { callerCtor: r };
20
+ return i.registrations.set(n, a), i.instances.add(n), queueMicrotask(() => {
21
+ var r;
22
+ let o = e.get(n), s = (o == null || (r = o.vd) == null ? void 0 : r.value) ?? null;
23
+ s && l.get(t) === i && i.registrations.get(n) === a && i.domMap.set(n, s);
24
+ }), () => {
25
+ let e = l.get(t);
26
+ e === i && e.registrations.get(n) === a && (e.registrations.delete(n), e.instances.delete(n), e.domMap.delete(n));
27
+ };
28
+ }, f = (e) => {
29
+ let t = l.get(e);
30
+ if (t) {
31
+ l.delete(e);
32
+ for (let [e, n] of Array.from(t.registrations)) n.callerCtor || s(e);
33
+ t.instances.clear(), t.registrations.clear(), t.domMap.clear(), o();
34
+ }
35
+ }, p = (e, t) => {
36
+ let n = l.get(e);
37
+ return n != null && n.instances.size ? (n.pendingUpdate = {
38
+ ctor: t,
39
+ instances: new Map(n.registrations),
40
+ retryCount: 0,
41
+ updated: !1
42
+ }, n.scheduled || (n.scheduled = !0, queueMicrotask(() => m(e, n))), !0) : !1;
43
+ }, m = (t, r) => {
44
+ var i, a;
45
+ if (l.get(t) !== r) return;
46
+ r.scheduled = !1;
47
+ let o = r.pendingUpdate;
48
+ if (!o) return;
49
+ r.pendingUpdate = void 0;
50
+ let u = !1, d = Array.from(o.instances, ([t, n]) => {
51
+ var i;
52
+ return {
53
+ compKey: t,
54
+ wDom: ((i = e.get(t)) == null || (i = i.vd) == null ? void 0 : i.value) || r.domMap.get(t),
55
+ registration: n
56
+ };
57
+ });
58
+ if (o.instances.clear(), d.forEach(({ compKey: e, wDom: i, registration: a }) => {
59
+ if (l.get(t) !== r || r.registrations.get(e) !== a || i != null && i.il) return;
60
+ if (!i || !i.el) {
61
+ o.instances.set(e, a);
62
+ return;
63
+ }
64
+ let { compProps: c, compChild: d } = i;
65
+ if (!c || !d) {
66
+ o.instances.set(e, a);
67
+ return;
68
+ }
69
+ let f = a.callerCtor || o.ctor, p = i.ctor;
70
+ !a.callerCtor && p === f && (i.ctor = void 0);
71
+ try {
72
+ a.callerCtor || s(e), n(f, c, d, i), o.updated = !0;
73
+ } catch (e) {
74
+ u = !0, console.warn(`[Lithent HMR] boundary update 실패: ${t}`, e);
75
+ } finally {
76
+ i.ctor = p;
77
+ }
78
+ }), l.get(t) === r) {
79
+ if (u ? (i = r.onFailure) == null || i.call(r, `replacement failed: ${t}`) : o.updated && !o.instances.size && ((a = r.onApplied) == null || a.call(r)), !r.pendingUpdate && !u && o.instances.size) {
80
+ if (o.retryCount += 1, o.retryCount > c) {
81
+ var f;
82
+ console.warn(`[Lithent HMR] boundary update failed after ${o.retryCount} attempts; aborting: ${t}`), (f = r.onFailure) == null || f.call(r, `missing DOM after ${o.retryCount} attempts: ${t}`);
83
+ return;
84
+ }
85
+ r.pendingUpdate = o;
86
+ }
87
+ r.pendingUpdate && !r.scheduled && (r.scheduled = !0, setTimeout(() => m(t, r), 0));
88
+ }
89
+ }, h = (e, t, n) => {
90
+ let r = u(e);
91
+ r.owners += 1, r.onFailure = t, r.onApplied = n;
92
+ let i = !1, a = () => !i && l.get(e) === r;
93
+ return {
94
+ register: (t, n) => a() ? d(e, t, n) : () => {},
95
+ update: (t) => a() && p(e, t),
96
+ dispose: () => {
97
+ a() && (i = !0, --r.owners, r.owners || f(e));
98
+ }
99
+ };
109
100
  };
110
- export {
111
- H as createBoundary
112
- };
113
- //# sourceMappingURL=lithentDevHelper.mjs.map
101
+ export { h as createBoundary };
102
+
103
+ //# sourceMappingURL=lithentDevHelper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithentDevHelper.mjs","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","_b","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":";AAGA,IAAIA,IAAqB;AAElB,MAAMC,IAA+B,MAAY;AAChC,EAAAD,KAAA,GACtBE,EAA0B,EAAI;AAChC,GAEaC,IAAgC,MAAY;AACvD,EAAAH,IAAqB,KAAK,IAAI,GAAGA,IAAqB,CAAC,GACnDA,MAAuB,KACzBE,EAA0B,EAAK;AAEnC,GAEaE,IAAuB,CAACC,MAA2B;AAC9D,EAAAC,EAAsBD,CAAO;AAC/B,GCXME,IAAY,GAsBZC,wBAAuB,OAEvBC,IAAc,CAACC,MAAuC;AACtD,MAAAC,IAAWH,EAAiB,IAAIE,CAAQ;AAE5C,SAAKC,MACQA,IAAA;AAAA,IACT,+BAAe,IAAI;AAAA,IACnB,4BAAY,IAAI;AAAA,IAChB,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,mCAAmB,IAAI;AAAA,EAAA,GAERH,EAAA,IAAIE,GAAUC,CAAQ,GACVV,MAGxBU;AACT,GAQaC,IAA2B,CACtCF,GACAL,GACAQ,MACG;AACG,QAAAF,IAAWF,EAAYC,CAAQ,GAE/BI,IAAe,EAAE,YAAAD;AACd,SAAAF,EAAA,cAAc,IAAIN,GAASS,CAAY,GACvCH,EAAA,UAAU,IAAIN,CAAO,GAE9B,eAAe,MAAM;;AACb,UAAAU,IAAQC,EAAa,IAAIX,CAAO,GAChCY,MAAcC,IAAAH,KAAA,gBAAAA,EAAO,OAAP,gBAAAG,EAAW,UAAS;AAGtC,IAAAD,KACAT,EAAiB,IAAIE,CAAQ,MAAMC,KACnCA,EAAS,cAAc,IAAIN,CAAO,MAAMS,KAE/BH,EAAA,OAAO,IAAIN,GAASY,CAAW;AAAA,EAC1C,CACD,GAEM,MAAM;AACL,UAAAE,IAAkBX,EA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,cAAc,GAEjBA,EAAO,aAAajB,GAAW;AACzB,gBAAA;AAAA,UACN,8CAA8CiB,EAAO,UAAU,wBAAwBd,CAAQ;AAAA,QAAA,IAGxFwB,IAAAvB,EAAA,cAAA,QAAAuB,EAAA;AAAA,UAAAvB;AAAA,UACP,qBAAqBa,EAAO,UAAU,cAAcd,CAAQ;AAAA;AAG9D;AAAA,MACF;AACA,MAAAC,EAAS,gBAAgBa;AAAA,IAC3B;AAEA,IAAIb,EAAS,iBAAiB,CAACA,EAAS,cACtCA,EAAS,YAAY,IACrB,WAAW,MAAMY,EAAcb,GAAUC,CAAQ,GAAG,CAAC;AAAA;AAEzD,GAEawB,IAAiB,CAC5BzB,GACA0B,GACAC,MACuB;AACjB,QAAA1B,IAAWF,EAAYC,CAAQ;AACrC,EAAAC,EAAS,UAAU,GACnBA,EAAS,YAAYyB,GACrBzB,EAAS,YAAY0B;AAErB,MAAIC,IAAW;AACf,QAAMC,IAAS,MAAM,CAACD,KAAY9B,EAAiB,IAAIE,CAAQ,MAAMC;AAC9D,SAAA;AAAA,IACL,UAAU,CAACN,GAAkBQ,MAC3B0B,EAAA,IACI3B,EAAyBF,GAAUL,GAASQ,CAAU,IACtD,MAAM;AAAA,IAAC;AAAA,IACb,QAAQ,CAACS,MACPiB,EAAY,KAAAlB,EAAoBX,GAAUY,CAAQ;AAAA,IACpD,SAAS,MAAM;AACT,MAACiB,QACMD,IAAA,IACX3B,EAAS,UAAU,GACdA,EAAS,UAAQS,EAAgBV,CAAQ;AAAA,IAChD;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"lithentDevHelper.mjs","names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","componentMap","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","replaceWDom","error","_registry$onFailure2","createBoundary","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":";;AAGA,IAAIA,IAAqB,GAEZC,UAA2C;CAEtD,AADA,KAAsB,GACtBC,EAA0B,EAAI;AAChC,GAEaC,UAA4C;CAEvD,AADA,IAAqB,KAAK,IAAI,GAAGH,IAAqB,CAAC,GACnDA,MAAuB,KACzBE,EAA0B,EAAK;AAEnC,GAEaE,KAAwB,MAA2B;CAC9D,EAAsBC,CAAO;AAC/B,GCXMC,IAAY,GAsBZC,oBAAmB,IAAI,IAA8B,GAErDC,KAAe,MAAuC;CAC1D,IAAIC,IAAWF,EAAiB,IAAIG,CAAQ;CAc5C,OAZKD,MACH,IAAW;EACT,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,WAAW;EACX,QAAQ;EACR,+BAAe,IAAI,IAAI;CACzB,GACAF,EAAiB,IAAIG,GAAUD,CAAQ,GACvCR,EAA6B,IAGxBQ;AACT,GAQaE,KACX,GACA,GACA,MACG;CACH,IAAMF,IAAWD,EAAYE,CAAQ,GAE/BE,IAAe,EAAE,cAAW;CAiBlC,OAhBAH,EAAS,cAAc,IAAIJ,GAASO,CAAY,GAChDH,EAAS,UAAU,IAAIJ,CAAO,GAE9B,qBAAqB;;EACnB,IAAMS,IAAQC,EAAa,IAAIV,CAAO,GAChCW,KAAAF,KAAA,SAAA,IAAcA,EAAO,OAAA,OAAA,KAAA,IAAAD,E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U,MAAM;GAG/D,IAFA,EAAO,cAAc,GAEjBA,EAAO,aAAalB,GAAW;;IAKjC,AAJA,QAAQ,KACN,8CAA8CkB,EAAO,WAAW,uBAAuBd,GACzF,IAEA,IAAAD,EAAS,cAAA,QAAAyB,EAAA,KAAAzB,GACP,qBAAqBe,EAAO,WAAW,aAAad,GACtD;IAEA;GACF;GACA,EAAS,gBAAgBc;EAC3B;EAEA,AAAIf,EAAS,iBAAiB,CAACA,EAAS,cACtC,EAAS,YAAY,IACrB,iBAAiBY,EAAcX,GAAUD,CAAQ,GAAG,CAAC;CAtBiB;AAwB1E,GAEa0B,KACX,GACA,GACA,MACuB;CACvB,IAAM1B,IAAWD,EAAYE,CAAQ;CAGrC,AAFA,EAAS,UAAU,GACnB,EAAS,YAAY0B,GACrB,EAAS,YAAYC;CAErB,IAAIC,IAAW,IACTC,UAAe,CAACD,KAAY/B,EAAiB,IAAIG,CAAQ,MAAMD;CACrE,OAAO;EACL,WAAW,GAAkB,MAC3B8B,EAAO,IACH5B,EAAyBD,GAAUL,GAASmC,CAAU,UAChD,CAAC;EACb,SAAS,MACPD,EAAO,KAAKpB,EAAoBT,GAAUU,CAAQ;EACpD,eAAe;GACb,AAAKmB,EAAO,MACZ,IAAW,IACX,IAAS,QACJ9B,EAAS,UAAQS,EAAgBR,CAAQ;EAChD;CACF;AACF"}
@@ -1,2 +1,2 @@
1
- (function(u,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("lithent")):typeof define=="function"&&define.amd?define(["exports","lithent"],r):(u=typeof globalThis<"u"?globalThis:u||self,r(u.lithentDevHelper={},u.lithent))})(this,function(u,r){"use strict";let C=0;const U=()=>{C+=1,r.setComponentMapManualMode(!0)},B=()=>{C=Math.max(0,C-1),C===0&&r.setComponentMapManualMode(!1)},h=n=>{r.disposeComponentEntry(n)},$=3,i=new Map,w=n=>{let e=i.get(n);return e||(e={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},i.set(n,e),U()),e},A=(n,e,t)=>{const a=w(n),d={callerCtor:t};return a.registrations.set(e,d),a.instances.add(e),queueMicrotask(()=>{var l;const s=r.componentMap.get(e),c=((l=s==null?void 0:s.vd)==null?void 0:l.value)??null;c&&i.get(n)===a&&a.registrations.get(e)===d&&a.domMap.set(e,c)}),()=>{const s=i.get(n);s!==a||s.registrations.get(e)!==d||(s.registrations.delete(e),s.instances.delete(e),s.domMap.delete(e))}},T=n=>{const e=i.get(n);if(e){i.delete(n);for(const[t,a]of Array.from(e.registrations))a.callerCtor||h(t);e.instances.clear(),e.registrations.clear(),e.domMap.clear(),B()}},E=(n,e)=>{const t=i.get(n);return t!=null&&t.instances.size?(t.pendingUpdate={ctor:e,instances:new Map(t.registrations),retryCount:0,updated:!1},t.scheduled||(t.scheduled=!0,queueMicrotask(()=>g(n,t))),!0):!1},g=(n,e)=>{var s,c,l;if(i.get(n)!==e)return;e.scheduled=!1;const t=e.pendingUpdate;if(!t)return;e.pendingUpdate=void 0;let a=!1;const d=Array.from(t.instances,([f,o])=>{var p,M;return{compKey:f,wDom:((M=(p=r.componentMap.get(f))==null?void 0:p.vd)==null?void 0:M.value)||e.domMap.get(f),registration:o}});if(t.instances.clear(),d.forEach(({compKey:f,wDom:o,registration:p})=>{if(i.get(n)!==e||e.registrations.get(f)!==p||o!=null&&o.il)return;if(!o||!o.el){t.instances.set(f,p);return}const{compProps:M,compChild:v}=o;if(!M||!v){t.instances.set(f,p);return}const b=p.callerCtor||t.ctor,R=o.ctor;!p.callerCtor&&R===b&&(o.ctor=void 0);try{p.callerCtor||h(f),r.replaceWDom(b,M,v,o),t.updated=!0}catch(x){a=!0,console.warn(`[Lithent HMR] boundary update 실패: ${n}`,x)}finally{o.ctor=R}}),i.get(n)===e){if(a?(s=e.onFailure)==null||s.call(e,`replacement failed: ${n}`):t.updated&&!t.instances.size&&((c=e.onApplied)==null||c.call(e)),!e.pendingUpdate&&!a&&t.instances.size){if(t.retryCount+=1,t.retryCount>$){console.warn(`[Lithent HMR] boundary update failed after ${t.retryCount} attempts; aborting: ${n}`),(l=e.onFailure)==null||l.call(e,`missing DOM after ${t.retryCount} attempts: ${n}`);return}e.pendingUpdate=t}e.pendingUpdate&&!e.scheduled&&(e.scheduled=!0,setTimeout(()=>g(n,e),0))}},q=(n,e,t)=>{const a=w(n);a.owners+=1,a.onFailure=e,a.onApplied=t;let d=!1;const s=()=>!d&&i.get(n)===a;return{register:(c,l)=>s()?A(n,c,l):()=>{},update:c=>s()&&E(n,c),dispose:()=>{s()&&(d=!0,a.owners-=1,a.owners||T(n))}}};u.createBoundary=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
2
- //# sourceMappingURL=lithentDevHelper.umd.js.map
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("lithent")):typeof define==`function`&&define.amd?define([`exports`,`lithent`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.lithentDevHelper={},e.lithent))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=0,r=()=>{n+=1,(0,t.setComponentMapManualMode)(!0)},i=()=>{n=Math.max(0,n-1),n===0&&(0,t.setComponentMapManualMode)(!1)},a=e=>{(0,t.disposeComponentEntry)(e)},o=3,s=new Map,c=e=>{let t=s.get(e);return t||(t={instances:new Set,domMap:new Map,scheduled:!1,owners:0,registrations:new Map},s.set(e,t),r()),t},l=(e,n,r)=>{let i=c(e),a={callerCtor:r};return i.registrations.set(n,a),i.instances.add(n),queueMicrotask(()=>{var r;let o=t.componentMap.get(n),c=(o==null||(r=o.vd)==null?void 0:r.value)??null;c&&s.get(e)===i&&i.registrations.get(n)===a&&i.domMap.set(n,c)}),()=>{let t=s.get(e);t===i&&t.registrations.get(n)===a&&(t.registrations.delete(n),t.instances.delete(n),t.domMap.delete(n))}},u=e=>{let t=s.get(e);if(t){s.delete(e);for(let[e,n]of Array.from(t.registrations))n.callerCtor||a(e);t.instances.clear(),t.registrations.clear(),t.domMap.clear(),i()}},d=(e,t)=>{let n=s.get(e);return n!=null&&n.instances.size?(n.pendingUpdate={ctor:t,instances:new Map(n.registrations),retryCount:0,updated:!1},n.scheduled||(n.scheduled=!0,queueMicrotask(()=>f(e,n))),!0):!1},f=(e,n)=>{var r,i;if(s.get(e)!==n)return;n.scheduled=!1;let c=n.pendingUpdate;if(!c)return;n.pendingUpdate=void 0;let l=!1,u=Array.from(c.instances,([e,r])=>{var i;return{compKey:e,wDom:((i=t.componentMap.get(e))==null||(i=i.vd)==null?void 0:i.value)||n.domMap.get(e),registration:r}});if(c.instances.clear(),u.forEach(({compKey:r,wDom:i,registration:o})=>{if(s.get(e)!==n||n.registrations.get(r)!==o||i!=null&&i.il)return;if(!i||!i.el){c.instances.set(r,o);return}let{compProps:u,compChild:d}=i;if(!u||!d){c.instances.set(r,o);return}let f=o.callerCtor||c.ctor,p=i.ctor;!o.callerCtor&&p===f&&(i.ctor=void 0);try{o.callerCtor||a(r),(0,t.replaceWDom)(f,u,d,i),c.updated=!0}catch(t){l=!0,console.warn(`[Lithent HMR] boundary update 실패: ${e}`,t)}finally{i.ctor=p}}),s.get(e)===n){if(l?(r=n.onFailure)==null||r.call(n,`replacement failed: ${e}`):c.updated&&!c.instances.size&&((i=n.onApplied)==null||i.call(n)),!n.pendingUpdate&&!l&&c.instances.size){if(c.retryCount+=1,c.retryCount>o){var d;console.warn(`[Lithent HMR] boundary update failed after ${c.retryCount} attempts; aborting: ${e}`),(d=n.onFailure)==null||d.call(n,`missing DOM after ${c.retryCount} attempts: ${e}`);return}n.pendingUpdate=c}n.pendingUpdate&&!n.scheduled&&(n.scheduled=!0,setTimeout(()=>f(e,n),0))}};e.createBoundary=(e,t,n)=>{let r=c(e);r.owners+=1,r.onFailure=t,r.onApplied=n;let i=!1,a=()=>!i&&s.get(e)===r;return{register:(t,n)=>a()?l(e,t,n):()=>{},update:t=>a()&&d(e,t),dispose:()=>{a()&&(i=!0,--r.owners,r.owners||u(e))}}}});
2
+ //# sourceMappingURL=lithentDevHelper.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lithentDevHelper.umd.js","sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"names":["manualModeRefCount","enableComponentMapManualMode","setComponentMapManualMode","disableComponentMapManualMode","removeComponentEntry","compKey","disposeComponentEntry","MAX_RETRY","boundaryRegistry","getRegistry","moduleId","registry","registerBoundaryInstance","callerCtor","registration","entry","componentMap","currentWDom","_a","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","update","failed","instances","compProps","compChild","ctor","previousCtor","replaceWDom","error","_c","createBoundary","onFailure","onApplied","disposed","active"],"mappings":"iRAGA,IAAIA,EAAqB,EAElB,MAAMC,EAA+B,IAAY,CAChCD,GAAA,EACtBE,EAAA,0BAA0B,EAAI,CAChC,EAEaC,EAAgC,IAAY,CACvDH,EAAqB,KAAK,IAAI,EAAGA,EAAqB,CAAC,EACnDA,IAAuB,GACzBE,EAAA,0BAA0B,EAAK,CAEnC,EAEaE,EAAwBC,GAA2B,CAC9DC,EAAA,sBAAsBD,CAAO,CAC/B,ECXME,EAAY,EAsBZC,MAAuB,IAEvBC,EAAeC,GAAuC,CACtD,IAAAC,EAAWH,EAAiB,IAAIE,CAAQ,EAE5C,OAAKC,IACQA,EAAA,CACT,cAAe,IACf,WAAY,IACZ,UAAW,GACX,OAAQ,EACR,kBAAmB,GAAI,EAERH,EAAA,IAAIE,EAAUC,CAAQ,EACVV,KAGxBU,CACT,EAQaC,EAA2B,CACtCF,EACAL,EACAQ,IACG,CACG,MAAAF,EAAWF,EAAYC,CAAQ,EAE/BI,E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,IAAMC,EAKvC,IAJIc,GAAQP,EAAAP,EAAS,YAAT,MAAAO,EAAA,KAAAP,EAAqB,uBAAuBD,CAAQ,IACvDc,EAAO,SAAW,CAACA,EAAO,UAAU,YAAe,6BAGxD,CAACb,EAAS,eAAiB,CAACc,GAAUD,EAAO,UAAU,KAAM,CAG3D,GAFJA,EAAO,YAAc,EAEjBA,EAAO,WAAajB,EAAW,CACzB,QAAA,KACN,8CAA8CiB,EAAO,UAAU,wBAAwBd,CAAQ,EAAA,GAGxFuB,EAAAtB,EAAA,YAAA,MAAAsB,EAAA,KAAAtB,EACP,qBAAqBa,EAAO,UAAU,cAAcd,CAAQ,IAG9D,MACF,CACAC,EAAS,cAAgBa,CAC3B,CAEIb,EAAS,eAAiB,CAACA,EAAS,YACtCA,EAAS,UAAY,GACrB,WAAW,IAAMY,EAAcb,EAAUC,CAAQ,EAAG,CAAC,GAEzD,EAEauB,EAAiB,CAC5BxB,EACAyB,EACAC,IACuB,CACjB,MAAAzB,EAAWF,EAAYC,CAAQ,EACrCC,EAAS,QAAU,EACnBA,EAAS,UAAYwB,EACrBxB,EAAS,UAAYyB,EAErB,IAAIC,EAAW,GACf,MAAMC,EAAS,IAAM,CAACD,GAAY7B,EAAiB,IAAIE,CAAQ,IAAMC,EAC9D,MAAA,CACL,SAAU,CAACN,EAAkBQ,IAC3ByB,EAAA,EACI1B,EAAyBF,EAAUL,EAASQ,CAAU,EACtD,IAAM,CAAC,EACb,OAASS,GACPgB,EAAY,GAAAjB,EAAoBX,EAAUY,CAAQ,EACpD,QAAS,IAAM,CACRgB,MACMD,EAAA,GACX1B,EAAS,QAAU,EACdA,EAAS,QAAQS,EAAgBV,CAAQ,EAChD,CAAA,CAEJ"}
1
+ {"version":3,"file":"lithentDevHelper.umd.js","names":["componentMap","factory","global","exports","manualModeRefCount","enableComponentMapManualMode","lithent","disableComponentMapManualMode","removeComponentEntry","compKey","MAX_RETRY","boundaryRegistry","getRegistry","registry","moduleId","registerBoundaryInstance","registration","_entry$vd","entry","currentWDom","currentRegistry","disposeBoundary","applyBoundaryUpdate","nextCtor","flushBoundary","_registry$onFailure","_registry$onApplied","update","failed","instances","_componentMap$get","compProps","compChild","ctor","previousCtor","error","_registry$onFailure2","onFailure","onApplied","disposed","active","callerCtor"],"sources":["../src/componentMapControl.ts","../src/createBoundary.ts"],"sourcesContent":["import type { CompKey } from 'lithent';\nimport { setComponentMapManualMode, disposeComponentEntry } from 'lithent';\n\nlet manualModeRefCount = 0;\n\nexport const enableComponentMapManualMode = (): void => {\n manualModeRefCount += 1;\n setComponentMapManualMode(true);\n};\n\nexport const disableComponentMapManualMode = (): void => {\n manualModeRefCount = Math.max(0, manualModeRefCount - 1);\n if (manualModeRefCount === 0) {\n setComponentMapManualMode(false);\n }\n};\n\nexport const removeComponentEntry = (compKey: CompKey): void => {\n disposeComponentEntry(compKey);\n};\n","import type { CompKey, TagFunction, WDom } from 'lithent';\nimport { componentMap, replaceWDom } from 'lithent';\nimport {\n disableComponentMapManualMode,\n enableComponentMapManualMode,\n removeComponentEntry,\n} from './componentMapControl';\n\nconst MAX_RETRY = 3;\n\ntype Registration = { callerCtor?: TagFunction };\n\ntype PendingUpdate = {\n ctor: TagFunction;\n instances: Map<CompKey, Registration>;\n retryCount: number;\n updated: boolean;\n};\n\ntype InstanceRegistry = {\n instances: Set<CompKey>;\n domMap: Map<CompKey, WDom>;\n scheduled: boolean;\n pendingUpdate?: PendingUpdate;\n owners: number;\n registrations: Map<CompKey, Registration>;\n onFailure?: (reason: string) => void;\n onApplied?: () => void;\n};\n\nconst boundaryRegistry = new Map<string, InstanceRegistry>();\n\nconst getRegistry = (moduleId: string): InstanceRegistry => {\n let registry = boundaryRegistry.get(moduleId);\n\n if (!registry) {\n registry = {\n instances: new Set(),\n domMap: new Map(),\n scheduled: false,\n owners: 0,\n registrations: new Map(),\n };\n boundaryRegistry.set(moduleId, registry);\n enableComponentMapManualMode();\n }\n\n return registry;\n};\n\nexport type BoundaryController = {\n register: (compKey: CompKey, callerCtor?: TagFunction) => () => void;\n update: (nextCtor: TagFunction) => boolean;\n dispose: () => void;\n};\n\nexport const registerBoundaryInstance = (\n moduleId: string,\n compKey: CompKey,\n callerCtor?: TagFunction\n) => {\n const registry = getRegistry(moduleId);\n\n const registration = { callerCtor };\n registry.registrations.set(compKey, registration);\n registry.instances.add(compKey);\n\n queueMicrotask(() => {\n const entry = componentMap.get(compKey);\n const currentWDom = entry?.vd?.value ?? null;\n\n if (\n currentWDom &&\n boundaryRegistry.get(moduleId) === registry &&\n registry.registrations.get(compKey) === registration\n ) {\n registry.domMap.set(compKey, currentWDom);\n }\n });\n\n return () => {\n const currentRegistry = boundaryRegistry.get(moduleId);\n if (\n currentRegistry !== registry ||\n currentRegistry.registrations.get(compKey) !== registration\n )\n return;\n\n currentRegistry.registrations.delete(compKey);\n currentRegistry.instances.delete(compKey);\n currentRegistry.domMap.delete(compKey);\n };\n};\n\nexport const disposeBoundary = (moduleId: string) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry) return;\n boundaryRegistry.delete(moduleId);\n for (const [compKey, registration] of Array.from(registry.registrations)) {\n // A direct call observes its caller; it does not own that caller's lifetime.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n }\n registry.instances.clear();\n registry.registrations.clear();\n registry.domMap.clear();\n disableComponentMapManualMode();\n};\n\nexport const applyBoundaryUpdate = (\n moduleId: string,\n nextCtor: TagFunction\n) => {\n const registry = boundaryRegistry.get(moduleId);\n\n if (!registry?.instances.size) return false;\n\n registry.pendingUpdate = {\n ctor: nextCtor,\n instances: new Map(registry.registrations),\n retryCount: 0,\n updated: false,\n };\n\n if (!registry.scheduled) {\n registry.scheduled = true;\n queueMicrotask(() => flushBoundary(moduleId, registry));\n }\n\n return true;\n};\n\nconst flushBoundary = (moduleId: string, registry: InstanceRegistry) => {\n if (boundaryRegistry.get(moduleId) !== registry) return;\n\n registry.scheduled = false;\n\n const update = registry.pendingUpdate;\n if (!update) return;\n\n registry.pendingUpdate = undefined;\n\n let failed = false;\n\n // Replacement can unregister old instances and register new descendants.\n // Never consume additions made during this flush, or revisit retired nodes.\n const instances = Array.from(update.instances, ([compKey, registration]) => ({\n compKey,\n wDom: componentMap.get(compKey)?.vd?.value || registry.domMap.get(compKey),\n registration,\n }));\n update.instances.clear();\n instances.forEach(({ compKey, wDom: currentWDom, registration }) => {\n if (\n boundaryRegistry.get(moduleId) !== registry ||\n registry.registrations.get(compKey) !== registration ||\n currentWDom?.il\n )\n return;\n\n if (!currentWDom || !currentWDom.el) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const { compProps, compChild } = currentWDom;\n\n if (!compProps || !compChild) {\n update.instances.set(compKey, registration);\n return;\n }\n\n const ctor = registration.callerCtor || update.ctor;\n const previousCtor = currentWDom.ctor;\n // A stable HMR proxy has the same identity across versions. Force only this\n // replacement to remount; the new WDom retains the proxy for later redraws.\n if (!registration.callerCtor && previousCtor === ctor)\n currentWDom.ctor = undefined;\n try {\n // A remount reuses the props/key. Release the old hooks before the core\n // initializes its new hook state under that key.\n if (!registration.callerCtor) removeComponentEntry(compKey);\n replaceWDom(ctor, compProps, compChild, currentWDom);\n update.updated = true;\n } catch (error) {\n failed = true;\n console.warn(`[Lithent HMR] boundary update 실패: ${moduleId}`, error);\n } finally {\n currentWDom.ctor = previousCtor;\n }\n });\n\n if (boundaryRegistry.get(moduleId) !== registry) return;\n if (failed) registry.onFailure?.(`replacement failed: ${moduleId}`);\n else if (update.updated && !update.instances.size) registry.onApplied?.();\n\n // A newer update supersedes retries for the older implementation.\n if (!registry.pendingUpdate && !failed && update.instances.size) {\n update.retryCount += 1;\n\n if (update.retryCount > MAX_RETRY) {\n console.warn(\n `[Lithent HMR] boundary update failed after ${update.retryCount} attempts; aborting: ${moduleId}`\n );\n\n registry.onFailure?.(\n `missing DOM after ${update.retryCount} attempts: ${moduleId}`\n );\n\n return;\n }\n registry.pendingUpdate = update;\n }\n\n if (registry.pendingUpdate && !registry.scheduled) {\n registry.scheduled = true;\n setTimeout(() => flushBoundary(moduleId, registry), 0);\n }\n};\n\nexport const createBoundary = (\n moduleId: string,\n onFailure?: (reason: string) => void,\n onApplied?: () => void\n): BoundaryController => {\n const registry = getRegistry(moduleId);\n registry.owners += 1;\n registry.onFailure = onFailure;\n registry.onApplied = onApplied;\n\n let disposed = false;\n const active = () => !disposed && boundaryRegistry.get(moduleId) === registry;\n return {\n register: (compKey: CompKey, callerCtor?: TagFunction) =>\n active()\n ? registerBoundaryInstance(moduleId, compKey, callerCtor)\n : () => {},\n update: (nextCtor: TagFunction) =>\n active() && applyBoundaryUpdate(moduleId, nextCtor),\n dispose: () => {\n if (!active()) return;\n disposed = true;\n registry.owners -= 1;\n if (!registry.owners) disposeBoundary(moduleId);\n },\n };\n};\n"],"mappings":"C,gUAGA,IAAII,EAAqB,EAEZC,MAA2C,CACtD,GAAsB,GACtB,EAAAC,EAAA,0BAAA,CAA0B,EAAI,CAChC,EAEaC,MAA4C,CACvD,EAAqB,KAAK,IAAI,EAAGH,EAAqB,CAAC,EACnDA,IAAuB,IACzB,EAAAE,EAAA,0BAAA,CAA0B,EAAK,CAEnC,EAEaE,EAAwB,GAA2B,EAC9D,EAAAF,EAAA,sBAAA,CAAsBG,CAAO,CAC/B,ECXMC,EAAY,EAsBZC,EAAmB,IAAI,IAEvBC,EAAe,GAAuC,CAC1D,IAAIC,EAAWF,EAAiB,IAAIG,CAAQ,EAc5C,OAZKD,IACH,EAAW,CACT,UAAW,IAAI,IACf,OAAQ,IAAI,IACZ,UAAW,GACX,OAAQ,EACR,cAAe,IAAI,GACrB,EACAF,EAAiB,IAAIG,EAAUD,CAAQ,EACvCR,EAA6B,GAGxBQ,CACT,EAQaE,GACX,EACA,EACA,IACG,CACH,IAAMF,EAAWD,EAAYE,CAAQ,EAE/BE,EAAe,CAAE,YAAW,EAiBlC,OAhBAH,EAAS,cAAc,IAAIJ,EAASO,CAAY,EAChDH,EAAS,UAAU,IAAIJ,CAAO,EAE9B,mBAAqB,C,MACn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Ad,EAAS,YAAA,MAAAa,EAAA,KAAAb,CAAY,GAGpE,CAACA,EAAS,eAAiB,CAACe,GAAUD,EAAO,UAAU,KAAM,CAG/D,GAFA,EAAO,YAAc,EAEjBA,EAAO,WAAajB,EAAW,C,MACjC,QAAQ,KACN,8CAA8CiB,EAAO,WAAW,uBAAuBb,GACzF,GAEA,EAAAD,EAAS,YAAA,MAAAuB,EAAA,KAAAvB,EACP,qBAAqBc,EAAO,WAAW,aAAab,GACtD,EAEA,MACF,CACA,EAAS,cAAgBa,CAC3B,CAEId,EAAS,eAAiB,CAACA,EAAS,YACtC,EAAS,UAAY,GACrB,eAAiBW,EAAcV,EAAUD,CAAQ,EAAG,CAAC,EAtBiB,CAwB1E,E,kBAGE,EACA,EACA,IACuB,CACvB,IAAMA,EAAWD,EAAYE,CAAQ,EACrC,EAAS,QAAU,EACnB,EAAS,UAAYuB,EACrB,EAAS,UAAYC,EAErB,IAAIC,EAAW,GACTC,MAAe,CAACD,GAAY5B,EAAiB,IAAIG,CAAQ,IAAMD,EACrE,MAAO,CACL,UAAW,EAAkB,IAC3B2B,EAAO,EACHzB,EAAyBD,EAAUL,EAASgC,CAAU,MAChD,CAAC,EACb,OAAS,GACPD,EAAO,GAAKlB,EAAoBR,EAAUS,CAAQ,EACpD,YAAe,CACRiB,EAAO,IACZ,EAAW,GACX,IAAS,OACJ3B,EAAS,QAAQQ,EAAgBP,CAAQ,EAChD,CACF,CACF,C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ type HotRuntime = {
2
+ data?: Record<string, unknown>;
3
+ accept: (cb: (mod: Record<string, unknown>) => void) => void;
4
+ dispose: (cb: (data: Record<string, unknown>) => void) => void;
5
+ invalidate?: () => void;
6
+ __lithentData?: Record<string, unknown>;
7
+ };
8
+ declare global {
9
+ interface ImportMeta {
10
+ hot?: HotRuntime;
11
+ }
12
+ }
13
+ declare const App: () => any;
14
+ export default App;
@@ -0,0 +1,14 @@
1
+ type HotRuntime = {
2
+ data?: Record<string, unknown>;
3
+ accept: (cb: (mod: Record<string, unknown>) => void) => void;
4
+ dispose: (cb: (data: Record<string, unknown>) => void) => void;
5
+ invalidate?: () => void;
6
+ __lithentData?: Record<string, unknown>;
7
+ };
8
+ declare global {
9
+ interface ImportMeta {
10
+ hot?: HotRuntime;
11
+ }
12
+ }
13
+ declare const App: () => any;
14
+ export default App;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Props } from './types/index.cjs';
1
+ import { Props } from './types/index.cjs';
2
2
  export { h, Fragment, portal, mount, lmount, replaceWDom } from './wDom.cjs';
3
3
  export { isPropType } from './utils/index.cjs';
4
4
  export { componentUpdate } from './utils/redraw.cjs';
@@ -12,8 +12,7 @@ export { useRenew } from './hook/useRenew.cjs';
12
12
  export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, Component, LComponent, ComponentSubKey, ComponentMap, ComponentInfo, CompKey, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, NodePointer, Param, } from './types/index.cjs';
13
13
  declare global {
14
14
  namespace JSX {
15
- interface IntrinsicElements {
16
- [name: string]: Props;
15
+ interface IntrinsicElements extends Record<string | number, Props> {
17
16
  }
18
17
  }
19
18
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Props } from './types/index.js';
1
+ import { Props } from './types/index.js';
2
2
  export { h, Fragment, portal, mount, lmount, replaceWDom } from './wDom.js';
3
3
  export { isPropType } from './utils/index.js';
4
4
  export { componentUpdate } from './utils/redraw.js';
@@ -12,8 +12,7 @@ export { useRenew } from './hook/useRenew.js';
12
12
  export type { WDom, TagFunction, TagFunctionResolver, FragmentFunction, Component, LComponent, ComponentSubKey, ComponentMap, ComponentInfo, CompKey, Props, Renew, MiddleStateWDomChildren, MiddleStateWDom, NodePointer, Param, } from './types/index.js';
13
13
  declare global {
14
14
  namespace JSX {
15
- interface IntrinsicElements {
16
- [name: string]: Props;
15
+ interface IntrinsicElements extends Record<string | number, Props> {
17
16
  }
18
17
  }
19
18
  }
@@ -1,6 +1,6 @@
1
1
  # Lithent Agent Addon
2
2
 
3
- > Version: 1.25.5
3
+ > Version: 1.25.7
4
4
 
5
5
  You are a coding agent with Lithent virtual DOM guidance enabled.
6
6