@akashjs/runtime 0.2.2 → 0.2.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 (552) hide show
  1. package/dist/a11y.cjs +2 -0
  2. package/dist/a11y.cjs.map +1 -0
  3. package/dist/a11y.d.cts +99 -0
  4. package/dist/a11y.d.ts +99 -0
  5. package/dist/a11y.js +2 -0
  6. package/dist/a11y.js.map +1 -0
  7. package/dist/async-component.cjs +2 -0
  8. package/dist/async-component.cjs.map +1 -0
  9. package/dist/async-component.d.cts +44 -0
  10. package/dist/async-component.d.ts +44 -0
  11. package/dist/async-component.js +2 -0
  12. package/dist/async-component.js.map +1 -0
  13. package/dist/await-block.cjs +2 -0
  14. package/dist/await-block.cjs.map +1 -0
  15. package/dist/await-block.d.cts +37 -0
  16. package/dist/await-block.d.ts +37 -0
  17. package/dist/await-block.js +2 -0
  18. package/dist/await-block.js.map +1 -0
  19. package/dist/browser.cjs +2 -0
  20. package/dist/browser.cjs.map +1 -0
  21. package/dist/browser.d.cts +125 -0
  22. package/dist/browser.d.ts +125 -0
  23. package/dist/browser.js +2 -0
  24. package/dist/browser.js.map +1 -0
  25. package/dist/chunk-2HLDEWRT.cjs +2 -0
  26. package/dist/chunk-2HLDEWRT.cjs.map +1 -0
  27. package/dist/chunk-2LKFIID7.cjs +2 -0
  28. package/dist/chunk-2LKFIID7.cjs.map +1 -0
  29. package/dist/chunk-34PQECMN.cjs +2 -0
  30. package/dist/chunk-34PQECMN.cjs.map +1 -0
  31. package/dist/chunk-36VM3RJW.cjs +2 -0
  32. package/dist/chunk-36VM3RJW.cjs.map +1 -0
  33. package/dist/chunk-3PGU24B5.cjs +3 -0
  34. package/dist/chunk-3PGU24B5.cjs.map +1 -0
  35. package/dist/chunk-3XREYIJH.cjs +2 -0
  36. package/dist/chunk-3XREYIJH.cjs.map +1 -0
  37. package/dist/chunk-45DPEU7T.cjs +2 -0
  38. package/dist/chunk-45DPEU7T.cjs.map +1 -0
  39. package/dist/chunk-4J3QBQVW.js +4 -0
  40. package/dist/chunk-4J3QBQVW.js.map +1 -0
  41. package/dist/{chunk-NVZLEJXB.cjs → chunk-4NQEIKH5.cjs} +2 -2
  42. package/dist/{chunk-NVZLEJXB.cjs.map → chunk-4NQEIKH5.cjs.map} +1 -1
  43. package/dist/chunk-5QCWH6QA.cjs +4 -0
  44. package/dist/chunk-5QCWH6QA.cjs.map +1 -0
  45. package/dist/chunk-6O46EMQS.cjs +2 -0
  46. package/dist/chunk-6O46EMQS.cjs.map +1 -0
  47. package/dist/chunk-7IJUJUXE.cjs +2 -0
  48. package/dist/chunk-7IJUJUXE.cjs.map +1 -0
  49. package/dist/chunk-7UX5CSGZ.cjs +2 -0
  50. package/dist/chunk-7UX5CSGZ.cjs.map +1 -0
  51. package/dist/chunk-7VBH4F3P.js +2 -0
  52. package/dist/chunk-7VBH4F3P.js.map +1 -0
  53. package/dist/chunk-7ZPSYZHD.cjs +2 -0
  54. package/dist/chunk-7ZPSYZHD.cjs.map +1 -0
  55. package/dist/chunk-AOFLE33X.js +5 -0
  56. package/dist/chunk-AOFLE33X.js.map +1 -0
  57. package/dist/chunk-AQQQVDBQ.cjs +2 -0
  58. package/dist/chunk-AQQQVDBQ.cjs.map +1 -0
  59. package/dist/chunk-AXB5GHGO.js +2 -0
  60. package/dist/chunk-AXB5GHGO.js.map +1 -0
  61. package/dist/chunk-AZCELE44.cjs +2 -0
  62. package/dist/chunk-AZCELE44.cjs.map +1 -0
  63. package/dist/chunk-BB7P6HTR.js +2 -0
  64. package/dist/chunk-BB7P6HTR.js.map +1 -0
  65. package/dist/chunk-BGSF77LF.js +2 -0
  66. package/dist/chunk-BGSF77LF.js.map +1 -0
  67. package/dist/chunk-BHP3UTTQ.cjs +3 -0
  68. package/dist/chunk-BHP3UTTQ.cjs.map +1 -0
  69. package/dist/chunk-CP6SK2B4.js +2 -0
  70. package/dist/chunk-CP6SK2B4.js.map +1 -0
  71. package/dist/chunk-DFYXFKCH.cjs +2 -0
  72. package/dist/chunk-DFYXFKCH.cjs.map +1 -0
  73. package/dist/chunk-DHFVVFZF.cjs +2 -0
  74. package/dist/chunk-DHFVVFZF.cjs.map +1 -0
  75. package/dist/chunk-DP7G45QM.cjs +13 -0
  76. package/dist/chunk-DP7G45QM.cjs.map +1 -0
  77. package/dist/chunk-E6RB7PRO.js +2 -0
  78. package/dist/chunk-E6RB7PRO.js.map +1 -0
  79. package/dist/chunk-F4FXIPR3.js +2 -0
  80. package/dist/chunk-F4FXIPR3.js.map +1 -0
  81. package/dist/chunk-F6VSSM2P.js +2 -0
  82. package/dist/chunk-F6VSSM2P.js.map +1 -0
  83. package/dist/chunk-FUVSCPU4.cjs +2 -0
  84. package/dist/chunk-FUVSCPU4.cjs.map +1 -0
  85. package/dist/chunk-FVF3T4JJ.js +2 -0
  86. package/dist/chunk-FVF3T4JJ.js.map +1 -0
  87. package/dist/chunk-FVWHMFX6.cjs +5 -0
  88. package/dist/chunk-FVWHMFX6.cjs.map +1 -0
  89. package/dist/chunk-IHEW6F2H.js +2 -0
  90. package/dist/chunk-IHEW6F2H.js.map +1 -0
  91. package/dist/chunk-IJS2EMSE.js +2 -0
  92. package/dist/chunk-IJS2EMSE.js.map +1 -0
  93. package/dist/chunk-IKVHLORY.cjs +11 -0
  94. package/dist/chunk-IKVHLORY.cjs.map +1 -0
  95. package/dist/chunk-IQGSDFBI.cjs +2 -0
  96. package/dist/chunk-IQGSDFBI.cjs.map +1 -0
  97. package/dist/chunk-J6KDUWX6.cjs +2 -0
  98. package/dist/chunk-J6KDUWX6.cjs.map +1 -0
  99. package/dist/chunk-JD3LDHUI.cjs +2 -0
  100. package/dist/chunk-JD3LDHUI.cjs.map +1 -0
  101. package/dist/chunk-JEYTB4AG.js +2 -0
  102. package/dist/chunk-JEYTB4AG.js.map +1 -0
  103. package/dist/chunk-JFLZJPVN.js +2 -0
  104. package/dist/chunk-JFLZJPVN.js.map +1 -0
  105. package/dist/chunk-JLPJ22CE.js +2 -0
  106. package/dist/chunk-JLPJ22CE.js.map +1 -0
  107. package/dist/chunk-JQCN42XX.js +2 -0
  108. package/dist/chunk-JQCN42XX.js.map +1 -0
  109. package/dist/chunk-K2HB5VFA.cjs +2 -0
  110. package/dist/chunk-K2HB5VFA.cjs.map +1 -0
  111. package/dist/chunk-K7TMUF3F.cjs +2 -0
  112. package/dist/chunk-K7TMUF3F.cjs.map +1 -0
  113. package/dist/chunk-KE7BJTCD.js +2 -0
  114. package/dist/chunk-KE7BJTCD.js.map +1 -0
  115. package/dist/chunk-KMEGUPH2.js +3 -0
  116. package/dist/chunk-KMEGUPH2.js.map +1 -0
  117. package/dist/chunk-KUPL3ZVD.js +2 -0
  118. package/dist/chunk-KUPL3ZVD.js.map +1 -0
  119. package/dist/chunk-L3ZZX36S.js +2 -0
  120. package/dist/chunk-L3ZZX36S.js.map +1 -0
  121. package/dist/chunk-LD4C62JY.cjs +2 -0
  122. package/dist/chunk-LD4C62JY.cjs.map +1 -0
  123. package/dist/chunk-LWQPLKL6.cjs +20 -0
  124. package/dist/chunk-LWQPLKL6.cjs.map +1 -0
  125. package/dist/chunk-M5IACTFC.cjs +17 -0
  126. package/dist/chunk-M5IACTFC.cjs.map +1 -0
  127. package/dist/chunk-MADMPRT2.js +20 -0
  128. package/dist/chunk-MADMPRT2.js.map +1 -0
  129. package/dist/chunk-MDHWM3C2.js +2 -0
  130. package/dist/chunk-MDHWM3C2.js.map +1 -0
  131. package/dist/chunk-N3ITIHHM.js +5 -0
  132. package/dist/chunk-N3ITIHHM.js.map +1 -0
  133. package/dist/chunk-N5APNCPB.js +2 -0
  134. package/dist/chunk-N5APNCPB.js.map +1 -0
  135. package/dist/chunk-NBYFHJWB.js +36 -0
  136. package/dist/chunk-NBYFHJWB.js.map +1 -0
  137. package/dist/chunk-NCXMNJUN.js +2 -0
  138. package/dist/chunk-NCXMNJUN.js.map +1 -0
  139. package/dist/chunk-NEQ5TENE.cjs +2 -0
  140. package/dist/chunk-NEQ5TENE.cjs.map +1 -0
  141. package/dist/chunk-NGU2W4PD.cjs +2 -0
  142. package/dist/chunk-NGU2W4PD.cjs.map +1 -0
  143. package/dist/chunk-NHDYQTC5.cjs +36 -0
  144. package/dist/chunk-NHDYQTC5.cjs.map +1 -0
  145. package/dist/chunk-NJXXC5JB.js +2 -0
  146. package/dist/chunk-NJXXC5JB.js.map +1 -0
  147. package/dist/chunk-NQEY7DR5.cjs +2 -0
  148. package/dist/chunk-NQEY7DR5.cjs.map +1 -0
  149. package/dist/chunk-OQV3NYDH.js +3 -0
  150. package/dist/chunk-OQV3NYDH.js.map +1 -0
  151. package/dist/chunk-OZ4GNBKA.js +2 -0
  152. package/dist/chunk-OZ4GNBKA.js.map +1 -0
  153. package/dist/chunk-PPNEAFKE.cjs +5 -0
  154. package/dist/chunk-PPNEAFKE.cjs.map +1 -0
  155. package/dist/chunk-PYASLKWF.js +2 -0
  156. package/dist/chunk-PYASLKWF.js.map +1 -0
  157. package/dist/chunk-Q6S7SUOM.js +2 -0
  158. package/dist/chunk-Q6S7SUOM.js.map +1 -0
  159. package/dist/chunk-QE2TJ6P5.cjs +2 -0
  160. package/dist/chunk-QE2TJ6P5.cjs.map +1 -0
  161. package/dist/chunk-QNVMBXVH.js +2 -0
  162. package/dist/chunk-QNVMBXVH.js.map +1 -0
  163. package/dist/chunk-QQ725EZL.js +2 -0
  164. package/dist/chunk-QQ725EZL.js.map +1 -0
  165. package/dist/chunk-QQTZQ6UX.cjs +2 -0
  166. package/dist/chunk-QQTZQ6UX.cjs.map +1 -0
  167. package/dist/chunk-QSPRVXFV.cjs +2 -0
  168. package/dist/chunk-QSPRVXFV.cjs.map +1 -0
  169. package/dist/chunk-QTQ6RUX4.cjs +5 -0
  170. package/dist/chunk-QTQ6RUX4.cjs.map +1 -0
  171. package/dist/chunk-R65RPMQX.cjs +2 -0
  172. package/dist/chunk-R65RPMQX.cjs.map +1 -0
  173. package/dist/chunk-R7NUVVHP.js +2 -0
  174. package/dist/{chunk-Z5LQV5ND.js.map → chunk-R7NUVVHP.js.map} +1 -1
  175. package/dist/chunk-SXYPAP4B.js +2 -0
  176. package/dist/chunk-SXYPAP4B.js.map +1 -0
  177. package/dist/chunk-T2RVAQEU.js +2 -0
  178. package/dist/chunk-T2RVAQEU.js.map +1 -0
  179. package/dist/chunk-T7A5YOEG.cjs +2 -0
  180. package/dist/chunk-T7A5YOEG.cjs.map +1 -0
  181. package/dist/chunk-TDKDZ3QJ.cjs +2 -0
  182. package/dist/chunk-TDKDZ3QJ.cjs.map +1 -0
  183. package/dist/chunk-TFEHO7SF.cjs +2 -0
  184. package/dist/chunk-TFEHO7SF.cjs.map +1 -0
  185. package/dist/chunk-TSFY5HKB.js +17 -0
  186. package/dist/chunk-TSFY5HKB.js.map +1 -0
  187. package/dist/chunk-TYTEJYUQ.cjs +2 -0
  188. package/dist/chunk-TYTEJYUQ.cjs.map +1 -0
  189. package/dist/chunk-TZHEZW6R.js +11 -0
  190. package/dist/chunk-TZHEZW6R.js.map +1 -0
  191. package/dist/chunk-U65WRXZC.js +13 -0
  192. package/dist/chunk-U65WRXZC.js.map +1 -0
  193. package/dist/chunk-UT4MWGJ3.js +2 -0
  194. package/dist/chunk-UT4MWGJ3.js.map +1 -0
  195. package/dist/chunk-V2JDKH3W.cjs +2 -0
  196. package/dist/chunk-V2JDKH3W.cjs.map +1 -0
  197. package/dist/chunk-VNDSKBXQ.cjs +2 -0
  198. package/dist/chunk-VNDSKBXQ.cjs.map +1 -0
  199. package/dist/chunk-VO4FCKHM.js +2 -0
  200. package/dist/chunk-VO4FCKHM.js.map +1 -0
  201. package/dist/chunk-VUMMC2P5.js +2 -0
  202. package/dist/chunk-VUMMC2P5.js.map +1 -0
  203. package/dist/chunk-VUSNUBNI.js +2 -0
  204. package/dist/chunk-VUSNUBNI.js.map +1 -0
  205. package/dist/chunk-VWTULWXF.js +2 -0
  206. package/dist/chunk-VWTULWXF.js.map +1 -0
  207. package/dist/chunk-VX7PSSOU.js +5 -0
  208. package/dist/chunk-VX7PSSOU.js.map +1 -0
  209. package/dist/chunk-WLSXJU2N.js +13 -0
  210. package/dist/chunk-WLSXJU2N.js.map +1 -0
  211. package/dist/chunk-WOZWFMOK.cjs +2 -0
  212. package/dist/chunk-WOZWFMOK.cjs.map +1 -0
  213. package/dist/chunk-WTDTVWCQ.cjs +2 -0
  214. package/dist/chunk-WTDTVWCQ.cjs.map +1 -0
  215. package/dist/chunk-WZ5ULION.js +2 -0
  216. package/dist/chunk-WZ5ULION.js.map +1 -0
  217. package/dist/chunk-XPLIEN2G.cjs +13 -0
  218. package/dist/chunk-XPLIEN2G.cjs.map +1 -0
  219. package/dist/chunk-XWVNLE2W.cjs +2 -0
  220. package/dist/chunk-XWVNLE2W.cjs.map +1 -0
  221. package/dist/chunk-XZR3J626.cjs +2 -0
  222. package/dist/chunk-XZR3J626.cjs.map +1 -0
  223. package/dist/chunk-YDO5KARN.js +2 -0
  224. package/dist/chunk-YDO5KARN.js.map +1 -0
  225. package/dist/chunk-YURIYBTN.cjs +2 -0
  226. package/dist/chunk-YURIYBTN.cjs.map +1 -0
  227. package/dist/chunk-YXKQTEPR.js +2 -0
  228. package/dist/chunk-YXKQTEPR.js.map +1 -0
  229. package/dist/chunk-Z6K4FYG6.js +2 -0
  230. package/dist/chunk-Z6K4FYG6.js.map +1 -0
  231. package/dist/chunk-ZJULEDLY.js +2 -0
  232. package/dist/chunk-ZJULEDLY.js.map +1 -0
  233. package/dist/{component-C1WnFcRp.d.ts → component-CPVtkASo.d.ts} +2 -3
  234. package/dist/{component-C1WnFcRp.d.cts → component-CxlupKuc.d.cts} +2 -3
  235. package/dist/composables.cjs +2 -0
  236. package/dist/composables.cjs.map +1 -0
  237. package/dist/composables.d.cts +103 -0
  238. package/dist/composables.d.ts +103 -0
  239. package/dist/composables.js +2 -0
  240. package/dist/composables.js.map +1 -0
  241. package/dist/{context-2uQ6fuxu.d.ts → context-Cwt7QCpk.d.cts} +1 -9
  242. package/dist/{context-2uQ6fuxu.d.cts → context-Cwt7QCpk.d.ts} +1 -9
  243. package/dist/core.cjs +1 -1
  244. package/dist/core.d.cts +5 -4
  245. package/dist/core.d.ts +5 -4
  246. package/dist/core.js +1 -1
  247. package/dist/css.cjs +2 -0
  248. package/dist/css.cjs.map +1 -0
  249. package/dist/css.d.cts +42 -0
  250. package/dist/css.d.ts +42 -0
  251. package/dist/css.js +2 -0
  252. package/dist/css.js.map +1 -0
  253. package/dist/data-table.cjs +2 -0
  254. package/dist/data-table.cjs.map +1 -0
  255. package/dist/data-table.d.cts +97 -0
  256. package/dist/data-table.d.ts +97 -0
  257. package/dist/data-table.js +2 -0
  258. package/dist/data-table.js.map +1 -0
  259. package/dist/deep-signal.cjs +2 -0
  260. package/dist/deep-signal.cjs.map +1 -0
  261. package/dist/deep-signal.d.cts +48 -0
  262. package/dist/deep-signal.d.ts +48 -0
  263. package/dist/deep-signal.js +2 -0
  264. package/dist/deep-signal.js.map +1 -0
  265. package/dist/defer.cjs +2 -0
  266. package/dist/defer.cjs.map +1 -0
  267. package/dist/defer.d.cts +55 -0
  268. package/dist/defer.d.ts +55 -0
  269. package/dist/defer.js +2 -0
  270. package/dist/defer.js.map +1 -0
  271. package/dist/deprecation.cjs +2 -0
  272. package/dist/deprecation.cjs.map +1 -0
  273. package/dist/deprecation.d.cts +119 -0
  274. package/dist/deprecation.d.ts +119 -0
  275. package/dist/deprecation.js +2 -0
  276. package/dist/deprecation.js.map +1 -0
  277. package/dist/devtools-overlay-3WRM6GKM.js +57 -0
  278. package/dist/devtools-overlay-3WRM6GKM.js.map +1 -0
  279. package/dist/devtools-overlay-WJGSIB4N.cjs +57 -0
  280. package/dist/devtools-overlay-WJGSIB4N.cjs.map +1 -0
  281. package/dist/devtools.cjs +2 -0
  282. package/dist/devtools.cjs.map +1 -0
  283. package/dist/devtools.d.cts +78 -0
  284. package/dist/devtools.d.ts +78 -0
  285. package/dist/devtools.js +2 -0
  286. package/dist/devtools.js.map +1 -0
  287. package/dist/di.cjs +2 -0
  288. package/dist/di.cjs.map +1 -0
  289. package/dist/di.d.cts +93 -0
  290. package/dist/di.d.ts +93 -0
  291. package/dist/di.js +2 -0
  292. package/dist/di.js.map +1 -0
  293. package/dist/directive.cjs +2 -0
  294. package/dist/directive.cjs.map +1 -0
  295. package/dist/directive.d.cts +102 -0
  296. package/dist/directive.d.ts +102 -0
  297. package/dist/directive.js +2 -0
  298. package/dist/directive.js.map +1 -0
  299. package/dist/error-boundary.cjs +2 -0
  300. package/dist/error-boundary.cjs.map +1 -0
  301. package/dist/error-boundary.d.cts +17 -0
  302. package/dist/error-boundary.d.ts +17 -0
  303. package/dist/error-boundary.js +2 -0
  304. package/dist/error-boundary.js.map +1 -0
  305. package/dist/error-hints.cjs +2 -0
  306. package/dist/error-hints.cjs.map +1 -0
  307. package/dist/error-hints.d.cts +17 -0
  308. package/dist/error-hints.d.ts +17 -0
  309. package/dist/error-hints.js +2 -0
  310. package/dist/error-hints.js.map +1 -0
  311. package/dist/errors.cjs +2 -0
  312. package/dist/errors.cjs.map +1 -0
  313. package/dist/errors.d.cts +35 -0
  314. package/dist/errors.d.ts +35 -0
  315. package/dist/errors.js +2 -0
  316. package/dist/errors.js.map +1 -0
  317. package/dist/event-bus.cjs +2 -0
  318. package/dist/event-bus.cjs.map +1 -0
  319. package/dist/event-bus.d.cts +68 -0
  320. package/dist/event-bus.d.ts +68 -0
  321. package/dist/event-bus.js +2 -0
  322. package/dist/event-bus.js.map +1 -0
  323. package/dist/event-modifiers.cjs +2 -0
  324. package/dist/event-modifiers.cjs.map +1 -0
  325. package/dist/event-modifiers.d.cts +130 -0
  326. package/dist/event-modifiers.d.ts +130 -0
  327. package/dist/event-modifiers.js +2 -0
  328. package/dist/event-modifiers.js.map +1 -0
  329. package/dist/flip.cjs +2 -0
  330. package/dist/flip.cjs.map +1 -0
  331. package/dist/flip.d.cts +66 -0
  332. package/dist/flip.d.ts +66 -0
  333. package/dist/flip.js +2 -0
  334. package/dist/flip.js.map +1 -0
  335. package/dist/head.cjs +2 -0
  336. package/dist/head.cjs.map +1 -0
  337. package/dist/head.d.cts +70 -0
  338. package/dist/head.d.ts +70 -0
  339. package/dist/head.js +2 -0
  340. package/dist/head.js.map +1 -0
  341. package/dist/hydration.cjs +2 -0
  342. package/dist/hydration.cjs.map +1 -0
  343. package/dist/hydration.d.cts +84 -0
  344. package/dist/hydration.d.ts +84 -0
  345. package/dist/hydration.js +2 -0
  346. package/dist/hydration.js.map +1 -0
  347. package/dist/image.cjs +2 -0
  348. package/dist/image.cjs.map +1 -0
  349. package/dist/image.d.cts +54 -0
  350. package/dist/image.d.ts +54 -0
  351. package/dist/image.js +2 -0
  352. package/dist/image.js.map +1 -0
  353. package/dist/index.cjs +1 -63
  354. package/dist/index.cjs.map +1 -1
  355. package/dist/index.d.cts +51 -3152
  356. package/dist/index.d.ts +51 -3152
  357. package/dist/index.js +1 -63
  358. package/dist/index.js.map +1 -1
  359. package/dist/infinite-scroll.cjs +2 -0
  360. package/dist/infinite-scroll.cjs.map +1 -0
  361. package/dist/infinite-scroll.d.cts +49 -0
  362. package/dist/infinite-scroll.d.ts +49 -0
  363. package/dist/infinite-scroll.js +2 -0
  364. package/dist/infinite-scroll.js.map +1 -0
  365. package/dist/leak-detector.cjs +2 -0
  366. package/dist/leak-detector.cjs.map +1 -0
  367. package/dist/leak-detector.d.cts +71 -0
  368. package/dist/leak-detector.d.ts +71 -0
  369. package/dist/leak-detector.js +2 -0
  370. package/dist/leak-detector.js.map +1 -0
  371. package/dist/machine.cjs +1 -1
  372. package/dist/machine.d.cts +1 -1
  373. package/dist/machine.d.ts +1 -1
  374. package/dist/machine.js +1 -1
  375. package/dist/offline.cjs +1 -1
  376. package/dist/offline.d.cts +3 -1
  377. package/dist/offline.d.ts +3 -1
  378. package/dist/offline.js +1 -1
  379. package/dist/perf.cjs +2 -0
  380. package/dist/perf.cjs.map +1 -0
  381. package/dist/perf.d.cts +97 -0
  382. package/dist/perf.d.ts +97 -0
  383. package/dist/perf.js +2 -0
  384. package/dist/perf.js.map +1 -0
  385. package/dist/pipes.cjs +2 -0
  386. package/dist/pipes.cjs.map +1 -0
  387. package/dist/pipes.d.cts +130 -0
  388. package/dist/pipes.d.ts +130 -0
  389. package/dist/pipes.js +2 -0
  390. package/dist/pipes.js.map +1 -0
  391. package/dist/plugin.cjs +2 -0
  392. package/dist/plugin.cjs.map +1 -0
  393. package/dist/plugin.d.cts +70 -0
  394. package/dist/plugin.d.ts +70 -0
  395. package/dist/plugin.js +2 -0
  396. package/dist/plugin.js.map +1 -0
  397. package/dist/portal.cjs +2 -0
  398. package/dist/portal.cjs.map +1 -0
  399. package/dist/portal.d.cts +30 -0
  400. package/dist/portal.d.ts +30 -0
  401. package/dist/portal.js +2 -0
  402. package/dist/portal.js.map +1 -0
  403. package/dist/pwa.cjs +1 -1
  404. package/dist/pwa.d.cts +6 -2
  405. package/dist/pwa.d.ts +6 -2
  406. package/dist/pwa.js +1 -1
  407. package/dist/query-state.cjs +2 -0
  408. package/dist/query-state.cjs.map +1 -0
  409. package/dist/query-state.d.cts +82 -0
  410. package/dist/query-state.d.ts +82 -0
  411. package/dist/query-state.js +2 -0
  412. package/dist/query-state.js.map +1 -0
  413. package/dist/reconcile.cjs +2 -0
  414. package/dist/reconcile.cjs.map +1 -0
  415. package/dist/reconcile.d.cts +42 -0
  416. package/dist/reconcile.d.ts +42 -0
  417. package/dist/reconcile.js +2 -0
  418. package/dist/reconcile.js.map +1 -0
  419. package/dist/scheduler-CKi1esN-.d.cts +9 -0
  420. package/dist/scheduler-CKi1esN-.d.ts +9 -0
  421. package/dist/security.cjs +2 -0
  422. package/dist/security.cjs.map +1 -0
  423. package/dist/security.d.cts +193 -0
  424. package/dist/security.d.ts +193 -0
  425. package/dist/security.js +2 -0
  426. package/dist/security.js.map +1 -0
  427. package/dist/seo.cjs +2 -0
  428. package/dist/seo.cjs.map +1 -0
  429. package/dist/seo.d.cts +118 -0
  430. package/dist/seo.d.ts +118 -0
  431. package/dist/seo.js +2 -0
  432. package/dist/seo.js.map +1 -0
  433. package/dist/{signals-C7XfOHHR.d.cts → signals-DionyGGY.d.cts} +7 -0
  434. package/dist/{signals-C7XfOHHR.d.ts → signals-DionyGGY.d.ts} +7 -0
  435. package/dist/snippets.cjs +2 -0
  436. package/dist/snippets.cjs.map +1 -0
  437. package/dist/snippets.d.cts +109 -0
  438. package/dist/snippets.d.ts +109 -0
  439. package/dist/snippets.js +2 -0
  440. package/dist/snippets.js.map +1 -0
  441. package/dist/ssg.cjs +2 -0
  442. package/dist/ssg.cjs.map +1 -0
  443. package/dist/ssg.d.cts +82 -0
  444. package/dist/ssg.d.ts +82 -0
  445. package/dist/ssg.js +2 -0
  446. package/dist/ssg.js.map +1 -0
  447. package/dist/ssr.cjs +1 -1
  448. package/dist/ssr.d.cts +2 -1
  449. package/dist/ssr.d.ts +2 -1
  450. package/dist/ssr.js +1 -1
  451. package/dist/store.cjs +1 -1
  452. package/dist/store.d.cts +33 -30
  453. package/dist/store.d.ts +33 -30
  454. package/dist/store.js +1 -1
  455. package/dist/suspense.cjs +2 -0
  456. package/dist/suspense.cjs.map +1 -0
  457. package/dist/suspense.d.cts +36 -0
  458. package/dist/suspense.d.ts +36 -0
  459. package/dist/suspense.js +2 -0
  460. package/dist/suspense.js.map +1 -0
  461. package/dist/switch.cjs +2 -0
  462. package/dist/switch.cjs.map +1 -0
  463. package/dist/switch.d.cts +48 -0
  464. package/dist/switch.d.ts +48 -0
  465. package/dist/switch.js +2 -0
  466. package/dist/switch.js.map +1 -0
  467. package/dist/sync.cjs +1 -1
  468. package/dist/sync.d.cts +60 -5
  469. package/dist/sync.d.ts +60 -5
  470. package/dist/sync.js +1 -1
  471. package/dist/test.cjs +4 -4
  472. package/dist/test.cjs.map +1 -1
  473. package/dist/test.d.cts +74 -5
  474. package/dist/test.d.ts +74 -5
  475. package/dist/test.js +4 -4
  476. package/dist/test.js.map +1 -1
  477. package/dist/theme.cjs +2 -0
  478. package/dist/theme.cjs.map +1 -0
  479. package/dist/theme.d.cts +56 -0
  480. package/dist/theme.d.ts +56 -0
  481. package/dist/theme.js +2 -0
  482. package/dist/theme.js.map +1 -0
  483. package/dist/toast.cjs +2 -0
  484. package/dist/toast.cjs.map +1 -0
  485. package/dist/toast.d.cts +66 -0
  486. package/dist/toast.d.ts +66 -0
  487. package/dist/toast.js +2 -0
  488. package/dist/toast.js.map +1 -0
  489. package/dist/transition.cjs +2 -0
  490. package/dist/transition.cjs.map +1 -0
  491. package/dist/transition.d.cts +90 -0
  492. package/dist/transition.d.ts +90 -0
  493. package/dist/transition.js +2 -0
  494. package/dist/transition.js.map +1 -0
  495. package/dist/tweened.cjs +2 -0
  496. package/dist/tweened.cjs.map +1 -0
  497. package/dist/tweened.d.cts +59 -0
  498. package/dist/tweened.d.ts +59 -0
  499. package/dist/tweened.js +2 -0
  500. package/dist/tweened.js.map +1 -0
  501. package/dist/types-DjZCk1xT.d.cts +4 -0
  502. package/dist/types-DjZCk1xT.d.ts +4 -0
  503. package/dist/view-transition.cjs +2 -0
  504. package/dist/view-transition.cjs.map +1 -0
  505. package/dist/view-transition.d.cts +80 -0
  506. package/dist/view-transition.d.ts +80 -0
  507. package/dist/view-transition.js +2 -0
  508. package/dist/view-transition.js.map +1 -0
  509. package/dist/virtual-list.cjs +2 -0
  510. package/dist/virtual-list.cjs.map +1 -0
  511. package/dist/virtual-list.d.cts +67 -0
  512. package/dist/virtual-list.d.ts +67 -0
  513. package/dist/virtual-list.js +2 -0
  514. package/dist/virtual-list.js.map +1 -0
  515. package/dist/watch.cjs +2 -0
  516. package/dist/watch.cjs.map +1 -0
  517. package/dist/watch.d.cts +70 -0
  518. package/dist/watch.d.ts +70 -0
  519. package/dist/watch.js +2 -0
  520. package/dist/watch.js.map +1 -0
  521. package/dist/web-component.cjs +2 -0
  522. package/dist/web-component.cjs.map +1 -0
  523. package/dist/web-component.d.cts +51 -0
  524. package/dist/web-component.d.ts +51 -0
  525. package/dist/web-component.js +2 -0
  526. package/dist/web-component.js.map +1 -0
  527. package/package.json +249 -11
  528. package/dist/chunk-3AL2DVPZ.cjs +0 -13
  529. package/dist/chunk-3AL2DVPZ.cjs.map +0 -1
  530. package/dist/chunk-6NX6JRSV.cjs +0 -32
  531. package/dist/chunk-6NX6JRSV.cjs.map +0 -1
  532. package/dist/chunk-BT6HNBE7.js +0 -5
  533. package/dist/chunk-BT6HNBE7.js.map +0 -1
  534. package/dist/chunk-D6QQYZIC.js +0 -2
  535. package/dist/chunk-D6QQYZIC.js.map +0 -1
  536. package/dist/chunk-H4SAK7A5.cjs +0 -2
  537. package/dist/chunk-H4SAK7A5.cjs.map +0 -1
  538. package/dist/chunk-IKZMC3T6.js +0 -2
  539. package/dist/chunk-IKZMC3T6.js.map +0 -1
  540. package/dist/chunk-IM2VW4TK.js +0 -32
  541. package/dist/chunk-IM2VW4TK.js.map +0 -1
  542. package/dist/chunk-NQVWTQ2I.cjs +0 -5
  543. package/dist/chunk-NQVWTQ2I.cjs.map +0 -1
  544. package/dist/chunk-ODDXU5DO.js +0 -2
  545. package/dist/chunk-ODDXU5DO.js.map +0 -1
  546. package/dist/chunk-POLTPHUA.js +0 -13
  547. package/dist/chunk-POLTPHUA.js.map +0 -1
  548. package/dist/chunk-YIB4EKVI.cjs +0 -2
  549. package/dist/chunk-YIB4EKVI.cjs.map +0 -1
  550. package/dist/chunk-YJQLXUTN.cjs +0 -2
  551. package/dist/chunk-YJQLXUTN.cjs.map +0 -1
  552. package/dist/chunk-Z5LQV5ND.js +0 -2
