@akashjs/runtime 0.2.6 → 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.
- package/dist/a11y.cjs +2 -0
- package/dist/a11y.cjs.map +1 -0
- package/dist/a11y.d.cts +99 -0
- package/dist/a11y.d.ts +99 -0
- package/dist/a11y.js +2 -0
- package/dist/a11y.js.map +1 -0
- package/dist/async-component.cjs +2 -0
- package/dist/async-component.cjs.map +1 -0
- package/dist/async-component.d.cts +44 -0
- package/dist/async-component.d.ts +44 -0
- package/dist/async-component.js +2 -0
- package/dist/async-component.js.map +1 -0
- package/dist/await-block.cjs +2 -0
- package/dist/await-block.cjs.map +1 -0
- package/dist/await-block.d.cts +37 -0
- package/dist/await-block.d.ts +37 -0
- package/dist/await-block.js +2 -0
- package/dist/await-block.js.map +1 -0
- package/dist/browser.cjs +2 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +125 -0
- package/dist/browser.d.ts +125 -0
- package/dist/browser.js +2 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunk-2HLDEWRT.cjs +2 -0
- package/dist/chunk-2HLDEWRT.cjs.map +1 -0
- package/dist/{chunk-2U643GJZ.cjs → chunk-2LKFIID7.cjs} +2 -2
- package/dist/{chunk-2U643GJZ.cjs.map → chunk-2LKFIID7.cjs.map} +1 -1
- package/dist/chunk-34PQECMN.cjs +2 -0
- package/dist/chunk-34PQECMN.cjs.map +1 -0
- package/dist/chunk-36VM3RJW.cjs +2 -0
- package/dist/chunk-36VM3RJW.cjs.map +1 -0
- package/dist/chunk-3PGU24B5.cjs +3 -0
- package/dist/chunk-3PGU24B5.cjs.map +1 -0
- package/dist/chunk-3XREYIJH.cjs +2 -0
- package/dist/chunk-3XREYIJH.cjs.map +1 -0
- package/dist/chunk-45DPEU7T.cjs +2 -0
- package/dist/chunk-45DPEU7T.cjs.map +1 -0
- package/dist/chunk-4J3QBQVW.js +4 -0
- package/dist/chunk-4J3QBQVW.js.map +1 -0
- package/dist/{chunk-2Q6SYE5O.cjs → chunk-4NQEIKH5.cjs} +2 -2
- package/dist/{chunk-2Q6SYE5O.cjs.map → chunk-4NQEIKH5.cjs.map} +1 -1
- package/dist/chunk-5QCWH6QA.cjs +4 -0
- package/dist/chunk-5QCWH6QA.cjs.map +1 -0
- package/dist/chunk-6O46EMQS.cjs +2 -0
- package/dist/chunk-6O46EMQS.cjs.map +1 -0
- package/dist/chunk-7IJUJUXE.cjs +2 -0
- package/dist/chunk-7IJUJUXE.cjs.map +1 -0
- package/dist/chunk-7UX5CSGZ.cjs +2 -0
- package/dist/chunk-7UX5CSGZ.cjs.map +1 -0
- package/dist/chunk-7VBH4F3P.js +2 -0
- package/dist/chunk-7VBH4F3P.js.map +1 -0
- package/dist/chunk-7ZPSYZHD.cjs +2 -0
- package/dist/chunk-7ZPSYZHD.cjs.map +1 -0
- package/dist/chunk-AOFLE33X.js +5 -0
- package/dist/chunk-AOFLE33X.js.map +1 -0
- package/dist/chunk-AQQQVDBQ.cjs +2 -0
- package/dist/chunk-AQQQVDBQ.cjs.map +1 -0
- package/dist/chunk-AXB5GHGO.js +2 -0
- package/dist/chunk-AXB5GHGO.js.map +1 -0
- package/dist/chunk-AZCELE44.cjs +2 -0
- package/dist/chunk-AZCELE44.cjs.map +1 -0
- package/dist/chunk-BB7P6HTR.js +2 -0
- package/dist/chunk-BB7P6HTR.js.map +1 -0
- package/dist/chunk-BGSF77LF.js +2 -0
- package/dist/chunk-BGSF77LF.js.map +1 -0
- package/dist/chunk-BHP3UTTQ.cjs +3 -0
- package/dist/chunk-BHP3UTTQ.cjs.map +1 -0
- package/dist/chunk-CP6SK2B4.js +2 -0
- package/dist/{chunk-5NHDEY2C.js.map → chunk-CP6SK2B4.js.map} +1 -1
- package/dist/chunk-DFYXFKCH.cjs +2 -0
- package/dist/chunk-DFYXFKCH.cjs.map +1 -0
- package/dist/chunk-DHFVVFZF.cjs +2 -0
- package/dist/chunk-DHFVVFZF.cjs.map +1 -0
- package/dist/chunk-DP7G45QM.cjs +13 -0
- package/dist/chunk-DP7G45QM.cjs.map +1 -0
- package/dist/chunk-E6RB7PRO.js +2 -0
- package/dist/chunk-E6RB7PRO.js.map +1 -0
- package/dist/chunk-F4FXIPR3.js +2 -0
- package/dist/chunk-F4FXIPR3.js.map +1 -0
- package/dist/chunk-F6VSSM2P.js +2 -0
- package/dist/chunk-F6VSSM2P.js.map +1 -0
- package/dist/chunk-FUVSCPU4.cjs +2 -0
- package/dist/chunk-FUVSCPU4.cjs.map +1 -0
- package/dist/chunk-FVF3T4JJ.js +2 -0
- package/dist/chunk-FVF3T4JJ.js.map +1 -0
- package/dist/chunk-FVWHMFX6.cjs +5 -0
- package/dist/chunk-FVWHMFX6.cjs.map +1 -0
- package/dist/chunk-IHEW6F2H.js +2 -0
- package/dist/chunk-IHEW6F2H.js.map +1 -0
- package/dist/chunk-IJS2EMSE.js +2 -0
- package/dist/chunk-IJS2EMSE.js.map +1 -0
- package/dist/chunk-IKVHLORY.cjs +11 -0
- package/dist/chunk-IKVHLORY.cjs.map +1 -0
- package/dist/chunk-IQGSDFBI.cjs +2 -0
- package/dist/chunk-IQGSDFBI.cjs.map +1 -0
- package/dist/chunk-J6KDUWX6.cjs +2 -0
- package/dist/chunk-J6KDUWX6.cjs.map +1 -0
- package/dist/chunk-JD3LDHUI.cjs +2 -0
- package/dist/chunk-JD3LDHUI.cjs.map +1 -0
- package/dist/chunk-JEYTB4AG.js +2 -0
- package/dist/chunk-JEYTB4AG.js.map +1 -0
- package/dist/chunk-JFLZJPVN.js +2 -0
- package/dist/chunk-JFLZJPVN.js.map +1 -0
- package/dist/chunk-JLPJ22CE.js +2 -0
- package/dist/chunk-JLPJ22CE.js.map +1 -0
- package/dist/chunk-JQCN42XX.js +2 -0
- package/dist/chunk-JQCN42XX.js.map +1 -0
- package/dist/chunk-K2HB5VFA.cjs +2 -0
- package/dist/chunk-K2HB5VFA.cjs.map +1 -0
- package/dist/chunk-K7TMUF3F.cjs +2 -0
- package/dist/chunk-K7TMUF3F.cjs.map +1 -0
- package/dist/chunk-KE7BJTCD.js +2 -0
- package/dist/chunk-KE7BJTCD.js.map +1 -0
- package/dist/chunk-KMEGUPH2.js +3 -0
- package/dist/chunk-KMEGUPH2.js.map +1 -0
- package/dist/chunk-KUPL3ZVD.js +2 -0
- package/dist/chunk-KUPL3ZVD.js.map +1 -0
- package/dist/chunk-L3ZZX36S.js +2 -0
- package/dist/chunk-L3ZZX36S.js.map +1 -0
- package/dist/chunk-LD4C62JY.cjs +2 -0
- package/dist/chunk-LD4C62JY.cjs.map +1 -0
- package/dist/chunk-LWQPLKL6.cjs +20 -0
- package/dist/chunk-LWQPLKL6.cjs.map +1 -0
- package/dist/chunk-M5IACTFC.cjs +17 -0
- package/dist/chunk-M5IACTFC.cjs.map +1 -0
- package/dist/chunk-MADMPRT2.js +20 -0
- package/dist/chunk-MADMPRT2.js.map +1 -0
- package/dist/chunk-MDHWM3C2.js +2 -0
- package/dist/chunk-MDHWM3C2.js.map +1 -0
- package/dist/chunk-N3ITIHHM.js +5 -0
- package/dist/chunk-N3ITIHHM.js.map +1 -0
- package/dist/chunk-N5APNCPB.js +2 -0
- package/dist/chunk-N5APNCPB.js.map +1 -0
- package/dist/{chunk-U53YRJNV.js → chunk-NBYFHJWB.js} +3 -3
- package/dist/{chunk-U53YRJNV.js.map → chunk-NBYFHJWB.js.map} +1 -1
- package/dist/chunk-NCXMNJUN.js +2 -0
- package/dist/chunk-NCXMNJUN.js.map +1 -0
- package/dist/chunk-NEQ5TENE.cjs +2 -0
- package/dist/chunk-NEQ5TENE.cjs.map +1 -0
- package/dist/chunk-NGU2W4PD.cjs +2 -0
- package/dist/chunk-NGU2W4PD.cjs.map +1 -0
- package/dist/{chunk-ZYVQQ5VR.cjs → chunk-NHDYQTC5.cjs} +3 -3
- package/dist/{chunk-ZYVQQ5VR.cjs.map → chunk-NHDYQTC5.cjs.map} +1 -1
- package/dist/chunk-NJXXC5JB.js +2 -0
- package/dist/chunk-NJXXC5JB.js.map +1 -0
- package/dist/chunk-NQEY7DR5.cjs +2 -0
- package/dist/chunk-NQEY7DR5.cjs.map +1 -0
- package/dist/chunk-OQV3NYDH.js +3 -0
- package/dist/chunk-OQV3NYDH.js.map +1 -0
- package/dist/chunk-OZ4GNBKA.js +2 -0
- package/dist/chunk-OZ4GNBKA.js.map +1 -0
- package/dist/chunk-PPNEAFKE.cjs +5 -0
- package/dist/chunk-PPNEAFKE.cjs.map +1 -0
- package/dist/chunk-PYASLKWF.js +2 -0
- package/dist/chunk-PYASLKWF.js.map +1 -0
- package/dist/chunk-Q6S7SUOM.js +2 -0
- package/dist/chunk-Q6S7SUOM.js.map +1 -0
- package/dist/chunk-QE2TJ6P5.cjs +2 -0
- package/dist/chunk-QE2TJ6P5.cjs.map +1 -0
- package/dist/chunk-QNVMBXVH.js +2 -0
- package/dist/chunk-QNVMBXVH.js.map +1 -0
- package/dist/chunk-QQ725EZL.js +2 -0
- package/dist/chunk-QQ725EZL.js.map +1 -0
- package/dist/chunk-QQTZQ6UX.cjs +2 -0
- package/dist/chunk-QQTZQ6UX.cjs.map +1 -0
- package/dist/{chunk-AVVJKYT3.cjs → chunk-QSPRVXFV.cjs} +2 -2
- package/dist/{chunk-AVVJKYT3.cjs.map → chunk-QSPRVXFV.cjs.map} +1 -1
- package/dist/chunk-QTQ6RUX4.cjs +5 -0
- package/dist/chunk-QTQ6RUX4.cjs.map +1 -0
- package/dist/chunk-R65RPMQX.cjs +2 -0
- package/dist/chunk-R65RPMQX.cjs.map +1 -0
- package/dist/chunk-R7NUVVHP.js +2 -0
- package/dist/{chunk-5A7KDBDU.js.map → chunk-R7NUVVHP.js.map} +1 -1
- package/dist/chunk-SXYPAP4B.js +2 -0
- package/dist/chunk-SXYPAP4B.js.map +1 -0
- package/dist/chunk-T2RVAQEU.js +2 -0
- package/dist/chunk-T2RVAQEU.js.map +1 -0
- package/dist/chunk-T7A5YOEG.cjs +2 -0
- package/dist/chunk-T7A5YOEG.cjs.map +1 -0
- package/dist/chunk-TDKDZ3QJ.cjs +2 -0
- package/dist/chunk-TDKDZ3QJ.cjs.map +1 -0
- package/dist/chunk-TFEHO7SF.cjs +2 -0
- package/dist/chunk-TFEHO7SF.cjs.map +1 -0
- package/dist/chunk-TSFY5HKB.js +17 -0
- package/dist/chunk-TSFY5HKB.js.map +1 -0
- package/dist/chunk-TYTEJYUQ.cjs +2 -0
- package/dist/chunk-TYTEJYUQ.cjs.map +1 -0
- package/dist/chunk-TZHEZW6R.js +11 -0
- package/dist/chunk-TZHEZW6R.js.map +1 -0
- package/dist/chunk-U65WRXZC.js +13 -0
- package/dist/chunk-U65WRXZC.js.map +1 -0
- package/dist/chunk-UT4MWGJ3.js +2 -0
- package/dist/chunk-UT4MWGJ3.js.map +1 -0
- package/dist/chunk-V2JDKH3W.cjs +2 -0
- package/dist/chunk-V2JDKH3W.cjs.map +1 -0
- package/dist/chunk-VNDSKBXQ.cjs +2 -0
- package/dist/chunk-VNDSKBXQ.cjs.map +1 -0
- package/dist/chunk-VO4FCKHM.js +2 -0
- package/dist/chunk-VO4FCKHM.js.map +1 -0
- package/dist/chunk-VUMMC2P5.js +2 -0
- package/dist/chunk-VUMMC2P5.js.map +1 -0
- package/dist/chunk-VUSNUBNI.js +2 -0
- package/dist/chunk-VUSNUBNI.js.map +1 -0
- package/dist/chunk-VWTULWXF.js +2 -0
- package/dist/{chunk-TKFJGLUO.js.map → chunk-VWTULWXF.js.map} +1 -1
- package/dist/chunk-VX7PSSOU.js +5 -0
- package/dist/chunk-VX7PSSOU.js.map +1 -0
- package/dist/chunk-WLSXJU2N.js +13 -0
- package/dist/chunk-WLSXJU2N.js.map +1 -0
- package/dist/chunk-WOZWFMOK.cjs +2 -0
- package/dist/chunk-WOZWFMOK.cjs.map +1 -0
- package/dist/chunk-WTDTVWCQ.cjs +2 -0
- package/dist/chunk-WTDTVWCQ.cjs.map +1 -0
- package/dist/chunk-WZ5ULION.js +2 -0
- package/dist/chunk-WZ5ULION.js.map +1 -0
- package/dist/chunk-XPLIEN2G.cjs +13 -0
- package/dist/chunk-XPLIEN2G.cjs.map +1 -0
- package/dist/chunk-XWVNLE2W.cjs +2 -0
- package/dist/chunk-XWVNLE2W.cjs.map +1 -0
- package/dist/chunk-XZR3J626.cjs +2 -0
- package/dist/chunk-XZR3J626.cjs.map +1 -0
- package/dist/chunk-YDO5KARN.js +2 -0
- package/dist/chunk-YDO5KARN.js.map +1 -0
- package/dist/chunk-YURIYBTN.cjs +2 -0
- package/dist/chunk-YURIYBTN.cjs.map +1 -0
- package/dist/chunk-YXKQTEPR.js +2 -0
- package/dist/chunk-YXKQTEPR.js.map +1 -0
- package/dist/chunk-Z6K4FYG6.js +2 -0
- package/dist/chunk-Z6K4FYG6.js.map +1 -0
- package/dist/chunk-ZJULEDLY.js +2 -0
- package/dist/chunk-ZJULEDLY.js.map +1 -0
- package/dist/{component-C1WnFcRp.d.ts → component-CPVtkASo.d.ts} +2 -3
- package/dist/{component-C1WnFcRp.d.cts → component-CxlupKuc.d.cts} +2 -3
- package/dist/composables.cjs +2 -0
- package/dist/composables.cjs.map +1 -0
- package/dist/composables.d.cts +103 -0
- package/dist/composables.d.ts +103 -0
- package/dist/composables.js +2 -0
- package/dist/composables.js.map +1 -0
- package/dist/{context-CB1mCq2h.d.cts → context-Cwt7QCpk.d.cts} +1 -9
- package/dist/{context-CB1mCq2h.d.ts → context-Cwt7QCpk.d.ts} +1 -9
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +5 -4
- package/dist/core.d.ts +5 -4
- package/dist/core.js +1 -1
- package/dist/css.cjs +2 -0
- package/dist/css.cjs.map +1 -0
- package/dist/css.d.cts +42 -0
- package/dist/css.d.ts +42 -0
- package/dist/css.js +2 -0
- package/dist/css.js.map +1 -0
- package/dist/data-table.cjs +2 -0
- package/dist/data-table.cjs.map +1 -0
- package/dist/data-table.d.cts +97 -0
- package/dist/data-table.d.ts +97 -0
- package/dist/data-table.js +2 -0
- package/dist/data-table.js.map +1 -0
- package/dist/deep-signal.cjs +2 -0
- package/dist/deep-signal.cjs.map +1 -0
- package/dist/deep-signal.d.cts +48 -0
- package/dist/deep-signal.d.ts +48 -0
- package/dist/deep-signal.js +2 -0
- package/dist/deep-signal.js.map +1 -0
- package/dist/defer.cjs +2 -0
- package/dist/defer.cjs.map +1 -0
- package/dist/defer.d.cts +55 -0
- package/dist/defer.d.ts +55 -0
- package/dist/defer.js +2 -0
- package/dist/defer.js.map +1 -0
- package/dist/deprecation.cjs +2 -0
- package/dist/deprecation.cjs.map +1 -0
- package/dist/deprecation.d.cts +119 -0
- package/dist/deprecation.d.ts +119 -0
- package/dist/deprecation.js +2 -0
- package/dist/deprecation.js.map +1 -0
- package/dist/{devtools-overlay-CJWKBTP4.js → devtools-overlay-3WRM6GKM.js} +3 -3
- package/dist/{devtools-overlay-CJWKBTP4.js.map → devtools-overlay-3WRM6GKM.js.map} +1 -1
- package/dist/{devtools-overlay-EQ3G755P.cjs → devtools-overlay-WJGSIB4N.cjs} +4 -4
- package/dist/{devtools-overlay-EQ3G755P.cjs.map → devtools-overlay-WJGSIB4N.cjs.map} +1 -1
- package/dist/devtools.cjs +2 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +78 -0
- package/dist/devtools.d.ts +78 -0
- package/dist/devtools.js +2 -0
- package/dist/devtools.js.map +1 -0
- package/dist/di.cjs +2 -0
- package/dist/di.cjs.map +1 -0
- package/dist/di.d.cts +93 -0
- package/dist/di.d.ts +93 -0
- package/dist/di.js +2 -0
- package/dist/di.js.map +1 -0
- package/dist/directive.cjs +2 -0
- package/dist/directive.cjs.map +1 -0
- package/dist/directive.d.cts +102 -0
- package/dist/directive.d.ts +102 -0
- package/dist/directive.js +2 -0
- package/dist/directive.js.map +1 -0
- package/dist/error-boundary.cjs +2 -0
- package/dist/error-boundary.cjs.map +1 -0
- package/dist/error-boundary.d.cts +17 -0
- package/dist/error-boundary.d.ts +17 -0
- package/dist/error-boundary.js +2 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/error-hints.cjs +2 -0
- package/dist/error-hints.cjs.map +1 -0
- package/dist/error-hints.d.cts +17 -0
- package/dist/error-hints.d.ts +17 -0
- package/dist/error-hints.js +2 -0
- package/dist/error-hints.js.map +1 -0
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +35 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -0
- package/dist/event-bus.cjs +2 -0
- package/dist/event-bus.cjs.map +1 -0
- package/dist/event-bus.d.cts +68 -0
- package/dist/event-bus.d.ts +68 -0
- package/dist/event-bus.js +2 -0
- package/dist/event-bus.js.map +1 -0
- package/dist/event-modifiers.cjs +2 -0
- package/dist/event-modifiers.cjs.map +1 -0
- package/dist/event-modifiers.d.cts +130 -0
- package/dist/event-modifiers.d.ts +130 -0
- package/dist/event-modifiers.js +2 -0
- package/dist/event-modifiers.js.map +1 -0
- package/dist/flip.cjs +2 -0
- package/dist/flip.cjs.map +1 -0
- package/dist/flip.d.cts +66 -0
- package/dist/flip.d.ts +66 -0
- package/dist/flip.js +2 -0
- package/dist/flip.js.map +1 -0
- package/dist/head.cjs +2 -0
- package/dist/head.cjs.map +1 -0
- package/dist/head.d.cts +70 -0
- package/dist/head.d.ts +70 -0
- package/dist/head.js +2 -0
- package/dist/head.js.map +1 -0
- package/dist/hydration.cjs +2 -0
- package/dist/hydration.cjs.map +1 -0
- package/dist/hydration.d.cts +84 -0
- package/dist/hydration.d.ts +84 -0
- package/dist/hydration.js +2 -0
- package/dist/hydration.js.map +1 -0
- package/dist/image.cjs +2 -0
- package/dist/image.cjs.map +1 -0
- package/dist/image.d.cts +54 -0
- package/dist/image.d.ts +54 -0
- package/dist/image.js +2 -0
- package/dist/image.js.map +1 -0
- package/dist/index.cjs +1 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -3155
- package/dist/index.d.ts +50 -3155
- package/dist/index.js +1 -63
- package/dist/index.js.map +1 -1
- package/dist/infinite-scroll.cjs +2 -0
- package/dist/infinite-scroll.cjs.map +1 -0
- package/dist/infinite-scroll.d.cts +49 -0
- package/dist/infinite-scroll.d.ts +49 -0
- package/dist/infinite-scroll.js +2 -0
- package/dist/infinite-scroll.js.map +1 -0
- package/dist/leak-detector.cjs +2 -0
- package/dist/leak-detector.cjs.map +1 -0
- package/dist/leak-detector.d.cts +71 -0
- package/dist/leak-detector.d.ts +71 -0
- package/dist/leak-detector.js +2 -0
- package/dist/leak-detector.js.map +1 -0
- package/dist/machine.cjs +1 -1
- package/dist/machine.d.cts +1 -1
- package/dist/machine.d.ts +1 -1
- package/dist/machine.js +1 -1
- package/dist/offline.cjs +1 -1
- package/dist/offline.d.cts +1 -1
- package/dist/offline.d.ts +1 -1
- package/dist/offline.js +1 -1
- package/dist/perf.cjs +2 -0
- package/dist/perf.cjs.map +1 -0
- package/dist/perf.d.cts +97 -0
- package/dist/perf.d.ts +97 -0
- package/dist/perf.js +2 -0
- package/dist/perf.js.map +1 -0
- package/dist/pipes.cjs +2 -0
- package/dist/pipes.cjs.map +1 -0
- package/dist/pipes.d.cts +130 -0
- package/dist/pipes.d.ts +130 -0
- package/dist/pipes.js +2 -0
- package/dist/pipes.js.map +1 -0
- package/dist/plugin.cjs +2 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +70 -0
- package/dist/plugin.d.ts +70 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -0
- package/dist/portal.cjs +2 -0
- package/dist/portal.cjs.map +1 -0
- package/dist/portal.d.cts +30 -0
- package/dist/portal.d.ts +30 -0
- package/dist/portal.js +2 -0
- package/dist/portal.js.map +1 -0
- package/dist/pwa.cjs +1 -1
- package/dist/pwa.d.cts +1 -1
- package/dist/pwa.d.ts +1 -1
- package/dist/pwa.js +1 -1
- package/dist/query-state.cjs +2 -0
- package/dist/query-state.cjs.map +1 -0
- package/dist/query-state.d.cts +82 -0
- package/dist/query-state.d.ts +82 -0
- package/dist/query-state.js +2 -0
- package/dist/query-state.js.map +1 -0
- package/dist/reconcile.cjs +2 -0
- package/dist/reconcile.cjs.map +1 -0
- package/dist/reconcile.d.cts +42 -0
- package/dist/reconcile.d.ts +42 -0
- package/dist/reconcile.js +2 -0
- package/dist/reconcile.js.map +1 -0
- package/dist/scheduler-CKi1esN-.d.cts +9 -0
- package/dist/scheduler-CKi1esN-.d.ts +9 -0
- package/dist/security.cjs +2 -0
- package/dist/security.cjs.map +1 -0
- package/dist/security.d.cts +193 -0
- package/dist/security.d.ts +193 -0
- package/dist/security.js +2 -0
- package/dist/security.js.map +1 -0
- package/dist/seo.cjs +2 -0
- package/dist/seo.cjs.map +1 -0
- package/dist/seo.d.cts +118 -0
- package/dist/seo.d.ts +118 -0
- package/dist/seo.js +2 -0
- package/dist/seo.js.map +1 -0
- package/dist/{signals-C7XfOHHR.d.cts → signals-DionyGGY.d.cts} +7 -0
- package/dist/{signals-C7XfOHHR.d.ts → signals-DionyGGY.d.ts} +7 -0
- package/dist/snippets.cjs +2 -0
- package/dist/snippets.cjs.map +1 -0
- package/dist/snippets.d.cts +109 -0
- package/dist/snippets.d.ts +109 -0
- package/dist/snippets.js +2 -0
- package/dist/snippets.js.map +1 -0
- package/dist/ssg.cjs +2 -0
- package/dist/ssg.cjs.map +1 -0
- package/dist/ssg.d.cts +82 -0
- package/dist/ssg.d.ts +82 -0
- package/dist/ssg.js +2 -0
- package/dist/ssg.js.map +1 -0
- package/dist/ssr.cjs +1 -1
- package/dist/ssr.d.cts +2 -1
- package/dist/ssr.d.ts +2 -1
- package/dist/ssr.js +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/suspense.cjs +2 -0
- package/dist/suspense.cjs.map +1 -0
- package/dist/suspense.d.cts +36 -0
- package/dist/suspense.d.ts +36 -0
- package/dist/suspense.js +2 -0
- package/dist/suspense.js.map +1 -0
- package/dist/switch.cjs +2 -0
- package/dist/switch.cjs.map +1 -0
- package/dist/switch.d.cts +48 -0
- package/dist/switch.d.ts +48 -0
- package/dist/switch.js +2 -0
- package/dist/switch.js.map +1 -0
- package/dist/sync.cjs +1 -1
- package/dist/sync.d.cts +1 -1
- package/dist/sync.d.ts +1 -1
- package/dist/sync.js +1 -1
- package/dist/test.cjs +2 -2
- package/dist/test.cjs.map +1 -1
- package/dist/test.d.cts +5 -4
- package/dist/test.d.ts +5 -4
- package/dist/test.js +2 -2
- package/dist/test.js.map +1 -1
- package/dist/theme.cjs +2 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +56 -0
- package/dist/theme.d.ts +56 -0
- package/dist/theme.js +2 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast.cjs +2 -0
- package/dist/toast.cjs.map +1 -0
- package/dist/toast.d.cts +66 -0
- package/dist/toast.d.ts +66 -0
- package/dist/toast.js +2 -0
- package/dist/toast.js.map +1 -0
- package/dist/transition.cjs +2 -0
- package/dist/transition.cjs.map +1 -0
- package/dist/transition.d.cts +90 -0
- package/dist/transition.d.ts +90 -0
- package/dist/transition.js +2 -0
- package/dist/transition.js.map +1 -0
- package/dist/tweened.cjs +2 -0
- package/dist/tweened.cjs.map +1 -0
- package/dist/tweened.d.cts +59 -0
- package/dist/tweened.d.ts +59 -0
- package/dist/tweened.js +2 -0
- package/dist/tweened.js.map +1 -0
- package/dist/types-DjZCk1xT.d.cts +4 -0
- package/dist/types-DjZCk1xT.d.ts +4 -0
- package/dist/view-transition.cjs +2 -0
- package/dist/view-transition.cjs.map +1 -0
- package/dist/view-transition.d.cts +80 -0
- package/dist/view-transition.d.ts +80 -0
- package/dist/view-transition.js +2 -0
- package/dist/view-transition.js.map +1 -0
- package/dist/virtual-list.cjs +2 -0
- package/dist/virtual-list.cjs.map +1 -0
- package/dist/virtual-list.d.cts +67 -0
- package/dist/virtual-list.d.ts +67 -0
- package/dist/virtual-list.js +2 -0
- package/dist/virtual-list.js.map +1 -0
- package/dist/watch.cjs +2 -0
- package/dist/watch.cjs.map +1 -0
- package/dist/watch.d.cts +70 -0
- package/dist/watch.d.ts +70 -0
- package/dist/watch.js +2 -0
- package/dist/watch.js.map +1 -0
- package/dist/web-component.cjs +2 -0
- package/dist/web-component.cjs.map +1 -0
- package/dist/web-component.d.cts +51 -0
- package/dist/web-component.d.ts +51 -0
- package/dist/web-component.js +2 -0
- package/dist/web-component.js.map +1 -0
- package/package.json +249 -11
- package/dist/chunk-35DJOBEO.cjs +0 -2
- package/dist/chunk-35DJOBEO.cjs.map +0 -1
- package/dist/chunk-3GRR4VW2.js +0 -13
- package/dist/chunk-3GRR4VW2.js.map +0 -1
- package/dist/chunk-5A7KDBDU.js +0 -2
- package/dist/chunk-5NHDEY2C.js +0 -2
- package/dist/chunk-6GGYM5SF.cjs +0 -5
- package/dist/chunk-6GGYM5SF.cjs.map +0 -1
- package/dist/chunk-EEILP4OL.cjs +0 -13
- package/dist/chunk-EEILP4OL.cjs.map +0 -1
- package/dist/chunk-FTTNKDZQ.js +0 -5
- package/dist/chunk-FTTNKDZQ.js.map +0 -1
- package/dist/chunk-H2HNKYN2.js +0 -2
- package/dist/chunk-H2HNKYN2.js.map +0 -1
- package/dist/chunk-TKFJGLUO.js +0 -2
package/dist/chunk-6GGYM5SF.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkEEILP4OL_cjs=require('./chunk-EEILP4OL.cjs');var w={AK0010:{code:"AK0010",message:"provide() called outside of component setup.",hint:"provide() must be called inside defineComponent()."},AK0012:{code:"AK0012",message:"inject() called outside of component setup.",hint:"inject() must be called inside defineComponent()."},AK0013:{code:"AK0013",message:"No provider found for injected context.",hint:"Make sure an ancestor component calls provide() with this key."},AK0020:{code:"AK0020",message:"onMount() called outside of component setup.",hint:"onMount() must be called inside defineComponent()."},AK0021:{code:"AK0021",message:"onUnmount() called outside of component setup.",hint:"onUnmount() must be called inside defineComponent()."},AK0022:{code:"AK0022",message:"onError() called outside of component setup.",hint:"onError() must be called inside defineComponent()."},AK0030:{code:"AK0030",message:"Circular dependency detected in computed signal.",hint:"A computed signal is reading itself, directly or via other computeds."},AK0031:{code:"AK0031",message:"Signal set() called during computation.",hint:"Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers."},AK0040:{code:"AK0040",message:"Component setup must return a render function.",hint:"The function passed to defineComponent() must return () => AkashNode."},AK0041:{code:"AK0041",message:"Required prop is missing.",hint:"Check that the parent component is passing all required props."},AK0050:{code:"AK0050",message:"useRoute() called outside of router context.",hint:"Make sure your component is rendered inside a router provider."},AK0051:{code:"AK0051",message:"No route matched the current URL.",hint:"Add a catch-all route ([...rest]) to handle unmatched paths."},AK0052:{code:"AK0052",message:"Route guard threw an error.",hint:"Check the guard function for unhandled exceptions."},AK0060:{code:"AK0060",message:"Form submitted while invalid.",hint:"The submit handler was not called because validation failed. Check form.errors()."},AK0061:{code:"AK0061",message:"Async validator timed out.",hint:"The async validator did not resolve within the expected time. Check your async validation logic."},AK0070:{code:"AK0070",message:"HTTP request failed.",hint:"Check the server response status and network connectivity."},AK0071:{code:"AK0071",message:"createResource() fetcher threw an error.",hint:"Check the fetcher function passed to createResource()."}},P="https://akashjs.dev/errors";function R(e,n){let o=w[e];if(!o)return `[AkashJS ${e}] Unknown error code.`;let s=`[AkashJS ${e}] ${o.message}`;return n&&(s+=`
|
|
2
|
-
${n}`),s+=`
|
|
3
|
-
${o.hint}`,s+=`
|
|
4
|
-
See: ${P}/${e}`,s}function T(e,n){return new Error(R(e,n))}function F(e){return w[e]}function _(){return Object.keys(w)}var D=Symbol("akash.context"),m=null;function S(e=m){let n={values:new Map,parent:e};return m=n,n}function K(e){m=e.parent;}function C(){return m}function v(e,n){let o=m;m=e;try{return n()}finally{m=o;}}function O(e){return {[D]:true,_type:void 0,defaultValue:e,id:Symbol("context")}}function $(e,n){if(!m)throw T("AK0010");m.values.set(e.id,n);}function U(e,n){if(!m)throw T("AK0012");let o=m;for(;o;){if(o.values.has(e.id))return o.values.get(e.id);o=o.parent;}if(n!==void 0)return n;if(e.defaultValue!==void 0)return e.defaultValue;throw T("AK0013")}function W(e,n){let o=document.createElement(e);if(n)for(let[s,a]of Object.entries(n))b(o,s,a);return o}function X(e){return document.createTextNode(e)}function G(e){let n=document.createElement("template");return n.innerHTML=e,n.content.cloneNode(true)}function b(e,n,o){if(n==="class"||n==="className")e.className=o;else if(n==="style"&&typeof o=="object"&&o!==null)Object.assign(e.style,o);else if(n==="innerHTML")e.innerHTML=o;else if(n!=="ref")if(n.startsWith("on")){let s=n.slice(2).toLowerCase();e.addEventListener(s,o);}else n in e?e[n]=o:o===false||o==null?e.removeAttribute(n):e.setAttribute(n,o===true?"":String(o));}function Y(e,n){return chunkEEILP4OL_cjs.n(()=>{e.textContent=String(n());},{render:true})}function z(e,n,o){return chunkEEILP4OL_cjs.n(()=>{b(e,n,o());},{render:true})}function Q(e,n){return chunkEEILP4OL_cjs.n(()=>{e.style.display=n()?"":"none";},{render:true})}function L(e=""){return document.createComment(e)}function j(e,n,o,s,a){let i=null,g=C(),y=chunkEEILP4OL_cjs.n(()=>{let c=o();if(i){for(let f of i.nodes)try{f.parentNode?.removeChild(f);}catch{}i.dispose?.(),i=null;}let d=c?s:a,p=n.parentNode;if(!p&&i?.nodes[0]?.parentNode&&(p=i.nodes[0].parentNode),d&&p){let f=g?v(g,d):d(),t=f instanceof DocumentFragment?Array.from(f.childNodes):[f];for(let r of t)p.insertBefore(r,n);i={nodes:t,dispose:null};}},{render:true});return ()=>{if(y(),i){for(let c of i.nodes)try{c.parentNode?.removeChild(c);}catch{}i.dispose?.();}}}function H(e,n,o,s,a){let i=[],g=C(),y=chunkEEILP4OL_cjs.n(()=>{let c=o(),d=[],p=new Map;for(let t of i)p.set(t.key,t);for(let t=0;t<c.length;t++){let r=c[t],u=s(r,t),l=p.get(u);if(l){p.delete(u);let A=l.nodes[0];if(A&&!A.parentNode){let k=g?v(g,()=>a(r,t)):a(r,t),M=k instanceof DocumentFragment?Array.from(k.childNodes):[k];d.push({key:u,value:r,nodes:M,dispose:null});}else l.value=r,d.push(l);}else {let A=g?v(g,()=>a(r,t)):a(r,t),k=A instanceof DocumentFragment?Array.from(A.childNodes):[A];d.push({key:u,value:r,nodes:k,dispose:null});}}for(let t of p.values()){for(let r of t.nodes)r.parentNode&&r.parentNode.removeChild(r);t.dispose?.();}let f=n.parentNode;if(f)for(let t of d)for(let r of t.nodes)f.insertBefore(r,n);else {let t=null;for(let r of i)if(r.nodes[0]?.parentNode){t=r.nodes[0].parentNode;break}if(t)for(let r of d)for(let u of r.nodes)t.appendChild(u);}i=d;},{render:true});return ()=>{y();for(let c of i){for(let d of c.nodes)d.parentNode&&d.parentNode.removeChild(d);c.dispose?.();}i=[];}}function Z(e){let n=L("show"),o=document.createDocumentFragment();o.appendChild(n);let s=typeof e.when=="function"?e.when:()=>e.when,a;return j(o,n,()=>(a=s(),!!a),()=>x(e.children(a)),e.fallback?()=>x(e.fallback()):void 0),o}function ee(e){let n=L("for"),o=document.createDocumentFragment();o.appendChild(n);let s=typeof e.each=="function"?e.each:()=>e.each;return H(o,n,s,e.key,(a,i)=>x(e.children(a,i))),o}function x(e){if(e==null||typeof e=="boolean")return document.createTextNode("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(e instanceof Node)return e;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let o of e)n.appendChild(x(o));return n}return document.createTextNode(String(e))}function ne(e,n,o){let s=x(n);o?e.insertBefore(s,o):e.appendChild(s);}function de(e){return e.__reactive=true,e}var h=null;function ae(e){if(!h)throw T("AK0020");h.mount.push(e);}function ue(e){if(!h)throw T("AK0021");h.unmount.push(e);}function le(e){if(!h)throw T("AK0022");h.error.push(e);}function fe(e){return {current:e}}function pe(e){let n=o=>{let{children:s,...a}=o??{},y={props:a,children:typeof s=="function"?s:()=>s??null},c={mount:[],unmount:[],error:[]},d=h;h=c;let p=C(),f=S(p),t,r;try{r=chunkEEILP4OL_cjs.o(()=>{if(t=e(y),typeof t!="function")throw T("AK0040");let u=t();return x(u)});}catch(u){if(K(f),h=d,c.error.length>0){for(let l of c.error)l(u instanceof Error?u:new Error(String(u)));return document.createComment("error")}throw u}return K(f),h=d,c.mount.length>0&&queueMicrotask(()=>{for(let u of c.mount)try{let l=u();typeof l=="function"&&c.unmount.push(l);}catch(l){for(let A of c.error)A(l instanceof Error?l:new Error(String(l)));}}),r};return n._akash=true,n}exports.A=fe;exports.B=pe;exports.a=R;exports.b=T;exports.c=F;exports.d=_;exports.e=C;exports.f=v;exports.g=O;exports.h=$;exports.i=U;exports.j=W;exports.k=X;exports.l=G;exports.m=b;exports.n=Y;exports.o=z;exports.p=Q;exports.q=j;exports.r=H;exports.s=Z;exports.t=ee;exports.u=x;exports.v=ne;exports.w=de;exports.x=ae;exports.y=ue;exports.z=le;//# sourceMappingURL=chunk-6GGYM5SF.cjs.map
|
|
5
|
-
//# sourceMappingURL=chunk-6GGYM5SF.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/context.ts","../src/dom.ts","../src/component.ts"],"names":["errors","DOC_BASE","formatError","code","context","def","msg","akashError","getErrorDef","getAllErrorCodes","CONTEXT_BRAND","currentScope","pushScope","parent","scope","popScope","getCurrentScope","runInScope","fn","prev","createContext","defaultValue","provide","key","value","inject","fallback","createElement","tag","attrs","el","setProperty","createText","cloneTemplate","html","template","event","bindText","node","effect","bindProperty","bindVisible","createAnchor","label","renderConditional","anchor","condition","trueBranch","falseBranch","current","dispose","branch","liveParent","fragment","nodes","renderList","items","keyFn","renderItem","currentItems","newData","newItems","oldMap","item","i","data","existing","firstNode","realParent","Show","props","container","getWhen","whenValue","nodeToDOM","For","getEach","index","child","insert","domNode","__getter","currentHooks","onMount","onUnmount","onError","ref","initialValue","defineComponent","setup","component","rawProps","childrenProp","restProps","ctx","hooks","prevHooks","parentScope","renderFn","untrack","rendered","err","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CAAA,CAAG,CAC1B,QAAWO,CAAAA,IAAWP,CAAAA,CAAM,KAAA,CAC1BO,CAAAA,CAAQD,aAAe,KAAA,CAAQA,CAAAA,CAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,CAAC,CAAA,CAE7D,OAAO,QAAA,CAAS,aAAA,CAAc,OAAO,CACvC,CACA,MAAMA,CACR,CAGA,OAAAtF,EAASD,CAAK,CAAA,CACdoE,CAAAA,CAAec,CAAAA,CAGXD,EAAM,KAAA,CAAM,MAAA,CAAS,CAAA,EACvB,cAAA,CAAe,IAAM,CACnB,IAAA,IAAWQ,CAAAA,IAAWR,CAAAA,CAAM,MAC1B,GAAI,CACF,IAAMS,CAAAA,CAAUD,GAAQ,CACpB,OAAOC,CAAAA,EAAY,UAAA,EACrBT,EAAM,OAAA,CAAQ,IAAA,CAAKS,CAAO,EAE9B,OAASH,CAAAA,CAAK,CACZ,IAAA,IAAWC,CAAAA,IAAWP,EAAM,KAAA,CAC1BO,CAAAA,CAAQD,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,MAAA,CAAOA,CAAG,CAAC,CAAC,EAE/D,CAEJ,CAAC,EAGIrB,CACT,CAAA,CAEA,OAAAU,CAAAA,CAAU,MAAA,CAAS,KACZA,CACT","file":"chunk-6GGYM5SF.cjs","sourcesContent":["/**\n * Error message catalog.\n *\n * Every AkashJS runtime error has a unique code (AK0001, AK0002, etc.),\n * a one-line description, and a link to detailed documentation.\n *\n * Usage:\n * throw akashError('AK0010', 'provide()');\n */\n\n// --- Error registry ---\n\nexport interface ErrorDef {\n /** Error code */\n code: string;\n /** Short description */\n message: string;\n /** Extended explanation and fix suggestion */\n hint: string;\n}\n\nconst errors: Record<string, ErrorDef> = {\n // --- Context errors (AK001x) ---\n AK0010: {\n code: 'AK0010',\n message: 'provide() called outside of component setup.',\n hint: 'provide() must be called inside defineComponent().',\n },\n AK0012: {\n code: 'AK0012',\n message: 'inject() called outside of component setup.',\n hint: 'inject() must be called inside defineComponent().',\n },\n AK0013: {\n code: 'AK0013',\n message: 'No provider found for injected context.',\n hint: 'Make sure an ancestor component calls provide() with this key.',\n },\n\n // --- Lifecycle errors (AK002x) ---\n AK0020: {\n code: 'AK0020',\n message: 'onMount() called outside of component setup.',\n hint: 'onMount() must be called inside defineComponent().',\n },\n AK0021: {\n code: 'AK0021',\n message: 'onUnmount() called outside of component setup.',\n hint: 'onUnmount() must be called inside defineComponent().',\n },\n AK0022: {\n code: 'AK0022',\n message: 'onError() called outside of component setup.',\n hint: 'onError() must be called inside defineComponent().',\n },\n\n // --- Signal errors (AK003x) ---\n AK0030: {\n code: 'AK0030',\n message: 'Circular dependency detected in computed signal.',\n hint: 'A computed signal is reading itself, directly or via other computeds.',\n },\n AK0031: {\n code: 'AK0031',\n message: 'Signal set() called during computation.',\n hint: 'Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers.',\n },\n\n // --- Component errors (AK004x) ---\n AK0040: {\n code: 'AK0040',\n message: 'Component setup must return a render function.',\n hint: 'The function passed to defineComponent() must return () => AkashNode.',\n },\n AK0041: {\n code: 'AK0041',\n message: 'Required prop is missing.',\n hint: 'Check that the parent component is passing all required props.',\n },\n\n // --- Router errors (AK005x) ---\n AK0050: {\n code: 'AK0050',\n message: 'useRoute() called outside of router context.',\n hint: 'Make sure your component is rendered inside a router provider.',\n },\n AK0051: {\n code: 'AK0051',\n message: 'No route matched the current URL.',\n hint: 'Add a catch-all route ([...rest]) to handle unmatched paths.',\n },\n AK0052: {\n code: 'AK0052',\n message: 'Route guard threw an error.',\n hint: 'Check the guard function for unhandled exceptions.',\n },\n\n // --- Form errors (AK006x) ---\n AK0060: {\n code: 'AK0060',\n message: 'Form submitted while invalid.',\n hint: 'The submit handler was not called because validation failed. Check form.errors().',\n },\n AK0061: {\n code: 'AK0061',\n message: 'Async validator timed out.',\n hint: 'The async validator did not resolve within the expected time. Check your async validation logic.',\n },\n\n // --- HTTP errors (AK007x) ---\n AK0070: {\n code: 'AK0070',\n message: 'HTTP request failed.',\n hint: 'Check the server response status and network connectivity.',\n },\n AK0071: {\n code: 'AK0071',\n message: 'createResource() fetcher threw an error.',\n hint: 'Check the fetcher function passed to createResource().',\n },\n};\n\n// --- Public API ---\n\nconst DOC_BASE = 'https://akashjs.dev/errors';\n\n/**\n * Format an AkashJS error with code, message, hint, and doc link.\n */\nexport function formatError(code: string, context?: string): string {\n const def = errors[code];\n if (!def) {\n return `[AkashJS ${code}] Unknown error code.`;\n }\n\n let msg = `[AkashJS ${code}] ${def.message}`;\n if (context) {\n msg += `\\n ${context}`;\n }\n msg += `\\n ${def.hint}`;\n msg += `\\n See: ${DOC_BASE}/${code}`;\n return msg;\n}\n\n/**\n * Create and throw an AkashJS error.\n */\nexport function akashError(code: string, context?: string): Error {\n return new Error(formatError(code, context));\n}\n\n/**\n * Get the error definition for a code.\n */\nexport function getErrorDef(code: string): ErrorDef | undefined {\n return errors[code];\n}\n\n/**\n * Get all registered error codes.\n */\nexport function getAllErrorCodes(): string[] {\n return Object.keys(errors);\n}\n","/**\n * Lightweight dependency injection via provide/inject.\n *\n * Context is scoped to the component tree — no injector hierarchy,\n * no decorators, no classes. Just createContext(), provide(), inject().\n */\n\n// --- Types ---\n\nimport { akashError } from './errors.js';\n\nconst CONTEXT_BRAND = Symbol('akash.context');\n\nexport interface InjectionKey<T> {\n readonly [CONTEXT_BRAND]: true;\n readonly _type: T; // phantom type — never used at runtime\n readonly defaultValue: T | undefined;\n readonly id: symbol;\n}\n\n// --- Context stack (managed by component system) ---\n\ninterface ContextScope {\n values: Map<symbol, unknown>;\n parent: ContextScope | null;\n}\n\nlet currentScope: ContextScope | null = null;\n\n/** @internal — called by defineComponent to push/pop context scopes */\nexport function pushScope(parent: ContextScope | null = currentScope): ContextScope {\n const scope: ContextScope = { values: new Map(), parent };\n currentScope = scope;\n return scope;\n}\n\n/** @internal */\nexport function popScope(scope: ContextScope): void {\n currentScope = scope.parent;\n}\n\n/** @internal */\nexport function getCurrentScope(): ContextScope | null {\n return currentScope;\n}\n\n/**\n * Run a function within a given scope so that provide/inject\n * work correctly for components created asynchronously\n * (e.g., lazy-loaded route components).\n */\nexport function runInScope<T>(scope: ContextScope, fn: () => T): T {\n const prev = currentScope;\n currentScope = scope;\n try {\n return fn();\n } finally {\n currentScope = prev;\n }\n}\n\n// --- Public API ---\n\n/**\n * Create a typed context key with an optional default value.\n *\n * ```ts\n * const ThemeContext = createContext<'light' | 'dark'>('light');\n * ```\n */\nexport function createContext<T>(defaultValue?: T): InjectionKey<T> {\n return {\n [CONTEXT_BRAND]: true,\n _type: undefined as T,\n defaultValue,\n id: Symbol('context'),\n };\n}\n\n/**\n * Provide a value for a context key in the current component scope.\n * All descendant components can inject() this value.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function provide<T>(key: InjectionKey<T>, value: T): void {\n if (!currentScope) {\n throw akashError('AK0010');\n }\n currentScope.values.set(key.id, value);\n}\n\n/**\n * Inject a value from the nearest ancestor that provided it.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function inject<T>(key: InjectionKey<T>): T;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, fallback?: T): T {\n if (!currentScope) {\n throw akashError('AK0012');\n }\n\n // Walk up the scope chain\n let scope: ContextScope | null = currentScope;\n while (scope) {\n if (scope.values.has(key.id)) {\n return scope.values.get(key.id) as T;\n }\n scope = scope.parent;\n }\n\n // Check fallback, then default\n if (fallback !== undefined) return fallback;\n if (key.defaultValue !== undefined) return key.defaultValue;\n\n throw akashError('AK0013');\n}\n","/**\n * Direct DOM rendering runtime.\n *\n * No virtual DOM. The compiler generates calls to these helpers.\n * Signal reads inside templates become fine-grained effects that\n * update only the specific DOM node that changed.\n */\n\nimport { effect } from './signals.js';\nimport { getCurrentScope, runInScope } from './context.js';\nimport type { AkashNode } from './types.js';\n\n// --- DOM creation helpers (used by compiler output) ---\n\n/** Create an element and optionally set static attributes */\nexport function createElement(\n tag: string,\n attrs?: Record<string, unknown>,\n): HTMLElement {\n const el = document.createElement(tag);\n if (attrs) {\n for (const [key, value] of Object.entries(attrs)) {\n setProperty(el, key, value);\n }\n }\n return el;\n}\n\n/** Create a text node */\nexport function createText(value: string): Text {\n return document.createTextNode(value);\n}\n\n/** Clone a template element for static structure */\nexport function cloneTemplate(html: string): DocumentFragment {\n const template = document.createElement('template');\n template.innerHTML = html;\n return template.content.cloneNode(true) as DocumentFragment;\n}\n\n// --- Property/attribute setting ---\n\nexport function setProperty(el: HTMLElement, key: string, value: unknown): void {\n if (key === 'class' || key === 'className') {\n el.className = value as string;\n } else if (key === 'style' && typeof value === 'object' && value !== null) {\n Object.assign(el.style, value);\n } else if (key === 'innerHTML') {\n el.innerHTML = value as string;\n } else if (key === 'ref') {\n // Handled separately by component system\n } else if (key.startsWith('on')) {\n const event = key.slice(2).toLowerCase();\n el.addEventListener(event, value as EventListener);\n } else if (key in el) {\n (el as unknown as Record<string, unknown>)[key] = value;\n } else if (value === false || value == null) {\n el.removeAttribute(key);\n } else {\n el.setAttribute(key, value === true ? '' : String(value));\n }\n}\n\n// --- Reactive binding (used by compiler for dynamic expressions) ---\n\n/** Bind a reactive expression to a text node's content */\nexport function bindText(node: Text, fn: () => unknown): () => void {\n return effect(\n () => {\n node.textContent = String(fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's attribute/property */\nexport function bindProperty(\n el: HTMLElement,\n key: string,\n fn: () => unknown,\n): () => void {\n return effect(\n () => {\n setProperty(el, key, fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's visibility (display) */\nexport function bindVisible(el: HTMLElement, fn: () => boolean): () => void {\n return effect(\n () => {\n el.style.display = fn() ? '' : 'none';\n },\n { render: true },\n );\n}\n\n// --- Conditional rendering ---\n\n/** Anchor node — comment for normal DOM, hidden element for table contexts */\ntype Anchor = Comment | HTMLElement;\n\n/** Table elements where comment nodes get relocated by the browser */\nconst TABLE_TAGS = new Set(['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR']);\n\nfunction createAnchor(label = ''): Anchor {\n return document.createComment(label);\n}\n\n/**\n * Create a table-safe anchor. Browsers relocate comment nodes inside\n * table elements, breaking anchor-based insertion. Use a hidden element instead.\n */\nfunction createTableSafeAnchor(parent: Node): Anchor {\n if (parent instanceof HTMLElement && TABLE_TAGS.has(parent.tagName)) {\n const tag = parent.tagName === 'TR' ? 'td' : 'tr';\n const el = document.createElement(tag);\n el.style.display = 'none';\n return el;\n }\n return document.createComment('');\n}\n\ninterface ConditionalBlock {\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a conditional block. Swaps DOM fragments based on a reactive\n * condition. Used by the compiler for :if directives and <Show>.\n */\nexport function renderConditional(\n parent: Node,\n anchor: Node,\n condition: () => boolean,\n trueBranch: () => Node,\n falseBranch?: () => Node,\n): () => void {\n let current: ConditionalBlock | null = null;\n\n // Capture scope so children created in branches inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const value = condition();\n\n // Remove old nodes\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n current = null;\n }\n\n // Insert new nodes — use anchor.parentNode since the anchor may have\n // moved from the initial DocumentFragment into the real DOM.\n // In table contexts, the browser may relocate comment anchors.\n const branch = value ? trueBranch : falseBranch;\n let liveParent: Node | null = anchor.parentNode;\n if (!liveParent && (current as ConditionalBlock | null)?.nodes[0]?.parentNode) {\n liveParent = (current as ConditionalBlock | null)!.nodes[0].parentNode;\n }\n if (branch && liveParent) {\n const fragment = scope ? runInScope(scope, branch) : branch();\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n for (const node of nodes) {\n liveParent.insertBefore(node, anchor);\n }\n current = { nodes, dispose: null };\n }\n },\n { render: true },\n );\n\n return () => {\n dispose();\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n }\n };\n}\n\n// --- List rendering ---\n\ninterface ListItem<T> {\n key: unknown;\n value: T;\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a reactive list with keyed reconciliation.\n * Used by the compiler for :for directives and <For>.\n */\nexport function renderList<T>(\n parent: Node,\n anchor: Node,\n items: () => T[],\n keyFn: (item: T, index: number) => unknown,\n renderItem: (item: T, index: number) => Node,\n): () => void {\n let currentItems: ListItem<T>[] = [];\n\n // Capture scope so children created in renderItem inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const newData = items();\n const newItems: ListItem<T>[] = [];\n const oldMap = new Map<unknown, ListItem<T>>();\n\n for (const item of currentItems) {\n oldMap.set(item.key, item);\n }\n\n // Build new list, reuse existing DOM nodes when keys match\n for (let i = 0; i < newData.length; i++) {\n const data = newData[i];\n const key = keyFn(data, i);\n const existing = oldMap.get(key);\n\n if (existing) {\n oldMap.delete(key);\n // If the reused item's nodes were detached (e.g., parent removed them),\n // treat as new to avoid stale DOM references\n const firstNode = existing.nodes[0];\n if (firstNode && !firstNode.parentNode) {\n // Nodes were detached — create fresh\n const fragment = scope ? runInScope(scope, () => renderItem(data, i)) : renderItem(data, i);\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n newItems.push({ key, value: data, nodes, dispose: null });\n } else {\n existing.value = data;\n newItems.push(existing);\n }\n } else {\n const fragment = scope ? runInScope(scope, () => renderItem(data, i)) : renderItem(data, i);\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n newItems.push({ key, value: data, nodes, dispose: null });\n }\n }\n\n // Remove items that are no longer in the list\n for (const item of oldMap.values()) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n\n // Reconcile DOM order — insertBefore moves existing nodes, inserts new ones\n const liveParent = anchor.parentNode;\n if (liveParent) {\n // Normal path — anchor is in the DOM, insert before it\n for (const item of newItems) {\n for (const node of item.nodes) {\n liveParent.insertBefore(node, anchor);\n }\n }\n } else {\n // Table fallback — browser relocated the comment anchor.\n // Find the real parent from any node still in the DOM.\n let realParent: Node | null = null;\n for (const item of currentItems) {\n if (item.nodes[0]?.parentNode) { realParent = item.nodes[0].parentNode; break; }\n }\n if (realParent) {\n // Remove old nodes first (oldMap items already removed above)\n // Then append all new items\n for (const item of newItems) {\n for (const node of item.nodes) {\n realParent.appendChild(node);\n }\n }\n }\n }\n\n currentItems = newItems;\n },\n { render: true },\n );\n\n return () => {\n dispose();\n for (const item of currentItems) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n currentItems = [];\n };\n}\n\n// --- Built-in control flow components ---\n\n/** Props for the <Show> component */\nexport interface ShowProps<T> {\n when: (() => T | null | undefined | false) | T | null | undefined | false;\n fallback?: () => AkashNode;\n children: (value: T) => AkashNode;\n}\n\n/**\n * <Show> component — conditionally renders children with type narrowing.\n * The children callback receives the non-null/undefined value.\n * `when` can be a reactive getter or a static value.\n */\nexport function Show<T>(props: ShowProps<T>): Node {\n const anchor = createAnchor('show');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve when — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getWhen = typeof props.when === 'function'\n ? props.when as () => T | null | undefined | false\n : () => props.when as T | null | undefined | false;\n\n // Capture the when value once per evaluation so the condition check\n // and the children callback receive the same value (fixes nested For contexts)\n let whenValue: T | null | undefined | false;\n renderConditional(\n container,\n anchor,\n () => { whenValue = getWhen(); return !!whenValue; },\n () => nodeToDOM(props.children(whenValue as T)),\n props.fallback ? () => nodeToDOM(props.fallback!()) : undefined,\n );\n\n return container;\n}\n\n/** Props for the <For> component */\nexport interface ForProps<T> {\n each: (() => T[]) | T[];\n key: (item: T) => unknown;\n children: (item: T, index: number) => AkashNode;\n}\n\n/**\n * <For> component — renders a list with keyed reconciliation.\n * `each` can be a reactive getter or a static array.\n */\nexport function For<T>(props: ForProps<T>): Node {\n const anchor = createAnchor('for');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve each — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getEach = typeof props.each === 'function'\n ? props.each as () => T[]\n : () => props.each as T[];\n\n renderList(\n container,\n anchor,\n getEach,\n props.key,\n (item, index) => nodeToDOM(props.children(item, index)),\n );\n\n return container;\n}\n\n// --- Helpers ---\n\n/** Convert an AkashNode to a DOM Node */\nexport function nodeToDOM(node: AkashNode): Node {\n if (node == null || typeof node === 'boolean') {\n return document.createTextNode('');\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return document.createTextNode(String(node));\n }\n if (node instanceof Node) {\n return node;\n }\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment();\n for (const child of node) {\n fragment.appendChild(nodeToDOM(child));\n }\n return fragment;\n }\n return document.createTextNode(String(node));\n}\n\n/** Insert a node into a parent before an anchor */\nexport function insert(parent: Node, node: AkashNode, anchor?: Node): void {\n const domNode = nodeToDOM(node);\n if (anchor) {\n parent.insertBefore(domNode, anchor);\n } else {\n parent.appendChild(domNode);\n }\n}\n","/**\n * Component system.\n *\n * Components are functions. defineComponent() wraps a setup function\n * that runs once, establishes signals and effects, and returns a\n * render function that produces DOM nodes.\n */\n\nimport { effect, untrack } from './signals.js';\nimport { pushScope, popScope, getCurrentScope } from './context.js';\nimport { nodeToDOM } from './dom.js';\nimport { akashError } from './errors.js';\nimport type { AkashNode } from './types.js';\n\n// --- Reactive getter marker (used by compiler) ---\n\n/** Mark a function as a compiler-generated reactive getter */\nexport function __getter<T>(fn: () => T): (() => T) & { __reactive: true } {\n (fn as any).__reactive = true;\n return fn as any;\n}\n\n// --- Types ---\n\nexport interface Ref<T = HTMLElement> {\n current: T | undefined;\n}\n\nexport interface ComponentContext<P extends Record<string, unknown> = Record<string, unknown>> {\n props: Readonly<P>;\n children: () => AkashNode;\n}\n\nexport type Component<P extends Record<string, unknown> = Record<string, unknown>> = {\n (props: P & { children?: AkashNode | (() => AkashNode) }): Node;\n _akash: true;\n};\n\n// --- Lifecycle hook storage ---\n\ninterface LifecycleHooks {\n mount: Array<() => void | (() => void)>;\n unmount: Array<() => void>;\n error: Array<(error: Error) => void>;\n}\n\nlet currentHooks: LifecycleHooks | null = null;\n\n// --- Public lifecycle hooks ---\n\n/**\n * Register a callback to run after the component is mounted to the DOM.\n * If the callback returns a function, it will be called on unmount (cleanup).\n */\nexport function onMount(fn: () => void | (() => void)): void {\n if (!currentHooks) {\n throw akashError('AK0020');\n }\n currentHooks.mount.push(fn);\n}\n\n/**\n * Register a callback to run before the component is unmounted.\n */\nexport function onUnmount(fn: () => void): void {\n if (!currentHooks) {\n throw akashError('AK0021');\n }\n currentHooks.unmount.push(fn);\n}\n\n/**\n * Register an error handler for this component and its descendants.\n */\nexport function onError(fn: (error: Error) => void): void {\n if (!currentHooks) {\n throw akashError('AK0022');\n }\n currentHooks.error.push(fn);\n}\n\n/**\n * Create a ref for accessing a DOM element or storing a mutable value.\n */\nexport function ref<T = HTMLElement>(initialValue?: T): Ref<T> {\n return { current: initialValue as T | undefined };\n}\n\n// --- defineComponent ---\n\n/**\n * Define a component. The setup function runs once per instance.\n * It receives a context with typed props and must return a render function.\n *\n * ```ts\n * const Counter = defineComponent<{ initial: number }>((ctx) => {\n * const count = signal(ctx.props.initial);\n * return () => <div>{count()}</div>;\n * });\n * ```\n */\nexport function defineComponent<P extends Record<string, any> = Record<string, any>>(\n setup: (ctx: ComponentContext<P>) => () => AkashNode,\n): Component<P> {\n const component = (rawProps: P & { children?: AkashNode | (() => AkashNode) }): Node => {\n // Separate children from props, unwrap getter functions for reactivity\n const { children: childrenProp, ...restProps } = rawProps ?? {};\n // Props are passed through as-is — no auto-unwrapping.\n // Components use readProp() to unwrap reactive getters/signals inside\n // effects, which preserves dependency tracking. Auto-unwrapping in the\n // Proxy broke reactivity because it called the getter once and returned\n // the plain value, so effects never subscribed to the underlying signal.\n const props = restProps as unknown as P;\n\n const childrenFn: () => AkashNode =\n typeof childrenProp === 'function'\n ? childrenProp\n : () => childrenProp ?? null;\n\n const ctx: ComponentContext<P> = {\n props,\n children: childrenFn,\n };\n\n // Set up lifecycle hooks collector\n const hooks: LifecycleHooks = { mount: [], unmount: [], error: [] };\n const prevHooks = currentHooks;\n currentHooks = hooks;\n\n // Push context scope for provide/inject\n const parentScope = getCurrentScope();\n const scope = pushScope(parentScope);\n\n let renderFn: () => AkashNode;\n let domNode: Node;\n\n try {\n // Untrack component creation so that signals created inside the component\n // don't register with a parent render effect. This prevents parent effects\n // from re-running (and re-creating the entire component) when internal\n // component state changes. The component's own effects still track their\n // dependencies because effect() sets its own subscriber during execution.\n domNode = untrack(() => {\n renderFn = setup(ctx);\n if (typeof renderFn !== 'function') { throw akashError('AK0040'); }\n const rendered = renderFn();\n return nodeToDOM(rendered);\n });\n } catch (err) {\n popScope(scope);\n currentHooks = prevHooks;\n if (hooks.error.length > 0) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n return document.createComment('error');\n }\n throw err;\n }\n\n // Restore parent state\n popScope(scope);\n currentHooks = prevHooks;\n\n // Run mount callbacks (microtask to ensure DOM is attached)\n if (hooks.mount.length > 0) {\n queueMicrotask(() => {\n for (const mountFn of hooks.mount) {\n try {\n const cleanup = mountFn();\n if (typeof cleanup === 'function') {\n hooks.unmount.push(cleanup);\n }\n } catch (err) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n }\n }\n });\n }\n\n return domNode;\n };\n\n component._akash = true as const;\n return component as Component<P>;\n}\n"]}
|
package/dist/chunk-EEILP4OL.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';var f=new Set,l=new Set,b=false,d=0,g=false,x=3,P=100;function v(){if(b)return;b=true;let e=new Map,n=false,t=0;for(;(f.size>0||l.size>0)&&t<P;){if(t++,f.size>0){let s=[...f].sort(C);f.clear();for(let r of s){let o=(e.get(r)??0)+1;if(e.set(r,o),o>x){n=true;continue}r.run();}}if(l.size>0){let s=[...l].sort(C);l.clear();for(let r of s){let o=(e.get(r)??0)+1;if(e.set(r,o),o>x){n=true;continue}r.run();}}if(n&&f.size===0&&l.size===0)break}(n||t>=P)&&(f.clear(),l.clear(),console.error("[AkashJS] Circular dependency detected between effects. Two or more effects are writing to each other's dependencies. The cycle has been broken after "+t+" iterations.")),b=false,g&&(g=false,(f.size>0||l.size>0)&&v());}function N(e){e.isRender?f.add(e):l.add(e),d===0&&!b?v():b&&(g=true);}function _(e){d++;try{return e()}finally{d--,d===0&&v();}}function R(){d++;}function k(){d--,d===0&&v();}function C(e,n){return (e.depth??0)-(n.depth??0)}function M(){v();}var T=false,h=[],S=0;function B(){T=true,h=[],S=performance.now();}function K(){T=false;let e=performance.now();return {entries:[...h],totalDuration:e-S,startTime:S,endTime:e}}function y(){return T}function p(e,n,t){T&&h.push({type:e,name:n,duration:t,timestamp:performance.now()});}function z(e){let n=e.entries.filter(i=>i.type==="render"),t=e.entries.filter(i=>i.type==="effect"),s=e.entries.filter(i=>i.type==="signal-update"),r=e.entries.filter(i=>i.type==="computed"),o=i=>i.length>0?i.reduce((u,m)=>u+m.duration,0)/i.length:0,c=i=>i.length>0?i.reduce((u,m)=>m.duration>u.duration?m:u):null;return {totalRenders:n.length,totalEffects:t.length,totalSignalUpdates:s.length,totalComputedEvals:r.length,avgRenderTime:o(n),avgEffectTime:o(t),slowestRender:c(n),slowestEffect:c(t)}}function O(e,n){let t=performance.now(),s=n(),r=performance.now()-t;return p("render",e,r),{result:s,duration:r}}async function j(e,n){let t=performance.now(),s=await n(),r=performance.now()-t;return p("render",e,r),{result:s,duration:r}}function I(e){let n=0,t=0;return {start(){n=performance.now();},stop(){t=performance.now()-n,p("render",e,t);},get duration(){return t}}}function X(e){let n=z(e),t=`
|
|
2
|
-
Performance Profile
|
|
3
|
-
`;return t+=" "+"\u2500".repeat(50)+`
|
|
4
|
-
`,t+=` Duration: ${e.totalDuration.toFixed(1)} ms
|
|
5
|
-
`,t+=` Renders: ${n.totalRenders} (avg ${n.avgRenderTime.toFixed(2)} ms)
|
|
6
|
-
`,t+=` Effects: ${n.totalEffects} (avg ${n.avgEffectTime.toFixed(2)} ms)
|
|
7
|
-
`,t+=` Signal updates: ${n.totalSignalUpdates}
|
|
8
|
-
`,t+=` Computed evals: ${n.totalComputedEvals}
|
|
9
|
-
`,n.slowestRender&&(t+=` Slowest render: ${n.slowestRender.name} (${n.slowestRender.duration.toFixed(2)} ms)
|
|
10
|
-
`),n.slowestEffect&&(t+=` Slowest effect: ${n.slowestEffect.name} (${n.slowestEffect.duration.toFixed(2)} ms)
|
|
11
|
-
`),t+=" "+"\u2500".repeat(50)+`
|
|
12
|
-
`,t}var F=typeof process>"u"||process.env?.NODE_ENV!=="production";var a=null;function G(e,n){let t={value:e,subscribers:new Set,equals:n?.equals??Object.is},s=()=>(J(t),t.value);return s.set=r=>{F&&a&&a._tag==="computed"&&console.warn("[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation."),!t.equals(t.value,r)&&(t.value=r,y()&&p("signal-update","signal.set",0),_(()=>{E(t);}));},s.update=r=>{s.set(r(t.value));},s.peek=()=>t.value,s}function Q(e,n){let t={_tag:"computed",fn:e,value:void 0,state:1,subscribers:new Set,sources:new Set,equals:n?.equals??Object.is};return ()=>(a&&(t.subscribers.add(a),"sources"in a&&a.sources.add(t)),t.state!==0&&q(t),t.value)}var w=new Set;function q(e,n=false){if(w.has(e))throw new Error("[AkashJS] Circular dependency detected between computed values.");w.add(e),R();for(let r of e.sources)r.subscribers.delete(e);e.sources.clear();let t=a;a=e;let s=y()?performance.now():0;try{let r=e.fn(),o=e.value===void 0,c=o||!e.equals(e.value,r);if(e.value=r,e.state=0,c&&!o)if(n){for(let i of [...e.subscribers])if(i._tag==="computed"){i.state=1;for(let u of [...i.subscribers])u._tag==="computed"&&(u.state=1);}}else E(e);}finally{s&&p("computed","computed",performance.now()-s),w.delete(e),a=t,k();}}function Y(e,n){let t={_tag:"effect",fn:e,cleanup:null,sources:new Set,disposed:false,isRender:n?.render??false,run(){D(t);}};return D(t),()=>{t.disposed=true,A(t);for(let s of t.sources)s.subscribers.delete(t);t.sources.clear();}}function D(e){if(e.disposed)return;if(e.sources.size>0){let r=false;for(let o of e.sources)if("_tag"in o&&o._tag==="computed"){o.state===1&&q(o,true);let c=e._lastSeen;if(c?.has(o)){let i=c.get(o);o.equals(i,o.value)||(r=true);}else r=true;}else r=true;if(!r)return}A(e);let n=new Set(e.sources);for(let r of e.sources)r.subscribers.delete(e);e.sources.clear();let t=a;a=e;let s=y()?performance.now():0;try{let r=e.fn();typeof r=="function"&&(e.cleanup=r);}catch(r){for(let o of n)o.subscribers.add(e),e.sources.add(o);console.error("[AkashJS] Error in effect (will retry on next signal change):",r);}finally{s&&p("effect","effect",performance.now()-s),a=t;let r=new Map;for(let o of e.sources)"_tag"in o&&o._tag==="computed"&&r.set(o,o.value);r.size>0&&(e._lastSeen=r);}}function A(e){if(e.cleanup){try{e.cleanup();}catch(n){console.error("[AkashJS] Error in effect cleanup (ignored):",n);}e.cleanup=null;}}function U(e){let n=a;a=null;try{return e()}finally{a=n;}}function Z(e,n,t){let s=Array.isArray(e),r=s?e:[e],o,c=true;return ()=>{let i=r.map(m=>m());if(c&&(c=false,o=i.slice(),t?.defer!==false))return;let u=o;return o=i.slice(),U(()=>n(s?i:i[0],u?s?u:u[0]:void 0))}}function J(e){a&&(e.subscribers.add(a),"sources"in a&&a.sources.add(e));}function E(e){let n=[...e.subscribers];for(let t of n)t._tag==="computed"?(t.state=1,E(t)):t._tag==="effect"&&N(t);}exports.a=_;exports.b=M;exports.c=B;exports.d=K;exports.e=y;exports.f=p;exports.g=z;exports.h=O;exports.i=j;exports.j=I;exports.k=X;exports.l=G;exports.m=Q;exports.n=Y;exports.o=U;exports.p=Z;//# sourceMappingURL=chunk-EEILP4OL.cjs.map
|
|
13
|
-
//# sourceMappingURL=chunk-EEILP4OL.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/scheduler.ts","../src/perf.ts","../src/signals.ts"],"names":["pendingRender","pendingUser","flushing","batchDepth","reflushNeeded","MAX_EFFECT_RUNS","MAX_FLUSH_ITERATIONS","flush","runCounts","circularDetected","iterations","queue","byDepth","fx","count","scheduleEffect","batch","fn","enterBatch","exitBatch","a","b","flushSync","profiling","entries","profileStart","startProfiling","stopProfiling","endTime","isProfiling","recordPerfEntry","type","name","duration","getProfileSummary","profile","renders","e","effects","signalUpdates","computeds","avg","arr","s","slowest","measureSync","start","result","measureAsync","createTimer","startTime","dur","formatProfile","summary","out","__DEV__","currentSubscriber","signal","initialValue","options","node","read","trackSubscriber","value","notifySubscribers","computed","recompute","computingSet","skipEffectNotify","source","prevSubscriber","_t0","newValue","isFirst","changed","sub","sub2","effect","runEffect","cleanupEffect","anyChanged","cachedValues","lastSeen","prevSources","err","untrack","prev","on","deps","isArray","depArray","prevValues","values","d","subs"],"mappings":"aAcA,IAAMA,CAAAA,CAAgB,IAAI,GAAA,CACpBC,CAAAA,CAAc,IAAI,GAAA,CACpBC,CAAAA,CAAW,KAAA,CACXC,CAAAA,CAAa,CAAA,CAEbC,EAAgB,KAAA,CAEdC,CAAAA,CAAkB,CAAA,CAClBC,CAAAA,CAAuB,IAE7B,SAASC,CAAAA,EAAc,CACrB,GAAIL,CAAAA,CAAU,OACdA,CAAAA,CAAW,IACM,CAGjB,IAAMM,EAAY,IAAI,GAAA,CAClBC,CAAAA,CAAmB,KAAA,CAInBC,CAAAA,CAAa,CAAA,CACjB,KAAA,CAAQV,CAAAA,CAAc,IAAA,CAAO,CAAA,EAAKC,CAAAA,CAAY,IAAA,CAAO,CAAA,GAAMS,CAAAA,CAAaJ,CAAAA,EAAsB,CAI5F,GAHAI,CAAAA,EAAAA,CAGIV,CAAAA,CAAc,IAAA,CAAO,CAAA,CAAG,CAC1B,IAAMW,CAAAA,CA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CAEX,IAAMmB,CAAAA,CAASF,EAAS,GAAA,CAAIG,CAAAA,EAAKA,GAAG,CAAA,CAIpC,GAAIpB,CAAAA,GACFA,EAAU,KAAA,CACVkB,CAAAA,CAAaC,CAAAA,CAAO,KAAA,GAChBjC,CAAAA,EAAS,KAAA,GAAU,KAAA,CAAA,CAAO,OAGhC,IAAM2B,CAAAA,CAAOK,CAAAA,CACb,OAAAA,CAAAA,CAAaC,CAAAA,CAAO,OAAM,CAGnBP,CAAAA,CAAQ,IAAMpE,CAAAA,CACnBwE,EAAUG,CAAAA,CAASA,CAAAA,CAAO,CAAC,CAAA,CAC3BN,CAAAA,CAAQG,EAAUH,CAAAA,CAAOA,CAAAA,CAAK,CAAC,CAAA,CAAK,MACtC,CAAC,CACH,CACF,CAIA,SAASxB,EACPF,CAAAA,CACM,CACFJ,CAAAA,GACFI,CAAAA,CAAK,YAAY,GAAA,CAAIJ,CAAiB,EAElC,SAAA,GAAaA,CAAAA,EACfA,EAAkB,OAAA,CAAQ,GAAA,CAAII,CAAI,CAAA,EAGxC,CAEA,SAASI,CAAAA,CACPJ,EACM,CAKN,IAAMkC,EAAO,CAAC,GAAGlC,CAAAA,CAAK,WAAW,EACjC,IAAA,IAAWe,CAAAA,IAAOmB,EACZnB,CAAAA,CAAI,IAAA,GAAS,YAEfA,CAAAA,CAAI,KAAA,CAAQ,CAAA,CAIZX,CAAAA,CAAkBW,CAAG,CAAA,EACZA,CAAAA,CAAI,OAAS,QAAA,EACtB5D,CAAAA,CAAe4D,CAAG,EAGxB","file":"chunk-EEILP4OL.cjs","sourcesContent":["/**\n * Microtask-based effect scheduler with priority levels and deduplication.\n *\n * Render effects (DOM bindings) run before user effects to ensure\n * DOM is consistent before user-side effects execute.\n */\n\nexport interface ScheduledEffect {\n run(): void;\n isRender: boolean;\n /** Depth in the dependency graph (0 = root). Lower depth runs first. */\n depth?: number;\n}\n\nconst pendingRender = new Set<ScheduledEffect>();\nconst pendingUser = new Set<ScheduledEffect>();\nlet flushing = false;\nlet batchDepth = 0;\nlet flushScheduled = false;\nlet reflushNeeded = false;\n\nconst MAX_EFFECT_RUNS = 3;\nconst MAX_FLUSH_ITERATIONS = 100;\n\nfunction flush(): void {\n if (flushing) return;\n flushing = true;\n flushScheduled = false;\n\n // Fresh per-effect run counter for THIS flush — reset every time\n const runCounts = new Map<ScheduledEffect, number>();\n let circularDetected = false;\n\n // Process render effects first, then user effects.\n // Effects may enqueue more effects during flush, so loop until empty.\n let iterations = 0;\n while ((pendingRender.size > 0 || pendingUser.size > 0) && iterations < MAX_FLUSH_ITERATIONS) {\n iterations++;\n\n // Drain render effects (sorted by depth — parents before children)\n if (pendingRender.size > 0) {\n const queue = [...pendingRender].sort(byDepth);\n pendingRender.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // Drain user effects (sorted by depth)\n if (pendingUser.size > 0) {\n const queue = [...pendingUser].sort(byDepth);\n pendingUser.clear();\n for (const fx of queue) {\n const count = (runCounts.get(fx) ?? 0) + 1;\n runCounts.set(fx, count);\n if (count > MAX_EFFECT_RUNS) {\n circularDetected = true;\n continue; // skip this effect — it's in a cycle\n }\n fx.run();\n }\n }\n\n // If all remaining effects were skipped due to cycle detection, break\n if (circularDetected && pendingRender.size === 0 && pendingUser.size === 0) {\n break;\n }\n }\n\n if (circularDetected || iterations >= MAX_FLUSH_ITERATIONS) {\n pendingRender.clear();\n pendingUser.clear();\n console.error(\n '[AkashJS] Circular dependency detected between effects. ' +\n 'Two or more effects are writing to each other\\'s dependencies. ' +\n 'The cycle has been broken after ' + iterations + ' iterations.'\n );\n }\n\n flushing = false;\n\n // If effects were scheduled during the tail end of this flush (after the\n // while loop's condition was last checked), re-flush them now.\n if (reflushNeeded) {\n reflushNeeded = false;\n if (pendingRender.size > 0 || pendingUser.size > 0) {\n flush();\n }\n }\n}\n\nexport function scheduleEffect(fx: ScheduledEffect): void {\n if (fx.isRender) {\n pendingRender.add(fx);\n } else {\n pendingUser.add(fx);\n }\n\n if (batchDepth === 0 && !flushing) {\n flush();\n } else if (flushing) {\n // Effects were added during a flush. The while loop may still pick them\n // up, but if it has already checked the queues and found them empty,\n // we need a re-flush after the current one completes.\n reflushNeeded = true;\n }\n}\n\n/**\n * Batch multiple signal writes — subscribers are notified only once\n * at the end of the batch.\n */\nexport function batch<T>(fn: () => T): T {\n batchDepth++;\n try {\n return fn();\n } finally {\n batchDepth--;\n if (batchDepth === 0) {\n flush();\n }\n }\n}\n\n/** Enter/exit batch depth — used by computed recompute to prevent mid-evaluation flush */\nexport function enterBatch(): void { batchDepth++; }\nexport function exitBatch(): void {\n batchDepth--;\n if (batchDepth === 0) flush();\n}\n\n/** Sort effects by depth (lower depth first = parents before children) */\nfunction byDepth(a: ScheduledEffect, b: ScheduledEffect): number {\n return (a.depth ?? 0) - (b.depth ?? 0);\n}\n\n/** Synchronously flush all pending effects. Useful for testing. */\nexport function flushSync(): void {\n flush();\n}\n","/**\n * Performance profiling utilities.\n *\n * Measure component render times, signal propagation, and\n * effect execution for performance debugging.\n *\n * ```ts\n * import { startProfiling, stopProfiling, getProfile } from '@akashjs/runtime';\n *\n * startProfiling();\n * // ... do stuff ...\n * stopProfiling();\n * console.table(getProfile().entries);\n * ```\n */\n\n// --- Types ---\n\nexport interface PerfEntry {\n type: 'render' | 'effect' | 'signal-update' | 'computed';\n name: string;\n duration: number;\n timestamp: number;\n}\n\nexport interface PerfProfile {\n entries: PerfEntry[];\n totalDuration: number;\n startTime: number;\n endTime: number;\n}\n\nexport interface PerfSummary {\n totalRenders: number;\n totalEffects: number;\n totalSignalUpdates: number;\n totalComputedEvals: number;\n avgRenderTime: number;\n avgEffectTime: number;\n slowestRender: PerfEntry | null;\n slowestEffect: PerfEntry | null;\n}\n\n// --- Profiling state ---\n\nlet profiling = false;\nlet entries: PerfEntry[] = [];\nlet profileStart = 0;\n\n// --- Public API ---\n\n/**\n * Start profiling. Clears previous data.\n */\nexport function startProfiling(): void {\n profiling = true;\n entries = [];\n profileStart = performance.now();\n}\n\n/**\n * Stop profiling.\n */\nexport function stopProfiling(): PerfProfile {\n profiling = false;\n const endTime = performance.now();\n\n return {\n entries: [...entries],\n totalDuration: endTime - profileStart,\n startTime: profileStart,\n endTime,\n };\n}\n\n/**\n * Check if profiling is active.\n */\nexport function isProfiling(): boolean {\n return profiling;\n}\n\n/**\n * Record a performance entry (called internally by the framework).\n */\nexport function recordPerfEntry(\n type: PerfEntry['type'],\n name: string,\n duration: number,\n): void {\n if (!profiling) return;\n entries.push({\n type,\n name,\n duration,\n timestamp: performance.now(),\n });\n}\n\n/**\n * Get a summary of the profiling data.\n */\nexport function getProfileSummary(profile: PerfProfile): PerfSummary {\n const renders = profile.entries.filter((e) => e.type === 'render');\n const effects = profile.entries.filter((e) => e.type === 'effect');\n const signalUpdates = profile.entries.filter((e) => e.type === 'signal-update');\n const computeds = profile.entries.filter((e) => e.type === 'computed');\n\n const avg = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => s + e.duration, 0) / arr.length : 0;\n\n const slowest = (arr: PerfEntry[]) =>\n arr.length > 0 ? arr.reduce((s, e) => (e.duration > s.duration ? e : s)) : null;\n\n return {\n totalRenders: renders.length,\n totalEffects: effects.length,\n totalSignalUpdates: signalUpdates.length,\n totalComputedEvals: computeds.length,\n avgRenderTime: avg(renders),\n avgEffectTime: avg(effects),\n slowestRender: slowest(renders),\n slowestEffect: slowest(effects),\n };\n}\n\n// --- Measurement helpers ---\n\n/**\n * Measure the time to execute a function.\n *\n * ```ts\n * const { result, duration } = measureSync('my-operation', () => expensiveWork());\n * ```\n */\nexport function measureSync<T>(name: string, fn: () => T): { result: T; duration: number } {\n const start = performance.now();\n const result = fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Measure the time to execute an async function.\n */\nexport async function measureAsync<T>(\n name: string,\n fn: () => Promise<T>,\n): Promise<{ result: T; duration: number }> {\n const start = performance.now();\n const result = await fn();\n const duration = performance.now() - start;\n recordPerfEntry('render', name, duration);\n return { result, duration };\n}\n\n/**\n * Create a named timer for manual start/stop measurement.\n *\n * ```ts\n * const timer = createTimer('data-fetch');\n * timer.start();\n * await fetch(...);\n * timer.stop(); // records the entry\n * timer.duration; // ms\n * ```\n */\nexport function createTimer(name: string) {\n let startTime = 0;\n let dur = 0;\n\n return {\n start() { startTime = performance.now(); },\n stop() {\n dur = performance.now() - startTime;\n recordPerfEntry('render', name, dur);\n },\n get duration() { return dur; },\n };\n}\n\n/**\n * Format a profile for console output.\n */\nexport function formatProfile(profile: PerfProfile): string {\n const summary = getProfileSummary(profile);\n let out = '\\n Performance Profile\\n';\n out += ' ' + '─'.repeat(50) + '\\n';\n out += ` Duration: ${profile.totalDuration.toFixed(1)} ms\\n`;\n out += ` Renders: ${summary.totalRenders} (avg ${summary.avgRenderTime.toFixed(2)} ms)\\n`;\n out += ` Effects: ${summary.totalEffects} (avg ${summary.avgEffectTime.toFixed(2)} ms)\\n`;\n out += ` Signal updates: ${summary.totalSignalUpdates}\\n`;\n out += ` Computed evals: ${summary.totalComputedEvals}\\n`;\n\n if (summary.slowestRender) {\n out += ` Slowest render: ${summary.slowestRender.name} (${summary.slowestRender.duration.toFixed(2)} ms)\\n`;\n }\n if (summary.slowestEffect) {\n out += ` Slowest effect: ${summary.slowestEffect.name} (${summary.slowestEffect.duration.toFixed(2)} ms)\\n`;\n }\n\n out += ' ' + '─'.repeat(50) + '\\n';\n return out;\n}\n","/**\n * Fine-grained reactivity system.\n *\n * Inspired by SolidJS/Preact Signals. Provides signal(), computed(),\n * effect(), and untrack() primitives with automatic dependency tracking\n * and glitch-free diamond dependency resolution.\n */\n\nimport { scheduleEffect, batch, enterBatch, exitBatch, type ScheduledEffect } from './scheduler.js';\nimport { recordPerfEntry, isProfiling } from './perf.js';\n\nconst __DEV__ = typeof process === 'undefined' || process.env?.NODE_ENV !== 'production';\n\n/** Depth counter to defer effect scheduling until all notifications complete (glitch-free) */\nlet notifyDepth = 0;\n\n// --- Tracking scope ---\n\ntype Subscriber = EffectNode | ComputedNode<any>;\n\nlet currentSubscriber: Subscriber | null = null;\n\n// --- Signal ---\n\nexport interface Signal<T> {\n /** Read the current value (tracks dependency if inside a reactive scope) */\n (): T;\n /** Set a new value */\n set(value: T): void;\n /** Update the value using the previous value */\n update(fn: (prev: T) => T): void;\n /** Read without tracking (no dependency registered) */\n peek(): T;\n}\n\nexport type ReadonlySignal<T> = () => T;\n\ninterface SignalNode<T> {\n value: T;\n subscribers: Set<Subscriber>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function signal<T>(\n initialValue: T,\n options?: { equals?: (a: T, b: T) => boolean },\n): Signal<T> {\n const node: SignalNode<T> = {\n value: initialValue,\n subscribers: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n trackSubscriber(node);\n return node.value;\n };\n\n read.set = (value: T): void => {\n if (__DEV__ && currentSubscriber && currentSubscriber._tag === 'computed') {\n console.warn('[AkashJS] Writing to a signal inside computed() is not allowed. The write will be lost on the next evaluation.');\n }\n if (node.equals(node.value, value)) return;\n node.value = value;\n if (isProfiling()) recordPerfEntry('signal-update', 'signal.set', 0);\n batch(() => { notifySubscribers(node); });\n };\n\n read.update = (fn: (prev: T) => T): void => {\n read.set(fn(node.value));\n };\n\n read.peek = (): T => node.value;\n\n return read;\n}\n\n// --- Computed ---\n\nconst enum ComputedState {\n Clean = 0,\n Dirty = 1,\n}\n\ninterface ComputedNode<T> {\n _tag: 'computed';\n fn: () => T;\n value: T | undefined;\n state: ComputedState;\n subscribers: Set<Subscriber>;\n sources: Set<SignalNode<any> | ComputedNode<any>>;\n equals: (a: T, b: T) => boolean;\n}\n\nexport function computed<T>(\n fn: () => T,\n options?: { equals?: (a: T, b: T) => boolean },\n): ReadonlySignal<T> {\n const node: ComputedNode<T> = {\n _tag: 'computed',\n fn,\n value: undefined,\n state: ComputedState.Dirty,\n subscribers: new Set(),\n sources: new Set(),\n equals: options?.equals ?? Object.is,\n };\n\n const read = (): T => {\n // Track this computed as a dependency of the current subscriber\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n\n if (node.state !== ComputedState.Clean) {\n recompute(node);\n }\n\n return node.value as T;\n };\n\n return read;\n}\n\nconst computingSet = new Set<ComputedNode<unknown>>();\n\n/**\n * @param skipEffectNotify - When true, don't schedule effects in notifySubscribers.\n * Used when recompute is called from runEffect's dirty check — the effect is\n * already being processed, re-scheduling it would trigger the circular run limit.\n */\nfunction recompute<T>(node: ComputedNode<T>, skipEffectNotify = false): void {\n // Detect circular computed dependencies — only if THIS node is already being computed\n if (computingSet.has(node as ComputedNode<unknown>)) {\n throw new Error('[AkashJS] Circular dependency detected between computed values.');\n }\n computingSet.add(node as ComputedNode<unknown>);\n\n // Prevent effects from flushing while computed is evaluating.\n // Without this, a computed that reads other dirty computeds can trigger\n // notifySubscribers → scheduleEffect → flush → re-enter recompute on\n // a node still in computingSet (false circular detection).\n enterBatch();\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n\n const _t0 = isProfiling() ? performance.now() : 0;\n try {\n const newValue = node.fn();\n const isFirst = node.value === undefined;\n const changed = isFirst || !node.equals(node.value as T, newValue);\n node.value = newValue;\n node.state = ComputedState.Clean;\n\n // Only propagate if value actually changed (skip first computation —\n // the effect that triggered the read is already running).\n if (changed && !isFirst) {\n if (skipEffectNotify) {\n // Only mark downstream computeds as dirty — don't schedule effects.\n // Effects are already handled by the runEffect that triggered this recompute.\n for (const sub of [...node.subscribers]) {\n if (sub._tag === 'computed') {\n sub.state = ComputedState.Dirty;\n // Recursively propagate to further computeds\n for (const sub2 of [...sub.subscribers]) {\n if (sub2._tag === 'computed') sub2.state = ComputedState.Dirty;\n }\n }\n }\n } else {\n notifySubscribers(node);\n }\n }\n } finally {\n if (_t0) recordPerfEntry('computed', 'computed', performance.now() - _t0);\n computingSet.delete(node as ComputedNode<unknown>);\n currentSubscriber = prevSubscriber;\n exitBatch();\n }\n}\n\n// --- Effect ---\n\ninterface EffectNode extends ScheduledEffect {\n _tag: 'effect';\n fn: () => void | (() => void);\n cleanup: (() => void) | null;\n sources: Set<SignalNode<any> | ComputedNode<any>>;\n disposed: boolean;\n isRender: boolean;\n}\n\nexport function effect(\n fn: () => void | (() => void),\n options?: { render?: boolean },\n): () => void {\n const node: EffectNode = {\n _tag: 'effect',\n fn,\n cleanup: null,\n sources: new Set(),\n disposed: false,\n isRender: options?.render ?? false,\n run() {\n runEffect(node);\n },\n };\n\n // Run immediately to establish dependencies\n runEffect(node);\n\n // Return dispose function\n return () => {\n node.disposed = true;\n cleanupEffect(node);\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n };\n}\n\nfunction runEffect(node: EffectNode): void {\n if (node.disposed) return;\n\n // Before re-running, check if any dirty computed source actually changed.\n // Compare against per-effect cached values (not the shared source.value which\n // may have been updated by another effect's recompute already).\n if (node.sources.size > 0) {\n let anyChanged = false;\n for (const source of node.sources) {\n if ('_tag' in source && source._tag === 'computed') {\n if (source.state === ComputedState.Dirty) {\n recompute(source, true);\n }\n // Compare against this effect's last-seen value (not the shared source.value\n // which another effect's recompute may have already updated)\n const cachedValues = (node as any)._lastSeen as Map<unknown, unknown> | undefined;\n if (cachedValues?.has(source)) {\n const lastSeen = cachedValues.get(source);\n if (!source.equals(lastSeen as never, source.value as never)) {\n anyChanged = true;\n }\n } else {\n // No cached value — first dirty check after creation. Always run.\n anyChanged = true;\n }\n } else {\n // Plain signal source — if we got scheduled, something changed\n anyChanged = true;\n }\n }\n if (!anyChanged) return;\n }\n\n // Clean up previous run\n cleanupEffect(node);\n\n // Save old sources in case the effect throws — we need to re-subscribe\n const prevSources = new Set(node.sources);\n\n // Clean up old source subscriptions\n for (const source of node.sources) {\n source.subscribers.delete(node);\n }\n node.sources.clear();\n\n const prevSubscriber = currentSubscriber;\n currentSubscriber = node;\n const _t0 = isProfiling() ? performance.now() : 0;\n\n try {\n const result = node.fn();\n if (typeof result === 'function') {\n node.cleanup = result;\n }\n } catch (err) {\n // Re-subscribe to previous sources so the effect can recover on next change\n for (const source of prevSources) {\n source.subscribers.add(node);\n node.sources.add(source);\n }\n console.error('[AkashJS] Error in effect (will retry on next signal change):', err);\n } finally {\n if (_t0) recordPerfEntry('effect', 'effect', performance.now() - _t0);\n currentSubscriber = prevSubscriber;\n\n // Cache computed values so the next dirty check compares against THIS effect's\n // last-seen values, not the shared source.value (which another effect may update)\n const lastSeen = new Map();\n for (const source of node.sources) {\n if ('_tag' in source && source._tag === 'computed') {\n lastSeen.set(source, source.value);\n }\n }\n if (lastSeen.size > 0) (node as any)._lastSeen = lastSeen;\n }\n}\n\nfunction cleanupEffect(node: EffectNode): void {\n if (node.cleanup) {\n try {\n node.cleanup();\n } catch (err) {\n console.error('[AkashJS] Error in effect cleanup (ignored):', err);\n }\n node.cleanup = null;\n }\n}\n\n// --- Untrack ---\n\n/** Execute a function without tracking any signal reads */\nexport function untrack<T>(fn: () => T): T {\n const prev = currentSubscriber;\n currentSubscriber = null;\n try {\n return fn();\n } finally {\n currentSubscriber = prev;\n }\n}\n\n// --- on() helper ---\n\n/**\n * Create an effect callback that only tracks specific signals.\n * All other signal reads inside the callback are untracked.\n *\n * ```ts\n * effect(on(url, (currentUrl, prevUrl) => {\n * fetch(currentUrl, options()); // options() not tracked\n * }));\n *\n * effect(on([url, page], ([u, p], prev) => {\n * fetch(`${u}?page=${p}`);\n * }));\n * ```\n */\nexport function on<T>(\n dep: () => T,\n fn: (value: T, prev: T | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on<T extends readonly (() => unknown)[]>(\n deps: [...T],\n fn: (values: { [K in keyof T]: ReturnType<T[K]> }, prev: { [K in keyof T]: ReturnType<T[K]> } | undefined) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void);\nexport function on(\n deps: (() => any) | (() => any)[],\n fn: (values: any, prev: any) => void | (() => void),\n options?: { defer?: boolean },\n): () => void | (() => void) {\n const isArray = Array.isArray(deps);\n const depArray = isArray ? deps : [deps];\n let prevValues: unknown[] | undefined;\n let isFirst = true;\n\n return () => {\n // Track only the specified deps\n const values = depArray.map(d => d());\n\n // Skip the initial effect run — only fire on actual changes\n // (pass { defer: false } to opt out and run immediately)\n if (isFirst) {\n isFirst = false;\n prevValues = values.slice();\n if (options?.defer !== false) return;\n }\n\n const prev = prevValues;\n prevValues = values.slice();\n\n // Run fn without tracking so reads inside don't create subscriptions\n return untrack(() => fn(\n isArray ? values : values[0],\n prev ? (isArray ? prev : prev[0]) : undefined,\n ));\n };\n}\n\n// --- Internal helpers ---\n\nfunction trackSubscriber(\n node: SignalNode<any> | ComputedNode<any>,\n): void {\n if (currentSubscriber) {\n node.subscribers.add(currentSubscriber);\n\n if ('sources' in currentSubscriber) {\n currentSubscriber.sources.add(node);\n }\n }\n}\n\nfunction notifySubscribers(\n node: SignalNode<any> | ComputedNode<any>,\n): void {\n // Snapshot subscribers before iterating. Effects that run synchronously\n // during flush() will delete and re-add themselves to the Set, and JS\n // Set iterators visit newly added entries — causing an infinite loop\n // without the snapshot.\n const subs = [...node.subscribers];\n for (const sub of subs) {\n if (sub._tag === 'computed') {\n // Mark dirty. The computed will re-evaluate lazily when read.\n sub.state = ComputedState.Dirty;\n // Propagate through the computed chain to reach effects.\n // The effects will re-read the computed, triggering recompute,\n // and only update DOM if the value actually changed.\n notifySubscribers(sub);\n } else if (sub._tag === 'effect') {\n scheduleEffect(sub);\n }\n }\n}\n"]}
|
package/dist/chunk-FTTNKDZQ.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {n,o}from'./chunk-3GRR4VW2.js';var w={AK0010:{code:"AK0010",message:"provide() called outside of component setup.",hint:"provide() must be called inside defineComponent()."},AK0012:{code:"AK0012",message:"inject() called outside of component setup.",hint:"inject() must be called inside defineComponent()."},AK0013:{code:"AK0013",message:"No provider found for injected context.",hint:"Make sure an ancestor component calls provide() with this key."},AK0020:{code:"AK0020",message:"onMount() called outside of component setup.",hint:"onMount() must be called inside defineComponent()."},AK0021:{code:"AK0021",message:"onUnmount() called outside of component setup.",hint:"onUnmount() must be called inside defineComponent()."},AK0022:{code:"AK0022",message:"onError() called outside of component setup.",hint:"onError() must be called inside defineComponent()."},AK0030:{code:"AK0030",message:"Circular dependency detected in computed signal.",hint:"A computed signal is reading itself, directly or via other computeds."},AK0031:{code:"AK0031",message:"Signal set() called during computation.",hint:"Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers."},AK0040:{code:"AK0040",message:"Component setup must return a render function.",hint:"The function passed to defineComponent() must return () => AkashNode."},AK0041:{code:"AK0041",message:"Required prop is missing.",hint:"Check that the parent component is passing all required props."},AK0050:{code:"AK0050",message:"useRoute() called outside of router context.",hint:"Make sure your component is rendered inside a router provider."},AK0051:{code:"AK0051",message:"No route matched the current URL.",hint:"Add a catch-all route ([...rest]) to handle unmatched paths."},AK0052:{code:"AK0052",message:"Route guard threw an error.",hint:"Check the guard function for unhandled exceptions."},AK0060:{code:"AK0060",message:"Form submitted while invalid.",hint:"The submit handler was not called because validation failed. Check form.errors()."},AK0061:{code:"AK0061",message:"Async validator timed out.",hint:"The async validator did not resolve within the expected time. Check your async validation logic."},AK0070:{code:"AK0070",message:"HTTP request failed.",hint:"Check the server response status and network connectivity."},AK0071:{code:"AK0071",message:"createResource() fetcher threw an error.",hint:"Check the fetcher function passed to createResource()."}},P="https://akashjs.dev/errors";function R(e,n){let o=w[e];if(!o)return `[AkashJS ${e}] Unknown error code.`;let s=`[AkashJS ${e}] ${o.message}`;return n&&(s+=`
|
|
2
|
-
${n}`),s+=`
|
|
3
|
-
${o.hint}`,s+=`
|
|
4
|
-
See: ${P}/${e}`,s}function T(e,n){return new Error(R(e,n))}function F(e){return w[e]}function _(){return Object.keys(w)}var D=Symbol("akash.context"),m=null;function S(e=m){let n={values:new Map,parent:e};return m=n,n}function K(e){m=e.parent;}function C(){return m}function v(e,n){let o=m;m=e;try{return n()}finally{m=o;}}function O(e){return {[D]:true,_type:void 0,defaultValue:e,id:Symbol("context")}}function $(e,n){if(!m)throw T("AK0010");m.values.set(e.id,n);}function U(e,n){if(!m)throw T("AK0012");let o=m;for(;o;){if(o.values.has(e.id))return o.values.get(e.id);o=o.parent;}if(n!==void 0)return n;if(e.defaultValue!==void 0)return e.defaultValue;throw T("AK0013")}function W(e,n){let o=document.createElement(e);if(n)for(let[s,a]of Object.entries(n))b(o,s,a);return o}function X(e){return document.createTextNode(e)}function G(e){let n=document.createElement("template");return n.innerHTML=e,n.content.cloneNode(true)}function b(e,n,o){if(n==="class"||n==="className")e.className=o;else if(n==="style"&&typeof o=="object"&&o!==null)Object.assign(e.style,o);else if(n==="innerHTML")e.innerHTML=o;else if(n!=="ref")if(n.startsWith("on")){let s=n.slice(2).toLowerCase();e.addEventListener(s,o);}else n in e?e[n]=o:o===false||o==null?e.removeAttribute(n):e.setAttribute(n,o===true?"":String(o));}function Y(e,n$1){return n(()=>{e.textContent=String(n$1());},{render:true})}function z(e,n$1,o){return n(()=>{b(e,n$1,o());},{render:true})}function Q(e,n$1){return n(()=>{e.style.display=n$1()?"":"none";},{render:true})}function L(e=""){return document.createComment(e)}function j(e,n$1,o,s,a){let i=null,g=C(),y=n(()=>{let c=o();if(i){for(let f of i.nodes)try{f.parentNode?.removeChild(f);}catch{}i.dispose?.(),i=null;}let d=c?s:a,p=n$1.parentNode;if(!p&&i?.nodes[0]?.parentNode&&(p=i.nodes[0].parentNode),d&&p){let f=g?v(g,d):d(),t=f instanceof DocumentFragment?Array.from(f.childNodes):[f];for(let r of t)p.insertBefore(r,n$1);i={nodes:t,dispose:null};}},{render:true});return ()=>{if(y(),i){for(let c of i.nodes)try{c.parentNode?.removeChild(c);}catch{}i.dispose?.();}}}function H(e,n$1,o,s,a){let i=[],g=C(),y=n(()=>{let c=o(),d=[],p=new Map;for(let t of i)p.set(t.key,t);for(let t=0;t<c.length;t++){let r=c[t],u=s(r,t),l=p.get(u);if(l){p.delete(u);let A=l.nodes[0];if(A&&!A.parentNode){let k=g?v(g,()=>a(r,t)):a(r,t),M=k instanceof DocumentFragment?Array.from(k.childNodes):[k];d.push({key:u,value:r,nodes:M,dispose:null});}else l.value=r,d.push(l);}else {let A=g?v(g,()=>a(r,t)):a(r,t),k=A instanceof DocumentFragment?Array.from(A.childNodes):[A];d.push({key:u,value:r,nodes:k,dispose:null});}}for(let t of p.values()){for(let r of t.nodes)r.parentNode&&r.parentNode.removeChild(r);t.dispose?.();}let f=n$1.parentNode;if(f)for(let t of d)for(let r of t.nodes)f.insertBefore(r,n$1);else {let t=null;for(let r of i)if(r.nodes[0]?.parentNode){t=r.nodes[0].parentNode;break}if(t)for(let r of d)for(let u of r.nodes)t.appendChild(u);}i=d;},{render:true});return ()=>{y();for(let c of i){for(let d of c.nodes)d.parentNode&&d.parentNode.removeChild(d);c.dispose?.();}i=[];}}function Z(e){let n=L("show"),o=document.createDocumentFragment();o.appendChild(n);let s=typeof e.when=="function"?e.when:()=>e.when,a;return j(o,n,()=>(a=s(),!!a),()=>x(e.children(a)),e.fallback?()=>x(e.fallback()):void 0),o}function ee(e){let n=L("for"),o=document.createDocumentFragment();o.appendChild(n);let s=typeof e.each=="function"?e.each:()=>e.each;return H(o,n,s,e.key,(a,i)=>x(e.children(a,i))),o}function x(e){if(e==null||typeof e=="boolean")return document.createTextNode("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(e instanceof Node)return e;if(Array.isArray(e)){let n=document.createDocumentFragment();for(let o of e)n.appendChild(x(o));return n}return document.createTextNode(String(e))}function ne(e,n,o){let s=x(n);o?e.insertBefore(s,o):e.appendChild(s);}function de(e){return e.__reactive=true,e}var h=null;function ae(e){if(!h)throw T("AK0020");h.mount.push(e);}function ue(e){if(!h)throw T("AK0021");h.unmount.push(e);}function le(e){if(!h)throw T("AK0022");h.error.push(e);}function fe(e){return {current:e}}function pe(e){let n=o$1=>{let{children:s,...a}=o$1??{},y={props:a,children:typeof s=="function"?s:()=>s??null},c={mount:[],unmount:[],error:[]},d=h;h=c;let p=C(),f=S(p),t,r;try{r=o(()=>{if(t=e(y),typeof t!="function")throw T("AK0040");let u=t();return x(u)});}catch(u){if(K(f),h=d,c.error.length>0){for(let l of c.error)l(u instanceof Error?u:new Error(String(u)));return document.createComment("error")}throw u}return K(f),h=d,c.mount.length>0&&queueMicrotask(()=>{for(let u of c.mount)try{let l=u();typeof l=="function"&&c.unmount.push(l);}catch(l){for(let A of c.error)A(l instanceof Error?l:new Error(String(l)));}}),r};return n._akash=true,n}export{fe as A,pe as B,R as a,T as b,F as c,_ as d,C as e,v as f,O as g,$ as h,U as i,W as j,X as k,G as l,b as m,Y as n,z as o,Q as p,j as q,H as r,Z as s,ee as t,x as u,ne as v,de as w,ae as x,ue as y,le as z};//# sourceMappingURL=chunk-FTTNKDZQ.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-FTTNKDZQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/context.ts","../src/dom.ts","../src/component.ts"],"names":["errors","DOC_BASE","formatError","code","context","def","msg","akashError","getErrorDef","getAllErrorCodes","CONTEXT_BRAND","currentScope","pushScope","parent","scope","popScope","getCurrentScope","runInScope","fn","prev","createContext","defaultValue","provide","key","value","inject","fallback","createElement","tag","attrs","el","setProperty","createText","cloneTemplate","html","template","event","bindText","node","effect","bindProperty","bindVisible","createAnchor","label","renderConditional","anchor","condition","trueBranch","falseBranch","current","dispose","branch","liveParent","fragment","nodes","renderList","items","keyFn","renderItem","currentItems","newData","newItems","oldMap","item","i","data","existing","firstNode","realParent","Show","props","container","getWhen","whenValue","nodeToDOM","For","getEach","index","child","insert","domNode","__getter","currentHooks","onMount","onUnmount","onError","ref","initialValue","defineComponent","setup","component","rawProps","childrenProp","restProps","ctx","hooks","prevHooks","parentScope","renderFn","untrack","rendered","err","handler","mountFn","cleanup"],"mappings":"sCAqBA,IAAMA,EAAmC,CAEvC,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,8CAAA,CACT,IAAA,CAAM,oDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,6CAAA,CACT,IAAA,CAAM,mDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,yCAAA,CACT,IAAA,CAAM,gEACR,CAAA,CAGA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,8CAAA,CACT,IAAA,CAAM,oDACR,CAAA,CACA,MAAA,CAAQ,CACN,IAAA,CAAM,QAAA,CACN,QAAS,gDAAA,CACT,IAAA,CAAM,sDACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,8CAAA,CACT,KAAM,oDACR,CAAA,CAGA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,kDAAA,CACT,KAAM,uEACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,yCAAA,CACT,KAAM,gHACR,CAAA,CAGA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,gDAAA,CACT,KAAM,uEACR,CAAA,CACA,OAAQ,CACN,IAAA,CAAM,SACN,OAAA,CAAS,2BAAA,CACT,KAAM,gEACR,CAAA,CAGA,MAAA,CAAQ,CACN,KAAM,QAAA,CACN,OAAA,CAAS,+CACT,IAAA,CAAM,gEACR,EACA,MAAA,CAAQ,CACN,KAAM,QAAA,CACN,OAAA,CAAS,oCACT,IAAA,CAAM,8DACR,EACA,MAAA,CAAQ,CACN,KAAM,QAAA,CACN,OAAA,CAAS,8BACT,IAAA,CAAM,oDACR,EAGA,MAAA,CAAQ,CACN,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AK,CAGZ,GAFAtF,EAASD,CAAK,CAAA,CACdoE,CAAAA,CAAec,CAAAA,CACXD,EAAM,KAAA,CAAM,MAAA,CAAS,CAAA,CAAG,CAC1B,QAAWO,CAAAA,IAAWP,CAAAA,CAAM,KAAA,CAC1BO,CAAAA,CAAQD,aAAe,KAAA,CAAQA,CAAAA,CAAM,IAAI,KAAA,CAAM,OAAOA,CAAG,CAAC,CAAC,CAAA,CAE7D,OAAO,QAAA,CAAS,aAAA,CAAc,OAAO,CACvC,CACA,MAAMA,CACR,CAGA,OAAAtF,EAASD,CAAK,CAAA,CACdoE,CAAAA,CAAec,CAAAA,CAGXD,EAAM,KAAA,CAAM,MAAA,CAAS,CAAA,EACvB,cAAA,CAAe,IAAM,CACnB,IAAA,IAAWQ,CAAAA,IAAWR,CAAAA,CAAM,MAC1B,GAAI,CACF,IAAMS,CAAAA,CAAUD,GAAQ,CACpB,OAAOC,CAAAA,EAAY,UAAA,EACrBT,EAAM,OAAA,CAAQ,IAAA,CAAKS,CAAO,EAE9B,OAASH,CAAAA,CAAK,CACZ,IAAA,IAAWC,CAAAA,IAAWP,EAAM,KAAA,CAC1BO,CAAAA,CAAQD,CAAAA,YAAe,KAAA,CAAQA,EAAM,IAAI,KAAA,CAAM,MAAA,CAAOA,CAAG,CAAC,CAAC,EAE/D,CAEJ,CAAC,EAGIrB,CACT,CAAA,CAEA,OAAAU,CAAAA,CAAU,MAAA,CAAS,KACZA,CACT","file":"chunk-FTTNKDZQ.js","sourcesContent":["/**\n * Error message catalog.\n *\n * Every AkashJS runtime error has a unique code (AK0001, AK0002, etc.),\n * a one-line description, and a link to detailed documentation.\n *\n * Usage:\n * throw akashError('AK0010', 'provide()');\n */\n\n// --- Error registry ---\n\nexport interface ErrorDef {\n /** Error code */\n code: string;\n /** Short description */\n message: string;\n /** Extended explanation and fix suggestion */\n hint: string;\n}\n\nconst errors: Record<string, ErrorDef> = {\n // --- Context errors (AK001x) ---\n AK0010: {\n code: 'AK0010',\n message: 'provide() called outside of component setup.',\n hint: 'provide() must be called inside defineComponent().',\n },\n AK0012: {\n code: 'AK0012',\n message: 'inject() called outside of component setup.',\n hint: 'inject() must be called inside defineComponent().',\n },\n AK0013: {\n code: 'AK0013',\n message: 'No provider found for injected context.',\n hint: 'Make sure an ancestor component calls provide() with this key.',\n },\n\n // --- Lifecycle errors (AK002x) ---\n AK0020: {\n code: 'AK0020',\n message: 'onMount() called outside of component setup.',\n hint: 'onMount() must be called inside defineComponent().',\n },\n AK0021: {\n code: 'AK0021',\n message: 'onUnmount() called outside of component setup.',\n hint: 'onUnmount() must be called inside defineComponent().',\n },\n AK0022: {\n code: 'AK0022',\n message: 'onError() called outside of component setup.',\n hint: 'onError() must be called inside defineComponent().',\n },\n\n // --- Signal errors (AK003x) ---\n AK0030: {\n code: 'AK0030',\n message: 'Circular dependency detected in computed signal.',\n hint: 'A computed signal is reading itself, directly or via other computeds.',\n },\n AK0031: {\n code: 'AK0031',\n message: 'Signal set() called during computation.',\n hint: 'Do not set signals inside computed() or during effect execution. Use batch() or set signals in event handlers.',\n },\n\n // --- Component errors (AK004x) ---\n AK0040: {\n code: 'AK0040',\n message: 'Component setup must return a render function.',\n hint: 'The function passed to defineComponent() must return () => AkashNode.',\n },\n AK0041: {\n code: 'AK0041',\n message: 'Required prop is missing.',\n hint: 'Check that the parent component is passing all required props.',\n },\n\n // --- Router errors (AK005x) ---\n AK0050: {\n code: 'AK0050',\n message: 'useRoute() called outside of router context.',\n hint: 'Make sure your component is rendered inside a router provider.',\n },\n AK0051: {\n code: 'AK0051',\n message: 'No route matched the current URL.',\n hint: 'Add a catch-all route ([...rest]) to handle unmatched paths.',\n },\n AK0052: {\n code: 'AK0052',\n message: 'Route guard threw an error.',\n hint: 'Check the guard function for unhandled exceptions.',\n },\n\n // --- Form errors (AK006x) ---\n AK0060: {\n code: 'AK0060',\n message: 'Form submitted while invalid.',\n hint: 'The submit handler was not called because validation failed. Check form.errors().',\n },\n AK0061: {\n code: 'AK0061',\n message: 'Async validator timed out.',\n hint: 'The async validator did not resolve within the expected time. Check your async validation logic.',\n },\n\n // --- HTTP errors (AK007x) ---\n AK0070: {\n code: 'AK0070',\n message: 'HTTP request failed.',\n hint: 'Check the server response status and network connectivity.',\n },\n AK0071: {\n code: 'AK0071',\n message: 'createResource() fetcher threw an error.',\n hint: 'Check the fetcher function passed to createResource().',\n },\n};\n\n// --- Public API ---\n\nconst DOC_BASE = 'https://akashjs.dev/errors';\n\n/**\n * Format an AkashJS error with code, message, hint, and doc link.\n */\nexport function formatError(code: string, context?: string): string {\n const def = errors[code];\n if (!def) {\n return `[AkashJS ${code}] Unknown error code.`;\n }\n\n let msg = `[AkashJS ${code}] ${def.message}`;\n if (context) {\n msg += `\\n ${context}`;\n }\n msg += `\\n ${def.hint}`;\n msg += `\\n See: ${DOC_BASE}/${code}`;\n return msg;\n}\n\n/**\n * Create and throw an AkashJS error.\n */\nexport function akashError(code: string, context?: string): Error {\n return new Error(formatError(code, context));\n}\n\n/**\n * Get the error definition for a code.\n */\nexport function getErrorDef(code: string): ErrorDef | undefined {\n return errors[code];\n}\n\n/**\n * Get all registered error codes.\n */\nexport function getAllErrorCodes(): string[] {\n return Object.keys(errors);\n}\n","/**\n * Lightweight dependency injection via provide/inject.\n *\n * Context is scoped to the component tree — no injector hierarchy,\n * no decorators, no classes. Just createContext(), provide(), inject().\n */\n\n// --- Types ---\n\nimport { akashError } from './errors.js';\n\nconst CONTEXT_BRAND = Symbol('akash.context');\n\nexport interface InjectionKey<T> {\n readonly [CONTEXT_BRAND]: true;\n readonly _type: T; // phantom type — never used at runtime\n readonly defaultValue: T | undefined;\n readonly id: symbol;\n}\n\n// --- Context stack (managed by component system) ---\n\ninterface ContextScope {\n values: Map<symbol, unknown>;\n parent: ContextScope | null;\n}\n\nlet currentScope: ContextScope | null = null;\n\n/** @internal — called by defineComponent to push/pop context scopes */\nexport function pushScope(parent: ContextScope | null = currentScope): ContextScope {\n const scope: ContextScope = { values: new Map(), parent };\n currentScope = scope;\n return scope;\n}\n\n/** @internal */\nexport function popScope(scope: ContextScope): void {\n currentScope = scope.parent;\n}\n\n/** @internal */\nexport function getCurrentScope(): ContextScope | null {\n return currentScope;\n}\n\n/**\n * Run a function within a given scope so that provide/inject\n * work correctly for components created asynchronously\n * (e.g., lazy-loaded route components).\n */\nexport function runInScope<T>(scope: ContextScope, fn: () => T): T {\n const prev = currentScope;\n currentScope = scope;\n try {\n return fn();\n } finally {\n currentScope = prev;\n }\n}\n\n// --- Public API ---\n\n/**\n * Create a typed context key with an optional default value.\n *\n * ```ts\n * const ThemeContext = createContext<'light' | 'dark'>('light');\n * ```\n */\nexport function createContext<T>(defaultValue?: T): InjectionKey<T> {\n return {\n [CONTEXT_BRAND]: true,\n _type: undefined as T,\n defaultValue,\n id: Symbol('context'),\n };\n}\n\n/**\n * Provide a value for a context key in the current component scope.\n * All descendant components can inject() this value.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function provide<T>(key: InjectionKey<T>, value: T): void {\n if (!currentScope) {\n throw akashError('AK0010');\n }\n currentScope.values.set(key.id, value);\n}\n\n/**\n * Inject a value from the nearest ancestor that provided it.\n *\n * Must be called inside defineComponent() setup.\n */\nexport function inject<T>(key: InjectionKey<T>): T;\nexport function inject<T>(key: InjectionKey<T>, fallback: T): T;\nexport function inject<T>(key: InjectionKey<T>, fallback?: T): T {\n if (!currentScope) {\n throw akashError('AK0012');\n }\n\n // Walk up the scope chain\n let scope: ContextScope | null = currentScope;\n while (scope) {\n if (scope.values.has(key.id)) {\n return scope.values.get(key.id) as T;\n }\n scope = scope.parent;\n }\n\n // Check fallback, then default\n if (fallback !== undefined) return fallback;\n if (key.defaultValue !== undefined) return key.defaultValue;\n\n throw akashError('AK0013');\n}\n","/**\n * Direct DOM rendering runtime.\n *\n * No virtual DOM. The compiler generates calls to these helpers.\n * Signal reads inside templates become fine-grained effects that\n * update only the specific DOM node that changed.\n */\n\nimport { effect } from './signals.js';\nimport { getCurrentScope, runInScope } from './context.js';\nimport type { AkashNode } from './types.js';\n\n// --- DOM creation helpers (used by compiler output) ---\n\n/** Create an element and optionally set static attributes */\nexport function createElement(\n tag: string,\n attrs?: Record<string, unknown>,\n): HTMLElement {\n const el = document.createElement(tag);\n if (attrs) {\n for (const [key, value] of Object.entries(attrs)) {\n setProperty(el, key, value);\n }\n }\n return el;\n}\n\n/** Create a text node */\nexport function createText(value: string): Text {\n return document.createTextNode(value);\n}\n\n/** Clone a template element for static structure */\nexport function cloneTemplate(html: string): DocumentFragment {\n const template = document.createElement('template');\n template.innerHTML = html;\n return template.content.cloneNode(true) as DocumentFragment;\n}\n\n// --- Property/attribute setting ---\n\nexport function setProperty(el: HTMLElement, key: string, value: unknown): void {\n if (key === 'class' || key === 'className') {\n el.className = value as string;\n } else if (key === 'style' && typeof value === 'object' && value !== null) {\n Object.assign(el.style, value);\n } else if (key === 'innerHTML') {\n el.innerHTML = value as string;\n } else if (key === 'ref') {\n // Handled separately by component system\n } else if (key.startsWith('on')) {\n const event = key.slice(2).toLowerCase();\n el.addEventListener(event, value as EventListener);\n } else if (key in el) {\n (el as unknown as Record<string, unknown>)[key] = value;\n } else if (value === false || value == null) {\n el.removeAttribute(key);\n } else {\n el.setAttribute(key, value === true ? '' : String(value));\n }\n}\n\n// --- Reactive binding (used by compiler for dynamic expressions) ---\n\n/** Bind a reactive expression to a text node's content */\nexport function bindText(node: Text, fn: () => unknown): () => void {\n return effect(\n () => {\n node.textContent = String(fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's attribute/property */\nexport function bindProperty(\n el: HTMLElement,\n key: string,\n fn: () => unknown,\n): () => void {\n return effect(\n () => {\n setProperty(el, key, fn());\n },\n { render: true },\n );\n}\n\n/** Bind a reactive expression to an element's visibility (display) */\nexport function bindVisible(el: HTMLElement, fn: () => boolean): () => void {\n return effect(\n () => {\n el.style.display = fn() ? '' : 'none';\n },\n { render: true },\n );\n}\n\n// --- Conditional rendering ---\n\n/** Anchor node — comment for normal DOM, hidden element for table contexts */\ntype Anchor = Comment | HTMLElement;\n\n/** Table elements where comment nodes get relocated by the browser */\nconst TABLE_TAGS = new Set(['TABLE', 'THEAD', 'TBODY', 'TFOOT', 'TR']);\n\nfunction createAnchor(label = ''): Anchor {\n return document.createComment(label);\n}\n\n/**\n * Create a table-safe anchor. Browsers relocate comment nodes inside\n * table elements, breaking anchor-based insertion. Use a hidden element instead.\n */\nfunction createTableSafeAnchor(parent: Node): Anchor {\n if (parent instanceof HTMLElement && TABLE_TAGS.has(parent.tagName)) {\n const tag = parent.tagName === 'TR' ? 'td' : 'tr';\n const el = document.createElement(tag);\n el.style.display = 'none';\n return el;\n }\n return document.createComment('');\n}\n\ninterface ConditionalBlock {\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a conditional block. Swaps DOM fragments based on a reactive\n * condition. Used by the compiler for :if directives and <Show>.\n */\nexport function renderConditional(\n parent: Node,\n anchor: Node,\n condition: () => boolean,\n trueBranch: () => Node,\n falseBranch?: () => Node,\n): () => void {\n let current: ConditionalBlock | null = null;\n\n // Capture scope so children created in branches inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const value = condition();\n\n // Remove old nodes\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n current = null;\n }\n\n // Insert new nodes — use anchor.parentNode since the anchor may have\n // moved from the initial DocumentFragment into the real DOM.\n // In table contexts, the browser may relocate comment anchors.\n const branch = value ? trueBranch : falseBranch;\n let liveParent: Node | null = anchor.parentNode;\n if (!liveParent && (current as ConditionalBlock | null)?.nodes[0]?.parentNode) {\n liveParent = (current as ConditionalBlock | null)!.nodes[0].parentNode;\n }\n if (branch && liveParent) {\n const fragment = scope ? runInScope(scope, branch) : branch();\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n for (const node of nodes) {\n liveParent.insertBefore(node, anchor);\n }\n current = { nodes, dispose: null };\n }\n },\n { render: true },\n );\n\n return () => {\n dispose();\n if (current) {\n for (const node of current.nodes) {\n try { node.parentNode?.removeChild(node); } catch {}\n }\n current.dispose?.();\n }\n };\n}\n\n// --- List rendering ---\n\ninterface ListItem<T> {\n key: unknown;\n value: T;\n nodes: Node[];\n dispose: (() => void) | null;\n}\n\n/**\n * Render a reactive list with keyed reconciliation.\n * Used by the compiler for :for directives and <For>.\n */\nexport function renderList<T>(\n parent: Node,\n anchor: Node,\n items: () => T[],\n keyFn: (item: T, index: number) => unknown,\n renderItem: (item: T, index: number) => Node,\n): () => void {\n let currentItems: ListItem<T>[] = [];\n\n // Capture scope so children created in renderItem inherit provide/inject context\n const scope = getCurrentScope();\n\n const dispose = effect(\n () => {\n const newData = items();\n const newItems: ListItem<T>[] = [];\n const oldMap = new Map<unknown, ListItem<T>>();\n\n for (const item of currentItems) {\n oldMap.set(item.key, item);\n }\n\n // Build new list, reuse existing DOM nodes when keys match\n for (let i = 0; i < newData.length; i++) {\n const data = newData[i];\n const key = keyFn(data, i);\n const existing = oldMap.get(key);\n\n if (existing) {\n oldMap.delete(key);\n // If the reused item's nodes were detached (e.g., parent removed them),\n // treat as new to avoid stale DOM references\n const firstNode = existing.nodes[0];\n if (firstNode && !firstNode.parentNode) {\n // Nodes were detached — create fresh\n const fragment = scope ? runInScope(scope, () => renderItem(data, i)) : renderItem(data, i);\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n newItems.push({ key, value: data, nodes, dispose: null });\n } else {\n existing.value = data;\n newItems.push(existing);\n }\n } else {\n const fragment = scope ? runInScope(scope, () => renderItem(data, i)) : renderItem(data, i);\n const nodes = fragment instanceof DocumentFragment\n ? Array.from(fragment.childNodes)\n : [fragment];\n newItems.push({ key, value: data, nodes, dispose: null });\n }\n }\n\n // Remove items that are no longer in the list\n for (const item of oldMap.values()) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n\n // Reconcile DOM order — insertBefore moves existing nodes, inserts new ones\n const liveParent = anchor.parentNode;\n if (liveParent) {\n // Normal path — anchor is in the DOM, insert before it\n for (const item of newItems) {\n for (const node of item.nodes) {\n liveParent.insertBefore(node, anchor);\n }\n }\n } else {\n // Table fallback — browser relocated the comment anchor.\n // Find the real parent from any node still in the DOM.\n let realParent: Node | null = null;\n for (const item of currentItems) {\n if (item.nodes[0]?.parentNode) { realParent = item.nodes[0].parentNode; break; }\n }\n if (realParent) {\n // Remove old nodes first (oldMap items already removed above)\n // Then append all new items\n for (const item of newItems) {\n for (const node of item.nodes) {\n realParent.appendChild(node);\n }\n }\n }\n }\n\n currentItems = newItems;\n },\n { render: true },\n );\n\n return () => {\n dispose();\n for (const item of currentItems) {\n for (const node of item.nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n item.dispose?.();\n }\n currentItems = [];\n };\n}\n\n// --- Built-in control flow components ---\n\n/** Props for the <Show> component */\nexport interface ShowProps<T> {\n when: (() => T | null | undefined | false) | T | null | undefined | false;\n fallback?: () => AkashNode;\n children: (value: T) => AkashNode;\n}\n\n/**\n * <Show> component — conditionally renders children with type narrowing.\n * The children callback receives the non-null/undefined value.\n * `when` can be a reactive getter or a static value.\n */\nexport function Show<T>(props: ShowProps<T>): Node {\n const anchor = createAnchor('show');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve when — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getWhen = typeof props.when === 'function'\n ? props.when as () => T | null | undefined | false\n : () => props.when as T | null | undefined | false;\n\n // Capture the when value once per evaluation so the condition check\n // and the children callback receive the same value (fixes nested For contexts)\n let whenValue: T | null | undefined | false;\n renderConditional(\n container,\n anchor,\n () => { whenValue = getWhen(); return !!whenValue; },\n () => nodeToDOM(props.children(whenValue as T)),\n props.fallback ? () => nodeToDOM(props.fallback!()) : undefined,\n );\n\n return container;\n}\n\n/** Props for the <For> component */\nexport interface ForProps<T> {\n each: (() => T[]) | T[];\n key: (item: T) => unknown;\n children: (item: T, index: number) => AkashNode;\n}\n\n/**\n * <For> component — renders a list with keyed reconciliation.\n * `each` can be a reactive getter or a static array.\n */\nexport function For<T>(props: ForProps<T>): Node {\n const anchor = createAnchor('for');\n const container = document.createDocumentFragment();\n container.appendChild(anchor);\n\n // Resolve each — if it's a function, always call it (supports both\n // compiler-generated __reactive getters and plain programmatic functions)\n const getEach = typeof props.each === 'function'\n ? props.each as () => T[]\n : () => props.each as T[];\n\n renderList(\n container,\n anchor,\n getEach,\n props.key,\n (item, index) => nodeToDOM(props.children(item, index)),\n );\n\n return container;\n}\n\n// --- Helpers ---\n\n/** Convert an AkashNode to a DOM Node */\nexport function nodeToDOM(node: AkashNode): Node {\n if (node == null || typeof node === 'boolean') {\n return document.createTextNode('');\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return document.createTextNode(String(node));\n }\n if (node instanceof Node) {\n return node;\n }\n if (Array.isArray(node)) {\n const fragment = document.createDocumentFragment();\n for (const child of node) {\n fragment.appendChild(nodeToDOM(child));\n }\n return fragment;\n }\n return document.createTextNode(String(node));\n}\n\n/** Insert a node into a parent before an anchor */\nexport function insert(parent: Node, node: AkashNode, anchor?: Node): void {\n const domNode = nodeToDOM(node);\n if (anchor) {\n parent.insertBefore(domNode, anchor);\n } else {\n parent.appendChild(domNode);\n }\n}\n","/**\n * Component system.\n *\n * Components are functions. defineComponent() wraps a setup function\n * that runs once, establishes signals and effects, and returns a\n * render function that produces DOM nodes.\n */\n\nimport { effect, untrack } from './signals.js';\nimport { pushScope, popScope, getCurrentScope } from './context.js';\nimport { nodeToDOM } from './dom.js';\nimport { akashError } from './errors.js';\nimport type { AkashNode } from './types.js';\n\n// --- Reactive getter marker (used by compiler) ---\n\n/** Mark a function as a compiler-generated reactive getter */\nexport function __getter<T>(fn: () => T): (() => T) & { __reactive: true } {\n (fn as any).__reactive = true;\n return fn as any;\n}\n\n// --- Types ---\n\nexport interface Ref<T = HTMLElement> {\n current: T | undefined;\n}\n\nexport interface ComponentContext<P extends Record<string, unknown> = Record<string, unknown>> {\n props: Readonly<P>;\n children: () => AkashNode;\n}\n\nexport type Component<P extends Record<string, unknown> = Record<string, unknown>> = {\n (props: P & { children?: AkashNode | (() => AkashNode) }): Node;\n _akash: true;\n};\n\n// --- Lifecycle hook storage ---\n\ninterface LifecycleHooks {\n mount: Array<() => void | (() => void)>;\n unmount: Array<() => void>;\n error: Array<(error: Error) => void>;\n}\n\nlet currentHooks: LifecycleHooks | null = null;\n\n// --- Public lifecycle hooks ---\n\n/**\n * Register a callback to run after the component is mounted to the DOM.\n * If the callback returns a function, it will be called on unmount (cleanup).\n */\nexport function onMount(fn: () => void | (() => void)): void {\n if (!currentHooks) {\n throw akashError('AK0020');\n }\n currentHooks.mount.push(fn);\n}\n\n/**\n * Register a callback to run before the component is unmounted.\n */\nexport function onUnmount(fn: () => void): void {\n if (!currentHooks) {\n throw akashError('AK0021');\n }\n currentHooks.unmount.push(fn);\n}\n\n/**\n * Register an error handler for this component and its descendants.\n */\nexport function onError(fn: (error: Error) => void): void {\n if (!currentHooks) {\n throw akashError('AK0022');\n }\n currentHooks.error.push(fn);\n}\n\n/**\n * Create a ref for accessing a DOM element or storing a mutable value.\n */\nexport function ref<T = HTMLElement>(initialValue?: T): Ref<T> {\n return { current: initialValue as T | undefined };\n}\n\n// --- defineComponent ---\n\n/**\n * Define a component. The setup function runs once per instance.\n * It receives a context with typed props and must return a render function.\n *\n * ```ts\n * const Counter = defineComponent<{ initial: number }>((ctx) => {\n * const count = signal(ctx.props.initial);\n * return () => <div>{count()}</div>;\n * });\n * ```\n */\nexport function defineComponent<P extends Record<string, any> = Record<string, any>>(\n setup: (ctx: ComponentContext<P>) => () => AkashNode,\n): Component<P> {\n const component = (rawProps: P & { children?: AkashNode | (() => AkashNode) }): Node => {\n // Separate children from props, unwrap getter functions for reactivity\n const { children: childrenProp, ...restProps } = rawProps ?? {};\n // Props are passed through as-is — no auto-unwrapping.\n // Components use readProp() to unwrap reactive getters/signals inside\n // effects, which preserves dependency tracking. Auto-unwrapping in the\n // Proxy broke reactivity because it called the getter once and returned\n // the plain value, so effects never subscribed to the underlying signal.\n const props = restProps as unknown as P;\n\n const childrenFn: () => AkashNode =\n typeof childrenProp === 'function'\n ? childrenProp\n : () => childrenProp ?? null;\n\n const ctx: ComponentContext<P> = {\n props,\n children: childrenFn,\n };\n\n // Set up lifecycle hooks collector\n const hooks: LifecycleHooks = { mount: [], unmount: [], error: [] };\n const prevHooks = currentHooks;\n currentHooks = hooks;\n\n // Push context scope for provide/inject\n const parentScope = getCurrentScope();\n const scope = pushScope(parentScope);\n\n let renderFn: () => AkashNode;\n let domNode: Node;\n\n try {\n // Untrack component creation so that signals created inside the component\n // don't register with a parent render effect. This prevents parent effects\n // from re-running (and re-creating the entire component) when internal\n // component state changes. The component's own effects still track their\n // dependencies because effect() sets its own subscriber during execution.\n domNode = untrack(() => {\n renderFn = setup(ctx);\n if (typeof renderFn !== 'function') { throw akashError('AK0040'); }\n const rendered = renderFn();\n return nodeToDOM(rendered);\n });\n } catch (err) {\n popScope(scope);\n currentHooks = prevHooks;\n if (hooks.error.length > 0) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n return document.createComment('error');\n }\n throw err;\n }\n\n // Restore parent state\n popScope(scope);\n currentHooks = prevHooks;\n\n // Run mount callbacks (microtask to ensure DOM is attached)\n if (hooks.mount.length > 0) {\n queueMicrotask(() => {\n for (const mountFn of hooks.mount) {\n try {\n const cleanup = mountFn();\n if (typeof cleanup === 'function') {\n hooks.unmount.push(cleanup);\n }\n } catch (err) {\n for (const handler of hooks.error) {\n handler(err instanceof Error ? err : new Error(String(err)));\n }\n }\n }\n });\n }\n\n return domNode;\n };\n\n component._akash = true as const;\n return component as Component<P>;\n}\n"]}
|
package/dist/chunk-H2HNKYN2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {l,m}from'./chunk-3GRR4VW2.js';var b=class{entry;constructor(s,o){this.entry={value:s,timestamp:Date.now(),peerId:o};}get value(){return this.entry.value}get timestamp(){return this.entry.timestamp}set(s,o){let r=Date.now();return o===this.entry.peerId||r>this.entry.timestamp||r===this.entry.timestamp&&o>this.entry.peerId?(this.entry={value:s,timestamp:Math.max(r,this.entry.timestamp+1),peerId:o},true):false}merge(s){return s.timestamp>this.entry.timestamp||s.timestamp===this.entry.timestamp&&(!s.peerId||!this.entry.peerId||s.peerId>=this.entry.peerId)?(this.entry=s,true):false}toEntry(){return {...this.entry}}};function L(c){let s=null,o=[],r=[];return {send(n){s?.send(JSON.stringify({...n,type:"op",room:c.room}));},onReceive(n){o.push(n);let t=false;return ()=>{if(t)return;t=true;let i=o.indexOf(n);i!==-1&&o.splice(i,1);}},onPresence(n){return r.push(n),()=>{let t=r.indexOf(n);t!==-1&&r.splice(t,1);}},sendPresence(n){s?.send(JSON.stringify({type:"presence",room:c.room,data:n}));},connect(){s=new WebSocket(c.url,c.protocols),s.onmessage=n=>{try{let t=JSON.parse(n.data);if(t.type==="op")for(let i of o)i(t);else if(t.type==="presence")for(let i of r)i(t.peerId,t.data);}catch{}},s.onopen=()=>{s?.send(JSON.stringify({type:"join",room:c.room}));};},disconnect(){s?.close(),s=null;}}}function W(){let c=[],s=[];return {send(o){for(let r of c)r(o);},onReceive(o){c.push(o);let r=false;return ()=>{if(r)return;r=true;let n=c.indexOf(o);n!==-1&&c.splice(n,1);}},sendPresence(o,r){for(let n of s)n(r??"unknown",o);},onPresence(o){s.push(o);let r=false;return ()=>{if(r)return;r=true;let n=s.indexOf(o);n!==-1&&s.splice(n,1);}},connect(){},disconnect(){}}}var D=0;function _(c,s,o){let r,n;typeof c=="string"?(r=s,n=o??{}):(r=c,n=s??{});let t=n.peerId??`peer-${++D}-${Date.now()}`,i=n.transport??W(),l$1=new Map,u={};for(let[e,a]of Object.entries(r))l$1.set(e,new b(a,t)),u[e]=l(a);let y={};for(let e of Object.keys(r)){let a=u[e],d=l$1.get(e),p=(()=>a());p.set=k=>{d.set(k,t),a.set(k),i.send({type:"set",key:e,value:k,timestamp:d.timestamp,peerId:t});},p.update=k=>{p.set(k(a()));},p.peek=()=>a.peek(),y[e]=p;}let f=l([]),g=l(false),v=l(n.presence??{}),x=l(new Map),T=l([]);function O(e,a){if(e in u){u[e].set(a);let d=l$1.get(e);d&&d.set(a,t),i.send({type:"set",key:e,value:a,timestamp:Date.now(),peerId:t});}T.update(d=>d.filter(p=>p.key!==e));}let R=i.onReceive(e=>{if(e.type==="set"&&l$1.has(e.key)){let a=l$1.get(e.key),d=a.value,p=a.timestamp;if(n.onConflict&&p>0&&Math.abs(e.timestamp-p)<1e3&&e.peerId!==t){let w={key:e.key,localValue:d,remoteValue:e.value,localTimestamp:p,remoteTimestamp:e.timestamp,remotePeerId:e.peerId},S;try{S=n.onConflict(w);}catch(h){console.warn("[AkashJS Sync] onConflict handler threw, falling back to LWW:",h),a.merge({value:e.value,timestamp:e.timestamp,peerId:e.peerId})&&u[e.key].set(e.value),S="__fallback__";}S==="__fallback__"||(S!==void 0?(a.set(S,t),u[e.key].set(S),i.send({type:"set",key:e.key,value:S,timestamp:Date.now(),peerId:t})):T.update(h=>[...h,w]));}else a.merge({value:e.value,timestamp:e.timestamp,peerId:e.peerId})&&u[e.key].set(e.value);}}),P=v.set;v.set=e=>{P.call(v,e),i.sendPresence?.(e,t);};let C=i.onPresence?.((e,a)=>{e!==t&&x.update(d=>{let p=new Map(d);return a===null?p.delete(e):p.set(e,a),p});});return {state:y,peers:()=>f(),presence:v,peerPresence:()=>x(),conflicts:()=>T(),resolveConflict:O,peerId:t,connected:()=>g(),connect(){i.connect(),g.set(true);let e=v();Object.keys(e).length>0&&i.sendPresence?.(e,t);},disconnect(){i.sendPresence?.(null,t),i.disconnect(),g.set(false);},dispose(){i.sendPresence?.(null,t),R(),C?.(),i.disconnect();}}}function j(c,s){let o=s?.throttle??50,r=s?.target??(typeof document<"u"?document:null),n=l(0),t=l(0),i=0,l$1=null;function u(y){n.set(y.clientX),t.set(y.clientY);let f=Date.now();f-i>=o?(i=f,c.presence.set({...c.presence.peek?.()??{},cursor:{x:y.clientX,y:y.clientY}})):l$1||(l$1=setTimeout(()=>{l$1=null,i=Date.now(),c.presence.set({...c.presence.peek?.()??{},cursor:{x:n.peek(),y:t.peek()}});},o-(f-i)));}return r?.addEventListener?.("mousemove",u),{x:()=>n(),y:()=>t(),dispose(){r?.removeEventListener?.("mousemove",u),l$1&&clearTimeout(l$1);}}}function A(c,s){let o=s?.timeout??2e3,r=l(false),n=null;function t(){r.set(true),c.presence.set({...c.presence.peek?.()??{},typing:true}),n&&clearTimeout(n),n=setTimeout(i,o);}function i(){r.set(false),c.presence.set({...c.presence.peek?.()??{},typing:false}),n&&(clearTimeout(n),n=null);}let l$1=m(()=>{let u=c.peerPresence(),y=[];if(u instanceof Map)for(let[f,g]of u)g&&typeof g=="object"&&g.typing&&y.push(f);return y});return {isTyping:()=>r(),othersTyping:l$1,start:t,stop:i}}export{b as a,L as b,W as c,_ as d,j as e,A as f};//# sourceMappingURL=chunk-H2HNKYN2.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-H2HNKYN2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sync.ts"],"names":["LWWRegister","initialValue","peerId","value","ts","remote","createWebSocketTransport","options","ws","opHandlers","presenceHandlers","op","handler","removed","i","data","e","msg","h","createLocalTransport","senderPeerId","peerIdCounter","createSync","roomIdOrState","stateOrOptions","maybeOptions","initialState","transport","registers","stateSignals","key","signal","state","original","register","proxy","fn","peers","connected","presence","peerPresenceMap","conflictsSignal","resolveConflict","list","c","unsubOps","localValue","localTimestamp","conflict","resolved","err","originalPresenceSet","unsubPresence","remotePeerId","map","next","p","useCursor","doc","throttleMs","target","x","y","lastSend","pending","onMove","now","useTypingIndicator","timeout","isTyping","timer","start","stop","othersTyping","computed","typing","id"],"mappings":"sCAqCO,IAAMA,CAAAA,CAAN,KAAqB,CAClB,KAAA,CAER,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AAU,IAAMN,CAAAA,EAAS,CACzB,aAAAI,GAAAA,CACA,KAAA,CAAAF,CAAAA,CACA,IAAA,CAAAC,CACF,CACF","file":"chunk-H2HNKYN2.js","sourcesContent":["/**\n * Collaborative signals with CRDT.\n *\n * Make any signal multiplayer with one line. Multiple users can\n * edit the same state simultaneously with automatic conflict\n * resolution via Last-Writer-Wins Register and Operation-based CRDTs.\n *\n * ```ts\n * const doc = createSync('doc-123', {\n * title: '',\n * blocks: [],\n * cursor: { x: 0, y: 0 },\n * });\n *\n * doc.state.title.set('Hello'); // syncs to all peers\n * doc.peers(); // list of connected users\n * doc.presence.set({ cursor: { x: 10, y: 20 } });\n * ```\n */\n\nimport { signal, computed } from './signals.js';\nimport type { Signal, ReadonlySignal } from './signals.js';\n\n// =========================================================================\n// CRDT — Last-Writer-Wins Register\n// =========================================================================\n\nexport interface LWWEntry<T> {\n value: T;\n timestamp: number;\n peerId: string;\n}\n\n/**\n * Last-Writer-Wins Register — simplest CRDT for single values.\n * The write with the highest timestamp wins on conflict.\n */\nexport class LWWRegister<T> {\n private entry: LWWEntry<T>;\n\n constructor(initialValue: T, peerId: string) {\n this.entry = { value: initialValue, timestamp: Date.now(), peerId };\n }\n\n get value(): T {\n return this.entry.value;\n }\n\n get timestamp(): number {\n return this.entry.timestamp;\n }\n\n set(value: T, peerId: string): boolean {\n const ts = Date.now();\n // Local writes always succeed (same peer always advances its own state).\n // Cross-peer conflicts resolve by highest timestamp, then peerId tiebreak.\n if (\n peerId === this.entry.peerId ||\n ts > this.entry.timestamp ||\n (ts === this.entry.timestamp && peerId > this.entry.peerId)\n ) {\n this.entry = { value, timestamp: Math.max(ts, this.entry.timestamp + 1), peerId };\n return true;\n }\n return false;\n }\n\n merge(remote: LWWEntry<T>): boolean {\n if (\n remote.timestamp > this.entry.timestamp ||\n (remote.timestamp === this.entry.timestamp && (\n !remote.peerId || !this.entry.peerId || remote.peerId >= this.entry.peerId\n ))\n ) {\n this.entry = remote;\n return true;\n }\n return false;\n }\n\n toEntry(): LWWEntry<T> {\n return { ...this.entry };\n }\n}\n\n// =========================================================================\n// Operation log for list CRDTs\n// =========================================================================\n\nexport type SyncOp =\n | { type: 'set'; key: string; value: unknown; timestamp: number; peerId: string }\n | { type: 'insert'; key: string; index: number; value: unknown; timestamp: number; peerId: string }\n | { type: 'delete'; key: string; index: number; timestamp: number; peerId: string };\n\n// =========================================================================\n// Sync transport interface\n// =========================================================================\n\nexport interface SyncTransport {\n /** Send an operation to peers */\n send(op: SyncOp): void;\n /** Listen for operations from peers */\n onReceive(handler: (op: SyncOp) => void): () => void;\n /** Listen for peer presence updates */\n onPresence?(handler: (peerId: string, data: unknown) => void): () => void;\n /** Send presence data (peerId passed by createSync internals) */\n sendPresence?(data: unknown, peerId?: string): void;\n /** Connect to the sync channel */\n connect(): void;\n /** Disconnect */\n disconnect(): void;\n}\n\n// =========================================================================\n// WebSocket transport\n// =========================================================================\n\nexport interface WebSocketTransportOptions {\n url: string;\n room: string;\n protocols?: string | string[];\n}\n\nexport function createWebSocketTransport(options: WebSocketTransportOptions): SyncTransport {\n let ws: WebSocket | null = null;\n const opHandlers: Array<(op: SyncOp) => void> = [];\n const presenceHandlers: Array<(peerId: string, data: unknown) => void> = [];\n\n return {\n send(op: SyncOp) {\n ws?.send(JSON.stringify({ ...op, type: 'op', room: options.room }));\n },\n onReceive(handler) {\n opHandlers.push(handler);\n let removed = false;\n return () => {\n if (removed) return;\n removed = true;\n const i = opHandlers.indexOf(handler);\n if (i !== -1) opHandlers.splice(i, 1);\n };\n },\n onPresence(handler) {\n presenceHandlers.push(handler);\n return () => {\n const i = presenceHandlers.indexOf(handler);\n if (i !== -1) presenceHandlers.splice(i, 1);\n };\n },\n sendPresence(data) {\n ws?.send(JSON.stringify({ type: 'presence', room: options.room, data }));\n },\n connect() {\n ws = new WebSocket(options.url, options.protocols);\n ws.onmessage = (e) => {\n try {\n const msg = JSON.parse(e.data);\n if (msg.type === 'op') {\n for (const h of opHandlers) h(msg);\n } else if (msg.type === 'presence') {\n for (const h of presenceHandlers) h(msg.peerId, msg.data);\n }\n } catch { /* ignore parse errors */ }\n };\n ws.onopen = () => {\n ws?.send(JSON.stringify({ type: 'join', room: options.room }));\n };\n },\n disconnect() {\n ws?.close();\n ws = null;\n },\n };\n}\n\n// =========================================================================\n// In-memory transport (for testing / single-tab)\n// =========================================================================\n\nexport function createLocalTransport(): SyncTransport {\n const opHandlers: Array<(op: SyncOp) => void> = [];\n const presenceHandlers: Array<(peerId: string, data: unknown) => void> = [];\n return {\n send(op) {\n for (const h of opHandlers) h(op);\n },\n onReceive(handler) {\n opHandlers.push(handler);\n let removed = false;\n return () => {\n if (removed) return;\n removed = true;\n const i = opHandlers.indexOf(handler);\n if (i !== -1) opHandlers.splice(i, 1);\n };\n },\n sendPresence(data, senderPeerId?: string) {\n for (const h of presenceHandlers) h(senderPeerId ?? 'unknown', data);\n },\n onPresence(handler) {\n presenceHandlers.push(handler);\n let removed = false;\n return () => {\n if (removed) return;\n removed = true;\n const i = presenceHandlers.indexOf(handler);\n if (i !== -1) presenceHandlers.splice(i, 1);\n };\n },\n connect() {},\n disconnect() {},\n };\n}\n\n// =========================================================================\n// createSync — the main API\n// =========================================================================\n\nexport interface SyncConflict {\n key: string;\n localValue: unknown;\n remoteValue: unknown;\n localTimestamp: number;\n remoteTimestamp: number;\n remotePeerId: string;\n}\n\nexport interface SyncOptions {\n /** Transport for sending/receiving operations */\n transport?: SyncTransport;\n /** Unique peer ID (default: random) */\n peerId?: string;\n /** Initial presence data — broadcast on connect */\n presence?: Record<string, unknown>;\n /** Custom conflict resolver. Return the winning value, or undefined to queue for manual resolution. */\n onConflict?: (conflict: SyncConflict) => unknown | undefined;\n}\n\nexport interface SyncDoc<T extends Record<string, unknown>> {\n /** Reactive synced state — each key is a Signal */\n state: { [K in keyof T]: Signal<T[K]> };\n /** Connected peers (reactive) */\n peers: ReadonlySignal<PeerInfo[]>;\n /** Local presence data */\n presence: Signal<Record<string, unknown>>;\n /** Peer presence map (reactive) */\n peerPresence: ReadonlySignal<Map<string, unknown>>;\n /** Unresolved conflicts (reactive) */\n conflicts: ReadonlySignal<SyncConflict[]>;\n /** Resolve a conflict by choosing a value for a key */\n resolveConflict: (key: string, value: unknown) => void;\n /** This peer's ID */\n peerId: string;\n /** Whether connected */\n connected: ReadonlySignal<boolean>;\n /** Connect to the sync channel */\n connect(): void;\n /** Disconnect */\n disconnect(): void;\n /** Dispose the sync doc */\n dispose(): void;\n}\n\nexport interface PeerInfo {\n id: string;\n joinedAt: number;\n}\n\nlet peerIdCounter = 0;\n\n/**\n * Create a collaborative synced document.\n *\n * ```ts\n * const doc = createSync('room-1', { title: '', count: 0 }, {\n * transport: createWebSocketTransport({ url: 'wss://sync.example.com', room: 'room-1' }),\n * });\n *\n * doc.state.title.set('Hello'); // auto-syncs to all peers\n * doc.peers(); // connected users\n * ```\n */\nexport function createSync<T extends Record<string, unknown>>(\n initialState: T,\n options?: SyncOptions,\n): SyncDoc<T>;\nexport function createSync<T extends Record<string, unknown>>(\n roomIdOrState: string | T,\n stateOrOptions?: T | SyncOptions,\n maybeOptions?: SyncOptions,\n): SyncDoc<T> {\n // Support both old (roomId, state, options) and new (state, options) signatures\n let initialState: T;\n let options: SyncOptions;\n if (typeof roomIdOrState === 'string') {\n initialState = stateOrOptions as T;\n options = maybeOptions ?? {};\n } else {\n initialState = roomIdOrState;\n options = (stateOrOptions as SyncOptions) ?? {};\n }\n const peerId = options.peerId ?? `peer-${++peerIdCounter}-${Date.now()}`;\n const transport = options.transport ?? createLocalTransport();\n\n // Create CRDT registers and signals for each state key\n const registers = new Map<string, LWWRegister<unknown>>();\n const stateSignals: Record<string, Signal<unknown>> = {};\n\n for (const [key, value] of Object.entries(initialState)) {\n registers.set(key, new LWWRegister(value, peerId));\n stateSignals[key] = signal(value);\n }\n\n // Intercept signal.set to broadcast operations\n const state = {} as { [K in keyof T]: Signal<T[K]> };\n for (const key of Object.keys(initialState)) {\n const original = stateSignals[key];\n const register = registers.get(key)!;\n\n const proxy: Signal<any> = (() => original()) as any;\n proxy.set = (value: any) => {\n register.set(value, peerId);\n original.set(value);\n transport.send({\n type: 'set',\n key,\n value,\n timestamp: register.timestamp,\n peerId,\n });\n };\n proxy.update = (fn: (prev: any) => any) => {\n proxy.set(fn(original()));\n };\n proxy.peek = () => original.peek();\n\n (state as any)[key] = proxy;\n }\n\n // Peers\n const peers = signal<PeerInfo[]>([]);\n const connected = signal(false);\n const presence = signal<Record<string, unknown>>(options.presence ?? {});\n const peerPresenceMap = signal(new Map<string, unknown>());\n\n // Conflict tracking\n const conflictsSignal = signal<SyncConflict[]>([]);\n\n function resolveConflict(key: string, value: unknown): void {\n // Apply the resolved value\n if (key in stateSignals) {\n stateSignals[key].set(value);\n const register = registers.get(key);\n if (register) register.set(value, peerId);\n // Broadcast the resolution\n transport.send({ type: 'set', key, value, timestamp: Date.now(), peerId });\n }\n // Remove from conflicts list\n conflictsSignal.update(list => list.filter(c => c.key !== key));\n }\n\n // Listen for remote operations\n const unsubOps = transport.onReceive((op) => {\n if (op.type === 'set' && registers.has(op.key)) {\n const register = registers.get(op.key)!;\n const localValue = register.value;\n const localTimestamp = register.timestamp;\n\n // Check for conflict: remote write to a key we also recently wrote\n const isConflict = options.onConflict && localTimestamp > 0 &&\n Math.abs(op.timestamp - localTimestamp) < 1000 && // within 1s window\n op.peerId !== peerId;\n\n if (isConflict) {\n const conflict: SyncConflict = {\n key: op.key,\n localValue,\n remoteValue: op.value,\n localTimestamp,\n remoteTimestamp: op.timestamp,\n remotePeerId: op.peerId,\n };\n let resolved: unknown;\n try {\n resolved = options.onConflict!(conflict);\n } catch (err) {\n console.warn('[AkashJS Sync] onConflict handler threw, falling back to LWW:', err);\n // Fallback to standard LWW merge\n const merged = register.merge({ value: op.value, timestamp: op.timestamp, peerId: op.peerId });\n if (merged) stateSignals[op.key].set(op.value);\n resolved = '__fallback__';\n }\n if (resolved === '__fallback__') {\n // Already handled by LWW fallback above\n } else if (resolved !== undefined) {\n register.set(resolved, peerId);\n stateSignals[op.key].set(resolved);\n transport.send({ type: 'set', key: op.key, value: resolved, timestamp: Date.now(), peerId });\n } else {\n conflictsSignal.update(list => [...list, conflict]);\n }\n } else {\n // No conflict handler or no conflict — standard LWW merge\n const merged = register.merge({\n value: op.value,\n timestamp: op.timestamp,\n peerId: op.peerId,\n });\n if (merged) {\n stateSignals[op.key].set(op.value);\n }\n }\n }\n });\n\n // Intercept presence.set to broadcast with peerId\n const originalPresenceSet = presence.set;\n presence.set = (data: Record<string, unknown>) => {\n originalPresenceSet.call(presence, data);\n transport.sendPresence?.(data, peerId);\n };\n\n // Listen for presence — filter out self\n const unsubPresence = transport.onPresence?.((remotePeerId, data) => {\n if (remotePeerId === peerId) return; // ignore own presence\n peerPresenceMap.update((map) => {\n const next = new Map(map);\n if (data === null) {\n next.delete(remotePeerId); // peer disconnected\n } else {\n next.set(remotePeerId, data);\n }\n return next;\n });\n });\n\n return {\n state,\n peers: () => peers(),\n presence,\n peerPresence: () => peerPresenceMap(),\n conflicts: () => conflictsSignal(),\n resolveConflict,\n peerId,\n connected: () => connected(),\n connect() {\n transport.connect();\n connected.set(true);\n // Broadcast initial presence on connect\n const p = presence();\n if (Object.keys(p).length > 0) {\n transport.sendPresence?.(p, peerId);\n }\n },\n disconnect() {\n // Broadcast null presence to signal departure\n transport.sendPresence?.(null, peerId);\n transport.disconnect();\n connected.set(false);\n },\n dispose() {\n transport.sendPresence?.(null, peerId);\n unsubOps();\n unsubPresence?.();\n transport.disconnect();\n },\n };\n}\n\n// =========================================================================\n// Presence composables\n// =========================================================================\n\n/**\n * Track cursor position and broadcast via sync presence.\n * Throttles updates to avoid flooding the transport.\n *\n * ```ts\n * const cursor = useCursor(doc, { throttle: 50 });\n * // Automatically tracks mousemove and broadcasts { cursor: { x, y } }\n * // Other peers: doc.peerPresence().get(peerId).cursor\n * ```\n */\nexport function useCursor(\n doc: SyncDoc<any>,\n options?: { throttle?: number; target?: HTMLElement },\n): { x: ReadonlySignal<number>; y: ReadonlySignal<number>; dispose: () => void } {\n const throttleMs = options?.throttle ?? 50;\n const target = options?.target ?? (typeof document !== 'undefined' ? document : null);\n const x = signal(0);\n const y = signal(0);\n let lastSend = 0;\n let pending: ReturnType<typeof setTimeout> | null = null;\n\n function onMove(e: MouseEvent): void {\n x.set(e.clientX);\n y.set(e.clientY);\n\n const now = Date.now();\n if (now - lastSend >= throttleMs) {\n lastSend = now;\n doc.presence.set({ ...doc.presence.peek?.() ?? {}, cursor: { x: e.clientX, y: e.clientY } });\n } else if (!pending) {\n pending = setTimeout(() => {\n pending = null;\n lastSend = Date.now();\n doc.presence.set({ ...doc.presence.peek?.() ?? {}, cursor: { x: x.peek(), y: y.peek() } });\n }, throttleMs - (now - lastSend));\n }\n }\n\n target?.addEventListener?.('mousemove', onMove as EventListener);\n\n return {\n x: () => x(),\n y: () => y(),\n dispose() {\n target?.removeEventListener?.('mousemove', onMove as EventListener);\n if (pending) clearTimeout(pending);\n },\n };\n}\n\n/**\n * Typing indicator — broadcasts typing state with auto-timeout.\n *\n * ```ts\n * const typing = useTypingIndicator(doc, { timeout: 2000 });\n * typing.start(); // broadcasts { typing: true }\n * // Auto-stops after 2s of inactivity\n * typing.stop(); // manual stop\n *\n * // Other peers typing:\n * typing.othersTyping(); // string[] of peer IDs currently typing\n * ```\n */\nexport function useTypingIndicator(\n doc: SyncDoc<any>,\n options?: { timeout?: number },\n): {\n isTyping: ReadonlySignal<boolean>;\n othersTyping: ReadonlySignal<string[]>;\n start: () => void;\n stop: () => void;\n} {\n const timeout = options?.timeout ?? 2000;\n const isTyping = signal(false);\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n function start(): void {\n isTyping.set(true);\n doc.presence.set({ ...doc.presence.peek?.() ?? {}, typing: true });\n if (timer) clearTimeout(timer);\n timer = setTimeout(stop, timeout);\n }\n\n function stop(): void {\n isTyping.set(false);\n doc.presence.set({ ...doc.presence.peek?.() ?? {}, typing: false });\n if (timer) { clearTimeout(timer); timer = null; }\n }\n\n const othersTyping = computed(() => {\n const peers = doc.peerPresence();\n const typing: string[] = [];\n if (peers instanceof Map) {\n for (const [id, data] of peers) {\n if (data && typeof data === 'object' && (data as any).typing) {\n typing.push(id);\n }\n }\n }\n return typing;\n });\n\n return {\n isTyping: () => isTyping(),\n othersTyping,\n start,\n stop,\n };\n}\n"]}
|
package/dist/chunk-TKFJGLUO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {d}from'./chunk-H2HNKYN2.js';import {l,m,a,n}from'./chunk-3GRR4VW2.js';var K=[];function F(c){K.push(...c.plugins);}var k=new Map;function D(c,f){return ()=>{if(k.has(c))return k.get(c);let o=f.state(),n=$(c,o,f);return k.set(c,n),n}}function $(c,f,o){let n$1={},p=Object.keys(f);for(let e of p)n$1[e]=l(f[e]);let i={$id:c};for(let e of p)i[e]=n$1[e];let h=[],m$1=[];if(i.$__meta={stateKeys:p,getterKeys:h,actionKeys:m$1},o.getters)for(let[e,t]of Object.entries(o.getters))h.push(e),i[e]=m(()=>t.call(i,n$1));let R=[...K,...o.plugins??[]];if(o.actions)for(let[e,t]of Object.entries(o.actions))m$1.push(e),i[e]=(...S)=>{for(let s of R)s.onAction?.(i,e,S);return t.apply(i,S)};i.$reset=()=>{let e=o.state();for(let t of p)n$1[t].set(e[t]);},i.$patch=e=>{a(()=>{if(typeof e=="function")e(n$1);else for(let[t,S]of Object.entries(e))t in n$1&&n$1[t].set(S);});},i.$snapshot=()=>{let e={};for(let t of p)e[t]=n$1[t]();return e};let w=new Set,d$1=null;if(i.$subscribe=e=>{if(w.add(e),!d$1){let t=true;d$1=n(()=>{for(let s of p)n$1[s]();if(t){t=false;return}let S=i.$snapshot();for(let s of w)s(S);});}return ()=>{w.delete(e),w.size===0&&d$1&&(d$1(),d$1=null);}},o.persist&&typeof window<"u"){let e=O(c,o.persist);for(let t of e){let S=t.storage==="sessionStorage"?sessionStorage:localStorage,s=t.serialize??JSON.stringify,y=t.deserialize??JSON.parse,g=t.pick??p;try{let r=S.getItem(t.key);if(r){let a=y(r);for(let l of g)l in a&&l in n$1&&n$1[l].set(a[l]);}}catch{}let u=false,b=true;n(()=>{for(let r of g)r in n$1&&n$1[r]();if(b){b=false;return}u||(u=true,queueMicrotask(()=>{u=false;let r={};for(let a of g)a in n$1&&(r[a]=n$1[a].peek());try{S.setItem(t.key,s(r));}catch{}}));}),t.storage!=="sessionStorage"&&window.addEventListener("storage",r=>{if(!(r.key!==t.key||!r.newValue))try{let a=y(r.newValue);for(let l of g)l in a&&l in n$1&&n$1[l].set(a[l]);}catch{}});}}if(o.sync&&o.sync.enabled!==false){let e=o.sync,t=e.pick??p,S={};for(let y of t)S[y]=n$1[y]?.peek?.()??f[y];let s=d(S,{transport:e.transport,peerId:e.peerId});for(let y of t){if(!(y in n$1)||!(y in s.state))continue;let g=n$1[y],u=s.state[y],b=g.set,r=false;g.set=a=>{b.call(g,a),r||u.set(a);},n(()=>{let a=u();r=true,g.set(a),r=false;});}i.$sync={peers:s.peers,presence:s.presence,peerPresence:s.peerPresence,peerId:s.peerId,connected:s.connected,connect:s.connect.bind(s),disconnect:s.disconnect.bind(s)};}for(let e of R)e.init?.(i);return i}function O(c,f){return f===true?[{key:`akash-store:${c}`}]:f===false?[]:Array.isArray(f)?f.map((o,n)=>({...o,key:o.key??`akash-store:${c}:${n}`})):[{...f,key:f.key??`akash-store:${c}`}]}function _(){k.clear();}function E(){return Object.fromEntries(k)}export{F as a,D as b,_ as c,E as d};//# sourceMappingURL=chunk-TKFJGLUO.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-TKFJGLUO.js.map
|