package/dist/index.d.cts CHANGED
@@ -1,17 +1,60 @@
1
- import { R as ReadonlySignal, S as Signal } from './signals-C7XfOHHR.cjs';
2
- export { c as computed, e as effect, o as on, s as signal, u as untrack } from './signals-C7XfOHHR.cjs';
3
- import { I as InjectionKey } from './context-2uQ6fuxu.cjs';
4
- export { b as batch, c as createContext, f as flushSync, g as getCurrentScope, i as inject, p as provide, r as runInScope } from './context-2uQ6fuxu.cjs';
5
- import { A as AkashNode, C as Component } from './component-C1WnFcRp.cjs';
6
- export { a as ComponentContext, R as Ref, _ as __getter, d as defineComponent, o as onError, b as onMount, c as onUnmount, r as ref } from './component-C1WnFcRp.cjs';
1
+ export { R as ReadonlySignal, S as Signal, c as computed, e as effect, o as on, s as signal, u as untrack } from './signals-DionyGGY.cjs';
2
+ export { b as batch, f as flushSync } from './scheduler-CKi1esN-.cjs';
3
+ export { C as Component, a as ComponentContext, R as Ref, _ as __getter, d as defineComponent, o as onError, b as onMount, c as onUnmount, r as ref } from './component-CxlupKuc.cjs';
4
+ export { I as InjectionKey, c as createContext, g as getCurrentScope, i as inject, p as provide, r as runInScope } from './context-Cwt7QCpk.cjs';
7
5
  export { For, Show, bindProperty, bindText, bindVisible, cloneTemplate, createElement, createText, insert, nodeToDOM, renderConditional, renderList, setProperty } from './core.cjs';
6
+ import { A as AkashNode } from './types-DjZCk1xT.cjs';
7
+ export { ErrorBoundary, ErrorBoundaryProps } from './error-boundary.cjs';
8
+ export { Suspense, SuspenseProps, getSuspenseContext, registerPending } from './suspense.cjs';
9
+ export { HYDRATE_ATTR, HydrateOptions, ProgressiveHydrateOptions, claimElement, claimText, findHydrationBoundaries, hydrate, isHydrationActive, progressiveHydrate } from './hydration.cjs';
8
10
  export { SSRElement, SSRNode, SSRRaw, SSRText, isServerRendering, nodeToHtml, renderNodes, renderToStream, renderToString, renderToStringSync, ssrElement, ssrRaw, ssrText } from './ssr.cjs';
9
11
  export { Store, StoreDefinition, StorePlugin, __getStoreInstances, clearStores, configureStores, defineStore } from './store.cjs';
10
- export { LWWEntry, LWWRegister, PeerInfo, SyncDoc, SyncOp, SyncOptions, SyncTransport, createLocalTransport, createSync, createWebSocketTransport } from './sync.cjs';
12
+ export { Transition, TransitionClasses, TransitionProps, enterTransition, exitTransition, generateTransitionCSS, getTransitionClasses } from './transition.cjs';
13
+ export { HeadConfig, LinkTag, MetaTag, ScriptTag, collectSSRHead, renderHeadToString, useHead } from './head.cjs';
14
+ export { AppInstance, Plugin, PluginContext, createApp, definePlugin } from './plugin.cjs';
15
+ export { useCounter, useDebounce, useInterval, usePrevious, useThrottle, useTimeout, useToggle } from './composables.cjs';
16
+ export { Breakpoints, GeolocationState, useBreakpoint, useClickOutside, useClipboard, useGeolocation, useMediaQuery, useOnline, useStorage, useWindowSize } from './browser.cjs';
17
+ export { Portal, PortalProps } from './portal.cjs';
18
+ export { Toast, ToastOptions, ToastPosition, ToastType, Toaster, ToasterOptions, createToaster } from './toast.cjs';
19
+ export { Theme, ThemeConfig, ThemeVariables, useTheme } from './theme.cjs';
20
+ export { VirtualFor, VirtualForProps, VirtualRange, calculateRange, useVirtualList } from './virtual-list.cjs';
21
+ export { AsyncComponentLoader, AsyncComponentOptions, defineAsyncComponent } from './async-component.cjs';
22
+ export { ReconcileOp, countOps, longestIncreasingSubsequence, reconcileKeys } from './reconcile.cjs';
23
+ export { LeakWarning, checkForLeaks, disableLeakDetection, enableLeakDetection, getActiveEffects, getLeakDetectionStats, isLeakDetectionEnabled, reportLeaks, trackEffect, untrackEffect } from './leak-detector.cjs';
24
+ export { PerfEntry, PerfProfile, PerfSummary, createTimer, formatProfile, getProfileSummary, isProfiling, measureAsync, measureSync, recordPerfEntry, startProfiling, stopProfiling } from './perf.cjs';
25
+ export { AriaLive, FocusTrap, FocusTrapOptions, KeyBinding, KeyboardManager, useAnnounce, useFocusTrap, useKeyboard } from './a11y.cjs';
26
+ export { Image, ImageProps } from './image.cjs';
27
+ export { InfiniteScroll, InfiniteScrollOptions, useInfiniteScroll } from './infinite-scroll.cjs';
28
+ export { applyStyles, css, cx } from './css.cjs';
29
+ export { ColumnDef, DataTable, DataTableOptions, SortDirection, SortState, createDataTable } from './data-table.cjs';
30
+ export { OpenGraphData, SEOConfig, SitemapEntry, StructuredData, TwitterCardData, generateSitemap, useOpenGraph, useSEO, useStructuredData, useTwitterCard } from './seo.cjs';
31
+ export { LWWEntry, LWWRegister, PeerInfo, SyncConflict, SyncDoc, SyncOp, SyncOptions, SyncTransport, createLocalTransport, createSync, createWebSocketTransport, useCursor, useTypingIndicator } from './sync.cjs';
11
32
  export { ConflictStrategy, OfflineStore, OfflineStoreOptions, createOfflineStore } from './offline.cjs';
33
+ export { PipeFn, capitalize, chain, currency, date, definePipe, json, lowercase, number, percent, pipe, plural, relativeTime, titleCase, trim, truncate, uppercase } from './pipes.cjs';
34
+ export { Directive, DirectiveBinding, DirectiveHooks, applyDirective, defineDirective, directiveFromFn, removeDirectives, updateDirective, vAutoFocus, vClickOutside, vIntersect, vLongPress, vResize } from './directive.cjs';
12
35
  export { CacheRoute, CacheStrategy, SWOptions, SWRegistration, generateSWScript, registerServiceWorker, subscribePush } from './pwa.cjs';
36
+ export { CustomElementOptions, defineCustomElement, toCustomElement } from './web-component.cjs';
37
+ export { PrerenderOptions, PrerenderResult, discoverStaticRoutes, generatePaths, prerender, sitemapFromResults, urlToFilePath } from './ssg.cjs';
38
+ export { Switch, SwitchProps, match, renderSwitch } from './switch.cjs';
39
+ export { Injector, ProviderDef, ProviderRegistration, clearProviders, createInjector, defineProvider, injectProvider } from './di.cjs';
13
40
  export { AnimationControl, AnimationOptions, AnimationState, SpringOptions, StaggerOptions, animate, animateGroup, animateSequence, animateSpring, animateStagger, defineStates, keyframes } from './animate.cjs';
41
+ export { DeferOptions, DeferTrigger, defer } from './defer.cjs';
42
+ export { ViewTransition, ViewTransitionOptions, assignTransitionName, startViewTransition, supportsViewTransitions, viewTransitionCSS } from './view-transition.cjs';
43
+ export { QueryStateOptions, clearQueryState, getQueryParams, removeQueryState, resetQueryState, useQueryState, useQueryStates } from './query-state.cjs';
44
+ export { EasingFn, Interpolator, TweenedOptions, TweenedSignal, easings, tweened } from './tweened.cjs';
45
+ export { FlipController, FlipOptions, createFlip, flip } from './flip.cjs';
46
+ export { Await, AwaitProps, awaitSignal } from './await-block.cjs';
47
+ export { EventModifiers, bindClass, bindClasses, bindDimensions, bindElement, bindGroup, bindGroupItem, bindScroll, bindStyle, bindStyles, onEvent, withModifiers } from './event-modifiers.cjs';
48
+ export { FormAction, InspectOptions, SnapshotConfig, Snippet, defineFormAction, defineSnippet, enableSnapshots, inspect } from './snippets.cjs';
49
+ export { WatchCallback, WatchOptions, WatchSource, watch, watchDebounced, watchOnce } from './watch.cjs';
50
+ export { DeepSignal, deepSignal, isDeepSignal, toRaw } from './deep-signal.cjs';
14
51
  export { Machine, MachineConfig, MachineContext, StateConfig, TransitionConfig, createMachine } from './machine.cjs';
52
+ export { EventBus, EventHandler, EventMap, createEventBus, globalEventBus } from './event-bus.cjs';
53
+ export { CSPConfig, SanitizeOptions, SecurityHeadersConfig, createCSRFInterceptor, createRateLimiter, createSafeHTML, deepFreeze, escapeHtml, generateCSP, generateCSRFToken, generateSRI, generateSecurityHeaders, getCSPHeaderName, safeMerge, sanitize, sanitizeURL } from './security.cjs';
54
+ export { APIInfo, APIStability, CompatibilityResult, DeprecationInfo, checkCompatibility, deprecated, deprecatedValue, getAPIsByStability, getDeprecationInfo, getRegisteredAPIs, isDeprecated, registerAPI, resetDeprecationWarnings, setDeprecationWarnings, setWarningHandler } from './deprecation.cjs';
55
+ export { ErrorDef, akashError, formatError, getAllErrorCodes, getErrorDef } from './errors.cjs';
56
+ export { DevToolsAPI, DevToolsOptions, installDevtools } from './devtools.cjs';
57
+ export { enhanceError, installErrorHints } from './error-hints.cjs';
15
58
 
16
59
  /**
17
60
  * Slot helpers for content projection.
@@ -71,3148 +114,4 @@ declare function hasSlot(slot: SlotFn | Slots | undefined, name?: string): boole
71
114
  */
72
115
  declare function createSlots<T extends Record<string, unknown>>(props: T, slotNames?: (keyof T)[]): Slots;
73
116
 
74
- interface ErrorBoundaryProps {
75
- /** Render function called when an error is caught */
76
- fallback: (error: Error, retry: () => void) => AkashNode;
77
- }
78
- /**
79
- * ErrorBoundary component.
80
- *
81
- * Catches errors from descendant components and renders a fallback.
82
- * The fallback receives the error and a `retry` function that re-renders
83
- * the children.
84
- */
85
- declare const ErrorBoundary: Component<ErrorBoundaryProps>;
86
-
87
- interface SuspenseContext {
88
- /** Register a pending promise */
89
- addPending(promise: Promise<unknown>): void;
90
- /** Check if all pending work is resolved */
91
- isResolved: () => boolean;
92
- }
93
- /**
94
- * Get the current Suspense context (if inside a <Suspense> boundary).
95
- * Used by async components and createResource to register pending work.
96
- */
97
- declare function getSuspenseContext(): SuspenseContext | null;
98
- /**
99
- * Register a promise with the nearest Suspense boundary.
100
- * If there is no Suspense boundary, the promise is ignored
101
- * (component renders without waiting).
102
- */
103
- declare function registerPending(promise: Promise<unknown>): void;
104
- interface SuspenseProps {
105
- /** Fallback UI shown while children are loading */
106
- fallback: () => AkashNode;
107
- }
108
- /**
109
- * <Suspense> component.
110
- *
111
- * ```html
112
- * <Suspense fallback={() => <Spinner />}>
113
- * <AsyncComponent />
114
- * </Suspense>
115
- * ```
116
- */
117
- declare const Suspense: Component<SuspenseProps>;
118
-
119
- /**
120
- * Client-side hydration.
121
- *
122
- * After SSR delivers HTML, the client needs to "hydrate" —
123
- * walk the existing DOM, attach signal effects, and make it interactive.
124
- * No new DOM nodes are created during hydration.
125
- *
126
- * Supports progressive hydration via IntersectionObserver:
127
- * components hydrate lazily when they enter the viewport.
128
- */
129
-
130
- /** Check if we're currently hydrating (vs. fresh rendering) */
131
- declare function isHydrationActive(): boolean;
132
- interface HydrateOptions {
133
- /** The root DOM element (rendered by SSR) */
134
- container: HTMLElement;
135
- /** The root component to hydrate */
136
- component: Component<any>;
137
- /** Props to pass to the root component */
138
- props?: Record<string, unknown>;
139
- }
140
- /**
141
- * Hydrate a server-rendered DOM tree.
142
- *
143
- * Walks the existing DOM instead of creating new nodes,
144
- * attaching signal effects to existing elements.
145
- *
146
- * ```ts
147
- * import { hydrate } from '@akashjs/runtime';
148
- * import App from './App.akash';
149
- *
150
- * hydrate({
151
- * container: document.getElementById('app')!,
152
- * component: App,
153
- * props: { title: 'Home' },
154
- * });
155
- * ```
156
- */
157
- declare function hydrate(options: HydrateOptions): () => void;
158
- /**
159
- * Claim the next DOM node during hydration.
160
- * Instead of creating a new element, returns the existing one.
161
- */
162
- declare function claimElement(tag: string): HTMLElement | null;
163
- /**
164
- * Claim the next text node during hydration.
165
- */
166
- declare function claimText(): Text | null;
167
- interface ProgressiveHydrateOptions {
168
- /** CSS selector or element to observe */
169
- target: HTMLElement;
170
- /** Component to hydrate when visible */
171
- component: Component<any>;
172
- /** Props */
173
- props?: Record<string, unknown>;
174
- /** IntersectionObserver root margin (default: '200px') */
175
- rootMargin?: string;
176
- }
177
- /**
178
- * Hydrate a component lazily when it enters the viewport.
179
- *
180
- * Uses IntersectionObserver to detect when the SSR placeholder
181
- * becomes visible, then runs full hydration.
182
- *
183
- * ```ts
184
- * progressiveHydrate({
185
- * target: document.querySelector('[data-hydrate="comments"]')!,
186
- * component: Comments,
187
- * props: { postId: 123 },
188
- * });
189
- * ```
190
- */
191
- declare function progressiveHydrate(options: ProgressiveHydrateOptions): () => void;
192
- /** Data attribute used to mark hydration boundaries in SSR HTML */
193
- declare const HYDRATE_ATTR = "data-akash-hydrate";
194
- /**
195
- * Find all hydration boundaries in the document.
196
- */
197
- declare function findHydrationBoundaries(root?: HTMLElement): HTMLElement[];
198
-
199
- /**
200
- * Transition/Animation system.
201
- *
202
- * Provides CSS-based enter/exit transitions for elements.
203
- * Works with <Transition> component or programmatic API.
204
- *
205
- * Class naming convention (matches Vue/Svelte):
206
- * - `{name}-enter-from` — initial enter state
207
- * - `{name}-enter-active` — active enter transition
208
- * - `{name}-enter-to` — final enter state
209
- * - `{name}-exit-from` — initial exit state
210
- * - `{name}-exit-active` — active exit transition
211
- * - `{name}-exit-to` — final exit state
212
- */
213
- interface TransitionProps {
214
- /** Transition name (used as CSS class prefix) */
215
- name?: string;
216
- /** Duration in ms (overrides CSS transition duration) */
217
- duration?: number;
218
- /** Whether the content is shown */
219
- when: boolean;
220
- /** CSS transition mode */
221
- mode?: 'in-out' | 'out-in';
222
- /** Callback when enter transition starts */
223
- onEnter?: (el: HTMLElement) => void;
224
- /** Callback when enter transition completes */
225
- onAfterEnter?: (el: HTMLElement) => void;
226
- /** Callback when exit transition starts */
227
- onExit?: (el: HTMLElement) => void;
228
- /** Callback when exit transition completes */
229
- onAfterExit?: (el: HTMLElement) => void;
230
- }
231
- interface TransitionClasses {
232
- enterFrom: string;
233
- enterActive: string;
234
- enterTo: string;
235
- exitFrom: string;
236
- exitActive: string;
237
- exitTo: string;
238
- }
239
- /**
240
- * Get the transition CSS class names for a given transition name.
241
- */
242
- declare function getTransitionClasses(name: string): TransitionClasses;
243
- /**
244
- * Run an enter transition on an element.
245
- * Returns a promise that resolves when the transition completes.
246
- */
247
- declare function enterTransition(el: HTMLElement, classes: TransitionClasses, duration?: number): Promise<void>;
248
- /**
249
- * Run an exit transition on an element.
250
- * Returns a promise that resolves when the transition completes.
251
- */
252
- declare function exitTransition(el: HTMLElement, classes: TransitionClasses, duration?: number): Promise<void>;
253
- /**
254
- * <Transition> component.
255
- *
256
- * Applies CSS enter/exit transitions when `when` changes.
257
- *
258
- * ```html
259
- * <Transition name="fade" when={isVisible()}>
260
- * <div>Content</div>
261
- * </Transition>
262
- * ```
263
- *
264
- * CSS:
265
- * ```css
266
- * .fade-enter-active, .fade-exit-active {
267
- * transition: opacity 0.3s;
268
- * }
269
- * .fade-enter-from, .fade-exit-to {
270
- * opacity: 0;
271
- * }
272
- * ```
273
- */
274
- declare const Transition: Component<TransitionProps>;
275
- /**
276
- * Generate CSS for common transition presets.
277
- * Inject this into your app's styles or use the CLI to generate it.
278
- */
279
- declare function generateTransitionCSS(name: string, options?: {
280
- property?: string;
281
- duration?: string;
282
- easing?: string;
283
- }): string;
284
-
285
- /**
286
- * Document head management.
287
- *
288
- * Provides Title, Meta, and Head components for managing
289
- * <head> content declaratively. SSR-compatible — on the server,
290
- * collects tags; on the client, directly mutates the DOM.
291
- *
292
- * ```ts
293
- * // In any component:
294
- * useHead({
295
- * title: 'My Page',
296
- * meta: [
297
- * { name: 'description', content: 'Page description' },
298
- * { property: 'og:title', content: 'My Page' },
299
- * ],
300
- * link: [
301
- * { rel: 'canonical', href: 'https://example.com/page' },
302
- * ],
303
- * });
304
- * ```
305
- */
306
- interface HeadConfig {
307
- /** Document title */
308
- title?: string;
309
- /** Title template — use %s as placeholder */
310
- titleTemplate?: string;
311
- /** Meta tags */
312
- meta?: MetaTag[];
313
- /** Link tags */
314
- link?: LinkTag[];
315
- /** Script tags */
316
- script?: ScriptTag[];
317
- /** HTML attributes */
318
- htmlAttrs?: Record<string, string>;
319
- /** Body attributes */
320
- bodyAttrs?: Record<string, string>;
321
- }
322
- interface MetaTag {
323
- name?: string;
324
- property?: string;
325
- httpEquiv?: string;
326
- content: string;
327
- }
328
- interface LinkTag {
329
- rel: string;
330
- href: string;
331
- type?: string;
332
- crossorigin?: string;
333
- }
334
- interface ScriptTag {
335
- src?: string;
336
- type?: string;
337
- async?: boolean;
338
- defer?: boolean;
339
- innerHTML?: string;
340
- }
341
- /** @internal — collect head tags during SSR */
342
- declare function collectSSRHead(): HeadConfig[];
343
- /** Render collected head tags to HTML string (for SSR) */
344
- declare function renderHeadToString(configs: HeadConfig[]): string;
345
- /**
346
- * Declaratively manage document head tags.
347
- * Call inside defineComponent() setup.
348
- *
349
- * Tags are automatically cleaned up when the component unmounts.
350
- * Reactive values (signals) in the config trigger updates.
351
- */
352
- declare function useHead(config: HeadConfig | (() => HeadConfig)): void;
353
-
354
- /**
355
- * Plugin system.
356
- *
357
- * Allows third-party extensions to hook into the AkashJS lifecycle.
358
- * Plugins can provide context values, add global error handlers,
359
- * register stores, and run setup code.
360
- *
361
- * ```ts
362
- * const authPlugin = definePlugin({
363
- * name: 'auth',
364
- * setup(app) {
365
- * const store = defineStore('auth', { ... })();
366
- * app.provide(AuthContext, store);
367
- * app.onError((err) => { if (err.status === 401) logout(); });
368
- * },
369
- * });
370
- *
371
- * const app = createApp(App);
372
- * app.use(authPlugin);
373
- * app.mount('#app');
374
- * ```
375
- */
376
-
377
- interface PluginContext {
378
- /** Provide a value to all components */
379
- provide<T>(key: InjectionKey<T>, value: T): void;
380
- /** Register a global error handler */
381
- onError(handler: (error: Error) => void): void;
382
- /** Register a hook that runs before each component mount */
383
- onBeforeMount(hook: () => void): void;
384
- /** Access the app config */
385
- config: Record<string, unknown>;
386
- }
387
- interface Plugin {
388
- /** Plugin name (for debugging) */
389
- name: string;
390
- /** Setup function called when the plugin is installed */
391
- setup: (ctx: PluginContext) => void | Promise<void>;
392
- }
393
- interface AppInstance {
394
- /** Install a plugin */
395
- use(plugin: Plugin): AppInstance;
396
- /** Set a config value */
397
- config(key: string, value: unknown): AppInstance;
398
- /** Mount the app to a DOM element */
399
- mount(selector: string | HTMLElement): void;
400
- /** Unmount the app */
401
- unmount(): void;
402
- }
403
- /**
404
- * Define a framework plugin.
405
- */
406
- declare function definePlugin(plugin: Plugin): Plugin;
407
- /**
408
- * Create an application instance with plugin support.
409
- *
410
- * ```ts
411
- * const app = createApp(App);
412
- * app.use(authPlugin);
413
- * app.use(i18nPlugin);
414
- * app.mount('#app');
415
- * ```
416
- */
417
- declare function createApp<P extends Record<string, unknown>>(rootComponent: Component<P>, rootProps?: P): AppInstance;
418
-
419
- /**
420
- * Reactive composables — signal-based utility functions.
421
- *
422
- * Timers, debounce, throttle, and other commonly needed
423
- * reactive primitives that every app uses.
424
- */
425
-
426
- /**
427
- * Create a reactive interval that ticks at a given rate.
428
- *
429
- * ```ts
430
- * const { count, pause, resume, reset } = useInterval(1000);
431
- * count(); // increments every second
432
- * ```
433
- */
434
- declare function useInterval(ms: number, options?: {
435
- immediate?: boolean;
436
- }): {
437
- count: ReadonlySignal<number>;
438
- isActive: ReadonlySignal<boolean>;
439
- pause(): void;
440
- resume(): void;
441
- reset(): void;
442
- dispose(): void;
443
- };
444
- /**
445
- * Reactive timeout that exposes ready state.
446
- *
447
- * ```ts
448
- * const { ready, restart } = useTimeout(3000);
449
- * ready(); // false, then true after 3s
450
- * ```
451
- */
452
- declare function useTimeout(ms: number): {
453
- ready: ReadonlySignal<boolean>;
454
- restart(): void;
455
- dispose(): void;
456
- };
457
- /**
458
- * Debounce a signal value. The output updates only after the input
459
- * stops changing for the given delay.
460
- *
461
- * ```ts
462
- * const search = signal('');
463
- * const debouncedSearch = useDebounce(search, 300);
464
- * // debouncedSearch() updates 300ms after last search.set()
465
- * ```
466
- */
467
- declare function useDebounce<T>(source: () => T, delay: number): ReadonlySignal<T>;
468
- /**
469
- * Throttle a signal value. The output updates at most once per interval.
470
- *
471
- * ```ts
472
- * const scrollY = signal(0);
473
- * const throttled = useThrottle(scrollY, 100);
474
- * ```
475
- */
476
- declare function useThrottle<T>(source: () => T, interval: number): ReadonlySignal<T>;
477
- /**
478
- * Simple reactive counter with inc/dec/set/reset.
479
- *
480
- * ```ts
481
- * const { count, inc, dec, set, reset } = useCounter(0);
482
- * ```
483
- */
484
- declare function useCounter(initial?: number, options?: {
485
- min?: number;
486
- max?: number;
487
- }): {
488
- count: ReadonlySignal<number>;
489
- inc(delta?: number): void;
490
- dec(delta?: number): void;
491
- set(value: number): void;
492
- reset(): void;
493
- };
494
- /**
495
- * Reactive boolean toggle.
496
- *
497
- * ```ts
498
- * const { value, toggle, setTrue, setFalse } = useToggle(false);
499
- * ```
500
- */
501
- declare function useToggle(initial?: boolean): {
502
- value: ReadonlySignal<boolean>;
503
- toggle(): void;
504
- setTrue(): void;
505
- setFalse(): void;
506
- };
507
- /**
508
- * Track the previous value of a signal.
509
- *
510
- * ```ts
511
- * const count = signal(0);
512
- * const prev = usePrevious(count);
513
- * count.set(1);
514
- * prev(); // 0
515
- * ```
516
- */
517
- declare function usePrevious<T>(source: () => T): ReadonlySignal<T | undefined>;
518
-
519
- /**
520
- * Browser API composables.
521
- *
522
- * Signal-based wrappers for common browser APIs.
523
- * All composables are SSR-safe — they return fallback values
524
- * when `window` is not available.
525
- */
526
-
527
- /**
528
- * Reactive media query matcher.
529
- *
530
- * ```ts
531
- * const isMobile = useMediaQuery('(max-width: 768px)');
532
- * isMobile(); // true/false, updates on resize
533
- * ```
534
- */
535
- declare function useMediaQuery(query: string): ReadonlySignal<boolean>;
536
- interface Breakpoints {
537
- [name: string]: number;
538
- }
539
- /**
540
- * Reactive breakpoint tracker (Tailwind-style).
541
- *
542
- * ```ts
543
- * const bp = useBreakpoint();
544
- * bp.current(); // 'md'
545
- * bp.gte('lg'); // false
546
- * bp.lt('sm'); // false
547
- * ```
548
- */
549
- declare function useBreakpoint(breakpoints?: Breakpoints): {
550
- current: () => string;
551
- gte: (name: string) => boolean;
552
- lt: (name: string) => boolean;
553
- width: ReadonlySignal<number>;
554
- };
555
- /**
556
- * Signal backed by localStorage or sessionStorage.
557
- * Persists across page refreshes.
558
- *
559
- * ```ts
560
- * const name = useStorage('user-name', 'Guest');
561
- * name(); // reads from localStorage or 'Guest'
562
- * name.set('Alice'); // writes to localStorage
563
- * ```
564
- */
565
- declare function useStorage<T>(key: string, initialValue: T, storage?: 'local' | 'session'): Signal<T>;
566
- /**
567
- * Reactive clipboard access.
568
- *
569
- * ```ts
570
- * const { text, copy, copied } = useClipboard();
571
- * await copy('Hello');
572
- * copied(); // true for 2 seconds
573
- * ```
574
- */
575
- declare function useClipboard(options?: {
576
- timeout?: number;
577
- }): {
578
- text: ReadonlySignal<string>;
579
- copied: ReadonlySignal<boolean>;
580
- copy: (value: string) => Promise<void>;
581
- };
582
- /**
583
- * Reactive online/offline status.
584
- *
585
- * ```ts
586
- * const online = useOnline();
587
- * online(); // true/false
588
- * ```
589
- */
590
- declare function useOnline(): ReadonlySignal<boolean>;
591
- interface GeolocationState {
592
- latitude: number | null;
593
- longitude: number | null;
594
- accuracy: number | null;
595
- error: GeolocationPositionError | null;
596
- loading: boolean;
597
- }
598
- /**
599
- * Reactive geolocation.
600
- *
601
- * ```ts
602
- * const geo = useGeolocation();
603
- * geo().latitude; // number | null
604
- * geo().loading; // boolean
605
- * ```
606
- */
607
- declare function useGeolocation(options?: PositionOptions): ReadonlySignal<GeolocationState>;
608
- /**
609
- * Reactive window dimensions.
610
- */
611
- declare function useWindowSize(): {
612
- width: ReadonlySignal<number>;
613
- height: ReadonlySignal<number>;
614
- };
615
- /**
616
- * Detect clicks outside an element. Essential for closing
617
- * dropdowns, modals, popovers, and context menus.
618
- *
619
- * ```ts
620
- * const dropdown = document.querySelector('.dropdown')!;
621
- * const dispose = useClickOutside(dropdown, () => {
622
- * closeDropdown();
623
- * });
624
- *
625
- * // With options:
626
- * useClickOutside(dropdown, onClose, {
627
- * events: ['mousedown', 'touchstart'],
628
- * ignore: ['.trigger-button'],
629
- * });
630
- * ```
631
- */
632
- declare function useClickOutside(target: HTMLElement | (() => HTMLElement | null), handler: (event: Event) => void, options?: {
633
- /** Events to listen for (default: ['pointerdown']) */
634
- events?: string[];
635
- /** Selectors or elements to ignore (clicks on these won't trigger) */
636
- ignore?: (string | HTMLElement)[];
637
- /** Whether the listener is active (default: true) */
638
- active?: boolean;
639
- }): () => void;
640
-
641
- /**
642
- * <Portal> component.
643
- *
644
- * Renders children into a different DOM node, outside the
645
- * component tree. Essential for modals, tooltips, toasts,
646
- * dropdowns, and overlays.
647
- *
648
- * ```html
649
- * <Portal target="body">
650
- * <div class="modal">Modal content</div>
651
- * </Portal>
652
- *
653
- * <Portal target="#tooltip-container">
654
- * <Tooltip />
655
- * </Portal>
656
- * ```
657
- */
658
- interface PortalProps {
659
- /** CSS selector or HTMLElement to render into (default: document.body) */
660
- target?: string | HTMLElement;
661
- }
662
- /**
663
- * <Portal> — render children into a different DOM location.
664
- */
665
- declare const Portal: Component<PortalProps>;
666
-
667
- /**
668
- * Toast notification system.
669
- *
670
- * Signal-based toast queue with auto-dismiss, stacking, and positions.
671
- *
672
- * ```ts
673
- * const toast = createToaster();
674
- * toast.success('Saved!');
675
- * toast.error('Something went wrong');
676
- * toast.info('Tip: try dark mode', { duration: 5000 });
677
- * toast.toasts(); // reactive list of active toasts
678
- * ```
679
- */
680
-
681
- type ToastType = 'success' | 'error' | 'info' | 'warning';
682
- type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
683
- interface Toast {
684
- id: string;
685
- type: ToastType;
686
- message: string;
687
- duration: number;
688
- dismissible: boolean;
689
- createdAt: number;
690
- }
691
- interface ToastOptions {
692
- /** Duration in ms (default: 3000, 0 = no auto-dismiss) */
693
- duration?: number;
694
- /** Whether the toast can be manually dismissed (default: true) */
695
- dismissible?: boolean;
696
- }
697
- interface ToasterOptions {
698
- /** Max visible toasts (default: 5) */
699
- maxVisible?: number;
700
- /** Default duration in ms (default: 3000) */
701
- defaultDuration?: number;
702
- /** Position (default: 'top-right') */
703
- position?: ToastPosition;
704
- }
705
- interface Toaster {
706
- /** Active toasts (reactive signal) */
707
- toasts: ReadonlySignal<Toast[]>;
708
- /** Position setting */
709
- position: ToastPosition;
710
- /** Show a success toast */
711
- success(message: string, options?: ToastOptions): string;
712
- /** Show an error toast */
713
- error(message: string, options?: ToastOptions): string;
714
- /** Show an info toast */
715
- info(message: string, options?: ToastOptions): string;
716
- /** Show a warning toast */
717
- warning(message: string, options?: ToastOptions): string;
718
- /** Show a toast with custom type */
719
- add(type: ToastType, message: string, options?: ToastOptions): string;
720
- /** Dismiss a specific toast */
721
- dismiss(id: string): void;
722
- /** Dismiss all toasts */
723
- dismissAll(): void;
724
- }
725
- /**
726
- * Create a toast notification manager.
727
- */
728
- declare function createToaster(options?: ToasterOptions): Toaster;
729
-
730
- /**
731
- * Theme / dark mode system.
732
- *
733
- * Signal-based theme management with system preference detection,
734
- * CSS variable injection, and localStorage persistence.
735
- *
736
- * ```ts
737
- * const theme = useTheme({
738
- * themes: {
739
- * light: { '--bg': '#fff', '--text': '#111' },
740
- * dark: { '--bg': '#111', '--text': '#eee' },
741
- * },
742
- * });
743
- *
744
- * theme.current(); // 'light' or 'dark'
745
- * theme.toggle(); // switch between light/dark
746
- * theme.set('dark'); // set explicitly
747
- * theme.isDark(); // boolean
748
- * ```
749
- */
750
-
751
- type ThemeVariables = Record<string, string>;
752
- interface ThemeConfig {
753
- /** Theme definitions (name → CSS variables) */
754
- themes?: Record<string, ThemeVariables>;
755
- /** Default theme name (default: auto-detect from system) */
756
- defaultTheme?: string;
757
- /** localStorage key for persistence (default: 'akash-theme') */
758
- storageKey?: string;
759
- /** CSS attribute to set on <html> (default: 'data-theme') */
760
- attribute?: string;
761
- /** Whether to sync with system preference (default: true) */
762
- syncSystem?: boolean;
763
- }
764
- interface Theme {
765
- /** Current theme name (reactive) */
766
- current: ReadonlySignal<string>;
767
- /** Whether dark mode is active */
768
- isDark: ReadonlySignal<boolean>;
769
- /** Set a specific theme */
770
- set(theme: string): void;
771
- /** Toggle between light and dark */
772
- toggle(): void;
773
- /** Set the system preference strategy */
774
- setSystem(): void;
775
- /** Available theme names */
776
- themes: string[];
777
- }
778
- /**
779
- * Create a theme manager with system preference detection and persistence.
780
- */
781
- declare function useTheme(config?: ThemeConfig): Theme;
782
-
783
- interface VirtualForProps<T> {
784
- /** Array of items */
785
- each: T[];
786
- /** Key function for reconciliation */
787
- key: (item: T) => unknown;
788
- /** Fixed height per item in pixels */
789
- itemHeight: number;
790
- /** Container height in pixels (default: auto-detect from parent) */
791
- containerHeight?: number;
792
- /** Number of extra items to render above/below viewport */
793
- overscan?: number;
794
- /** Render function for each item */
795
- children: (item: T, index: number) => AkashNode;
796
- }
797
- interface VirtualRange {
798
- /** First visible index */
799
- start: number;
800
- /** Last visible index (exclusive) */
801
- end: number;
802
- /** Total content height in pixels */
803
- totalHeight: number;
804
- /** Offset of the first rendered item */
805
- offsetTop: number;
806
- }
807
- /**
808
- * Calculate the visible range given scroll position and dimensions.
809
- */
810
- declare function calculateRange(scrollTopOrOpts: number | {
811
- scrollTop: number;
812
- containerHeight: number;
813
- itemHeight: number;
814
- totalItems: number;
815
- overscan?: number;
816
- }, containerHeight?: number, itemHeight?: number, totalItems?: number, overscan?: number): VirtualRange;
817
- /**
818
- * Low-level virtual list composable for custom implementations.
819
- *
820
- * ```ts
821
- * const { containerRef, range, visibleItems } = useVirtualList({
822
- * items: () => allItems(),
823
- * itemHeight: 40,
824
- * overscan: 5,
825
- * });
826
- * ```
827
- */
828
- declare function useVirtualList<T>(options: {
829
- items: () => T[];
830
- itemHeight: number;
831
- containerHeight?: number;
832
- overscan?: number;
833
- }): {
834
- range: ReadonlySignal<VirtualRange>;
835
- visibleItems: ReadonlySignal<{
836
- item: T;
837
- index: number;
838
- }[]>;
839
- onScroll: (e: Event) => void;
840
- setContainerHeight: (height: number) => void;
841
- scrollTop: ReadonlySignal<number>;
842
- };
843
- declare const VirtualFor: Component<VirtualForProps<any>>;
844
-
845
- /**
846
- * defineAsyncComponent — lazy component loading.
847
- *
848
- * Wraps a dynamic import() into a component that shows a loading
849
- * state while the chunk downloads, an error state if it fails,
850
- * and the real component once resolved.
851
- *
852
- * ```ts
853
- * const LazyChart = defineAsyncComponent(() => import('./Chart.akash'));
854
- *
855
- * // With loading/error:
856
- * const LazyChart = defineAsyncComponent({
857
- * loader: () => import('./Chart.akash'),
858
- * loading: () => <Spinner />,
859
- * error: (err) => <p>Failed: {err.message}</p>,
860
- * timeout: 10000,
861
- * });
862
- * ```
863
- */
864
-
865
- type AsyncComponentLoader<P extends Record<string, unknown> = any> = () => Promise<{
866
- default: Component<P>;
867
- }>;
868
- interface AsyncComponentOptions<P extends Record<string, unknown> = any> {
869
- /** The async loader function (dynamic import) */
870
- loader: AsyncComponentLoader<P>;
871
- /** Component to show while loading */
872
- loading?: () => AkashNode;
873
- /** Component to show on error */
874
- error?: (error: Error) => AkashNode;
875
- /** Timeout in ms — show error after this (default: none) */
876
- timeout?: number;
877
- /** Delay in ms before showing loading state (default: 200) */
878
- delay?: number;
879
- }
880
- /**
881
- * Define a component that loads asynchronously via dynamic import.
882
- */
883
- declare function defineAsyncComponent<P extends Record<string, unknown> = any>(loaderOrOptions: AsyncComponentLoader<P> | AsyncComponentOptions<P>): Component<P>;
884
-
885
- /**
886
- * List reconciliation with Longest Increasing Subsequence (LIS).
887
- *
888
- * When a keyed list updates, we need to determine the minimal set of
889
- * DOM operations (inserts, moves, removes). The LIS of the new key
890
- * positions tells us which nodes are already in the correct relative
891
- * order and don't need to move.
892
- *
893
- * This is the same algorithm used by Vue 3, Solid, and Inferno.
894
- */
895
- /**
896
- * Find the Longest Increasing Subsequence of indices.
897
- * Returns the indices into the input array that form the LIS.
898
- *
899
- * Time: O(n log n), Space: O(n)
900
- */
901
- declare function longestIncreasingSubsequence(arr: number[]): number[];
902
- /**
903
- * Reconcile two keyed lists and return the minimal DOM operations.
904
- *
905
- * @param oldKeys - Keys of the current DOM list
906
- * @param newKeys - Keys of the new data list
907
- * @returns Operations to transform old into new
908
- */
909
- interface ReconcileOp {
910
- type: 'insert' | 'move' | 'remove';
911
- /** Index in the NEW array (for insert/move) */
912
- newIndex?: number;
913
- /** Index in the OLD array (for remove/move source) */
914
- oldIndex?: number;
915
- }
916
- declare function reconcileKeys(oldKeys: unknown[], newKeys: unknown[]): ReconcileOp[];
917
- /**
918
- * Count the minimum number of DOM operations needed.
919
- */
920
- declare function countOps(oldKeys: unknown[], newKeys: unknown[]): {
921
- inserts: number;
922
- moves: number;
923
- removes: number;
924
- };
925
-
926
- /**
927
- * Effect disposal and leak detection (dev mode).
928
- *
929
- * In development, tracks all created effects and verifies they
930
- * get properly cleaned up when components unmount. Logs warnings
931
- * for leaked effects that were never disposed.
932
- */
933
- interface EffectRecord {
934
- id: number;
935
- createdAt: number;
936
- stackTrace: string | null;
937
- componentName: string | null;
938
- disposed: boolean;
939
- }
940
- /**
941
- * Enable leak detection. Call once at app startup in dev mode.
942
- *
943
- * ```ts
944
- * if (import.meta.env.DEV) {
945
- * enableLeakDetection();
946
- * }
947
- * ```
948
- */
949
- declare function enableLeakDetection(): void;
950
- /**
951
- * Disable leak detection.
952
- */
953
- declare function disableLeakDetection(): void;
954
- /**
955
- * Check if leak detection is enabled.
956
- */
957
- declare function isLeakDetectionEnabled(): boolean;
958
- /**
959
- * Register an effect for tracking. Called internally by effect().
960
- * Returns an ID for later disposal tracking.
961
- */
962
- declare function trackEffect(componentName?: string): number;
963
- /**
964
- * Mark an effect as disposed. Called internally by effect dispose function.
965
- */
966
- declare function untrackEffect(id: number): void;
967
- /**
968
- * Get all currently active (undisposed) effects.
969
- */
970
- declare function getActiveEffects(): EffectRecord[];
971
- /**
972
- * Check for leaked effects and return warnings.
973
- * An effect is considered leaked if it's been active for longer
974
- * than the given threshold without being disposed.
975
- */
976
- declare function checkForLeaks(thresholdMs?: number): LeakWarning[];
977
- /**
978
- * Log leak warnings to the console.
979
- */
980
- declare function reportLeaks(thresholdMs?: number): void;
981
- /**
982
- * Get a summary of effect tracking state.
983
- */
984
- declare function getLeakDetectionStats(): {
985
- enabled: boolean;
986
- activeCount: number;
987
- totalTracked: number;
988
- };
989
- interface LeakWarning {
990
- effectId: number;
991
- age: number;
992
- componentName: string | null;
993
- stackTrace: string | null;
994
- }
995
-
996
- /**
997
- * Performance profiling utilities.
998
- *
999
- * Measure component render times, signal propagation, and
1000
- * effect execution for performance debugging.
1001
- *
1002
- * ```ts
1003
- * import { startProfiling, stopProfiling, getProfile } from '@akashjs/runtime';
1004
- *
1005
- * startProfiling();
1006
- * // ... do stuff ...
1007
- * stopProfiling();
1008
- * console.table(getProfile().entries);
1009
- * ```
1010
- */
1011
- interface PerfEntry {
1012
- type: 'render' | 'effect' | 'signal-update' | 'computed';
1013
- name: string;
1014
- duration: number;
1015
- timestamp: number;
1016
- }
1017
- interface PerfProfile {
1018
- entries: PerfEntry[];
1019
- totalDuration: number;
1020
- startTime: number;
1021
- endTime: number;
1022
- }
1023
- interface PerfSummary {
1024
- totalRenders: number;
1025
- totalEffects: number;
1026
- totalSignalUpdates: number;
1027
- totalComputedEvals: number;
1028
- avgRenderTime: number;
1029
- avgEffectTime: number;
1030
- slowestRender: PerfEntry | null;
1031
- slowestEffect: PerfEntry | null;
1032
- }
1033
- /**
1034
- * Start profiling. Clears previous data.
1035
- */
1036
- declare function startProfiling(): void;
1037
- /**
1038
- * Stop profiling.
1039
- */
1040
- declare function stopProfiling(): PerfProfile;
1041
- /**
1042
- * Check if profiling is active.
1043
- */
1044
- declare function isProfiling(): boolean;
1045
- /**
1046
- * Record a performance entry (called internally by the framework).
1047
- */
1048
- declare function recordPerfEntry(type: PerfEntry['type'], name: string, duration: number): void;
1049
- /**
1050
- * Get a summary of the profiling data.
1051
- */
1052
- declare function getProfileSummary(profile: PerfProfile): PerfSummary;
1053
- /**
1054
- * Measure the time to execute a function.
1055
- *
1056
- * ```ts
1057
- * const { result, duration } = measureSync('my-operation', () => expensiveWork());
1058
- * ```
1059
- */
1060
- declare function measureSync<T>(name: string, fn: () => T): {
1061
- result: T;
1062
- duration: number;
1063
- };
1064
- /**
1065
- * Measure the time to execute an async function.
1066
- */
1067
- declare function measureAsync<T>(name: string, fn: () => Promise<T>): Promise<{
1068
- result: T;
1069
- duration: number;
1070
- }>;
1071
- /**
1072
- * Create a named timer for manual start/stop measurement.
1073
- *
1074
- * ```ts
1075
- * const timer = createTimer('data-fetch');
1076
- * timer.start();
1077
- * await fetch(...);
1078
- * timer.stop(); // records the entry
1079
- * timer.duration; // ms
1080
- * ```
1081
- */
1082
- declare function createTimer(name: string): {
1083
- start(): void;
1084
- stop(): void;
1085
- readonly duration: number;
1086
- };
1087
- /**
1088
- * Format a profile for console output.
1089
- */
1090
- declare function formatProfile(profile: PerfProfile): string;
1091
-
1092
- /**
1093
- * Accessibility composables.
1094
- *
1095
- * Built-in a11y primitives that no other framework ships natively.
1096
- * Focus management, screen reader announcements, and keyboard shortcuts.
1097
- */
1098
-
1099
- interface FocusTrapOptions {
1100
- /** CSS selector or element to focus initially (default: first focusable) */
1101
- initialFocus?: string | HTMLElement;
1102
- /** Return focus to the previously focused element on deactivate */
1103
- returnFocus?: boolean;
1104
- /** Escape key deactivates the trap (default: true) */
1105
- escapeDeactivates?: boolean;
1106
- /** Allow clicks outside the trap container (default: false) */
1107
- allowOutsideClick?: boolean;
1108
- /** Callback when Escape deactivates */
1109
- onDeactivate?: () => void;
1110
- }
1111
- interface FocusTrap {
1112
- /** Activate the focus trap */
1113
- activate(): void;
1114
- /** Deactivate the focus trap */
1115
- deactivate(): void;
1116
- /** Whether the trap is currently active */
1117
- active: ReadonlySignal<boolean>;
1118
- }
1119
- /**
1120
- * Trap focus inside a container element.
1121
- *
1122
- * ```ts
1123
- * const trap = useFocusTrap(dialogRef, {
1124
- * initialFocus: '#first-input',
1125
- * returnFocus: true,
1126
- * escapeDeactivates: true,
1127
- * });
1128
- * trap.activate(); // on open
1129
- * trap.deactivate(); // on close
1130
- * ```
1131
- */
1132
- declare function useFocusTrap(container: HTMLElement | (() => HTMLElement | null), options?: FocusTrapOptions): FocusTrap;
1133
- type AriaLive = 'polite' | 'assertive' | 'off';
1134
- /**
1135
- * Screen reader announcements via ARIA live regions.
1136
- *
1137
- * ```ts
1138
- * const announce = useAnnounce();
1139
- * announce('Page loaded: Dashboard');
1140
- * announce('Error: Invalid email', 'assertive');
1141
- * ```
1142
- */
1143
- declare function useAnnounce(): (message: string, politeness?: AriaLive) => void;
1144
- interface KeyBinding {
1145
- /** Key combo: 'mod+k', 'Escape', 'ArrowDown', 'shift+Enter' */
1146
- key: string;
1147
- /** Handler function */
1148
- handler: (e: KeyboardEvent) => void;
1149
- /** Optional scope (only active when scope is enabled) */
1150
- scope?: string;
1151
- /** Description for help dialog */
1152
- description?: string;
1153
- /** Prevent default browser behavior (default: true) */
1154
- preventDefault?: boolean;
1155
- }
1156
- interface KeyboardManager {
1157
- /** Register a binding */
1158
- bind(key: string, handler: (e: KeyboardEvent) => void, options?: {
1159
- scope?: string;
1160
- description?: string;
1161
- preventDefault?: boolean;
1162
- }): () => void;
1163
- /** Enable a scope */
1164
- enableScope(scope: string): void;
1165
- /** Disable a scope */
1166
- disableScope(scope: string): void;
1167
- /** Get all bindings (for help dialog) */
1168
- getBindings(): Array<{
1169
- key: string;
1170
- description: string;
1171
- scope?: string;
1172
- }>;
1173
- /** Dispose all bindings */
1174
- dispose(): void;
1175
- }
1176
- /**
1177
- * Keyboard shortcut manager with scope support.
1178
- *
1179
- * ```ts
1180
- * const kb = useKeyboard();
1181
- * kb.bind('mod+k', () => openSearch(), { description: 'Open search' });
1182
- * kb.bind('Escape', () => close(), { scope: 'modal' });
1183
- * kb.enableScope('modal');
1184
- * ```
1185
- */
1186
- declare function useKeyboard(): KeyboardManager;
1187
-
1188
- /**
1189
- * <Image> component.
1190
- *
1191
- * Optimized image rendering with lazy loading, srcset/sizes,
1192
- * blur placeholder, and error fallback.
1193
- *
1194
- * ```html
1195
- * <Image
1196
- * src="/photos/hero.jpg"
1197
- * alt="Hero image"
1198
- * width={800}
1199
- * height={600}
1200
- * placeholder="blur"
1201
- * blurDataUrl="data:image/jpeg;base64,..."
1202
- * srcset="/photos/hero-400.jpg 400w, /photos/hero-800.jpg 800w"
1203
- * sizes="(max-width: 600px) 400px, 800px"
1204
- * loading="lazy"
1205
- * />
1206
- * ```
1207
- */
1208
- interface ImageProps {
1209
- /** Image source URL */
1210
- src: string;
1211
- /** Alt text (required for accessibility) */
1212
- alt: string;
1213
- /** Width in pixels */
1214
- width?: number;
1215
- /** Height in pixels */
1216
- height?: number;
1217
- /** Loading strategy (default: 'lazy') */
1218
- loading?: 'lazy' | 'eager';
1219
- /** Srcset for responsive images */
1220
- srcset?: string;
1221
- /** Sizes attribute for responsive images */
1222
- sizes?: string;
1223
- /** Placeholder strategy */
1224
- placeholder?: 'blur' | 'empty';
1225
- /** Base64 data URL for blur placeholder */
1226
- blurDataUrl?: string;
1227
- /** CSS class */
1228
- class?: string;
1229
- /** Error fallback image URL */
1230
- fallbackSrc?: string;
1231
- /** Callback when image loads */
1232
- onLoad?: () => void;
1233
- /** Callback when image fails to load */
1234
- onError?: (error: Event) => void;
1235
- }
1236
- declare const Image: Component<ImageProps>;
1237
-
1238
- /**
1239
- * Infinite scroll composable.
1240
- *
1241
- * Uses IntersectionObserver to detect when a sentinel element
1242
- * enters the viewport, then triggers loading more data.
1243
- * Pairs with createCursorPagination() from @akashjs/http.
1244
- *
1245
- * ```ts
1246
- * const { sentinel, loading, done } = useInfiniteScroll({
1247
- * onLoadMore: async () => {
1248
- * pager.loadMore();
1249
- * await fetchNextPage();
1250
- * },
1251
- * hasMore: () => pager.hasMore(),
1252
- * });
1253
- * // Append sentinel() element at the end of your list
1254
- * ```
1255
- */
1256
-
1257
- interface InfiniteScrollOptions {
1258
- /** Callback to load more items */
1259
- onLoadMore: () => Promise<void> | void;
1260
- /** Whether there are more items to load */
1261
- hasMore: () => boolean;
1262
- /** Root margin for the observer (default: '200px') */
1263
- rootMargin?: string;
1264
- /** Threshold for the observer (default: 0) */
1265
- threshold?: number;
1266
- }
1267
- interface InfiniteScroll {
1268
- /** Sentinel element to place at the end of the list */
1269
- sentinel: () => HTMLElement;
1270
- /** Whether a load is in progress */
1271
- loading: ReadonlySignal<boolean>;
1272
- /** Whether all items have been loaded */
1273
- done: ReadonlySignal<boolean>;
1274
- /** Reset the scroll state */
1275
- reset(): void;
1276
- /** Dispose the observer */
1277
- dispose(): void;
1278
- }
1279
- /**
1280
- * Create an infinite scroll controller.
1281
- */
1282
- declare function useInfiniteScroll(options: InfiniteScrollOptions): InfiniteScroll;
1283
-
1284
- /**
1285
- * CSS utility functions.
1286
- *
1287
- * cx() for class name merging and css() for dynamic style objects.
1288
- * Tiny but used in every component.
1289
- */
1290
- type CxInput = string | boolean | null | undefined | Record<string, boolean> | CxInput[];
1291
- /**
1292
- * Merge class names conditionally. Falsy values are filtered out.
1293
- * Object keys are included when their value is truthy.
1294
- *
1295
- * ```ts
1296
- * cx('btn', isActive && 'btn-active', { 'btn-lg': isLarge })
1297
- * // 'btn btn-active btn-lg'
1298
- *
1299
- * cx('card', undefined, false, null, 'card-primary')
1300
- * // 'card card-primary'
1301
- * ```
1302
- */
1303
- declare function cx(...inputs: CxInput[]): string;
1304
- type CssValue = string | number | null | undefined;
1305
- type CssProperties = Record<string, CssValue>;
1306
- /**
1307
- * Build a CSS style string from an object. Handles camelCase → kebab-case
1308
- * conversion and filters out null/undefined values.
1309
- *
1310
- * ```ts
1311
- * css({ backgroundColor: 'red', fontSize: 14, display: isVisible ? 'block' : 'none' })
1312
- * // 'background-color: red; font-size: 14px; display: block'
1313
- * ```
1314
- */
1315
- declare function css(styles: CssProperties): string;
1316
- /**
1317
- * Apply a style object to an element.
1318
- *
1319
- * ```ts
1320
- * applyStyles(el, { color: 'red', marginTop: 10 });
1321
- * ```
1322
- */
1323
- declare function applyStyles(el: HTMLElement, styles: CssProperties): void;
1324
-
1325
- /**
1326
- * Headless data table.
1327
- *
1328
- * Signal-based table state management with sorting, filtering,
1329
- * column visibility, and pagination integration. No DOM — just logic.
1330
- *
1331
- * ```ts
1332
- * const table = createDataTable({
1333
- * data: () => users(),
1334
- * columns: [
1335
- * { key: 'name', header: 'Name', sortable: true },
1336
- * { key: 'email', header: 'Email', sortable: true, filterable: true },
1337
- * { key: 'age', header: 'Age', sortable: true },
1338
- * ],
1339
- * pageSize: 20,
1340
- * });
1341
- *
1342
- * table.rows(); // current page of sorted/filtered data
1343
- * table.sort('name'); // toggle sort by column
1344
- * table.filter('search term');
1345
- * table.toggleColumn('age');
1346
- * table.nextPage();
1347
- * ```
1348
- */
1349
-
1350
- interface ColumnDef<T> {
1351
- /** Key to access the data (dot notation supported) */
1352
- key: string;
1353
- /** Display header */
1354
- header: string;
1355
- /** Whether this column is sortable (default: false) */
1356
- sortable?: boolean;
1357
- /** Whether this column is searchable by the global filter (default: false) */
1358
- filterable?: boolean;
1359
- /** Custom sort comparator */
1360
- compare?: (a: T, b: T) => number;
1361
- /** Custom cell value accessor */
1362
- accessor?: (row: T) => unknown;
1363
- /** Whether column is visible by default (default: true) */
1364
- visible?: boolean;
1365
- }
1366
- type SortDirection = 'asc' | 'desc' | null;
1367
- interface SortState {
1368
- column: string | null;
1369
- direction: SortDirection;
1370
- }
1371
- interface DataTableOptions<T> {
1372
- /** Reactive data source */
1373
- data: () => T[];
1374
- /** Column definitions */
1375
- columns: ColumnDef<T>[];
1376
- /** Page size (0 = no pagination) */
1377
- pageSize?: number;
1378
- /** Initial sort */
1379
- initialSort?: SortState;
1380
- }
1381
- interface DataTable<T> {
1382
- /** Current page of processed (sorted + filtered) rows */
1383
- rows: ReadonlySignal<T[]>;
1384
- /** All processed rows (before pagination) */
1385
- allRows: ReadonlySignal<T[]>;
1386
- /** Total row count after filtering */
1387
- totalRows: ReadonlySignal<number>;
1388
- /** Visible columns */
1389
- visibleColumns: ReadonlySignal<ColumnDef<T>[]>;
1390
- /** Current sort state */
1391
- sortState: ReadonlySignal<SortState>;
1392
- /** Current filter text */
1393
- filterText: ReadonlySignal<string>;
1394
- /** Current page (1-based) */
1395
- page: ReadonlySignal<number>;
1396
- /** Total pages */
1397
- totalPages: ReadonlySignal<number>;
1398
- /** Toggle or set sort on a column */
1399
- sort(columnKey: string): void;
1400
- /** Set the global filter text */
1401
- filter(text: string): void;
1402
- /** Toggle column visibility */
1403
- toggleColumn(columnKey: string): void;
1404
- /** Show a column */
1405
- showColumn(columnKey: string): void;
1406
- /** Hide a column */
1407
- hideColumn(columnKey: string): void;
1408
- /** Go to next page */
1409
- nextPage(): void;
1410
- /** Go to previous page */
1411
- prevPage(): void;
1412
- /** Go to specific page */
1413
- goToPage(page: number): void;
1414
- /** Reset all state (sort, filter, page) */
1415
- reset(): void;
1416
- }
1417
- declare function createDataTable<T extends Record<string, unknown>>(options: DataTableOptions<T>): DataTable<T>;
1418
-
1419
- /**
1420
- * SEO utilities.
1421
- *
1422
- * Structured data (JSON-LD), Open Graph helpers, and canonical URL management.
1423
- * Works with useHead() for SSR-compatible head tag management.
1424
- *
1425
- * ```ts
1426
- * useStructuredData({
1427
- * '@type': 'Article',
1428
- * headline: 'My Post',
1429
- * author: { '@type': 'Person', name: 'Alice' },
1430
- * });
1431
- * ```
1432
- */
1433
- interface StructuredData {
1434
- '@context'?: string;
1435
- '@type': string;
1436
- [key: string]: unknown;
1437
- }
1438
- interface OpenGraphData {
1439
- title: string;
1440
- description?: string;
1441
- image?: string;
1442
- url?: string;
1443
- type?: string;
1444
- siteName?: string;
1445
- locale?: string;
1446
- }
1447
- interface TwitterCardData {
1448
- card?: 'summary' | 'summary_large_image' | 'player' | 'app';
1449
- title: string;
1450
- description?: string;
1451
- image?: string;
1452
- site?: string;
1453
- creator?: string;
1454
- }
1455
- interface SEOConfig {
1456
- title: string;
1457
- description?: string;
1458
- canonical?: string;
1459
- robots?: string;
1460
- openGraph?: OpenGraphData;
1461
- twitter?: TwitterCardData;
1462
- structuredData?: StructuredData | StructuredData[];
1463
- }
1464
- /**
1465
- * Inject JSON-LD structured data into the document head.
1466
- * Data is automatically wrapped with @context.
1467
- *
1468
- * ```ts
1469
- * useStructuredData({
1470
- * '@type': 'WebSite',
1471
- * name: 'AkashJS',
1472
- * url: 'https://akashjs.dev',
1473
- * });
1474
- * ```
1475
- */
1476
- declare function useStructuredData(data: StructuredData | StructuredData[]): void;
1477
- /**
1478
- * Set Open Graph meta tags.
1479
- *
1480
- * ```ts
1481
- * useOpenGraph({
1482
- * title: 'My Page',
1483
- * description: 'Page description',
1484
- * image: '/og-image.jpg',
1485
- * type: 'article',
1486
- * });
1487
- * ```
1488
- */
1489
- declare function useOpenGraph(data: OpenGraphData): void;
1490
- /**
1491
- * Set Twitter Card meta tags.
1492
- *
1493
- * ```ts
1494
- * useTwitterCard({
1495
- * card: 'summary_large_image',
1496
- * title: 'My Page',
1497
- * image: '/twitter-card.jpg',
1498
- * });
1499
- * ```
1500
- */
1501
- declare function useTwitterCard(data: TwitterCardData): void;
1502
- /**
1503
- * Set all SEO-related head tags at once.
1504
- *
1505
- * ```ts
1506
- * useSEO({
1507
- * title: 'My Page | MySite',
1508
- * description: 'Page description',
1509
- * canonical: 'https://mysite.com/page',
1510
- * openGraph: { title: 'My Page', image: '/og.jpg' },
1511
- * twitter: { card: 'summary_large_image', title: 'My Page' },
1512
- * structuredData: { '@type': 'WebPage', name: 'My Page' },
1513
- * });
1514
- * ```
1515
- */
1516
- declare function useSEO(config: SEOConfig): void;
1517
- interface SitemapEntry {
1518
- url: string;
1519
- lastmod?: string;
1520
- changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
1521
- priority?: number;
1522
- }
1523
- /**
1524
- * Generate a sitemap.xml string from route entries.
1525
- *
1526
- * ```ts
1527
- * const xml = generateSitemap('https://mysite.com', [
1528
- * { url: '/', priority: 1.0 },
1529
- * { url: '/about', changefreq: 'monthly' },
1530
- * { url: '/blog/hello', lastmod: '2026-03-29' },
1531
- * ]);
1532
- * ```
1533
- */
1534
- declare function generateSitemap(baseUrl: string, entries: SitemapEntry[]): string;
1535
-
1536
- /**
1537
- * Pipes — template transform functions.
1538
- *
1539
- * Pure functions that transform display values. Chainable, memoized,
1540
- * and usable both in templates and in script.
1541
- *
1542
- * ```ts
1543
- * import { pipe, uppercase, date, currency } from '@akashjs/runtime';
1544
- *
1545
- * pipe('hello', uppercase); // 'HELLO'
1546
- * pipe(new Date(), date, 'short'); // '3/29/26'
1547
- * pipe(1234.5, currency, 'USD'); // '$1,234.50'
1548
- * pipe('hello world', capitalize, truncate, 5); // 'Hello...'
1549
- * ```
1550
- */
1551
- type PipeFn<TIn = any, TOut = any> = (value: TIn, ...args: any[]) => TOut;
1552
- /**
1553
- * Apply a pipe transform to a value.
1554
- *
1555
- * ```ts
1556
- * pipe('hello', uppercase); // 'HELLO'
1557
- * pipe(1234, currency, 'USD'); // '$1,234.00'
1558
- * ```
1559
- */
1560
- declare function pipe(value: any, transform: Function, ...rest: any[]): any;
1561
- /**
1562
- * Chain multiple pipes together.
1563
- *
1564
- * ```ts
1565
- * const format = chain(trim, capitalize, truncate);
1566
- * format(' hello world ', 10); // 'Hello w...'
1567
- * ```
1568
- */
1569
- declare function chain<T>(...pipes: PipeFn[]): PipeFn<T, any>;
1570
- /**
1571
- * Define a custom pipe.
1572
- *
1573
- * ```ts
1574
- * const reverse = definePipe<string, string>((value) =>
1575
- * value.split('').reverse().join('')
1576
- * );
1577
- * pipe('hello', reverse); // 'olleh'
1578
- * ```
1579
- */
1580
- declare function definePipe<TIn, TOut>(fn: PipeFn<TIn, TOut>): PipeFn<TIn, TOut>;
1581
- /** Convert string to uppercase */
1582
- declare const uppercase: PipeFn<string, string>;
1583
- /** Convert string to lowercase */
1584
- declare const lowercase: PipeFn<string, string>;
1585
- /** Capitalize first letter */
1586
- declare const capitalize: PipeFn<string, string>;
1587
- /** Title case — capitalize each word */
1588
- declare const titleCase: PipeFn<string, string>;
1589
- /** Trim whitespace */
1590
- declare const trim: PipeFn<string, string>;
1591
- /**
1592
- * Truncate string to a max length, adding ellipsis.
1593
- *
1594
- * ```ts
1595
- * pipe('Hello World', truncate, 8); // 'Hello...'
1596
- * ```
1597
- */
1598
- declare const truncate: PipeFn<string, string>;
1599
- /**
1600
- * Format a date.
1601
- *
1602
- * ```ts
1603
- * pipe(new Date(), date); // '3/29/2026'
1604
- * pipe(new Date(), date, 'short'); // '3/29/26'
1605
- * pipe(new Date(), date, 'long'); // 'March 29, 2026'
1606
- * pipe(new Date(), date, 'time'); // '2:30 PM'
1607
- * pipe(new Date(), date, 'iso'); // '2026-03-29T...'
1608
- * ```
1609
- */
1610
- declare const date: PipeFn<Date | string | number, string>;
1611
- /**
1612
- * Format a number as currency.
1613
- *
1614
- * ```ts
1615
- * pipe(1234.5, currency); // '$1,234.50'
1616
- * pipe(1234.5, currency, 'EUR'); // '€1,234.50'
1617
- * ```
1618
- */
1619
- declare const currency: PipeFn<number, string>;
1620
- /**
1621
- * Format a number with locale formatting.
1622
- *
1623
- * ```ts
1624
- * pipe(1234567.89, number); // '1,234,567.89'
1625
- * pipe(1234567.89, number, '0-2'); // '1,234,567.89' (0-2 decimal digits)
1626
- * ```
1627
- */
1628
- declare const number: PipeFn<number, string>;
1629
- /**
1630
- * Format a number as a percentage.
1631
- *
1632
- * ```ts
1633
- * pipe(0.85, percent); // '85%'
1634
- * pipe(0.856, percent); // '86%'
1635
- * ```
1636
- */
1637
- declare const percent: PipeFn<number, string>;
1638
- /**
1639
- * JSON stringify with formatting.
1640
- *
1641
- * ```ts
1642
- * pipe({ a: 1 }, json); // '{\n "a": 1\n}'
1643
- * pipe({ a: 1 }, json, 0); // '{"a":1}'
1644
- * ```
1645
- */
1646
- declare const json: PipeFn<unknown, string>;
1647
- /**
1648
- * Pluralize a string based on count.
1649
- *
1650
- * ```ts
1651
- * pipe(1, plural, 'item', 'items'); // '1 item'
1652
- * pipe(5, plural, 'item', 'items'); // '5 items'
1653
- * ```
1654
- */
1655
- declare const plural: PipeFn<number, string>;
1656
- /**
1657
- * Relative time formatting.
1658
- *
1659
- * ```ts
1660
- * pipe(Date.now() - 60000, relativeTime); // '1 minute ago'
1661
- * ```
1662
- */
1663
- declare const relativeTime: PipeFn<Date | number, string>;
1664
-
1665
- /**
1666
- * Custom directive system.
1667
- *
1668
- * Reusable attribute behaviors with lifecycle hooks.
1669
- * Directives attach behavior to elements without components.
1670
- *
1671
- * ```ts
1672
- * const vAutoFocus = defineDirective({
1673
- * mounted(el) { el.focus(); },
1674
- * });
1675
- *
1676
- * const vTooltip = defineDirective<string>({
1677
- * mounted(el, { value }) { addTooltip(el, value); },
1678
- * updated(el, { value }) { updateTooltip(el, value); },
1679
- * unmounted(el) { removeTooltip(el); },
1680
- * });
1681
- *
1682
- * // Usage:
1683
- * applyDirective(el, vAutoFocus);
1684
- * applyDirective(el, vTooltip, 'Hello tooltip');
1685
- * ```
1686
- */
1687
- interface DirectiveBinding<T = any> {
1688
- /** Current value passed to the directive */
1689
- value: T;
1690
- /** Previous value (on update) */
1691
- oldValue?: T;
1692
- /** Argument (e.g., v-on:click → arg = 'click') */
1693
- arg?: string;
1694
- /** Modifiers (e.g., v-on.prevent → modifiers.prevent = true) */
1695
- modifiers?: Record<string, boolean>;
1696
- }
1697
- interface DirectiveHooks<T = any> {
1698
- /** Called when the element is inserted into the DOM */
1699
- mounted?: (el: HTMLElement, binding: DirectiveBinding<T>) => void;
1700
- /** Called when the bound value updates */
1701
- updated?: (el: HTMLElement, binding: DirectiveBinding<T>) => void;
1702
- /** Called before the element is removed from the DOM */
1703
- unmounted?: (el: HTMLElement, binding: DirectiveBinding<T>) => void;
1704
- }
1705
- interface Directive<T = any> {
1706
- _type: 'directive';
1707
- hooks: DirectiveHooks<T>;
1708
- }
1709
- /**
1710
- * Define a custom directive.
1711
- *
1712
- * ```ts
1713
- * const vClickOutside = defineDirective<() => void>({
1714
- * mounted(el, { value: handler }) {
1715
- * const listener = (e: Event) => {
1716
- * if (!el.contains(e.target as Node)) handler();
1717
- * };
1718
- * document.addEventListener('click', listener);
1719
- * (el as any).__clickOutside = listener;
1720
- * },
1721
- * unmounted(el) {
1722
- * document.removeEventListener('click', (el as any).__clickOutside);
1723
- * },
1724
- * });
1725
- * ```
1726
- */
1727
- declare function defineDirective<T = any>(hooks: DirectiveHooks<T>): Directive<T>;
1728
- /**
1729
- * Shorthand: directive from a single function (runs on mount).
1730
- */
1731
- declare function directiveFromFn<T = any>(fn: (el: HTMLElement, binding: DirectiveBinding<T>) => void | (() => void)): Directive<T>;
1732
- /**
1733
- * Apply a directive to an element.
1734
- *
1735
- * ```ts
1736
- * applyDirective(el, vAutoFocus);
1737
- * applyDirective(el, vTooltip, 'Hello');
1738
- * ```
1739
- */
1740
- declare function applyDirective<T>(el: HTMLElement, directive: Directive<T>, value?: T, options?: {
1741
- arg?: string;
1742
- modifiers?: Record<string, boolean>;
1743
- }): void;
1744
- /**
1745
- * Update a directive's value on an element.
1746
- */
1747
- declare function updateDirective<T>(el: HTMLElement, directive: Directive<T>, newValue: T): void;
1748
- /**
1749
- * Remove all directives from an element (call on unmount).
1750
- */
1751
- declare function removeDirectives(el: HTMLElement): void;
1752
- /** Auto-focus an element when mounted */
1753
- declare const vAutoFocus: Directive<any>;
1754
- /** Click outside handler */
1755
- declare const vClickOutside: Directive<() => void>;
1756
- /** Long press handler */
1757
- declare const vLongPress: Directive<{
1758
- handler: () => void;
1759
- duration?: number;
1760
- }>;
1761
- /** Intersection observer — triggers callback when element enters viewport */
1762
- declare const vIntersect: Directive<(isIntersecting: boolean) => void>;
1763
- /** Resize observer — triggers callback on element resize */
1764
- declare const vResize: Directive<(entry: ResizeObserverEntry) => void>;
1765
-
1766
- /**
1767
- * Web Components output.
1768
- *
1769
- * Compile AkashJS components to native Custom Elements that can
1770
- * be used in any framework or plain HTML.
1771
- *
1772
- * ```ts
1773
- * import { defineCustomElement } from '@akashjs/runtime';
1774
- * import Counter from './Counter.akash';
1775
- *
1776
- * defineCustomElement('my-counter', Counter, {
1777
- * props: ['initial'],
1778
- * shadow: true,
1779
- * });
1780
- *
1781
- * // Now usable as: <my-counter initial="5"></my-counter>
1782
- * ```
1783
- */
1784
-
1785
- interface CustomElementOptions {
1786
- /** Props to observe as attributes */
1787
- props?: string[];
1788
- /** Use Shadow DOM (default: true) */
1789
- shadow?: boolean;
1790
- /** CSS styles to inject (for shadow DOM) */
1791
- styles?: string;
1792
- /** Extend an existing element */
1793
- extends?: string;
1794
- }
1795
- /**
1796
- * Register an AkashJS component as a Custom Element.
1797
- *
1798
- * ```ts
1799
- * defineCustomElement('my-counter', Counter, {
1800
- * props: ['initial', 'step'],
1801
- * shadow: true,
1802
- * styles: ':host { display: block; }',
1803
- * });
1804
- * ```
1805
- */
1806
- declare function defineCustomElement<P extends Record<string, unknown>>(tagName: string, component: Component<P>, options?: CustomElementOptions): typeof HTMLElement;
1807
- /**
1808
- * Convert an AkashJS component to a Custom Element class without registering.
1809
- * Useful for testing or when you want to register later.
1810
- */
1811
- declare function toCustomElement<P extends Record<string, unknown>>(component: Component<P>, options?: CustomElementOptions): typeof HTMLElement;
1812
-
1813
- /**
1814
- * Static Site Generation (SSG) / Prerendering.
1815
- *
1816
- * Pre-render pages at build time to static HTML files.
1817
- * Combine with hydration for interactive islands.
1818
- *
1819
- * ```ts
1820
- * // In build script or akash build --prerender:
1821
- * await prerender({
1822
- * routes: ['/', '/about', '/blog/hello'],
1823
- * render: (url) => renderToString(App, { url }),
1824
- * outDir: 'dist',
1825
- * });
1826
- * ```
1827
- */
1828
- interface PrerenderOptions {
1829
- /** Routes to prerender */
1830
- routes: string[] | (() => Promise<string[]>);
1831
- /** Render function — returns HTML for a given URL */
1832
- render: (url: string) => Promise<string> | string;
1833
- /** Output directory (default: 'dist') */
1834
- outDir?: string;
1835
- /** HTML template with {{content}} placeholder */
1836
- template?: string;
1837
- /** Callback per rendered page */
1838
- onPage?: (url: string, html: string) => void;
1839
- /** Callback on error */
1840
- onError?: (url: string, error: Error) => void;
1841
- /** Concurrency limit (default: 5) */
1842
- concurrency?: number;
1843
- }
1844
- interface PrerenderResult {
1845
- /** Successfully rendered pages */
1846
- rendered: Array<{
1847
- url: string;
1848
- file: string;
1849
- size: number;
1850
- }>;
1851
- /** Pages that failed to render */
1852
- errors: Array<{
1853
- url: string;
1854
- error: string;
1855
- }>;
1856
- /** Total time in ms */
1857
- duration: number;
1858
- }
1859
- /**
1860
- * Pre-render routes to static HTML files.
1861
- */
1862
- declare function prerender(options: PrerenderOptions): Promise<PrerenderResult>;
1863
- /**
1864
- * Discover routes from the file system for prerendering.
1865
- * Scans src/routes/ and returns all static (non-parameterized) paths.
1866
- */
1867
- declare function discoverStaticRoutes(routeManifest: Array<{
1868
- path: string;
1869
- }>): string[];
1870
- /**
1871
- * Generate all possible paths for parameterized routes.
1872
- *
1873
- * ```ts
1874
- * const paths = generatePaths('/blog/:slug', [
1875
- * { slug: 'hello' },
1876
- * { slug: 'world' },
1877
- * ]);
1878
- * // ['/blog/hello', '/blog/world']
1879
- * ```
1880
- */
1881
- declare function generatePaths(pattern: string, params: Record<string, string>[]): string[];
1882
- /**
1883
- * Convert a URL path to a file path for static output.
1884
- * / → index.html
1885
- * /about → about/index.html
1886
- * /blog/hello → blog/hello/index.html
1887
- */
1888
- declare function urlToFilePath(url: string): string;
1889
- /**
1890
- * Generate a sitemap from prerender results.
1891
- */
1892
- declare function sitemapFromResults(baseUrl: string, results: PrerenderResult): string;
1893
-
1894
- /**
1895
- * Render a switch block. Swaps DOM based on reactive expression value.
1896
- */
1897
- declare function renderSwitch(parent: Node, anchor: Node, expression: () => unknown, cases: Record<string, () => Node>): () => void;
1898
- interface SwitchProps {
1899
- /** The value to switch on */
1900
- on: unknown;
1901
- /** Cases map: value → render function */
1902
- cases: Record<string, () => AkashNode>;
1903
- /** Default case */
1904
- fallback?: () => AkashNode;
1905
- }
1906
- /**
1907
- * <Switch> component — declarative switch/case.
1908
- *
1909
- * ```ts
1910
- * Switch({
1911
- * on: status(),
1912
- * cases: {
1913
- * loading: () => Spinner({}),
1914
- * error: () => ErrorView({}),
1915
- * success: () => Content({}),
1916
- * },
1917
- * fallback: () => 'Unknown status',
1918
- * });
1919
- * ```
1920
- */
1921
- declare const Switch: Component<SwitchProps>;
1922
- /**
1923
- * Pattern match on a signal value. Returns the result of the matching branch.
1924
- *
1925
- * ```ts
1926
- * const message = match(status(), {
1927
- * loading: () => 'Loading...',
1928
- * error: () => 'Something went wrong',
1929
- * success: () => 'Done!',
1930
- * _: () => 'Unknown',
1931
- * });
1932
- * ```
1933
- */
1934
- declare function match<T, R>(value: T, cases: Record<string, (value: T) => R> & {
1935
- _?: (value: T) => R;
1936
- }): R | undefined;
1937
-
1938
- /**
1939
- * Hierarchical Dependency Injection.
1940
- *
1941
- * Extends the basic provide/inject with multi-level injectors,
1942
- * provider factories, tree-shakable providers, and multi-providers.
1943
- *
1944
- * ```ts
1945
- * // Define a provider with factory
1946
- * const ApiService = defineProvider({
1947
- * factory: () => createHttpClient({ baseUrl: '/api' }),
1948
- * });
1949
- *
1950
- * // Tree-shakable provider (only bundled if injected)
1951
- * const Logger = defineProvider({
1952
- * factory: () => new ConsoleLogger(),
1953
- * providedIn: 'root',
1954
- * });
1955
- *
1956
- * // Use in component
1957
- * const api = injectProvider(ApiService);
1958
- * ```
1959
- */
1960
- interface ProviderDef<T> {
1961
- _type: 'provider';
1962
- factory: () => T;
1963
- providedIn?: 'root' | 'component';
1964
- multi?: boolean;
1965
- _id: symbol;
1966
- }
1967
- interface Injector {
1968
- /** Get a provider value */
1969
- get<T>(provider: ProviderDef<T>): T;
1970
- /** Check if a provider is registered */
1971
- has(provider: ProviderDef<unknown>): boolean;
1972
- /** Create a child injector */
1973
- createChild(providers?: ProviderRegistration[]): Injector;
1974
- /** Dispose this injector and all cached instances */
1975
- dispose(): void;
1976
- }
1977
- interface ProviderRegistration<T = unknown> {
1978
- provide: ProviderDef<T>;
1979
- useFactory?: () => T;
1980
- useValue?: T;
1981
- useExisting?: ProviderDef<T>;
1982
- multi?: boolean;
1983
- }
1984
- /**
1985
- * Define a typed provider.
1986
- *
1987
- * ```ts
1988
- * const DatabaseService = defineProvider({
1989
- * factory: () => new Database(config),
1990
- * providedIn: 'root', // singleton, tree-shakable
1991
- * });
1992
- * ```
1993
- */
1994
- declare function defineProvider<T>(config: {
1995
- factory: () => T;
1996
- providedIn?: 'root' | 'component';
1997
- multi?: boolean;
1998
- }): ProviderDef<T>;
1999
- /**
2000
- * Create an injector with hierarchical resolution.
2001
- *
2002
- * ```ts
2003
- * const injector = createInjector([
2004
- * { provide: ApiService, useFactory: () => new MockApi() },
2005
- * { provide: Logger, useValue: console },
2006
- * ]);
2007
- *
2008
- * const api = injector.get(ApiService);
2009
- * ```
2010
- */
2011
- declare function createInjector(providers?: ProviderRegistration[], parent?: Injector): Injector;
2012
- /**
2013
- * Inject a provider in the current component context.
2014
- *
2015
- * ```ts
2016
- * const api = injectProvider(ApiService);
2017
- * ```
2018
- */
2019
- declare function injectProvider<T>(provider: ProviderDef<T>): T;
2020
- /**
2021
- * Clear root provider instances (useful for testing).
2022
- */
2023
- declare function clearProviders(): void;
2024
-
2025
- /**
2026
- * Deferred loading with triggers.
2027
- *
2028
- * Lazy-load components based on viewport visibility, user interaction,
2029
- * idle time, timer, hover, or custom conditions.
2030
- *
2031
- * ```ts
2032
- * const LazyComments = defer(() => import('./Comments.akash'), {
2033
- * trigger: 'viewport',
2034
- * loading: () => <Skeleton variant="text" />,
2035
- * });
2036
- *
2037
- * const LazyChart = defer(() => import('./Chart.akash'), {
2038
- * trigger: 'idle',
2039
- * loading: () => <Spinner />,
2040
- * });
2041
- *
2042
- * const LazyDropdown = defer(() => import('./Dropdown.akash'), {
2043
- * trigger: 'interaction', // loads on hover/focus/click
2044
- * });
2045
- * ```
2046
- */
2047
-
2048
- type DeferTrigger = 'immediate' | 'viewport' | 'interaction' | 'idle' | 'hover' | {
2049
- type: 'timer';
2050
- delay: number;
2051
- } | {
2052
- type: 'custom';
2053
- condition: () => boolean;
2054
- };
2055
- interface DeferOptions {
2056
- /** When to start loading (default: 'viewport') */
2057
- trigger?: DeferTrigger;
2058
- /** Loading placeholder */
2059
- loading?: () => AkashNode;
2060
- /** Error fallback */
2061
- error?: (err: Error) => AkashNode;
2062
- /** Prefetch — start loading early but don't render until triggered */
2063
- prefetch?: boolean;
2064
- /** Minimum loading time in ms (prevent flash of loading state) */
2065
- minLoadTime?: number;
2066
- /** Viewport root margin for 'viewport' trigger */
2067
- rootMargin?: string;
2068
- }
2069
- /**
2070
- * Create a deferred component that loads based on a trigger.
2071
- */
2072
- declare function defer<P extends Record<string, unknown>>(loader: () => Promise<{
2073
- default: Component<P>;
2074
- }>, options?: DeferOptions): Component<P>;
2075
-
2076
- /**
2077
- * View Transitions API integration.
2078
- *
2079
- * Wraps the browser's native View Transitions API for smooth
2080
- * page transitions. Falls back gracefully when not supported.
2081
- *
2082
- * ```ts
2083
- * // With router
2084
- * const router = createRouter(routes);
2085
- * enableViewTransitions(router);
2086
- *
2087
- * // Manual
2088
- * await startViewTransition(() => {
2089
- * updateDOM();
2090
- * });
2091
- * ```
2092
- */
2093
- interface ViewTransitionOptions {
2094
- /** CSS class to add to the document during transition */
2095
- className?: string;
2096
- /** Callback before the transition starts */
2097
- onBefore?: () => void;
2098
- /** Callback after the transition completes */
2099
- onAfter?: () => void;
2100
- /** Fallback behavior when API is not supported (default: 'instant') */
2101
- fallback?: 'instant' | 'fade' | 'none';
2102
- }
2103
- interface ViewTransition {
2104
- /** Promise that resolves when transition animation is complete */
2105
- finished: Promise<void>;
2106
- /** Promise that resolves when the DOM update callback has run */
2107
- updateCallbackDone: Promise<void>;
2108
- /** Promise that resolves when the transition is ready to animate */
2109
- ready: Promise<void>;
2110
- /** Skip the transition animation */
2111
- skipTransition(): void;
2112
- }
2113
- /**
2114
- * Check if the View Transitions API is supported.
2115
- */
2116
- declare function supportsViewTransitions(): boolean;
2117
- /**
2118
- * Start a view transition with the native API, falling back
2119
- * to instant DOM update when not supported.
2120
- *
2121
- * ```ts
2122
- * await startViewTransition(() => {
2123
- * container.innerHTML = newContent;
2124
- * });
2125
- * ```
2126
- */
2127
- declare function startViewTransition(updateCallback: () => void | Promise<void>, options?: ViewTransitionOptions): ViewTransition;
2128
- /**
2129
- * Generate CSS for customizing view transitions.
2130
- *
2131
- * ```ts
2132
- * const css = viewTransitionCSS({
2133
- * duration: '0.3s',
2134
- * oldAnimation: 'slide-out-left',
2135
- * newAnimation: 'slide-in-right',
2136
- * });
2137
- * ```
2138
- */
2139
- declare function viewTransitionCSS(config?: {
2140
- duration?: string;
2141
- easing?: string;
2142
- oldAnimation?: string;
2143
- newAnimation?: string;
2144
- }): string;
2145
- /**
2146
- * Assign a view-transition-name to an element for per-element transitions.
2147
- *
2148
- * ```ts
2149
- * assignTransitionName(headerEl, 'page-header');
2150
- * assignTransitionName(contentEl, 'page-content');
2151
- * ```
2152
- */
2153
- declare function assignTransitionName(el: HTMLElement, name: string): void;
2154
-
2155
- /**
2156
- * URL-synced reactive state.
2157
- *
2158
- * Automatically sync signal values to URL query parameters.
2159
- * Users can share links, use browser back/forward, and state
2160
- * persists across page reloads — all with zero boilerplate.
2161
- *
2162
- * ```ts
2163
- * const search = useQueryState('q', '');
2164
- * const page = useQueryState('page', 1);
2165
- * const tags = useQueryState('tags', ['js']);
2166
- *
2167
- * search.set('akashjs'); // URL → ?q=akashjs&page=1&tags=js
2168
- * // User hits back → signals update automatically
2169
- * ```
2170
- */
2171
-
2172
- interface QueryStateOptions<T> {
2173
- /** Custom serializer (default: auto-detect from type) */
2174
- serialize?: (value: T) => string;
2175
- /** Custom deserializer (default: auto-detect from type) */
2176
- deserialize?: (raw: string) => T;
2177
- /** Whether to push or replace history entry (default: 'replace') */
2178
- history?: 'push' | 'replace';
2179
- /** Debounce URL updates in ms (default: 0) */
2180
- debounce?: number;
2181
- /** Remove param from URL when value equals default */
2182
- removeDefault?: boolean;
2183
- }
2184
- /**
2185
- * Create a signal synced to a URL query parameter.
2186
- *
2187
- * ```ts
2188
- * const search = useQueryState('q', '');
2189
- * search(); // reads from URL or default
2190
- * search.set('hello'); // updates URL to ?q=hello
2191
- * ```
2192
- */
2193
- declare function useQueryState<T>(key: string, defaultValue: T, options?: QueryStateOptions<T>): Signal<T>;
2194
- type QueryStateSchema = Record<string, {
2195
- default: unknown;
2196
- serialize?: (value: any) => string;
2197
- deserialize?: (raw: string) => any;
2198
- }>;
2199
- type QueryStates<T extends QueryStateSchema> = {
2200
- [K in keyof T]: Signal<T[K]['default']>;
2201
- };
2202
- /**
2203
- * Create multiple URL-synced signals at once.
2204
- * All updates within a batch result in a single URL change.
2205
- *
2206
- * ```ts
2207
- * const { q, page, sort } = useQueryStates({
2208
- * q: { default: '' },
2209
- * page: { default: 1 },
2210
- * sort: { default: 'name' },
2211
- * });
2212
- * ```
2213
- */
2214
- declare function useQueryStates<T extends QueryStateSchema>(schema: T, options?: {
2215
- history?: 'push' | 'replace';
2216
- }): QueryStates<T>;
2217
- /**
2218
- * Remove all query state params from the URL.
2219
- */
2220
- declare function clearQueryState(): void;
2221
- /**
2222
- * Get all current query params as a plain object.
2223
- */
2224
- declare function getQueryParams(): Record<string, string>;
2225
- /**
2226
- * Cleanup: remove a specific query state binding.
2227
- */
2228
- declare function removeQueryState(key: string): void;
2229
- /**
2230
- * Cleanup all query state bindings (useful for testing).
2231
- */
2232
- declare function resetQueryState(): void;
2233
-
2234
- /**
2235
- * Tweened values — smooth interpolation between states.
2236
- *
2237
- * Unlike signals that update instantly, tweened values animate
2238
- * smoothly from old to new over a duration.
2239
- *
2240
- * ```ts
2241
- * const progress = tweened(0, { duration: 400 });
2242
- * progress.set(100); // smoothly animates 0 → 100 over 400ms
2243
- * progress(); // intermediate values during animation
2244
- *
2245
- * const color = tweened('#ff0000', { duration: 300, interpolate: lerpColor });
2246
- * ```
2247
- */
2248
- type Interpolator<T> = (from: T, to: T, t: number) => T;
2249
- type EasingFn = (t: number) => number;
2250
- interface TweenedOptions<T> {
2251
- /** Duration in ms (default: 400) */
2252
- duration?: number;
2253
- /** Easing function (default: cubicOut) */
2254
- easing?: EasingFn;
2255
- /** Custom interpolation function */
2256
- interpolate?: Interpolator<T>;
2257
- /** Delay before animation starts */
2258
- delay?: number;
2259
- }
2260
- interface TweenedSignal<T> {
2261
- /** Read current (animated) value */
2262
- (): T;
2263
- /** Set new target — animates from current to new */
2264
- set(value: T, opts?: Partial<TweenedOptions<T>>): Promise<void>;
2265
- /** Set immediately without animation */
2266
- setImmediate(value: T): void;
2267
- /** Current target value */
2268
- target: () => T;
2269
- }
2270
- declare const easings: {
2271
- readonly linear: (t: number) => number;
2272
- readonly cubicIn: (t: number) => number;
2273
- readonly cubicOut: (t: number) => number;
2274
- readonly cubicInOut: (t: number) => number;
2275
- readonly quadIn: (t: number) => number;
2276
- readonly quadOut: (t: number) => number;
2277
- readonly quintOut: (t: number) => number;
2278
- readonly bounceOut: (t: number) => number;
2279
- readonly elasticOut: (t: number) => number;
2280
- };
2281
- /**
2282
- * Create a tweened signal that animates between values.
2283
- *
2284
- * ```ts
2285
- * const count = tweened(0, { duration: 300, easing: easings.cubicOut });
2286
- * count.set(100); // smoothly goes 0 → 100
2287
- * count(); // current interpolated value
2288
- * ```
2289
- */
2290
- declare function tweened<T>(initialValue: T, options?: TweenedOptions<T>): TweenedSignal<T>;
2291
-
2292
- /**
2293
- * FLIP animations for list reordering.
2294
- *
2295
- * First-Last-Invert-Play: measure element positions before and after
2296
- * a DOM change, then animate from old to new positions.
2297
- *
2298
- * ```ts
2299
- * const flip = createFlip(listContainer, {
2300
- * duration: 300,
2301
- * easing: 'cubic-bezier(0.2, 0, 0, 1)',
2302
- * });
2303
- *
2304
- * // Before changing the list:
2305
- * flip.measure();
2306
- * // Change the DOM (reorder, add, remove)
2307
- * items.set(newOrder);
2308
- * // Animate:
2309
- * flip.animate();
2310
- * ```
2311
- */
2312
- interface FlipOptions {
2313
- /** Animation duration in ms (default: 300) */
2314
- duration?: number;
2315
- /** CSS easing (default: 'cubic-bezier(0.2, 0, 0, 1)') */
2316
- easing?: string;
2317
- /** Delay in ms */
2318
- delay?: number;
2319
- /** Only animate elements matching this selector */
2320
- selector?: string;
2321
- /** Key attribute to track elements across reorders (default: 'data-key') */
2322
- keyAttribute?: string;
2323
- /** Callback when animation completes */
2324
- onComplete?: () => void;
2325
- }
2326
- interface FlipController {
2327
- /** Measure current positions (call BEFORE DOM change) */
2328
- measure(): void;
2329
- /** Animate from measured positions to current (call AFTER DOM change) */
2330
- animate(): Promise<void>;
2331
- /** Measure and animate in one step using a callback */
2332
- flip(update: () => void): Promise<void>;
2333
- }
2334
- /**
2335
- * Create a FLIP animation controller for a container.
2336
- *
2337
- * ```ts
2338
- * const flip = createFlip(container);
2339
- * flip.flip(() => {
2340
- * // reorder DOM elements here
2341
- * container.appendChild(container.firstChild); // move first to last
2342
- * });
2343
- * ```
2344
- */
2345
- declare function createFlip(container: HTMLElement, options?: FlipOptions): FlipController;
2346
- /**
2347
- * One-shot FLIP animation helper.
2348
- *
2349
- * ```ts
2350
- * await flip(container, () => {
2351
- * // reorder items
2352
- * }, { duration: 300 });
2353
- * ```
2354
- */
2355
- declare function flip(container: HTMLElement, update: () => void, options?: FlipOptions): Promise<void>;
2356
-
2357
- interface AwaitProps<T> {
2358
- /** The promise to await */
2359
- promise: Promise<T>;
2360
- /** Render while pending */
2361
- pending?: () => AkashNode;
2362
- /** Render when resolved */
2363
- then: (value: T) => AkashNode;
2364
- /** Render when rejected */
2365
- catch?: (error: Error) => AkashNode;
2366
- }
2367
- type AwaitState<T> = {
2368
- status: 'pending';
2369
- } | {
2370
- status: 'resolved';
2371
- value: T;
2372
- } | {
2373
- status: 'rejected';
2374
- error: Error;
2375
- };
2376
- /**
2377
- * <Await> component — declarative promise handling.
2378
- */
2379
- declare const Await: Component<AwaitProps<any>>;
2380
- /**
2381
- * Functional await block — returns a signal that updates as the promise resolves.
2382
- *
2383
- * ```ts
2384
- * const result = awaitSignal(fetchData());
2385
- * result().status; // 'pending' | 'resolved' | 'rejected'
2386
- * ```
2387
- */
2388
- declare function awaitSignal<T>(promise: Promise<T>): () => AwaitState<T>;
2389
-
2390
- /**
2391
- * Event modifiers and extended bind/class/style directives.
2392
- *
2393
- * Modifiers: onClick|preventDefault|stopPropagation|once|self|capture
2394
- * Extended binds: bind:clientWidth, bind:scrollY, bind:group, bind:this
2395
- * Class directive: class:active={isActive}
2396
- * Style directive: style:color={textColor}
2397
- */
2398
-
2399
- interface EventModifiers {
2400
- preventDefault?: boolean;
2401
- stopPropagation?: boolean;
2402
- stopImmediatePropagation?: boolean;
2403
- once?: boolean;
2404
- capture?: boolean;
2405
- passive?: boolean;
2406
- self?: boolean;
2407
- }
2408
- /**
2409
- * Wrap an event handler with modifiers.
2410
- *
2411
- * ```ts
2412
- * const handler = withModifiers(onClick, {
2413
- * preventDefault: true,
2414
- * stopPropagation: true,
2415
- * once: true,
2416
- * });
2417
- * el.addEventListener('click', handler);
2418
- * ```
2419
- */
2420
- declare function withModifiers<E extends Event>(handler: (e: E) => void, modifiers: EventModifiers): (e: E) => void;
2421
- /**
2422
- * Attach an event handler with modifiers to an element.
2423
- *
2424
- * ```ts
2425
- * onEvent(el, 'click', handler, { preventDefault: true, once: true });
2426
- * ```
2427
- */
2428
- declare function onEvent<K extends keyof HTMLElementEventMap>(el: HTMLElement, event: K, handler: (e: HTMLElementEventMap[K]) => void, modifiers?: EventModifiers): () => void;
2429
- /**
2430
- * Bind element dimensions to signals (read-only, auto-updating).
2431
- *
2432
- * ```ts
2433
- * const { width, height } = bindDimensions(el);
2434
- * width(); // tracks clientWidth
2435
- * ```
2436
- */
2437
- declare function bindDimensions(el: HTMLElement): {
2438
- width: ReadonlySignal<number>;
2439
- height: ReadonlySignal<number>;
2440
- };
2441
- /**
2442
- * Bind scroll position to signals.
2443
- *
2444
- * ```ts
2445
- * const { scrollX, scrollY } = bindScroll(el);
2446
- * // or for window:
2447
- * const { scrollX, scrollY } = bindScroll();
2448
- * ```
2449
- */
2450
- declare function bindScroll(el?: HTMLElement): {
2451
- scrollX: Signal<number>;
2452
- scrollY: Signal<number>;
2453
- };
2454
- /**
2455
- * Bind a signal to an element reference (like bind:this in Svelte).
2456
- *
2457
- * ```ts
2458
- * const myRef = bindElement<HTMLInputElement>();
2459
- * // In render: myRef.set(inputEl);
2460
- * myRef()?.focus();
2461
- * ```
2462
- */
2463
- declare function bindElement<T extends HTMLElement = HTMLElement>(): Signal<T | null>;
2464
- /**
2465
- * Bind a group of radio/checkbox inputs to a signal.
2466
- *
2467
- * ```ts
2468
- * const selected = bindGroup<string>('color');
2469
- * // Apply to each radio: bindGroupItem(radioEl, selected, 'red');
2470
- * ```
2471
- */
2472
- declare function bindGroup<T>(name: string): Signal<T | null>;
2473
- declare function bindGroupItem<T>(el: HTMLInputElement, group: Signal<T | null>, value: T): void;
2474
- /**
2475
- * Conditionally apply a CSS class based on a reactive condition.
2476
- *
2477
- * ```ts
2478
- * bindClass(el, 'active', () => isActive());
2479
- * bindClass(el, 'disabled', () => isDisabled());
2480
- * ```
2481
- */
2482
- declare function bindClass(el: HTMLElement, className: string, condition: () => boolean): () => void;
2483
- /**
2484
- * Apply multiple conditional classes at once.
2485
- *
2486
- * ```ts
2487
- * bindClasses(el, {
2488
- * active: () => isActive(),
2489
- * disabled: () => isDisabled(),
2490
- * 'text-bold': () => isBold(),
2491
- * });
2492
- * ```
2493
- */
2494
- declare function bindClasses(el: HTMLElement, classes: Record<string, () => boolean>): () => void;
2495
- /**
2496
- * Reactively bind a CSS property to a value.
2497
- *
2498
- * ```ts
2499
- * bindStyle(el, 'color', () => textColor());
2500
- * bindStyle(el, 'font-size', () => `${fontSize()}px`);
2501
- * ```
2502
- */
2503
- declare function bindStyle(el: HTMLElement, property: string, value: () => string | number | null): () => void;
2504
- /**
2505
- * Bind multiple style properties at once.
2506
- *
2507
- * ```ts
2508
- * bindStyles(el, {
2509
- * color: () => color(),
2510
- * 'font-size': () => `${size()}px`,
2511
- * opacity: () => isVisible() ? 1 : 0,
2512
- * });
2513
- * ```
2514
- */
2515
- declare function bindStyles(el: HTMLElement, styles: Record<string, () => string | number | null>): () => void;
2516
-
2517
- /**
2518
- * Snippets, $inspect, form actions, and navigation snapshots.
2519
- */
2520
-
2521
- type Snippet<TArgs extends unknown[] = []> = (...args: TArgs) => AkashNode;
2522
- /**
2523
- * Define a reusable template snippet.
2524
- *
2525
- * ```ts
2526
- * const UserBadge = defineSnippet((name: string, role: string) => {
2527
- * const el = document.createElement('span');
2528
- * el.textContent = `${name} (${role})`;
2529
- * el.className = 'badge';
2530
- * return el;
2531
- * });
2532
- *
2533
- * // Reuse anywhere:
2534
- * container.appendChild(nodeToDOM(UserBadge('Alice', 'admin')));
2535
- * container.appendChild(nodeToDOM(UserBadge('Bob', 'user')));
2536
- * ```
2537
- */
2538
- declare function defineSnippet<TArgs extends unknown[]>(render: (...args: TArgs) => AkashNode): Snippet<TArgs>;
2539
- interface InspectOptions {
2540
- /** Label prefix for console output */
2541
- label?: string;
2542
- /** Log level (default: 'log') */
2543
- level?: 'log' | 'warn' | 'debug' | 'trace';
2544
- /** Custom logger */
2545
- logger?: (label: string, ...values: unknown[]) => void;
2546
- /** Only log when a condition is true */
2547
- when?: () => boolean;
2548
- }
2549
- /**
2550
- * Debug helper — logs when reactive values change.
2551
- *
2552
- * ```ts
2553
- * const count = signal(0);
2554
- * const name = signal('Alice');
2555
- *
2556
- * inspect(count, name); // logs: [inspect] 0, 'Alice'
2557
- * count.set(1); // logs: [inspect] 1, 'Alice'
2558
- *
2559
- * // With label:
2560
- * inspect(count, { label: 'counter' });
2561
- * // logs: [counter] 1
2562
- * ```
2563
- */
2564
- declare function inspect(...args: Array<(() => unknown) | InspectOptions>): () => void;
2565
- interface FormAction<T = unknown> {
2566
- /** The action URL */
2567
- url: string;
2568
- /** Submit method */
2569
- method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2570
- /** Whether a submission is in progress */
2571
- submitting: ReadonlySignal<boolean>;
2572
- /** The last result */
2573
- result: ReadonlySignal<T | null>;
2574
- /** The last error */
2575
- error: ReadonlySignal<Error | null>;
2576
- /** Create an onSubmit handler for a <form> */
2577
- handle(formData?: Record<string, unknown>): (e: Event) => void;
2578
- /** Submit programmatically */
2579
- submit(data: Record<string, unknown>): Promise<T>;
2580
- }
2581
- /**
2582
- * Define a server-side form action with progressive enhancement.
2583
- *
2584
- * ```ts
2585
- * const createPost = defineFormAction<Post>('/api/posts', {
2586
- * method: 'POST',
2587
- * onSuccess: (post) => navigate(`/posts/${post.id}`),
2588
- * onError: (err) => toast.error(err.message),
2589
- * });
2590
- *
2591
- * // In template:
2592
- * <form onSubmit={createPost.handle()}>
2593
- * <input name="title" />
2594
- * <button disabled={createPost.submitting()}>Create</button>
2595
- * </form>
2596
- * ```
2597
- */
2598
- declare function defineFormAction<T = unknown>(url: string, options?: {
2599
- method?: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2600
- headers?: Record<string, string>;
2601
- onSuccess?: (result: T) => void;
2602
- onError?: (error: Error) => void;
2603
- fetch?: typeof globalThis.fetch;
2604
- }): FormAction<T>;
2605
- interface SnapshotConfig {
2606
- /** Storage key prefix (default: 'akash-snapshot') */
2607
- keyPrefix?: string;
2608
- /** What to capture */
2609
- capture?: ('scroll' | 'forms')[];
2610
- }
2611
- /**
2612
- * Enable navigation snapshots — preserves scroll position and form
2613
- * state when navigating with back/forward.
2614
- *
2615
- * ```ts
2616
- * enableSnapshots();
2617
- * // Now back/forward restores scroll position and form inputs
2618
- * ```
2619
- */
2620
- declare function enableSnapshots(config?: SnapshotConfig): () => void;
2621
-
2622
- /**
2623
- * watch() — react to signal changes with old/new values.
2624
- *
2625
- * Unlike effect() which just re-runs, watch() gives you the previous
2626
- * and current value so you can react to *what changed*.
2627
- *
2628
- * ```ts
2629
- * const count = signal(0);
2630
- * watch(count, (newVal, oldVal) => {
2631
- * console.log(`Changed from ${oldVal} to ${newVal}`);
2632
- * });
2633
- *
2634
- * // With options:
2635
- * watch(count, callback, { immediate: true, once: true });
2636
- *
2637
- * // Multiple sources:
2638
- * watch([count, name], ([newCount, newName], [oldCount, oldName]) => { ... });
2639
- * ```
2640
- */
2641
- interface WatchOptions {
2642
- /** Run callback immediately with current value (default: false) */
2643
- immediate?: boolean;
2644
- /** Only fire once, then auto-dispose (default: false) */
2645
- once?: boolean;
2646
- /** Debounce callback in ms */
2647
- debounce?: number;
2648
- /** Deep comparison for objects (default: false) */
2649
- deep?: boolean;
2650
- }
2651
- type WatchSource<T> = () => T;
2652
- type WatchCallback<T> = (newValue: T, oldValue: T | undefined) => void;
2653
- type WatchArrayCallback<T extends unknown[]> = (newValues: T, oldValues: (T[number] | undefined)[]) => void;
2654
- /**
2655
- * Watch a reactive source and call back with old + new values.
2656
- *
2657
- * ```ts
2658
- * const dispose = watch(count, (newVal, oldVal) => {
2659
- * analytics.track('count_changed', { from: oldVal, to: newVal });
2660
- * });
2661
- * ```
2662
- */
2663
- declare function watch<T>(source: WatchSource<T>, callback: WatchCallback<T>, options?: WatchOptions): () => void;
2664
- /**
2665
- * Watch multiple sources.
2666
- */
2667
- declare function watch<T extends unknown[]>(sources: {
2668
- [K in keyof T]: WatchSource<T[K]>;
2669
- }, callback: WatchArrayCallback<T>, options?: WatchOptions): () => void;
2670
- /**
2671
- * Watch a source once, then auto-dispose.
2672
- *
2673
- * ```ts
2674
- * watchOnce(isReady, (ready) => {
2675
- * if (ready) initApp();
2676
- * });
2677
- * ```
2678
- */
2679
- declare function watchOnce<T>(source: WatchSource<T>, callback: WatchCallback<T>): () => void;
2680
- /**
2681
- * Watch with built-in debounce.
2682
- *
2683
- * ```ts
2684
- * watchDebounced(searchInput, (query) => {
2685
- * fetchResults(query);
2686
- * }, 300);
2687
- * ```
2688
- */
2689
- declare function watchDebounced<T>(source: WatchSource<T>, callback: WatchCallback<T>, ms: number): () => void;
2690
-
2691
- /**
2692
- * Deep reactive signals.
2693
- *
2694
- * Unlike regular signals that are shallow, deepSignal() tracks
2695
- * nested property access and triggers updates when any nested
2696
- * property changes.
2697
- *
2698
- * ```ts
2699
- * const state = deepSignal({ user: { name: 'Alice', age: 30 }, items: [1, 2, 3] });
2700
- * state.user.name; // 'Alice' (tracked)
2701
- * state.user.name = 'Bob'; // triggers reactivity
2702
- * state.items.push(4); // triggers reactivity
2703
- * ```
2704
- */
2705
- type DeepSignal<T> = T extends object ? {
2706
- [K in keyof T]: DeepSignal<T[K]>;
2707
- } & {
2708
- readonly $raw: T;
2709
- readonly $signal: () => T;
2710
- } : T;
2711
- /**
2712
- * Create a deeply reactive signal. Nested property access is tracked,
2713
- * and setting any nested property triggers updates.
2714
- *
2715
- * ```ts
2716
- * const state = deepSignal({
2717
- * user: { name: 'Alice', age: 30 },
2718
- * todos: [{ text: 'Buy milk', done: false }],
2719
- * });
2720
- *
2721
- * effect(() => {
2722
- * console.log(state.user.name); // re-runs when name changes
2723
- * });
2724
- *
2725
- * state.user.name = 'Bob'; // triggers the effect above
2726
- * ```
2727
- */
2728
- declare function deepSignal<T extends object>(initialValue: T): DeepSignal<T>;
2729
- /**
2730
- * Get the raw (unwrapped) value from a deep signal.
2731
- */
2732
- declare function toRaw<T>(proxy: DeepSignal<T>): T;
2733
- /**
2734
- * Check if a value is a deep signal proxy.
2735
- */
2736
- declare function isDeepSignal(value: unknown): boolean;
2737
-
2738
- /**
2739
- * Event bus — typed pub/sub for cross-component communication.
2740
- *
2741
- * Fire-and-forget events between unrelated components without
2742
- * prop drilling or context coupling.
2743
- *
2744
- * ```ts
2745
- * const bus = createEventBus<{
2746
- * 'user:login': { userId: string };
2747
- * 'cart:updated': { itemCount: number };
2748
- * 'notification': string;
2749
- * }>();
2750
- *
2751
- * // Subscribe
2752
- * bus.on('user:login', ({ userId }) => fetchProfile(userId));
2753
- *
2754
- * // Emit from anywhere
2755
- * bus.emit('user:login', { userId: '123' });
2756
- *
2757
- * // One-time listener
2758
- * bus.once('cart:updated', ({ itemCount }) => showBadge(itemCount));
2759
- * ```
2760
- */
2761
- type EventMap = Record<string, unknown>;
2762
- type EventHandler<T = unknown> = (data: T) => void;
2763
- interface EventBus<T extends EventMap> {
2764
- /** Subscribe to an event */
2765
- on<K extends keyof T & string>(event: K, handler: EventHandler<T[K]>): () => void;
2766
- /** Subscribe once — auto-removes after first call */
2767
- once<K extends keyof T & string>(event: K, handler: EventHandler<T[K]>): () => void;
2768
- /** Emit an event to all listeners */
2769
- emit<K extends keyof T & string>(event: K, data: T[K]): void;
2770
- /** Remove a specific handler */
2771
- off<K extends keyof T & string>(event: K, handler: EventHandler<T[K]>): void;
2772
- /** Remove all handlers for an event (or all events) */
2773
- clear(event?: keyof T & string): void;
2774
- /** Get listener count for an event */
2775
- listenerCount(event: keyof T & string): number;
2776
- /** Check if an event has listeners */
2777
- hasListeners(event: keyof T & string): boolean;
2778
- }
2779
- /**
2780
- * Create a typed event bus.
2781
- *
2782
- * ```ts
2783
- * const bus = createEventBus<{
2784
- * 'theme:change': 'light' | 'dark';
2785
- * 'toast': { message: string; type: string };
2786
- * }>();
2787
- * ```
2788
- */
2789
- declare function createEventBus<T extends EventMap = Record<string, unknown>>(): EventBus<T>;
2790
- /**
2791
- * Get the global event bus (created on first call).
2792
- *
2793
- * ```ts
2794
- * import { globalEventBus } from '@akashjs/runtime';
2795
- *
2796
- * // In component A:
2797
- * globalEventBus().emit('notification', 'Hello!');
2798
- *
2799
- * // In component B:
2800
- * globalEventBus().on('notification', (msg) => show(msg));
2801
- * ```
2802
- */
2803
- declare function globalEventBus<T extends EventMap = Record<string, unknown>>(): EventBus<T>;
2804
-
2805
- /**
2806
- * Security module — built-in protection for AkashJS apps.
2807
- *
2808
- * Auto-sanitization, CSP support, prototype pollution prevention,
2809
- * and secure defaults. AkashJS is secure by default.
2810
- */
2811
- interface SanitizeOptions {
2812
- /** Additional allowed tags */
2813
- allowTags?: string[];
2814
- /** Additional allowed attributes */
2815
- allowAttrs?: string[];
2816
- /** Allow data-* attributes (default: true) */
2817
- allowDataAttrs?: boolean;
2818
- /** Allow aria-* attributes (default: true) */
2819
- allowAriaAttrs?: boolean;
2820
- /** Allow style attribute (default: false) */
2821
- allowStyle?: boolean;
2822
- /** Custom tag filter */
2823
- tagFilter?: (tag: string) => boolean;
2824
- /** Custom attribute filter */
2825
- attrFilter?: (attr: string, value: string, tag: string) => boolean;
2826
- }
2827
- /**
2828
- * Sanitize HTML string — remove dangerous tags, attributes, and URLs.
2829
- *
2830
- * ```ts
2831
- * const safe = sanitize(userInput);
2832
- * el.innerHTML = safe; // Safe from XSS
2833
- *
2834
- * // With options:
2835
- * const safe = sanitize(html, { allowTags: ['iframe'], allowStyle: true });
2836
- * ```
2837
- */
2838
- declare function sanitize(html: string, options?: SanitizeOptions): string;
2839
- /**
2840
- * Escape HTML entities — prevents XSS in text content.
2841
- */
2842
- declare function escapeHtml(str: string): string;
2843
- /**
2844
- * Create a safe HTML setter that sanitizes automatically.
2845
- *
2846
- * ```ts
2847
- * const setHTML = createSafeHTML(el);
2848
- * setHTML(userContent); // Auto-sanitized
2849
- * ```
2850
- */
2851
- declare function createSafeHTML(el: HTMLElement, options?: SanitizeOptions): (html: string) => void;
2852
- interface CSPConfig {
2853
- /** Nonce for inline scripts/styles */
2854
- nonce?: string;
2855
- /** Report-only mode (default: false) */
2856
- reportOnly?: boolean;
2857
- /** Report URI for CSP violations */
2858
- reportUri?: string;
2859
- /** Custom directives */
2860
- directives?: Record<string, string[]>;
2861
- }
2862
- /**
2863
- * Generate a CSP header string.
2864
- *
2865
- * ```ts
2866
- * const csp = generateCSP({
2867
- * nonce: 'abc123',
2868
- * directives: {
2869
- * 'script-src': ["'self'"],
2870
- * 'style-src': ["'self'", "'unsafe-inline'"],
2871
- * 'img-src': ["'self'", 'data:', 'https:'],
2872
- * },
2873
- * });
2874
- * // "script-src 'self' 'nonce-abc123'; style-src 'self' 'unsafe-inline'; ..."
2875
- * ```
2876
- */
2877
- declare function generateCSP(config?: CSPConfig): string;
2878
- /**
2879
- * Get the CSP header name based on config.
2880
- */
2881
- declare function getCSPHeaderName(config?: CSPConfig): string;
2882
- interface SecurityHeadersConfig {
2883
- /** Content Security Policy (false to disable) */
2884
- csp?: CSPConfig | false;
2885
- /** X-Frame-Options (default: 'DENY') */
2886
- frameOptions?: 'DENY' | 'SAMEORIGIN' | false;
2887
- /** X-Content-Type-Options (default: 'nosniff') */
2888
- contentTypeOptions?: boolean;
2889
- /** X-XSS-Protection (default: '0' — let CSP handle it) */
2890
- xssProtection?: boolean;
2891
- /** Strict-Transport-Security */
2892
- hsts?: {
2893
- maxAge: number;
2894
- includeSubDomains?: boolean;
2895
- preload?: boolean;
2896
- } | false;
2897
- /** Referrer-Policy (default: 'strict-origin-when-cross-origin') */
2898
- referrerPolicy?: string | false;
2899
- /** Permissions-Policy */
2900
- permissionsPolicy?: Record<string, string[]> | false;
2901
- /** Cross-Origin-Opener-Policy */
2902
- coop?: 'same-origin' | 'same-origin-allow-popups' | 'unsafe-none' | false;
2903
- /** Cross-Origin-Embedder-Policy */
2904
- coep?: 'require-corp' | 'credentialless' | 'unsafe-none' | false;
2905
- }
2906
- /**
2907
- * Generate security headers for SSR responses.
2908
- *
2909
- * ```ts
2910
- * const headers = generateSecurityHeaders();
2911
- * // Apply to your server response
2912
- * for (const [name, value] of Object.entries(headers)) {
2913
- * res.setHeader(name, value);
2914
- * }
2915
- * ```
2916
- */
2917
- declare function generateSecurityHeaders(config?: SecurityHeadersConfig): Record<string, string>;
2918
- /**
2919
- * Safe deep merge that prevents prototype pollution.
2920
- * Will not set __proto__, constructor, or prototype keys.
2921
- *
2922
- * ```ts
2923
- * const result = safeMerge(defaults, userConfig);
2924
- * ```
2925
- */
2926
- declare function safeMerge<T extends Record<string, unknown>>(target: T, ...sources: Partial<T>[]): T;
2927
- /**
2928
- * Freeze an object deeply — prevents any modification.
2929
- */
2930
- declare function deepFreeze<T>(obj: T): Readonly<T>;
2931
- /**
2932
- * Generate SRI hash for a script/style resource.
2933
- * For use in <script integrity="..."> and <link integrity="...">.
2934
- *
2935
- * ```ts
2936
- * // In Node.js build script:
2937
- * const hash = await generateSRI(fileContent);
2938
- * // 'sha384-...'
2939
- * ```
2940
- */
2941
- declare function generateSRI(content: string, algorithm?: 'sha256' | 'sha384' | 'sha512'): Promise<string>;
2942
- /**
2943
- * Generate a CSRF token.
2944
- */
2945
- declare function generateCSRFToken(): string;
2946
- /**
2947
- * Create an HTTP interceptor that attaches CSRF tokens.
2948
- *
2949
- * ```ts
2950
- * const csrf = createCSRFInterceptor();
2951
- * const http = createHttpClient({ interceptors: [csrf.interceptor] });
2952
- * // Token is auto-attached to every mutation request
2953
- * ```
2954
- */
2955
- declare function createCSRFInterceptor(options?: {
2956
- headerName?: string;
2957
- cookieName?: string;
2958
- tokenGenerator?: () => string;
2959
- }): {
2960
- interceptor: (request: Request, next: (req: Request) => Promise<Response>) => Promise<Response>;
2961
- token: () => string;
2962
- refresh(): void;
2963
- };
2964
- /**
2965
- * Validate and sanitize a URL — prevent open redirect attacks.
2966
- *
2967
- * ```ts
2968
- * const safe = sanitizeURL(userInput, { allowedHosts: ['example.com'] });
2969
- * if (safe) window.location.href = safe;
2970
- * ```
2971
- */
2972
- declare function sanitizeURL(url: string, options?: {
2973
- allowedHosts?: string[];
2974
- allowedProtocols?: string[];
2975
- allowRelative?: boolean;
2976
- }): string | null;
2977
- /**
2978
- * Rate limiter for client-side actions (e.g., form submissions).
2979
- *
2980
- * ```ts
2981
- * const limiter = createRateLimiter({ maxAttempts: 5, windowMs: 60000 });
2982
- * if (!limiter.check()) {
2983
- * toast.error('Too many attempts. Please wait.');
2984
- * return;
2985
- * }
2986
- * ```
2987
- */
2988
- declare function createRateLimiter(options: {
2989
- maxAttempts: number;
2990
- windowMs: number;
2991
- }): {
2992
- check(): boolean;
2993
- remaining(): number;
2994
- reset(): void;
2995
- };
2996
-
2997
- /**
2998
- * Deprecation warnings and API stability markers.
2999
- *
3000
- * Provides runtime warnings when deprecated APIs are used,
3001
- * with migration hints pointing to the replacement.
3002
- *
3003
- * ```ts
3004
- * // Mark an API as deprecated:
3005
- * export const oldName = deprecated(newImplementation, {
3006
- * name: 'oldName',
3007
- * replacement: 'newName',
3008
- * since: '0.2.0',
3009
- * removeIn: '1.0.0',
3010
- * message: 'Use newName() instead for better performance.',
3011
- * });
3012
- *
3013
- * // Users see:
3014
- * // [AkashJS] DEPRECATED: oldName() is deprecated since v0.2.0 and will be removed in v1.0.0.
3015
- * // Use newName() instead for better performance.
3016
- * // See: https://akash.js.org/migration
3017
- * ```
3018
- */
3019
- type APIStability = 'stable' | 'experimental' | 'deprecated' | 'internal';
3020
- interface DeprecationInfo {
3021
- /** Name of the deprecated API */
3022
- name: string;
3023
- /** Replacement API name */
3024
- replacement?: string;
3025
- /** Version when deprecated */
3026
- since: string;
3027
- /** Version when it will be removed */
3028
- removeIn?: string;
3029
- /** Custom migration message */
3030
- message?: string;
3031
- /** Documentation link */
3032
- link?: string;
3033
- }
3034
- interface APIInfo {
3035
- /** API name */
3036
- name: string;
3037
- /** Stability level */
3038
- stability: APIStability;
3039
- /** Version introduced */
3040
- since: string;
3041
- /** Deprecation info (if deprecated) */
3042
- deprecation?: DeprecationInfo;
3043
- }
3044
- /**
3045
- * Enable or disable deprecation warnings globally.
3046
- */
3047
- declare function setDeprecationWarnings(enabled: boolean): void;
3048
- /**
3049
- * Set a custom warning handler (default: console.warn).
3050
- */
3051
- declare function setWarningHandler(handler: ((msg: string) => void) | null): void;
3052
- /**
3053
- * Reset warned-about APIs (useful for testing).
3054
- */
3055
- declare function resetDeprecationWarnings(): void;
3056
- /**
3057
- * Wrap a function so it emits a deprecation warning on first call.
3058
- *
3059
- * ```ts
3060
- * // Old API that still works but warns:
3061
- * export const createStore = deprecated(defineStore, {
3062
- * name: 'createStore',
3063
- * replacement: 'defineStore',
3064
- * since: '0.2.0',
3065
- * removeIn: '1.0.0',
3066
- * });
3067
- * ```
3068
- */
3069
- declare function deprecated<T extends (...args: any[]) => any>(fn: T, info: DeprecationInfo): T;
3070
- /**
3071
- * Mark a value (non-function) as deprecated.
3072
- * Returns the value but warns on first access.
3073
- */
3074
- declare function deprecatedValue<T>(value: T, info: DeprecationInfo): T;
3075
- /**
3076
- * Register an API with its stability level.
3077
- */
3078
- declare function registerAPI(info: APIInfo): void;
3079
- /**
3080
- * Get all registered APIs.
3081
- */
3082
- declare function getRegisteredAPIs(): APIInfo[];
3083
- /**
3084
- * Get APIs by stability level.
3085
- */
3086
- declare function getAPIsByStability(stability: APIStability): APIInfo[];
3087
- /**
3088
- * Check if an API is deprecated.
3089
- */
3090
- declare function isDeprecated(name: string): boolean;
3091
- /**
3092
- * Get deprecation info for an API.
3093
- */
3094
- declare function getDeprecationInfo(name: string): DeprecationInfo | null;
3095
- interface CompatibilityResult {
3096
- compatible: boolean;
3097
- warnings: string[];
3098
- errors: string[];
3099
- }
3100
- /**
3101
- * Check if package versions are compatible.
3102
- *
3103
- * ```ts
3104
- * const result = checkCompatibility({
3105
- * '@akashjs/runtime': '0.2.0',
3106
- * '@akashjs/router': '0.1.0',
3107
- * });
3108
- * if (!result.compatible) {
3109
- * console.error(result.errors);
3110
- * }
3111
- * ```
3112
- */
3113
- declare function checkCompatibility(packages: Record<string, string>): CompatibilityResult;
3114
-
3115
- /**
3116
- * Error message catalog.
3117
- *
3118
- * Every AkashJS runtime error has a unique code (AK0001, AK0002, etc.),
3119
- * a one-line description, and a link to detailed documentation.
3120
- *
3121
- * Usage:
3122
- * throw akashError('AK0010', 'provide()');
3123
- */
3124
- interface ErrorDef {
3125
- /** Error code */
3126
- code: string;
3127
- /** Short description */
3128
- message: string;
3129
- /** Extended explanation and fix suggestion */
3130
- hint: string;
3131
- }
3132
- /**
3133
- * Format an AkashJS error with code, message, hint, and doc link.
3134
- */
3135
- declare function formatError(code: string, context?: string): string;
3136
- /**
3137
- * Create and throw an AkashJS error.
3138
- */
3139
- declare function akashError(code: string, context?: string): Error;
3140
- /**
3141
- * Get the error definition for a code.
3142
- */
3143
- declare function getErrorDef(code: string): ErrorDef | undefined;
3144
- /**
3145
- * Get all registered error codes.
3146
- */
3147
- declare function getAllErrorCodes(): string[];
3148
-
3149
- interface StoreSnapshot {
3150
- $id: string;
3151
- state: Record<string, unknown>;
3152
- getters: Record<string, unknown>;
3153
- actions: string[];
3154
- subscriberCount: number;
3155
- }
3156
- interface DevToolsAPI {
3157
- /** List all registered stores */
3158
- stores(): string[];
3159
- /** Inspect a specific store by ID */
3160
- store(id: string): StoreSnapshot | null;
3161
- /** Get all store snapshots */
3162
- storeSnapshots(): Record<string, StoreSnapshot>;
3163
- /** List tracked signals with current values */
3164
- signals(): Array<{
3165
- name: string;
3166
- value: unknown;
3167
- subscribers: number;
3168
- }>;
3169
- /** List tracked effects with run counts */
3170
- effects(): Array<{
3171
- name: string;
3172
- runs: number;
3173
- isRender: boolean;
3174
- sources: number;
3175
- }>;
3176
- /** Get framework version info */
3177
- version(): {
3178
- runtime: string;
3179
- };
3180
- /** Pretty-print store state to console */
3181
- log(storeId?: string): void;
3182
- /** Record store state history for time-travel */
3183
- startRecording(storeId: string): void;
3184
- /** Stop recording and return history */
3185
- stopRecording(storeId: string): Array<{
3186
- timestamp: number;
3187
- state: Record<string, unknown>;
3188
- action?: string;
3189
- }>;
3190
- }
3191
- /**
3192
- * Install AkashJS DevTools on the global object.
3193
- * Call this in your app's entry point during development:
3194
- *
3195
- * ```ts
3196
- * import { installDevtools } from '@akashjs/runtime';
3197
- * if (import.meta.env.DEV) installDevtools();
3198
- * ```
3199
- */
3200
- declare function installDevtools(): void;
3201
-
3202
- /**
3203
- * Developer-friendly error hints.
3204
- *
3205
- * Wraps common runtime errors with actionable messages.
3206
- * Only active in development mode.
3207
- */
3208
- /**
3209
- * Enhance an error with a developer hint if one matches.
3210
- */
3211
- declare function enhanceError(error: Error): Error;
3212
- /**
3213
- * Install global error handler that adds hints to unhandled errors.
3214
- * Call once in your app's entry point during development.
3215
- */
3216
- declare function installErrorHints(): void;
3217
-
3218
- export { type APIInfo, type APIStability, AkashNode, type AppInstance, type AriaLive, type AsyncComponentLoader, type AsyncComponentOptions, Await, type AwaitProps, type Breakpoints, type CSPConfig, type ColumnDef, type CompatibilityResult, Component, type CustomElementOptions, type DataTable, type DataTableOptions, type DeepSignal, type DeferOptions, type DeferTrigger, type DeprecationInfo, type DevToolsAPI, type Directive, type DirectiveBinding, type DirectiveHooks, type EasingFn, ErrorBoundary, type ErrorBoundaryProps, type ErrorDef, type EventBus, type EventHandler, type EventMap, type EventModifiers, type FlipController, type FlipOptions, type FocusTrap, type FocusTrapOptions, type FormAction, type GeolocationState, HYDRATE_ATTR, type HeadConfig, type HydrateOptions, Image, type ImageProps, type InfiniteScroll, type InfiniteScrollOptions, InjectionKey, type Injector, type InspectOptions, type Interpolator, type KeyBinding, type KeyboardManager, type LeakWarning, type LinkTag, type MetaTag, type OpenGraphData, type PerfEntry, type PerfProfile, type PerfSummary, type PipeFn, type Plugin, type PluginContext, Portal, type PortalProps, type PrerenderOptions, type PrerenderResult, type ProgressiveHydrateOptions, type ProviderDef, type ProviderRegistration, type QueryStateOptions, ReadonlySignal, type ReconcileOp, type SEOConfig, type SanitizeOptions, type ScriptTag, type SecurityHeadersConfig, Signal, type SitemapEntry, type SlotFn, type Slots, type SnapshotConfig, type Snippet, type SortDirection, type SortState, type StructuredData, Suspense, type SuspenseProps, Switch, type SwitchProps, type Theme, type ThemeConfig, type ThemeVariables, type Toast, type ToastOptions, type ToastPosition, type ToastType, type Toaster, type ToasterOptions, Transition, type TransitionClasses, type TransitionProps, type TweenedOptions, type TweenedSignal, type TwitterCardData, type ViewTransition, type ViewTransitionOptions, VirtualFor, type VirtualForProps, type VirtualRange, type WatchCallback, type WatchOptions, type WatchSource, akashError, applyDirective, applyStyles, assignTransitionName, awaitSignal, bindClass, bindClasses, bindDimensions, bindElement, bindGroup, bindGroupItem, bindScroll, bindStyle, bindStyles, calculateRange, capitalize, chain, checkCompatibility, checkForLeaks, claimElement, claimText, clearProviders, clearQueryState, collectSSRHead, countOps, createApp, createCSRFInterceptor, createDataTable, createEventBus, createFlip, createInjector, createRateLimiter, createSafeHTML, createSlots, createTimer, createToaster, css, currency, cx, date, deepFreeze, deepSignal, defer, defineAsyncComponent, defineCustomElement, defineDirective, defineFormAction, definePipe, definePlugin, defineProvider, defineSnippet, deprecated, deprecatedValue, directiveFromFn, disableLeakDetection, discoverStaticRoutes, easings, enableLeakDetection, enableSnapshots, enhanceError, enterTransition, escapeHtml, exitTransition, findHydrationBoundaries, flip, formatError, formatProfile, generateCSP, generateCSRFToken, generatePaths, generateSRI, generateSecurityHeaders, generateSitemap, generateTransitionCSS, getAPIsByStability, getActiveEffects, getAllErrorCodes, getCSPHeaderName, getDeprecationInfo, getErrorDef, getLeakDetectionStats, getProfileSummary, getQueryParams, getRegisteredAPIs, getSuspenseContext, getTransitionClasses, globalEventBus, hasSlot, hydrate, injectProvider, inspect, installDevtools, installErrorHints, isDeepSignal, isDeprecated, isHydrationActive, isLeakDetectionEnabled, isProfiling, json, longestIncreasingSubsequence, lowercase, match, measureAsync, measureSync, number, onEvent, percent, pipe, plural, prerender, progressiveHydrate, reconcileKeys, recordPerfEntry, registerAPI, registerPending, relativeTime, removeDirectives, removeQueryState, renderHeadToString, renderSlot, renderSwitch, reportLeaks, resetDeprecationWarnings, resetQueryState, safeMerge, sanitize, sanitizeURL, setDeprecationWarnings, setWarningHandler, sitemapFromResults, startProfiling, startViewTransition, stopProfiling, supportsViewTransitions, titleCase, toCustomElement, toRaw, trackEffect, trim, truncate, tweened, untrackEffect, updateDirective, uppercase, urlToFilePath, useAnnounce, useBreakpoint, useClickOutside, useClipboard, useCounter, useDebounce, useFocusTrap, useGeolocation, useHead, useInfiniteScroll, useInterval, useKeyboard, useMediaQuery, useOnline, useOpenGraph, usePrevious, useQueryState, useQueryStates, useSEO, useStorage, useStructuredData, useTheme, useThrottle, useTimeout, useToggle, useTwitterCard, useVirtualList, useWindowSize, vAutoFocus, vClickOutside, vIntersect, vLongPress, vResize, viewTransitionCSS, watch, watchDebounced, watchOnce, withModifiers };
117
+ export { AkashNode, type SlotFn, type Slots, createSlots, hasSlot, renderSlot };