@callable-recharge/callbag-recharge 0.1.0
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/README.md +259 -0
- package/dist/backoff-BXsH2Ago.d.cts +25 -0
- package/dist/backoff-BXsH2Ago.d.ts +25 -0
- package/dist/chunk-2BINVZ33.js +2 -0
- package/dist/chunk-2BINVZ33.js.map +1 -0
- package/dist/chunk-2E3ALULW.js +2 -0
- package/dist/chunk-2E3ALULW.js.map +1 -0
- package/dist/chunk-2IM76CX3.js +2 -0
- package/dist/chunk-2IM76CX3.js.map +1 -0
- package/dist/chunk-2KKEBHMR.js +2 -0
- package/dist/chunk-2KKEBHMR.js.map +1 -0
- package/dist/chunk-2P6G236K.js +2 -0
- package/dist/chunk-2P6G236K.js.map +1 -0
- package/dist/chunk-4AANJADQ.js +2 -0
- package/dist/chunk-4AANJADQ.js.map +1 -0
- package/dist/chunk-4WFD6EA7.js +2 -0
- package/dist/chunk-4WFD6EA7.js.map +1 -0
- package/dist/chunk-52WEI2L4.js +2 -0
- package/dist/chunk-52WEI2L4.js.map +1 -0
- package/dist/chunk-52YSBIVX.js +2 -0
- package/dist/chunk-52YSBIVX.js.map +1 -0
- package/dist/chunk-5PJCNPKY.js +2 -0
- package/dist/chunk-5PJCNPKY.js.map +1 -0
- package/dist/chunk-6YHJJXF4.js +2 -0
- package/dist/chunk-6YHJJXF4.js.map +1 -0
- package/dist/chunk-7CQ6XF2G.js +2 -0
- package/dist/chunk-7CQ6XF2G.js.map +1 -0
- package/dist/chunk-7WTS4C5R.js +3 -0
- package/dist/chunk-7WTS4C5R.js.map +1 -0
- package/dist/chunk-A6BNAR7H.js +2 -0
- package/dist/chunk-A6BNAR7H.js.map +1 -0
- package/dist/chunk-BNY43SC2.js +2 -0
- package/dist/chunk-BNY43SC2.js.map +1 -0
- package/dist/chunk-C2BNB3CS.js +2 -0
- package/dist/chunk-C2BNB3CS.js.map +1 -0
- package/dist/chunk-COAIGQ25.js +2 -0
- package/dist/chunk-COAIGQ25.js.map +1 -0
- package/dist/chunk-DBAHFYN4.js +2 -0
- package/dist/chunk-DBAHFYN4.js.map +1 -0
- package/dist/chunk-E63D25PW.js +1 -0
- package/dist/chunk-E63D25PW.js.map +1 -0
- package/dist/chunk-E6EZEFS5.js +2 -0
- package/dist/chunk-E6EZEFS5.js.map +1 -0
- package/dist/chunk-EMNGVHNM.js +2 -0
- package/dist/chunk-EMNGVHNM.js.map +1 -0
- package/dist/chunk-F356J323.js +2 -0
- package/dist/chunk-F356J323.js.map +1 -0
- package/dist/chunk-HKDBOVSA.js +2 -0
- package/dist/chunk-HKDBOVSA.js.map +1 -0
- package/dist/chunk-IJNZ5GDS.js +2 -0
- package/dist/chunk-IJNZ5GDS.js.map +1 -0
- package/dist/chunk-IQUXZNBK.js +2 -0
- package/dist/chunk-IQUXZNBK.js.map +1 -0
- package/dist/chunk-IUHESEXZ.js +2 -0
- package/dist/chunk-IUHESEXZ.js.map +1 -0
- package/dist/chunk-IZ5GFMMK.js +2 -0
- package/dist/chunk-IZ5GFMMK.js.map +1 -0
- package/dist/chunk-JCITTHWJ.js +2 -0
- package/dist/chunk-JCITTHWJ.js.map +1 -0
- package/dist/chunk-JS2FB4B3.js +2 -0
- package/dist/chunk-JS2FB4B3.js.map +1 -0
- package/dist/chunk-K7VPCAZD.js +2 -0
- package/dist/chunk-K7VPCAZD.js.map +1 -0
- package/dist/chunk-KDB2NMLA.js +2 -0
- package/dist/chunk-KDB2NMLA.js.map +1 -0
- package/dist/chunk-LHEWNZ3X.js +2 -0
- package/dist/chunk-LHEWNZ3X.js.map +1 -0
- package/dist/chunk-LM26JNAK.js +2 -0
- package/dist/chunk-LM26JNAK.js.map +1 -0
- package/dist/chunk-M6ZEDHQT.js +2 -0
- package/dist/chunk-M6ZEDHQT.js.map +1 -0
- package/dist/chunk-MJB2RHP4.js +2 -0
- package/dist/chunk-MJB2RHP4.js.map +1 -0
- package/dist/chunk-MKQEMUUJ.js +2 -0
- package/dist/chunk-MKQEMUUJ.js.map +1 -0
- package/dist/chunk-MVAQ5TH7.js +2 -0
- package/dist/chunk-MVAQ5TH7.js.map +1 -0
- package/dist/chunk-NEUWMVR4.js +2 -0
- package/dist/chunk-NEUWMVR4.js.map +1 -0
- package/dist/chunk-NSJJXMWD.js +2 -0
- package/dist/chunk-NSJJXMWD.js.map +1 -0
- package/dist/chunk-NUVYBG4B.js +2 -0
- package/dist/chunk-NUVYBG4B.js.map +1 -0
- package/dist/chunk-O5WOX6C7.js +2 -0
- package/dist/chunk-O5WOX6C7.js.map +1 -0
- package/dist/chunk-O7ITRRPK.js +2 -0
- package/dist/chunk-O7ITRRPK.js.map +1 -0
- package/dist/chunk-OHGZIPRU.js +2 -0
- package/dist/chunk-OHGZIPRU.js.map +1 -0
- package/dist/chunk-PXF7567W.js +2 -0
- package/dist/chunk-PXF7567W.js.map +1 -0
- package/dist/chunk-PYRVYHZG.js +2 -0
- package/dist/chunk-PYRVYHZG.js.map +1 -0
- package/dist/chunk-QECUTAQY.js +2 -0
- package/dist/chunk-QECUTAQY.js.map +1 -0
- package/dist/chunk-QPY7RRUK.js +2 -0
- package/dist/chunk-QPY7RRUK.js.map +1 -0
- package/dist/chunk-QYUTDL4D.js +2 -0
- package/dist/chunk-QYUTDL4D.js.map +1 -0
- package/dist/chunk-UEA4RIP5.js +2 -0
- package/dist/chunk-UEA4RIP5.js.map +1 -0
- package/dist/chunk-UHUNMZJO.js +2 -0
- package/dist/chunk-UHUNMZJO.js.map +1 -0
- package/dist/chunk-W5MQVYXW.js +2 -0
- package/dist/chunk-W5MQVYXW.js.map +1 -0
- package/dist/chunk-WHAGQ74D.js +2 -0
- package/dist/chunk-WHAGQ74D.js.map +1 -0
- package/dist/chunk-WRNNR3U5.js +2 -0
- package/dist/chunk-WRNNR3U5.js.map +1 -0
- package/dist/chunk-X6UCLV7L.js +2 -0
- package/dist/chunk-X6UCLV7L.js.map +1 -0
- package/dist/chunk-XHUZ4TRE.js +2 -0
- package/dist/chunk-XHUZ4TRE.js.map +1 -0
- package/dist/chunk-XISWBEKL.js +2 -0
- package/dist/chunk-XISWBEKL.js.map +1 -0
- package/dist/chunk-YCL7NHHW.js +2 -0
- package/dist/chunk-YCL7NHHW.js.map +1 -0
- package/dist/chunk-YMOLNCDC.js +2 -0
- package/dist/chunk-YMOLNCDC.js.map +1 -0
- package/dist/chunk-ZRKP6HCI.js +2 -0
- package/dist/chunk-ZRKP6HCI.js.map +1 -0
- package/dist/data/index.cjs +3 -0
- package/dist/data/index.cjs.map +1 -0
- package/dist/data/index.d.cts +32 -0
- package/dist/data/index.d.ts +32 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/eviction-DGPP1vHP.d.cts +21 -0
- package/dist/eviction-DGPP1vHP.d.ts +21 -0
- package/dist/extra/buffer.cjs +3 -0
- package/dist/extra/buffer.cjs.map +1 -0
- package/dist/extra/buffer.d.cts +21 -0
- package/dist/extra/buffer.d.ts +21 -0
- package/dist/extra/buffer.js +2 -0
- package/dist/extra/buffer.js.map +1 -0
- package/dist/extra/bufferTime.cjs +3 -0
- package/dist/extra/bufferTime.cjs.map +1 -0
- package/dist/extra/bufferTime.d.cts +15 -0
- package/dist/extra/bufferTime.d.ts +15 -0
- package/dist/extra/bufferTime.js +2 -0
- package/dist/extra/bufferTime.js.map +1 -0
- package/dist/extra/combine.cjs +3 -0
- package/dist/extra/combine.cjs.map +1 -0
- package/dist/extra/combine.d.cts +19 -0
- package/dist/extra/combine.d.ts +19 -0
- package/dist/extra/combine.js +2 -0
- package/dist/extra/combine.js.map +1 -0
- package/dist/extra/concat.cjs +3 -0
- package/dist/extra/concat.cjs.map +1 -0
- package/dist/extra/concat.d.cts +18 -0
- package/dist/extra/concat.d.ts +18 -0
- package/dist/extra/concat.js +2 -0
- package/dist/extra/concat.js.map +1 -0
- package/dist/extra/concatMap.cjs +3 -0
- package/dist/extra/concatMap.cjs.map +1 -0
- package/dist/extra/concatMap.d.cts +25 -0
- package/dist/extra/concatMap.d.ts +25 -0
- package/dist/extra/concatMap.js +2 -0
- package/dist/extra/concatMap.js.map +1 -0
- package/dist/extra/debounce.cjs +3 -0
- package/dist/extra/debounce.cjs.map +1 -0
- package/dist/extra/debounce.d.cts +17 -0
- package/dist/extra/debounce.d.ts +17 -0
- package/dist/extra/debounce.js +2 -0
- package/dist/extra/debounce.js.map +1 -0
- package/dist/extra/delay.cjs +3 -0
- package/dist/extra/delay.cjs.map +1 -0
- package/dist/extra/delay.d.cts +15 -0
- package/dist/extra/delay.d.ts +15 -0
- package/dist/extra/delay.js +2 -0
- package/dist/extra/delay.js.map +1 -0
- package/dist/extra/distinctUntilChanged.cjs +3 -0
- package/dist/extra/distinctUntilChanged.cjs.map +1 -0
- package/dist/extra/distinctUntilChanged.d.cts +16 -0
- package/dist/extra/distinctUntilChanged.d.ts +16 -0
- package/dist/extra/distinctUntilChanged.js +2 -0
- package/dist/extra/distinctUntilChanged.js.map +1 -0
- package/dist/extra/elementAt.cjs +3 -0
- package/dist/extra/elementAt.cjs.map +1 -0
- package/dist/extra/elementAt.d.cts +17 -0
- package/dist/extra/elementAt.d.ts +17 -0
- package/dist/extra/elementAt.js +2 -0
- package/dist/extra/elementAt.js.map +1 -0
- package/dist/extra/empty.cjs +3 -0
- package/dist/extra/empty.cjs.map +1 -0
- package/dist/extra/empty.d.cts +13 -0
- package/dist/extra/empty.d.ts +13 -0
- package/dist/extra/empty.js +2 -0
- package/dist/extra/empty.js.map +1 -0
- package/dist/extra/exhaustMap.cjs +3 -0
- package/dist/extra/exhaustMap.cjs.map +1 -0
- package/dist/extra/exhaustMap.d.cts +21 -0
- package/dist/extra/exhaustMap.d.ts +21 -0
- package/dist/extra/exhaustMap.js +2 -0
- package/dist/extra/exhaustMap.js.map +1 -0
- package/dist/extra/filter.cjs +3 -0
- package/dist/extra/filter.cjs.map +1 -0
- package/dist/extra/filter.d.cts +16 -0
- package/dist/extra/filter.d.ts +16 -0
- package/dist/extra/filter.js +2 -0
- package/dist/extra/filter.js.map +1 -0
- package/dist/extra/find.cjs +3 -0
- package/dist/extra/find.cjs.map +1 -0
- package/dist/extra/find.d.cts +17 -0
- package/dist/extra/find.d.ts +17 -0
- package/dist/extra/find.js +2 -0
- package/dist/extra/find.js.map +1 -0
- package/dist/extra/first.cjs +3 -0
- package/dist/extra/first.cjs.map +1 -0
- package/dist/extra/first.d.cts +15 -0
- package/dist/extra/first.d.ts +15 -0
- package/dist/extra/first.js +2 -0
- package/dist/extra/first.js.map +1 -0
- package/dist/extra/flat.cjs +3 -0
- package/dist/extra/flat.cjs.map +1 -0
- package/dist/extra/flat.d.cts +21 -0
- package/dist/extra/flat.d.ts +21 -0
- package/dist/extra/flat.js +2 -0
- package/dist/extra/flat.js.map +1 -0
- package/dist/extra/forEach.cjs +2 -0
- package/dist/extra/forEach.cjs.map +1 -0
- package/dist/extra/forEach.d.cts +13 -0
- package/dist/extra/forEach.d.ts +13 -0
- package/dist/extra/forEach.js +2 -0
- package/dist/extra/forEach.js.map +1 -0
- package/dist/extra/fromEvent.cjs +3 -0
- package/dist/extra/fromEvent.cjs.map +1 -0
- package/dist/extra/fromEvent.d.cts +14 -0
- package/dist/extra/fromEvent.d.ts +14 -0
- package/dist/extra/fromEvent.js +2 -0
- package/dist/extra/fromEvent.js.map +1 -0
- package/dist/extra/fromIter.cjs +3 -0
- package/dist/extra/fromIter.cjs.map +1 -0
- package/dist/extra/fromIter.d.cts +15 -0
- package/dist/extra/fromIter.d.ts +15 -0
- package/dist/extra/fromIter.js +2 -0
- package/dist/extra/fromIter.js.map +1 -0
- package/dist/extra/fromObs.cjs +3 -0
- package/dist/extra/fromObs.cjs.map +1 -0
- package/dist/extra/fromObs.d.cts +25 -0
- package/dist/extra/fromObs.d.ts +25 -0
- package/dist/extra/fromObs.js +2 -0
- package/dist/extra/fromObs.js.map +1 -0
- package/dist/extra/fromPromise.cjs +3 -0
- package/dist/extra/fromPromise.cjs.map +1 -0
- package/dist/extra/fromPromise.d.cts +16 -0
- package/dist/extra/fromPromise.d.ts +16 -0
- package/dist/extra/fromPromise.js +2 -0
- package/dist/extra/fromPromise.js.map +1 -0
- package/dist/extra/index.cjs +3 -0
- package/dist/extra/index.cjs.map +1 -0
- package/dist/extra/index.d.cts +220 -0
- package/dist/extra/index.d.ts +220 -0
- package/dist/extra/index.js +2 -0
- package/dist/extra/index.js.map +1 -0
- package/dist/extra/interval.cjs +3 -0
- package/dist/extra/interval.cjs.map +1 -0
- package/dist/extra/interval.d.cts +15 -0
- package/dist/extra/interval.d.ts +15 -0
- package/dist/extra/interval.js +2 -0
- package/dist/extra/interval.js.map +1 -0
- package/dist/extra/last.cjs +3 -0
- package/dist/extra/last.cjs.map +1 -0
- package/dist/extra/last.d.cts +16 -0
- package/dist/extra/last.d.ts +16 -0
- package/dist/extra/last.js +2 -0
- package/dist/extra/last.js.map +1 -0
- package/dist/extra/map.cjs +3 -0
- package/dist/extra/map.cjs.map +1 -0
- package/dist/extra/map.d.cts +15 -0
- package/dist/extra/map.d.ts +15 -0
- package/dist/extra/map.js +2 -0
- package/dist/extra/map.js.map +1 -0
- package/dist/extra/merge.cjs +3 -0
- package/dist/extra/merge.cjs.map +1 -0
- package/dist/extra/merge.d.cts +21 -0
- package/dist/extra/merge.d.ts +21 -0
- package/dist/extra/merge.js +2 -0
- package/dist/extra/merge.js.map +1 -0
- package/dist/extra/never.cjs +3 -0
- package/dist/extra/never.cjs.map +1 -0
- package/dist/extra/never.d.cts +13 -0
- package/dist/extra/never.d.ts +13 -0
- package/dist/extra/never.js +2 -0
- package/dist/extra/never.js.map +1 -0
- package/dist/extra/of.cjs +3 -0
- package/dist/extra/of.cjs.map +1 -0
- package/dist/extra/of.d.cts +14 -0
- package/dist/extra/of.d.ts +14 -0
- package/dist/extra/of.js +2 -0
- package/dist/extra/of.js.map +1 -0
- package/dist/extra/pairwise.cjs +3 -0
- package/dist/extra/pairwise.cjs.map +1 -0
- package/dist/extra/pairwise.d.cts +16 -0
- package/dist/extra/pairwise.d.ts +16 -0
- package/dist/extra/pairwise.js +2 -0
- package/dist/extra/pairwise.js.map +1 -0
- package/dist/extra/partition.cjs +3 -0
- package/dist/extra/partition.cjs.map +1 -0
- package/dist/extra/partition.d.cts +24 -0
- package/dist/extra/partition.d.ts +24 -0
- package/dist/extra/partition.js +2 -0
- package/dist/extra/partition.js.map +1 -0
- package/dist/extra/pipeRaw.cjs +3 -0
- package/dist/extra/pipeRaw.cjs.map +1 -0
- package/dist/extra/pipeRaw.d.cts +22 -0
- package/dist/extra/pipeRaw.d.ts +22 -0
- package/dist/extra/pipeRaw.js +2 -0
- package/dist/extra/pipeRaw.js.map +1 -0
- package/dist/extra/remember.cjs +3 -0
- package/dist/extra/remember.cjs.map +1 -0
- package/dist/extra/remember.d.cts +17 -0
- package/dist/extra/remember.d.ts +17 -0
- package/dist/extra/remember.js +2 -0
- package/dist/extra/remember.js.map +1 -0
- package/dist/extra/repeat.cjs +3 -0
- package/dist/extra/repeat.cjs.map +1 -0
- package/dist/extra/repeat.d.cts +29 -0
- package/dist/extra/repeat.d.ts +29 -0
- package/dist/extra/repeat.js +2 -0
- package/dist/extra/repeat.js.map +1 -0
- package/dist/extra/rescue.cjs +3 -0
- package/dist/extra/rescue.cjs.map +1 -0
- package/dist/extra/rescue.d.cts +16 -0
- package/dist/extra/rescue.d.ts +16 -0
- package/dist/extra/rescue.js +2 -0
- package/dist/extra/rescue.js.map +1 -0
- package/dist/extra/retry.cjs +3 -0
- package/dist/extra/retry.cjs.map +1 -0
- package/dist/extra/retry.d.cts +29 -0
- package/dist/extra/retry.d.ts +29 -0
- package/dist/extra/retry.js +2 -0
- package/dist/extra/retry.js.map +1 -0
- package/dist/extra/sample.cjs +3 -0
- package/dist/extra/sample.cjs.map +1 -0
- package/dist/extra/sample.d.cts +15 -0
- package/dist/extra/sample.d.ts +15 -0
- package/dist/extra/sample.js +2 -0
- package/dist/extra/sample.js.map +1 -0
- package/dist/extra/scan.cjs +3 -0
- package/dist/extra/scan.cjs.map +1 -0
- package/dist/extra/scan.d.cts +16 -0
- package/dist/extra/scan.d.ts +16 -0
- package/dist/extra/scan.js +2 -0
- package/dist/extra/scan.js.map +1 -0
- package/dist/extra/share.cjs +2 -0
- package/dist/extra/share.cjs.map +1 -0
- package/dist/extra/share.d.cts +12 -0
- package/dist/extra/share.d.ts +12 -0
- package/dist/extra/share.js +2 -0
- package/dist/extra/share.js.map +1 -0
- package/dist/extra/skip.cjs +3 -0
- package/dist/extra/skip.cjs.map +1 -0
- package/dist/extra/skip.d.cts +16 -0
- package/dist/extra/skip.d.ts +16 -0
- package/dist/extra/skip.js +2 -0
- package/dist/extra/skip.js.map +1 -0
- package/dist/extra/startWith.cjs +3 -0
- package/dist/extra/startWith.cjs.map +1 -0
- package/dist/extra/startWith.d.cts +15 -0
- package/dist/extra/startWith.d.ts +15 -0
- package/dist/extra/startWith.js +2 -0
- package/dist/extra/startWith.js.map +1 -0
- package/dist/extra/subject.cjs +3 -0
- package/dist/extra/subject.cjs.map +1 -0
- package/dist/extra/subject.d.cts +27 -0
- package/dist/extra/subject.d.ts +27 -0
- package/dist/extra/subject.js +2 -0
- package/dist/extra/subject.js.map +1 -0
- package/dist/extra/subscribe.cjs +2 -0
- package/dist/extra/subscribe.cjs.map +1 -0
- package/dist/extra/subscribe.d.cts +19 -0
- package/dist/extra/subscribe.d.ts +19 -0
- package/dist/extra/subscribe.js +2 -0
- package/dist/extra/subscribe.js.map +1 -0
- package/dist/extra/switchMap.cjs +3 -0
- package/dist/extra/switchMap.cjs.map +1 -0
- package/dist/extra/switchMap.d.cts +21 -0
- package/dist/extra/switchMap.d.ts +21 -0
- package/dist/extra/switchMap.js +2 -0
- package/dist/extra/switchMap.js.map +1 -0
- package/dist/extra/take.cjs +3 -0
- package/dist/extra/take.cjs.map +1 -0
- package/dist/extra/take.d.cts +15 -0
- package/dist/extra/take.d.ts +15 -0
- package/dist/extra/take.js +2 -0
- package/dist/extra/take.js.map +1 -0
- package/dist/extra/takeUntil.cjs +3 -0
- package/dist/extra/takeUntil.cjs.map +1 -0
- package/dist/extra/takeUntil.d.cts +20 -0
- package/dist/extra/takeUntil.d.ts +20 -0
- package/dist/extra/takeUntil.js +2 -0
- package/dist/extra/takeUntil.js.map +1 -0
- package/dist/extra/tap.cjs +3 -0
- package/dist/extra/tap.cjs.map +1 -0
- package/dist/extra/tap.d.cts +15 -0
- package/dist/extra/tap.d.ts +15 -0
- package/dist/extra/tap.js +2 -0
- package/dist/extra/tap.js.map +1 -0
- package/dist/extra/throttle.cjs +3 -0
- package/dist/extra/throttle.cjs.map +1 -0
- package/dist/extra/throttle.d.cts +16 -0
- package/dist/extra/throttle.d.ts +16 -0
- package/dist/extra/throttle.js +2 -0
- package/dist/extra/throttle.js.map +1 -0
- package/dist/extra/throwError.cjs +3 -0
- package/dist/extra/throwError.cjs.map +1 -0
- package/dist/extra/throwError.d.cts +13 -0
- package/dist/extra/throwError.d.ts +13 -0
- package/dist/extra/throwError.js +2 -0
- package/dist/extra/throwError.js.map +1 -0
- package/dist/extra/timeout.cjs +3 -0
- package/dist/extra/timeout.cjs.map +1 -0
- package/dist/extra/timeout.d.cts +19 -0
- package/dist/extra/timeout.d.ts +19 -0
- package/dist/extra/timeout.js +2 -0
- package/dist/extra/timeout.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +197 -0
- package/dist/index.d.ts +197 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/index.cjs +3 -0
- package/dist/memory/index.cjs.map +1 -0
- package/dist/memory/index.d.cts +113 -0
- package/dist/memory/index.d.ts +113 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/orchestrate/index.cjs +3 -0
- package/dist/orchestrate/index.cjs.map +1 -0
- package/dist/orchestrate/index.d.cts +101 -0
- package/dist/orchestrate/index.d.ts +101 -0
- package/dist/orchestrate/index.js +2 -0
- package/dist/orchestrate/index.js.map +1 -0
- package/dist/patterns/createStore/index.cjs +3 -0
- package/dist/patterns/createStore/index.cjs.map +1 -0
- package/dist/patterns/createStore/index.d.cts +55 -0
- package/dist/patterns/createStore/index.d.ts +55 -0
- package/dist/patterns/createStore/index.js +2 -0
- package/dist/patterns/createStore/index.js.map +1 -0
- package/dist/types-BiLijSKv.d.cts +192 -0
- package/dist/types-CIITLkgL.d.ts +192 -0
- package/dist/types-DsAN6Hga.d.cts +86 -0
- package/dist/types-DsAN6Hga.d.ts +86 -0
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +8 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +141 -0
package/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# callbag-recharge
|
|
2
|
+
|
|
3
|
+
**State that flows.** Reactive state management for TypeScript — from simple atoms to streaming pipelines, in one library.
|
|
4
|
+
|
|
5
|
+
- **5 primitives** — `state`, `derived`, `effect`, `producer`, `operator`
|
|
6
|
+
- **60+ operators** — `switchMap`, `debounce`, `scan`, `retry`, and more — tree-shakeable
|
|
7
|
+
- **Glitch-free** — two-phase push resolves diamonds correctly, every time
|
|
8
|
+
- **Streaming-native** — LLM chunks, WebSocket, SSE are first-class, not bolted on
|
|
9
|
+
- **Inspectable** — every node in the graph is observable via `Inspector` — names, edges, phases, values
|
|
10
|
+
- **Framework-agnostic** — no providers, no wrappers, works anywhere JS runs
|
|
11
|
+
- Zero dependencies
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { state, derived, effect } from 'callbag-recharge'
|
|
15
|
+
|
|
16
|
+
const count = state(0)
|
|
17
|
+
const doubled = derived([count], () => count.get() * 2)
|
|
18
|
+
|
|
19
|
+
effect([doubled], () => {
|
|
20
|
+
console.log(doubled.get()) // 0, then 10
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
count.set(5)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## When to use
|
|
29
|
+
|
|
30
|
+
- **Simple state management** — like Zustand/Jotai but framework-agnostic, no providers, no ceremony
|
|
31
|
+
- **Streaming data** — LLM chunks, WebSocket, SSE flowing into state via `producer` or `fromAsyncIter`
|
|
32
|
+
- **Cancellable async** — `switchMap` auto-cancels the previous operation when a new one starts
|
|
33
|
+
- **Derived values you can trust** — diamond-safe, cached, always consistent
|
|
34
|
+
- **Agentic workflows** — session state, tool call lifecycle, multi-agent coordination
|
|
35
|
+
- **Event pipelines** — transform, buffer, window, throttle, retry — compose with `pipe`
|
|
36
|
+
- **Reactive data structures** — `reactiveMap`, `reactiveLog`, `reactiveIndex` with near-native read performance
|
|
37
|
+
- **Scheduled pipelines** — cron triggers, task state tracking, DAG validation — Airflow-in-TypeScript
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why callbag-recharge?
|
|
42
|
+
|
|
43
|
+
Most state managers stop at atoms and computed values. Most streaming libraries don't have state. This library is both — signals-style `.get()/.set()` ergonomics with callbag's streaming protocol underneath.
|
|
44
|
+
|
|
45
|
+
**What you get that others don't — all in one library:**
|
|
46
|
+
|
|
47
|
+
- **Glitch-free diamond resolution** — when A → B, A → C, B+C → D, D computes exactly once with consistent values. Jotai, Nanostores, and vanilla signals all glitch here.
|
|
48
|
+
- **Streaming operators as first-class citizens** — `switchMap`, `debounce`, `throttle`, `scan`, `retry`, `bufferTime` — not an afterthought, not a separate library.
|
|
49
|
+
- **Inspectable graph** — every store has a name, a kind, dependency edges, and a status. `Inspector.graph()` shows the full picture. No other state manager gives you this without runtime cost in production.
|
|
50
|
+
- **Effects with dirty tracking** — `effect()` knows which deps changed and waits for all to resolve before running. Smarter than `useEffect`, `autorun`, or `watch`.
|
|
51
|
+
- **Completion and error semantics** — stores can complete and error, just like streams. `retry`, `rescue`, `repeat` handle recovery. No ad-hoc try/catch.
|
|
52
|
+
- **Built-in batching** — `batch()` defers value propagation until all writes finish. No torn reads mid-update.
|
|
53
|
+
- **Reactive data structures** — `reactiveMap` (1.56x native Map), `reactiveLog` (2.5x native), `reactiveIndex` (1.01x native reads) — near-native reactive collections that no competitor offers.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quick start
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { state, derived, effect, pipe, producer, Inspector } from 'callbag-recharge'
|
|
61
|
+
import { map, filter, scan, subscribe } from 'callbag-recharge/extra'
|
|
62
|
+
|
|
63
|
+
// Writable state — the source of truth
|
|
64
|
+
const count = state(0)
|
|
65
|
+
count.set(5)
|
|
66
|
+
count.get() // 5
|
|
67
|
+
|
|
68
|
+
// Derived — explicit deps, cached, always fresh
|
|
69
|
+
const doubled = derived([count], () => count.get() * 2)
|
|
70
|
+
doubled.get() // 10
|
|
71
|
+
|
|
72
|
+
// Producer — push-based source with cleanup
|
|
73
|
+
const ticks = producer<number>(({ emit }) => {
|
|
74
|
+
const id = setInterval(() => emit(Date.now()), 1000)
|
|
75
|
+
return () => clearInterval(id)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
// Effect — explicit deps, re-runs when deps change
|
|
79
|
+
const dispose = effect([doubled], () => {
|
|
80
|
+
console.log(doubled.get())
|
|
81
|
+
return () => { /* cleanup */ }
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Pipe — each step is an inspectable store
|
|
85
|
+
const result = pipe(
|
|
86
|
+
count,
|
|
87
|
+
map(n => n * 2),
|
|
88
|
+
filter(n => n > 0),
|
|
89
|
+
scan((acc, n) => acc + n, 0),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
// Subscribe — listen to value changes
|
|
93
|
+
const unsub = subscribe(count, (value, prev) => {
|
|
94
|
+
console.log(`${prev} → ${value}`)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// Inspect the entire reactive graph
|
|
98
|
+
Inspector.graph()
|
|
99
|
+
// Map { 'count' => { kind: 'state', value: 5 }, ... }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 60+ operators, tree-shakeable
|
|
105
|
+
|
|
106
|
+
Import only what you need from `callbag-recharge/extra`.
|
|
107
|
+
|
|
108
|
+
**Sources** — `interval` · `fromIter` · `fromAsyncIter` · `fromEvent` · `fromPromise` · `fromObs` · `of` · `empty` · `throwError` · `never`
|
|
109
|
+
|
|
110
|
+
**Filtering** — `filter` · `take` · `skip` · `first` · `last` · `find` · `elementAt` · `distinctUntilChanged` · `takeUntil`
|
|
111
|
+
|
|
112
|
+
**Transformation** — `map` · `scan` · `pairwise` · `startWith` · `flat` · `switchMap` · `concatMap` · `exhaustMap` · `groupBy`
|
|
113
|
+
|
|
114
|
+
**Combination** — `merge` · `combine` · `concat` · `race` · `withLatestFrom` · `partition`
|
|
115
|
+
|
|
116
|
+
**Time** — `debounce` · `throttle` · `delay` · `timeout` · `sample` · `audit`
|
|
117
|
+
|
|
118
|
+
**Buffering** — `buffer` · `bufferCount` · `bufferTime`
|
|
119
|
+
|
|
120
|
+
**Windowing** — `window` · `windowCount` · `windowTime`
|
|
121
|
+
|
|
122
|
+
**Aggregation** — `reduce` · `toArray`
|
|
123
|
+
|
|
124
|
+
**Error handling** — `rescue` · `retry` · `repeat`
|
|
125
|
+
|
|
126
|
+
**Utilities** — `tap` · `share` · `remember` · `subject` · `wrap`
|
|
127
|
+
|
|
128
|
+
**Piping** — `pipeRaw` · `SKIP`
|
|
129
|
+
|
|
130
|
+
**Sinks** — `forEach` · `subscribe`
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Design principles
|
|
135
|
+
|
|
136
|
+
1. **Stores are plain objects** — `{ get, set?, source }`, no classes, no property descriptors
|
|
137
|
+
2. **Two-phase push** — DIRTY propagates on type 3, then values flow on type 1; glitch-free diamonds without pull
|
|
138
|
+
3. **Explicit deps** — `derived` and `effect` declare dependencies upfront; callbag protocol is the sole connection mechanism
|
|
139
|
+
4. **Lazy derived** — no computation at construction. `get()` pull-computes from deps (always fresh). `source()` subscription triggers push-based connection; disconnects when last subscriber leaves
|
|
140
|
+
5. **`undefined` means empty** — no special symbols, no `.ready` flag
|
|
141
|
+
6. **Observability is external** — Inspector singleton with WeakMaps, zero per-store cost
|
|
142
|
+
|
|
143
|
+
See [docs/architecture.md](./docs/architecture.md) for the full design and implementation details.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Reactive data structures
|
|
148
|
+
|
|
149
|
+
Built on the core primitives, these provide reactive wrappers around common data structures with near-native read performance.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import { reactiveMap, reactiveLog, reactiveIndex } from 'callbag-recharge/data'
|
|
153
|
+
|
|
154
|
+
// Reactive Map — .get()/.set() with observable changes
|
|
155
|
+
const users = reactiveMap<string, User>()
|
|
156
|
+
users.set('alice', { name: 'Alice' })
|
|
157
|
+
const alice = users.select('alice') // Store<User | undefined> — reactive, cached
|
|
158
|
+
|
|
159
|
+
// Reactive Log — append-only with bounded mode (circular buffer)
|
|
160
|
+
const log = reactiveLog<string>({ maxSize: 1000 })
|
|
161
|
+
log.append('event happened')
|
|
162
|
+
const recent = log.slice(-10) // Store<string[]> — reactive
|
|
163
|
+
|
|
164
|
+
// Reactive Index — dual-key lookup, 1.01x native Map.get speed on reads
|
|
165
|
+
const index = reactiveIndex<string, string, Item>()
|
|
166
|
+
index.set('pk', 'sk', item)
|
|
167
|
+
const found = index.select('pk', 'sk') // Store<Item | undefined>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Scheduling & orchestration
|
|
173
|
+
|
|
174
|
+
Lightweight scheduling primitives that compose with `derived()` + `effect()` — diamond resolution IS the DAG executor.
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import { fromCron, taskState, dag } from 'callbag-recharge/orchestrate'
|
|
178
|
+
import { pipe } from 'callbag-recharge'
|
|
179
|
+
import { exhaustMap, retry } from 'callbag-recharge/extra'
|
|
180
|
+
|
|
181
|
+
// Cron-triggered pipeline with retry
|
|
182
|
+
const daily = fromCron('0 9 * * *')
|
|
183
|
+
const fetchBank = pipe(daily, exhaustMap(() => fromPromise(plaid.sync())), retry(3))
|
|
184
|
+
const fetchCards = pipe(daily, exhaustMap(() => fromPromise(stripe.charges())), retry(3))
|
|
185
|
+
|
|
186
|
+
// Diamond resolution ensures aggregate runs once when both complete
|
|
187
|
+
const aggregate = derived([fetchBank, fetchCards], () => merge(fetchBank.get(), fetchCards.get()))
|
|
188
|
+
|
|
189
|
+
// Task state tracking
|
|
190
|
+
const task = taskState<Result>({ id: 'daily-sync' })
|
|
191
|
+
await task.run(() => syncAll())
|
|
192
|
+
task.get().status // 'success'
|
|
193
|
+
task.get().duration // ms
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Agent memory
|
|
199
|
+
|
|
200
|
+
Reactive memory primitives for agentic workflows — push-based dirty tracking, decay-scored eviction, tag-based retrieval.
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
import { collection, memoryNode } from 'callbag-recharge/memory'
|
|
204
|
+
|
|
205
|
+
const memory = collection<string>({ maxSize: 100 })
|
|
206
|
+
memory.add('User prefers TypeScript', { id: 'pref-1', tags: ['preference'] })
|
|
207
|
+
|
|
208
|
+
// Tag-based retrieval via reactive index
|
|
209
|
+
memory.tagIndex.select('preference').get() // Set{'pref-1'}
|
|
210
|
+
|
|
211
|
+
// Decay-scored eviction — oldest/least important items evicted first
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Callbag interop
|
|
217
|
+
|
|
218
|
+
Every store exposes a `.source` property — a standard callbag source function. State management signals (DIRTY, RESOLVED) flow on the type 3 STATE channel, keeping type 1 DATA for real values only.
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
import { STATE, DIRTY, RESOLVED } from 'callbag-recharge'
|
|
222
|
+
|
|
223
|
+
store.source(0, (type, data) => {
|
|
224
|
+
if (type === 3 && data === DIRTY) { /* invalidation */ }
|
|
225
|
+
if (type === 3 && data === RESOLVED) { /* resolved unchanged */ }
|
|
226
|
+
if (type === 1) { /* value */ }
|
|
227
|
+
})
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Documentation
|
|
233
|
+
|
|
234
|
+
- **[Docs site](https://callbag-recharge.github.io/callbag-recharge/)** — getting started, API reference, recipes
|
|
235
|
+
- [Architecture](./docs/architecture.md) — layers, design principles, how each primitive works
|
|
236
|
+
- [Extras](./docs/extras.md) — 60+ operators, sources, and sinks
|
|
237
|
+
- [Recipes](https://callbag-recharge.github.io/callbag-recharge/recipes/) — AI chat streaming, data pipelines, and more
|
|
238
|
+
- [llms.txt](./llms.txt) / [llms-full.txt](./llms-full.txt) — AI-readable documentation
|
|
239
|
+
- [Benchmarks](./docs/benchmarks.md) — Vitest + tinybench (`pnpm run bench`)
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Install
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
npm install callbag-recharge
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Contributing
|
|
252
|
+
|
|
253
|
+
Clone, run `corepack enable` and `pnpm install`, then `pnpm test` / `pnpm run build`. See **[CONTRIBUTING.md](./CONTRIBUTING.md)** for commits; maintainers see **[docs/github-actions-release-setup.md](./docs/github-actions-release-setup.md)** for npm/GitHub Actions secrets.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns ms to wait before next attempt, or null to stop retrying.
|
|
3
|
+
* `attempt` is 0-based (0 = first retry, after first failure).
|
|
4
|
+
* `prevDelay` is the delay returned by the previous call (undefined on first call).
|
|
5
|
+
*/
|
|
6
|
+
type BackoffStrategy = (attempt: number, error?: unknown, prevDelay?: number) => number | null;
|
|
7
|
+
type JitterMode = "none" | "full" | "equal";
|
|
8
|
+
declare function constant(ms: number): BackoffStrategy;
|
|
9
|
+
declare function linear(base: number, step?: number): BackoffStrategy;
|
|
10
|
+
interface ExponentialOptions {
|
|
11
|
+
/** Base delay in ms. Default: 100 */
|
|
12
|
+
base?: number;
|
|
13
|
+
/** Multiplication factor per attempt. Default: 2 */
|
|
14
|
+
factor?: number;
|
|
15
|
+
/** Maximum delay in ms. Default: 30_000 */
|
|
16
|
+
maxDelay?: number;
|
|
17
|
+
/** Jitter mode. Default: "none" */
|
|
18
|
+
jitter?: JitterMode;
|
|
19
|
+
}
|
|
20
|
+
declare function exponential(opts?: ExponentialOptions): BackoffStrategy;
|
|
21
|
+
declare function fibonacci(base?: number, maxDelay?: number): BackoffStrategy;
|
|
22
|
+
declare function decorrelatedJitter(base?: number, max?: number): BackoffStrategy;
|
|
23
|
+
declare function withMaxAttempts(strategy: BackoffStrategy, maxAttempts: number): BackoffStrategy;
|
|
24
|
+
|
|
25
|
+
export { type BackoffStrategy as B, type ExponentialOptions as E, type JitterMode as J, constant as c, decorrelatedJitter as d, exponential as e, fibonacci as f, linear as l, withMaxAttempts as w };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns ms to wait before next attempt, or null to stop retrying.
|
|
3
|
+
* `attempt` is 0-based (0 = first retry, after first failure).
|
|
4
|
+
* `prevDelay` is the delay returned by the previous call (undefined on first call).
|
|
5
|
+
*/
|
|
6
|
+
type BackoffStrategy = (attempt: number, error?: unknown, prevDelay?: number) => number | null;
|
|
7
|
+
type JitterMode = "none" | "full" | "equal";
|
|
8
|
+
declare function constant(ms: number): BackoffStrategy;
|
|
9
|
+
declare function linear(base: number, step?: number): BackoffStrategy;
|
|
10
|
+
interface ExponentialOptions {
|
|
11
|
+
/** Base delay in ms. Default: 100 */
|
|
12
|
+
base?: number;
|
|
13
|
+
/** Multiplication factor per attempt. Default: 2 */
|
|
14
|
+
factor?: number;
|
|
15
|
+
/** Maximum delay in ms. Default: 30_000 */
|
|
16
|
+
maxDelay?: number;
|
|
17
|
+
/** Jitter mode. Default: "none" */
|
|
18
|
+
jitter?: JitterMode;
|
|
19
|
+
}
|
|
20
|
+
declare function exponential(opts?: ExponentialOptions): BackoffStrategy;
|
|
21
|
+
declare function fibonacci(base?: number, maxDelay?: number): BackoffStrategy;
|
|
22
|
+
declare function decorrelatedJitter(base?: number, max?: number): BackoffStrategy;
|
|
23
|
+
declare function withMaxAttempts(strategy: BackoffStrategy, maxAttempts: number): BackoffStrategy;
|
|
24
|
+
|
|
25
|
+
export { type BackoffStrategy as B, type ExponentialOptions as E, type JitterMode as J, constant as c, decorrelatedJitter as d, exponential as e, fibonacci as f, linear as l, withMaxAttempts as w };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-7WTS4C5R.js";import{a as m,b as y,c as b,d as T,e as E,f as v,g as O,h as k,i as u,j as B,k as D,l as h,m as f,n as l,o as A}from"./chunk-QYUTDL4D.js";var c=1,d=2,R=4,o=8,I=b<<u,w=T<<u,U=E<<u,x=v<<u,L=O<<u,M=k<<u,r=B,S=class{_value;_output=null;_upstreamTalkbacks=[];_handler=null;_flags;_deps;_init;_getterFn;_initial;get _status(){return D(this._flags)}constructor(s,e,i){this._value=i?.initial,this._initial=i?.initial,this._deps=s,this._init=e,this._getterFn=i?.getter;let t=0;i?.resetOnTeardown&&(t|=d),i?.resubscribable&&(t|=R),this._flags=t,this.source=this.source.bind(this),p.register(this,{kind:i?.kind??"operator",...i,deps:s});for(let n of s)p.registerEdge(n,this)}_dispatch(s,e){let i=this._output;if(i)if(this._flags&o)for(let t of i)t(s,e);else i(s,e)}_connectUpstream(){let s=new Array(this._deps.length).fill(null);this._upstreamTalkbacks=s;let e=!1,i={seed:t=>{e||(this._value=t)},emit:t=>{e||(this._value=t,this._flags=this._flags&~r|U,this._dispatch(f,t))},signal:t=>{e||(t===m?this._flags=this._flags&~r|w:t===y&&(this._flags=this._flags&~r|x),this._dispatch(A,t))},complete:()=>{if(e)return;e=!0,this._flags=(this._flags|c)&~r|L,this._handler=null;for(let a of s)a?.(l);s.fill(null),this._flags&d&&(this._value=this._initial);let t=this._output,n=this._flags&o;if(this._output=null,this._flags&=~o,t)if(n)for(let a of t)a(l);else t(l)},error:t=>{if(e)return;e=!0,this._flags=(this._flags|c)&~r|M,this._handler=null;for(let _ of s)_?.(l);s.fill(null),this._flags&d&&(this._value=this._initial);let n=this._output,a=this._flags&o;if(this._output=null,this._flags&=~o,n)if(a)for(let _ of n)_(l,t);else n(l,t)},disconnect:t=>{if(t!==void 0)s[t]?.(l),s[t]=null;else{for(let n of s)n?.(l);s.fill(null)}}};this._handler=this._init(i);for(let t=0;t<this._deps.length&&!e;t++){let n=t;this._deps[n].source(h,(a,_)=>{if(a===h){s[n]=_;return}this._handler?.(n,a,_)})}}_disconnectUpstream(){for(let s of this._upstreamTalkbacks)s?.(l);this._upstreamTalkbacks=[],this._handler=null,this._flags=this._flags&~r|I,this._flags&d&&(this._value=this._initial)}get(){if(this._getterFn&&!this._output){let s=this._getterFn(this._value);return this._value=s,s}return this._value}source(s,e){if(s===h){let i=e;if(this._flags&c)if(this._flags&R&&this._output===null)this._flags=this._flags&~(c|r)|I;else{i(h,n=>{}),i(l);return}let t=this._output===null;if(this._output===null)this._output=i;else if(this._flags&o)this._output.add(i);else{let n=new Set;n.add(this._output),n.add(i),this._output=n,this._flags|=o}i(h,n=>{if(n===f&&i(f,this._value),n===l){if(this._output===null)return;if(this._flags&o){let a=this._output;a.delete(i),a.size===1?(this._output=a.values().next().value,this._flags&=~o):a.size===0&&(this._output=null,this._flags&=~o,this._disconnectUpstream())}else this._output===i&&(this._output=null,this._disconnectUpstream())}}),t&&this._connectUpstream()}}};function N(g,s,e){return new S(g,s,e)}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2BINVZ33.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/operator.ts"],"sourcesContent":["/**\n * General-purpose transform primitive. Receives all signal types from upstream\n * deps and decides what to forward.\n *\n * v5: _status packed into _flags bits 7-9 for hot-path performance.\n * String status exposed via getter for Inspector/test backward compat.\n *\n * Class-based for V8 hidden class optimization and prototype method sharing.\n * Boolean fields packed into _flags bitmask to reduce hidden class size.\n */\n\nimport { Inspector } from \"./inspector\";\nimport type { Signal } from \"./protocol\";\nimport {\n\tDATA,\n\tDIRTY,\n\tdecodeStatus,\n\tEND,\n\tRESOLVED,\n\tS_COMPLETED,\n\tS_DIRTY,\n\tS_DISCONNECTED,\n\tS_ERRORED,\n\tS_RESOLVED,\n\tS_SETTLED,\n\tSTART,\n\tSTATE,\n\tSTATUS_MASK,\n\tSTATUS_SHIFT,\n} from \"./protocol\";\nimport type { Actions, SourceOptions, Store } from \"./types\";\n\nexport type OperatorOpts<B> = SourceOptions<B>;\n\n// Flag bits for _flags bitmask (bits 0-6)\nconst O_COMPLETED = 1;\nconst O_RESET = 2;\nconst O_RESUB = 4;\nconst O_MULTI = 8;\n\n// Pre-shifted status constants for hot-path writes\nconst _S_DISCONNECTED = S_DISCONNECTED << STATUS_SHIFT;\nconst _S_DIRTY = S_DIRTY << STATUS_SHIFT;\nconst _S_SETTLED = S_SETTLED << STATUS_SHIFT;\nconst _S_RESOLVED = S_RESOLVED << STATUS_SHIFT;\nconst _S_COMPLETED = S_COMPLETED << STATUS_SHIFT;\nconst _S_ERRORED = S_ERRORED << STATUS_SHIFT;\nconst _STATUS_MASK = STATUS_MASK;\n\nexport class OperatorImpl<B> {\n\t_value: B | undefined;\n\t_output: ((type: number, data?: any) => void) | Set<any> | null = null;\n\t_upstreamTalkbacks: Array<((type: number) => void) | null> = [];\n\t_handler: ((depIndex: number, type: number, data: any) => void) | null = null;\n\t_flags: number;\n\t_deps: Store<unknown>[];\n\t_init: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void;\n\t_getterFn: ((cached: B | undefined) => B) | undefined;\n\t_initial: B | undefined;\n\n\tget _status() {\n\t\treturn decodeStatus(this._flags);\n\t}\n\n\tconstructor(\n\t\tdeps: Store<unknown>[],\n\t\tinit: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void,\n\t\topts?: OperatorOpts<B>,\n\t) {\n\t\tthis._value = opts?.initial;\n\t\tthis._initial = opts?.initial;\n\t\tthis._deps = deps;\n\t\tthis._init = init;\n\t\tthis._getterFn = opts?.getter;\n\n\t\tlet flags = 0;\n\t\tif (opts?.resetOnTeardown) flags |= O_RESET;\n\t\tif (opts?.resubscribable) flags |= O_RESUB;\n\t\t// S_DISCONNECTED = 0, so no status bits needed\n\t\tthis._flags = flags;\n\n\t\tthis.source = this.source.bind(this);\n\n\t\tInspector.register(this as any, { kind: opts?.kind ?? \"operator\", ...opts, deps });\n\t\tfor (const dep of deps) Inspector.registerEdge(dep, this as any);\n\t}\n\n\t_dispatch(type: number, data?: any): void {\n\t\tconst output = this._output;\n\t\tif (!output) return;\n\t\tif (this._flags & O_MULTI) {\n\t\t\tfor (const sink of output as Set<any>) sink(type, data);\n\t\t} else {\n\t\t\t(output as (type: number, data?: any) => void)(type, data);\n\t\t}\n\t}\n\n\t_connectUpstream(): void {\n\t\tconst localTalkbacks: Array<((type: number) => void) | null> = new Array(\n\t\t\tthis._deps.length,\n\t\t).fill(null);\n\t\tthis._upstreamTalkbacks = localTalkbacks;\n\n\t\tlet completed = false;\n\n\t\tconst actions: Actions<B> = {\n\t\t\tseed: (value: B) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tthis._value = value;\n\t\t\t},\n\t\t\temit: (value: B) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\t\tthis._dispatch(DATA, value);\n\t\t\t},\n\t\t\tsignal: (s: Signal) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tif (s === DIRTY) this._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\telse if (s === RESOLVED) this._flags = (this._flags & ~_STATUS_MASK) | _S_RESOLVED;\n\t\t\t\tthis._dispatch(STATE, s);\n\t\t\t},\n\t\t\tcomplete: () => {\n\t\t\t\tif (completed) return;\n\t\t\t\tcompleted = true;\n\t\t\t\tthis._flags = ((this._flags | O_COMPLETED) & ~_STATUS_MASK) | _S_COMPLETED;\n\t\t\t\tthis._handler = null;\n\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t\t\t\tconst output = this._output;\n\t\t\t\tconst wasMulti = this._flags & O_MULTI;\n\t\t\t\tthis._output = null;\n\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\tif (output) {\n\t\t\t\t\tif (wasMulti) {\n\t\t\t\t\t\tfor (const sink of output as Set<any>) sink(END);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(output as (type: number, data?: any) => void)(END);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: (e: unknown) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tcompleted = true;\n\t\t\t\tthis._flags = ((this._flags | O_COMPLETED) & ~_STATUS_MASK) | _S_ERRORED;\n\t\t\t\tthis._handler = null;\n\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t\t\t\tconst output = this._output;\n\t\t\t\tconst wasMulti = this._flags & O_MULTI;\n\t\t\t\tthis._output = null;\n\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\tif (output) {\n\t\t\t\t\tif (wasMulti) {\n\t\t\t\t\t\tfor (const sink of output as Set<any>) sink(END, e);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(output as (type: number, data?: any) => void)(END, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisconnect: (dep?: number) => {\n\t\t\t\tif (dep !== undefined) {\n\t\t\t\t\tlocalTalkbacks[dep]?.(END);\n\t\t\t\t\tlocalTalkbacks[dep] = null;\n\t\t\t\t} else {\n\t\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\n\t\tthis._handler = this._init(actions);\n\n\t\tfor (let i = 0; i < this._deps.length; i++) {\n\t\t\tif (completed) break;\n\t\t\tconst depIndex = i;\n\t\t\tthis._deps[depIndex].source(START, (type: number, data: any) => {\n\t\t\t\tif (type === START) {\n\t\t\t\t\tlocalTalkbacks[depIndex] = data;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._handler?.(depIndex, type, data);\n\t\t\t});\n\t\t}\n\t}\n\n\t_disconnectUpstream(): void {\n\t\tfor (const tb of this._upstreamTalkbacks) tb?.(END);\n\t\tthis._upstreamTalkbacks = [];\n\t\tthis._handler = null;\n\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t}\n\n\tget(): B {\n\t\tif (this._getterFn && !this._output) {\n\t\t\tconst v = this._getterFn(this._value);\n\t\t\tthis._value = v;\n\t\t\treturn v;\n\t\t}\n\t\treturn this._value as B;\n\t}\n\n\tsource(type: number, payload?: any): void {\n\t\tif (type === START) {\n\t\t\tconst sink = payload;\n\t\t\tif (this._flags & O_COMPLETED) {\n\t\t\t\tif (this._flags & O_RESUB && this._output === null) {\n\t\t\t\t\tthis._flags = (this._flags & ~(O_COMPLETED | _STATUS_MASK)) | _S_DISCONNECTED;\n\t\t\t\t} else {\n\t\t\t\t\tsink(START, (_t: number) => {});\n\t\t\t\t\tsink(END);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst wasEmpty = this._output === null;\n\t\t\tif (this._output === null) {\n\t\t\t\tthis._output = sink;\n\t\t\t} else if (!(this._flags & O_MULTI)) {\n\t\t\t\tconst set = new Set<any>();\n\t\t\t\tset.add(this._output);\n\t\t\t\tset.add(sink);\n\t\t\t\tthis._output = set;\n\t\t\t\tthis._flags |= O_MULTI;\n\t\t\t} else {\n\t\t\t\t(this._output as Set<any>).add(sink);\n\t\t\t}\n\t\t\tsink(START, (t: number) => {\n\t\t\t\tif (t === DATA) sink(DATA, this._value);\n\t\t\t\tif (t === END) {\n\t\t\t\t\tif (this._output === null) return;\n\t\t\t\t\tif (this._flags & O_MULTI) {\n\t\t\t\t\t\tconst set = this._output as Set<any>;\n\t\t\t\t\t\tset.delete(sink);\n\t\t\t\t\t\tif (set.size === 1) {\n\t\t\t\t\t\t\tthis._output = set.values().next().value;\n\t\t\t\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\t\t\t} else if (set.size === 0) {\n\t\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\t\t\t\tthis._disconnectUpstream();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (this._output === sink) {\n\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\tthis._disconnectUpstream();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (wasEmpty) {\n\t\t\t\tthis._connectUpstream();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function operator<B>(\n\tdeps: Store<unknown>[],\n\tinit: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void,\n\topts?: OperatorOpts<B>,\n): Store<B> {\n\treturn new OperatorImpl<B>(deps, init, opts) as any;\n}\n"],"mappings":"kLAmCA,IAAMA,EAAc,EACdC,EAAU,EACVC,EAAU,EACVC,EAAU,EAGVC,EAAkBC,GAAkBC,EACpCC,EAAWC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E1B,GADIA,IAAMjB,GAAML,EAAKK,EAAM,KAAK,MAAM,EAClCiB,IAAMX,EAAK,CACd,GAAI,KAAK,UAAY,KAAM,OAC3B,GAAI,KAAK,OAAStC,EAAS,CAC1B,IAAMgD,EAAM,KAAK,QACjBA,EAAI,OAAOrB,CAAI,EACXqB,EAAI,OAAS,GAChB,KAAK,QAAUA,EAAI,OAAO,EAAE,KAAK,EAAE,MACnC,KAAK,QAAU,CAAChD,GACNgD,EAAI,OAAS,IACvB,KAAK,QAAU,KACf,KAAK,QAAU,CAAChD,EAChB,KAAK,oBAAoB,EAE3B,MAAW,KAAK,UAAY2B,IAC3B,KAAK,QAAU,KACf,KAAK,oBAAoB,EAE3B,CACD,CAAC,EACGoB,GACH,KAAK,iBAAiB,CAExB,CACD,CACD,EAEO,SAASG,EACfhC,EACAC,EACAC,EACW,CACX,OAAO,IAAIJ,EAAgBE,EAAMC,EAAMC,CAAI,CAC5C","names":["O_COMPLETED","O_RESET","O_RESUB","O_MULTI","_S_DISCONNECTED","S_DISCONNECTED","STATUS_SHIFT","_S_DIRTY","S_DIRTY","_S_SETTLED","S_SETTLED","_S_RESOLVED","S_RESOLVED","_S_COMPLETED","S_COMPLETED","_S_ERRORED","S_ERRORED","_STATUS_MASK","STATUS_MASK","OperatorImpl","decodeStatus","deps","init","opts","flags","Inspector","dep","type","data","output","sink","localTalkbacks","completed","actions","value","DATA","s","DIRTY","RESOLVED","STATE","tb","END","wasMulti","e","i","depIndex","START","v","payload","_t","wasEmpty","set","t","operator"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/fromObs.ts"],"sourcesContent":["import { producer } from \"../core/producer\";\nimport type { ProducerStore } from \"../core/types\";\n\ninterface Observable<T> {\n\tsubscribe(observer: {\n\t\tnext: (value: T) => void;\n\t\terror?: (err: unknown) => void;\n\t\tcomplete?: () => void;\n\t}): { unsubscribe: () => void };\n}\n\n/**\n * Creates a source from an Observable (or any object with a\n * `.subscribe({ next, error, complete })` method).\n *\n * Stateful: maintains last value via producer. get() returns the last\n * emitted value, or undefined before first emission.\n *\n * v3: Tier 2 Producer — event source, no upstream deps. Each next()\n * emission sends DIRTY on type 3 then value on type 1. Observable\n * error and complete are forwarded to downstream subscribers.\n */\nexport function fromObs<T>(observable: Observable<T>): ProducerStore<T> {\n\treturn producer<T>(({ emit, complete, error }) => {\n\t\tconst sub = observable.subscribe({\n\t\t\tnext: emit,\n\t\t\terror: (err) => error(err),\n\t\t\tcomplete: () => complete(),\n\t\t});\n\t\treturn () => sub.unsubscribe();\n\t});\n}\n"],"mappings":"wCAsBO,SAASA,EAAWC,EAA6C,CACvE,OAAOC,EAAY,CAAC,CAAE,KAAAC,EAAM,SAAAC,EAAU,MAAAC,CAAM,IAAM,CACjD,IAAMC,EAAML,EAAW,UAAU,CAChC,KAAME,EACN,MAAQI,GAAQF,EAAME,CAAG,EACzB,SAAU,IAAMH,EAAS,CAC1B,CAAC,EACD,MAAO,IAAME,EAAI,YAAY,CAC9B,CAAC,CACF","names":["fromObs","observable","producer","emit","complete","error","sub","err"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/never.ts"],"sourcesContent":["import { producer } from \"../core/producer\";\nimport type { ProducerStore } from \"../core/types\";\n\n/**\n * Creates a source that never emits, never errors, and never completes.\n *\n * Stateful: get() always returns undefined — no values are ever emitted.\n *\n * v3: Tier 2 Producer — starts but never calls emit/complete/error.\n * Cleanup function is a no-op. Tests verify no leaks from idle sources.\n */\nexport function never<T = never>(): ProducerStore<T> {\n\treturn producer<T>(() => {\n\t\treturn undefined;\n\t});\n}\n"],"mappings":"wCAWO,SAASA,GAAqC,CACpD,OAAOC,EAAY,IAAM,CAEzB,CAAC,CACF","names":["never","producer"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/fromEvent.ts"],"sourcesContent":["import { producer } from \"../core/producer\";\nimport type { ProducerStore } from \"../core/types\";\n\n/**\n * Creates a source from DOM events on the given target.\n *\n * Stateful: maintains last event via producer. get() returns the last\n * emitted event, or undefined before first event.\n *\n * v3: Tier 2 Producer — event source, no upstream deps. Each emit sends\n * DIRTY on type 3 before the value on type 1 (autoDirty: true).\n */\nexport function fromEvent<T extends Event = Event>(\n\ttarget: EventTarget,\n\teventName: string,\n): ProducerStore<T> {\n\treturn producer<T>(({ emit }) => {\n\t\tconst handler = (e: Event) => emit(e as T);\n\t\ttarget.addEventListener(eventName, handler);\n\t\treturn () => target.removeEventListener(eventName, handler);\n\t});\n}\n"],"mappings":"wCAYO,SAASA,EACfC,EACAC,EACmB,CACnB,OAAOC,EAAY,CAAC,CAAE,KAAAC,CAAK,IAAM,CAChC,IAAMC,EAAWC,GAAaF,EAAKE,CAAM,EACzC,OAAAL,EAAO,iBAAiBC,EAAWG,CAAO,EACnC,IAAMJ,EAAO,oBAAoBC,EAAWG,CAAO,CAC3D,CAAC,CACF","names":["fromEvent","target","eventName","producer","emit","handler","e"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-2BINVZ33.js";import{a as c}from"./chunk-PYRVYHZG.js";import{a as u,b as m,m as S,n as k,o as R}from"./chunk-QYUTDL4D.js";function E(...s){let r=s.map(n=>n.get());return p(s,({emit:n,signal:i,complete:w,error:y})=>{let e=new c(s.length),f=!1,a=s.length;return(t,l,o)=>{if(l===R)if(o===u){let T=e.empty();e.set(t),T&&(f=!1,i(u))}else o===m?e.test(t)&&(e.clear(t),e.empty()&&(f?n([...r]):i(m))):i(o);l===S&&(r[t]=o,e.test(t)?(e.clear(t),f=!0,e.empty()&&n([...r])):e.empty()?(i(u),n([...r])):f=!0),l===k&&(o!==void 0?y(o):(a--,a===0&&w()))}},{kind:"combine",name:"combine",initial:[...r],getter:()=>s.map(n=>n.get())})}export{E as a};
|
|
2
|
+
//# sourceMappingURL=chunk-2P6G236K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/combine.ts"],"sourcesContent":["import { Bitmask } from \"../core/bitmask\";\nimport { operator } from \"../core/operator\";\nimport { DATA, DIRTY, END, RESOLVED, STATE } from \"../core/protocol\";\nimport type { Store } from \"../core/types\";\n\n/**\n * Combines multiple sources into a single store whose value is a tuple\n * of all source values. Recomputes whenever any source changes.\n *\n * Stateful: maintains tuple value via operator()'s cache. get() returns\n * the current tuple of all source values.\n *\n * v3: Tier 1 — uses operator() with multi-dep dirty tracking via bitmask.\n * Forwards DIRTY on first dirty dep; recomputes and emits when all dirty\n * deps have resolved via DATA. If all dirty deps RESOLVED without DATA,\n * forwards RESOLVED (subtree skipping). Always produces a new array ref.\n */\nexport function combine<Sources extends Store<unknown>[]>(\n\t...sources: Sources\n): Store<{ [K in keyof Sources]: Sources[K] extends Store<infer T> ? T : never }> {\n\ttype Result = {\n\t\t[K in keyof Sources]: Sources[K] extends Store<infer T> ? T : never;\n\t};\n\tconst values = sources.map((s) => s.get());\n\n\treturn operator<Result>(\n\t\tsources as Store<unknown>[],\n\t\t({ emit, signal, complete, error }) => {\n\t\t\tconst dirtyDeps = new Bitmask(sources.length);\n\t\t\tlet anyDataReceived = false;\n\t\t\tlet activeCount = sources.length;\n\n\t\t\treturn (dep, type, data) => {\n\t\t\t\tif (type === STATE) {\n\t\t\t\t\tif (data === DIRTY) {\n\t\t\t\t\t\tconst wasClean = dirtyDeps.empty();\n\t\t\t\t\t\tdirtyDeps.set(dep);\n\t\t\t\t\t\tif (wasClean) {\n\t\t\t\t\t\t\tanyDataReceived = false;\n\t\t\t\t\t\t\tsignal(DIRTY);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (data === RESOLVED) {\n\t\t\t\t\t\tif (dirtyDeps.test(dep)) {\n\t\t\t\t\t\t\tdirtyDeps.clear(dep);\n\t\t\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\t\t\tif (anyDataReceived) {\n\t\t\t\t\t\t\t\t\temit([...values] as unknown as Result);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsignal(RESOLVED);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsignal(data); // Forward unknown STATE signals (v4 forward-compat)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (type === DATA) {\n\t\t\t\t\tvalues[dep] = data;\n\t\t\t\t\tif (dirtyDeps.test(dep)) {\n\t\t\t\t\t\tdirtyDeps.clear(dep);\n\t\t\t\t\t\tanyDataReceived = true;\n\t\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\t\temit([...values] as unknown as Result);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// DATA without prior DIRTY (raw callbag source)\n\t\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\t\tsignal(DIRTY);\n\t\t\t\t\t\t\temit([...values] as unknown as Result);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tanyDataReceived = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (type === END) {\n\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\terror(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tactiveCount--;\n\t\t\t\t\t\tif (activeCount === 0) complete();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\t{\n\t\t\tkind: \"combine\",\n\t\t\tname: \"combine\",\n\t\t\tinitial: [...values] as unknown as Result,\n\t\t\tgetter: () => sources.map((s) => s.get()) as unknown as Result,\n\t\t},\n\t);\n}\n"],"mappings":"oJAiBO,SAASA,KACZC,EAC8E,CAIjF,IAAMC,EAASD,EAAQ,IAAKE,GAAMA,EAAE,IAAI,CAAC,EAEzC,OAAOC,EACNH,EACA,CAAC,CAAE,KAAAI,EAAM,OAAAC,EAAQ,SAAAC,EAAU,MAAAC,CAAM,IAAM,CACtC,IAAMC,EAAY,IAAIC,EAAQT,EAAQ,MAAM,EACxCU,EAAkB,GAClBC,EAAcX,EAAQ,OAE1B,MAAO,CAACY,EAAKC,EAAMC,IAAS,CAC3B,GAAID,IAASE,EACZ,GAAID,IAASE,EAAO,CACnB,IAAMC,EAAWT,EAAU,MAAM,EACjCA,EAAU,IAAII,CAAG,EACbK,IACHP,EAAkB,GAClBL,EAAOW,CAAK,EAEd,MAAWF,IAASI,EACfV,EAAU,KAAKI,CAAG,IACrBJ,EAAU,MAAMI,CAAG,EACfJ,EAAU,MAAM,IACfE,EACHN,EAAK,CAAC,GAAGH,CAAM,CAAsB,EAErCI,EAAOa,CAAQ,IAKlBb,EAAOS,CAAI,EAGTD,IAASM,IACZlB,EAAOW,CAAG,EAAIE,EACVN,EAAU,KAAKI,CAAG,GACrBJ,EAAU,MAAMI,CAAG,EACnBF,EAAkB,GACdF,EAAU,MAAM,GACnBJ,EAAK,CAAC,GAAGH,CAAM,CAAsB,GAIlCO,EAAU,MAAM,GACnBH,EAAOW,CAAK,EACZZ,EAAK,CAAC,GAAGH,CAAM,CAAsB,GAErCS,EAAkB,IAIjBG,IAASO,IACRN,IAAS,OACZP,EAAMO,CAAI,GAEVH,IACIA,IAAgB,GAAGL,EAAS,GAGnC,CACD,EACA,CACC,KAAM,UACN,KAAM,UACN,QAAS,CAAC,GAAGL,CAAM,EACnB,OAAQ,IAAMD,EAAQ,IAAKE,GAAMA,EAAE,IAAI,CAAC,CACzC,CACD,CACD","names":["combine","sources","values","s","operator","emit","signal","complete","error","dirtyDeps","Bitmask","anyDataReceived","activeCount","dep","type","data","STATE","DIRTY","wasClean","RESOLVED","DATA","END"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as y}from"./chunk-2BINVZ33.js";import{b as s,m as l,n as v,o as c}from"./chunk-QYUTDL4D.js";var w=Symbol("SKIP");function K(p,...A){let n,t=!1;function f(e){let o=e;for(let u of A)if(o=u(o),o===w)return{value:void 0,skipped:!0};return{value:o,skipped:!1}}let a=f(p.get());return a.skipped||(n=a.value,t=!0),y([p],({emit:e,signal:o,complete:u,error:d})=>(k,i,r)=>{if(i===c&&o(r),i===l){let S=f(r);S.skipped?o(s):(n=S.value,t=!0,e(S.value))}i===v&&(r!==void 0?d(r):u())},{kind:"pipeRaw",name:"pipeRaw",initial:t?n:void 0,getter:()=>{let e=f(p.get());return e.skipped?t?n:void 0:(n=e.value,t=!0,e.value)}})}export{w as a,K as b};
|
|
2
|
+
//# sourceMappingURL=chunk-4AANJADQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/pipeRaw.ts"],"sourcesContent":["/**\n * pipeRaw() fuses all transform functions into a single operator() store\n * for ~2x throughput. SKIP sentinel provides filter semantics in pipeRaw.\n *\n * Stateful: returns a store (backed by operator()).\n *\n * v3: Tier 1 — uses operator() with single dep. Forwards type 3 STATE\n * signals; on type 1 DATA applies all fns sequentially, emitting the\n * result or sending RESOLVED when SKIP is returned. Pull-based get()\n * when disconnected re-evaluates the pipeline.\n */\n\nimport { operator } from \"../core/operator\";\nimport { DATA, END, RESOLVED, STATE } from \"../core/protocol\";\nimport type { Store } from \"../core/types\";\n\n// ---------------------------------------------------------------------------\n// SKIP sentinel + pipeRaw — fused pipe with a single operator store\n// ---------------------------------------------------------------------------\n\nexport const SKIP: unique symbol = Symbol(\"SKIP\");\n\nexport function pipeRaw<A, B>(source: Store<A>, f1: (v: A) => B | typeof SKIP): Store<B>;\nexport function pipeRaw<A, B, C>(\n\tsource: Store<A>,\n\tf1: (v: A) => B | typeof SKIP,\n\tf2: (v: B) => C | typeof SKIP,\n): Store<C>;\nexport function pipeRaw<A, B, C, D>(\n\tsource: Store<A>,\n\tf1: (v: A) => B | typeof SKIP,\n\tf2: (v: B) => C | typeof SKIP,\n\tf3: (v: C) => D | typeof SKIP,\n): Store<D>;\nexport function pipeRaw<A, B, C, D, E>(\n\tsource: Store<A>,\n\tf1: (v: A) => B | typeof SKIP,\n\tf2: (v: B) => C | typeof SKIP,\n\tf3: (v: C) => D | typeof SKIP,\n\tf4: (v: D) => E | typeof SKIP,\n): Store<E>;\nexport function pipeRaw(source: Store<unknown>, ...fns: Array<(v: any) => any>): Store<unknown>;\n\nexport function pipeRaw(source: Store<unknown>, ...fns: Array<(v: any) => any>): Store<unknown> {\n\t// Shared cache between handler (push) and getter (pull)\n\tlet cached: unknown;\n\tlet hasCached = false;\n\n\tfunction compute(input: unknown): { value: unknown; skipped: boolean } {\n\t\tlet v: any = input;\n\t\tfor (const fn of fns) {\n\t\t\tv = fn(v);\n\t\t\tif (v === SKIP) return { value: undefined, skipped: true };\n\t\t}\n\t\treturn { value: v, skipped: false };\n\t}\n\n\tconst initial = compute(source.get());\n\tif (!initial.skipped) {\n\t\tcached = initial.value;\n\t\thasCached = true;\n\t}\n\n\treturn operator(\n\t\t[source],\n\t\t({ emit, signal, complete, error }) => {\n\t\t\treturn (_dep, type, data) => {\n\t\t\t\tif (type === STATE) {\n\t\t\t\t\tsignal(data);\n\t\t\t\t}\n\t\t\t\tif (type === DATA) {\n\t\t\t\t\tconst result = compute(data);\n\t\t\t\t\tif (result.skipped) {\n\t\t\t\t\t\tsignal(RESOLVED);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcached = result.value;\n\t\t\t\t\t\thasCached = true;\n\t\t\t\t\t\temit(result.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (type === END) {\n\t\t\t\t\tif (data !== undefined) error(data);\n\t\t\t\t\telse complete();\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\t{\n\t\t\tkind: \"pipeRaw\",\n\t\t\tname: \"pipeRaw\",\n\t\t\tinitial: hasCached ? cached : undefined,\n\t\t\tgetter: () => {\n\t\t\t\tconst result = compute(source.get());\n\t\t\t\tif (result.skipped) return hasCached ? cached : undefined;\n\t\t\t\tcached = result.value;\n\t\t\t\thasCached = true;\n\t\t\t\treturn result.value;\n\t\t\t},\n\t\t},\n\t);\n}\n"],"mappings":"qGAoBO,IAAMA,EAAsB,OAAO,MAAM,EAuBzC,SAASC,EAAQC,KAA2BC,EAA6C,CAE/F,IAAIC,EACAC,EAAY,GAEhB,SAASC,EAAQC,EAAsD,CACtE,IAAIC,EAASD,EACb,QAAWE,KAAMN,EAEhB,GADAK,EAAIC,EAAGD,CAAC,EACJA,IAAMR,EAAM,MAAO,CAAE,MAAO,OAAW,QAAS,EAAK,EAE1D,MAAO,CAAE,MAAOQ,EAAG,QAAS,EAAM,CACnC,CAEA,IAAME,EAAUJ,EAAQJ,EAAO,IAAI,CAAC,EACpC,OAAKQ,EAAQ,UACZN,EAASM,EAAQ,MACjBL,EAAY,IAGNM,EACN,CAACT,CAAM,EACP,CAAC,CAAE,KAAAU,EAAM,OAAAC,EAAQ,SAAAC,EAAU,MAAAC,CAAM,IACzB,CAACC,EAAMC,EAAMC,IAAS,CAI5B,GAHID,IAASE,GACZN,EAAOK,CAAI,EAERD,IAASG,EAAM,CAClB,IAAMC,EAASf,EAAQY,CAAI,EACvBG,EAAO,QACVR,EAAOS,CAAQ,GAEflB,EAASiB,EAAO,MAChBhB,EAAY,GACZO,EAAKS,EAAO,KAAK,EAEnB,CACIJ,IAASM,IACRL,IAAS,OAAWH,EAAMG,CAAI,EAC7BJ,EAAS,EAEhB,EAED,CACC,KAAM,UACN,KAAM,UACN,QAAST,EAAYD,EAAS,OAC9B,OAAQ,IAAM,CACb,IAAMiB,EAASf,EAAQJ,EAAO,IAAI,CAAC,EACnC,OAAImB,EAAO,QAAgBhB,EAAYD,EAAS,QAChDA,EAASiB,EAAO,MAChBhB,EAAY,GACLgB,EAAO,MACf,CACD,CACD,CACD","names":["SKIP","pipeRaw","source","fns","cached","hasCached","compute","input","v","fn","initial","operator","emit","signal","complete","error","_dep","type","data","STATE","DATA","result","RESOLVED","END"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-OHGZIPRU.js";import{h as i}from"./chunk-LM26JNAK.js";import{a as s}from"./chunk-7WTS4C5R.js";function h(c){return l=>{let t=i(({emit:o,error:p,complete:m})=>{let e=[],a=u(l,r=>{e.push(r)},{onEnd:r=>{if(clearInterval(n),r!==void 0)p(r);else{if(e.length>0){let f=e;Object.freeze(f),e=[],o(f)}m()}}}),n=setInterval(()=>{if(e.length>0){let r=e;Object.freeze(r),e=[],o(r)}},c);return()=>{clearInterval(n),e=[],a()}},{initial:[]});return s.register(t,{kind:"bufferTime"}),t}}export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4WFD6EA7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/bufferTime.ts"],"sourcesContent":["import { Inspector } from \"../core/inspector\";\nimport { producer } from \"../core/producer\";\nimport type { Store, StoreOperator } from \"../core/types\";\nimport { subscribe } from \"./subscribe\";\n\n/**\n * Time-windowed buffering. Accumulates upstream values and flushes\n * the buffer every `ms` milliseconds.\n *\n * Stateful: maintains current buffer and last flushed array via producer.\n * get() returns the last flushed array (empty array before first flush).\n *\n * v3: Tier 2 — each flush starts a new DIRTY+value cycle (autoDirty: true).\n * No equals — each flushed array is a new reference.\n */\nexport function bufferTime<A>(ms: number): StoreOperator<A, A[]> {\n\treturn (input: Store<A>) => {\n\t\tconst store = producer<A[]>(\n\t\t\t({ emit, error, complete }) => {\n\t\t\t\tlet currentBuffer: A[] = [];\n\n\t\t\t\tconst unsub = subscribe(\n\t\t\t\t\tinput,\n\t\t\t\t\t(v) => {\n\t\t\t\t\t\tcurrentBuffer.push(v);\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tonEnd: (err) => {\n\t\t\t\t\t\t\tclearInterval(timer);\n\t\t\t\t\t\t\tif (err !== undefined) {\n\t\t\t\t\t\t\t\terror(err);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Flush remaining buffer on completion\n\t\t\t\t\t\t\t\tif (currentBuffer.length > 0) {\n\t\t\t\t\t\t\t\t\tconst flushed = currentBuffer;\n\t\t\t\t\t\t\t\t\tObject.freeze(flushed);\n\t\t\t\t\t\t\t\t\tcurrentBuffer = [];\n\t\t\t\t\t\t\t\t\temit(flushed);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tconst timer = setInterval(() => {\n\t\t\t\t\tif (currentBuffer.length > 0) {\n\t\t\t\t\t\tconst flushed = currentBuffer;\n\t\t\t\t\t\tObject.freeze(flushed);\n\t\t\t\t\t\tcurrentBuffer = [];\n\t\t\t\t\t\temit(flushed);\n\t\t\t\t\t}\n\t\t\t\t}, ms);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tclearInterval(timer);\n\t\t\t\t\tcurrentBuffer = [];\n\t\t\t\t\tunsub();\n\t\t\t\t};\n\t\t\t},\n\t\t\t{ initial: [] as A[] },\n\t\t);\n\n\t\tInspector.register(store, { kind: \"bufferTime\" });\n\t\treturn store;\n\t};\n}\n"],"mappings":"wHAeO,SAASA,EAAcC,EAAmC,CAChE,OAAQC,GAAoB,CAC3B,IAAMC,EAAQC,EACb,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,SAAAC,CAAS,IAAM,CAC9B,IAAIC,EAAqB,CAAC,EAEpBC,EAAQC,EACbR,EACCS,GAAM,CACNH,EAAc,KAAKG,CAAC,CACrB,EACA,CACC,MAAQC,GAAQ,CAEf,GADA,cAAcC,CAAK,EACfD,IAAQ,OACXN,EAAMM,CAAG,MACH,CAEN,GAAIJ,EAAc,OAAS,EAAG,CAC7B,IAAMM,EAAUN,EAChB,OAAO,OAAOM,CAAO,EACrBN,EAAgB,CAAC,EACjBH,EAAKS,CAAO,CACb,CACAP,EAAS,CACV,CACD,CACD,CACD,EAEMM,EAAQ,YAAY,IAAM,CAC/B,GAAIL,EAAc,OAAS,EAAG,CAC7B,IAAMM,EAAUN,EAChB,OAAO,OAAOM,CAAO,EACrBN,EAAgB,CAAC,EACjBH,EAAKS,CAAO,CACb,CACD,EAAGb,CAAE,EAEL,MAAO,IAAM,CACZ,cAAcY,CAAK,EACnBL,EAAgB,CAAC,EACjBC,EAAM,CACP,CACD,EACA,CAAE,QAAS,CAAC,CAAS,CACtB,EAEA,OAAAM,EAAU,SAASZ,EAAO,CAAE,KAAM,YAAa,CAAC,EACzCA,CACR,CACD","names":["bufferTime","ms","input","store","producer","emit","error","complete","currentBuffer","unsub","subscribe","v","err","timer","flushed","Inspector"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/share.ts"],"sourcesContent":["import type { Store, StoreOperator } from \"../core/types\";\n\n/**\n * No-op in callbag-recharge — stores are inherently shared (multicast).\n * Multiple subscribers connect to the same store instance.\n * Provided for API compatibility with callbag-basics.\n *\n * Stateless: returns input unchanged. No own state.\n */\nexport function share<A>(): StoreOperator<A, A> {\n\treturn (input: Store<A>) => input;\n}\n"],"mappings":"AASO,SAASA,GAAgC,CAC/C,OAAQC,GAAoBA,CAC7B","names":["share","input"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A}from"./chunk-2BINVZ33.js";import{m as f,n as i,o as u}from"./chunk-QYUTDL4D.js";function E(m){return p=>A([p],({emit:S,signal:d,complete:t,error:s,disconnect:l})=>{let n=0,e=!1;return(T,o,r)=>{o===u&&(e||d(r)),o===f&&(e||(n===m&&(e=!0,S(r),l(),t()),n++)),o===i&&(e||(e=!0,r!==void 0?s(r):t()))}})}export{E as a};
|
|
2
|
+
//# sourceMappingURL=chunk-52YSBIVX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/elementAt.ts"],"sourcesContent":["import { operator } from \"../core/operator\";\nimport { DATA, END, STATE } from \"../core/protocol\";\nimport type { Store, StoreOperator } from \"../core/types\";\n\n/**\n * Emits only the value at the given index (0-based), then disconnects and\n * completes. If upstream completes before reaching the index, sends END\n * with no DATA.\n *\n * Stateful: maintains the matched value. get() returns undefined until the\n * n-th value arrives, then the captured value (frozen after completion).\n *\n * v3: Tier 1 — uses operator() with single dep. Forwards STATE signals\n * until the target index is reached. Counts only actual DATA emissions.\n * On target, emits DATA, disconnects upstream, and completes.\n */\nexport function elementAt<A>(index: number): StoreOperator<A, A | undefined> {\n\treturn (input: Store<A>) => {\n\t\treturn operator<A | undefined>(\n\t\t\t[input] as Store<unknown>[],\n\t\t\t({ emit, signal, complete, error, disconnect }) => {\n\t\t\t\tlet count = 0;\n\t\t\t\tlet done = false;\n\n\t\t\t\treturn (_dep, type, data) => {\n\t\t\t\t\tif (type === STATE) {\n\t\t\t\t\t\tif (!done) signal(data);\n\t\t\t\t\t}\n\t\t\t\t\tif (type === DATA) {\n\t\t\t\t\t\tif (!done) {\n\t\t\t\t\t\t\tif (count === index) {\n\t\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\t\temit(data as A);\n\t\t\t\t\t\t\t\tdisconnect();\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcount++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (type === END) {\n\t\t\t\t\t\tif (!done) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\t\t\terror(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\t};\n}\n"],"mappings":"8FAgBO,SAASA,EAAaC,EAAgD,CAC5E,OAAQC,GACAC,EACN,CAACD,CAAK,EACN,CAAC,CAAE,KAAAE,EAAM,OAAAC,EAAQ,SAAAC,EAAU,MAAAC,EAAO,WAAAC,CAAW,IAAM,CAClD,IAAIC,EAAQ,EACRC,EAAO,GAEX,MAAO,CAACC,EAAMC,EAAMC,IAAS,CACxBD,IAASE,IACPJ,GAAML,EAAOQ,CAAI,GAEnBD,IAASG,IACPL,IACAD,IAAUR,IACbS,EAAO,GACPN,EAAKS,CAAS,EACdL,EAAW,EACXF,EAAS,GAEVG,MAGEG,IAASI,IACPN,IACJA,EAAO,GACHG,IAAS,OACZN,EAAMM,CAAI,EAEVP,EAAS,GAIb,CACD,CACD,CAEF","names":["elementAt","index","input","operator","emit","signal","complete","error","disconnect","count","done","_dep","type","data","STATE","DATA","END"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-PYRVYHZG.js";import{a as p}from"./chunk-7WTS4C5R.js";import{a as y,b as D,l as a,m as b,n as c,o as S,s as k,t as v}from"./chunk-QYUTDL4D.js";function w(n,T,h){let e,o=[],f=!1,t=new g(n.length),s=!1;function u(){f||(e&&e(),e=T())}k(),u();for(let r=0;r<n.length&&!f;r++){let i=r;n[i].source(a,(d,m)=>{if(d===a){o.push(m);return}if(!f&&(d===S&&(m===y?(t.empty()&&(s=!1),t.set(i)):m===D&&t.test(i)&&(t.clear(i),t.empty()&&s&&u())),d===b&&(t.test(i)?(t.clear(i),s=!0,t.empty()&&u()):t.empty()?u():s=!0),d===c)){f=!0,e&&e(),e=void 0;for(let A of o)A(c);o.length=0}})}v();let l=()=>{if(!f){f=!0,e&&e(),e=void 0;for(let r of o)r(c);o.length=0}};p.register(l,{kind:"effect",...h,deps:n});for(let r of n)p.registerEdge(r,l);return l}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-5PJCNPKY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/effect.ts"],"sourcesContent":["/**\n * Side-effect runner. Connects eagerly to deps on creation, runs fn() inline\n * when all dirty deps resolve. Returns a dispose function.\n *\n * Stateless: does not produce a store. No cached value or get().\n *\n * v3: type 3 dirty tracking across deps. Skips execution when all deps sent\n * RESOLVED (no value changed). Effects run as part of the callbag signal\n * flow — no enqueueEffect.\n *\n * Pure closure implementation — no class needed. All handler state lives in\n * closure-local variables for fastest V8 access. No instanceof usage in the\n * library, so the class shell provided no benefit.\n */\n\nimport { Bitmask } from \"./bitmask\";\nimport { Inspector } from \"./inspector\";\nimport {\n\tbeginDeferredStart,\n\tDATA,\n\tDIRTY,\n\tEND,\n\tendDeferredStart,\n\tRESOLVED,\n\tSTART,\n\tSTATE,\n} from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport function effect(\n\tdeps: Store<unknown>[],\n\tfn: () => undefined | (() => void),\n\topts?: { name?: string },\n): () => void {\n\tlet cleanup: (() => void) | undefined;\n\tconst talkbacks: Array<(type: number) => void> = [];\n\tlet disposed = false;\n\tconst dirtyDeps = new Bitmask(deps.length);\n\tlet anyDataReceived = false;\n\n\tfunction run(): void {\n\t\tif (disposed) return;\n\t\tif (cleanup) cleanup();\n\t\tcleanup = fn();\n\t}\n\n\tbeginDeferredStart();\n\n\trun();\n\n\tfor (let i = 0; i < deps.length; i++) {\n\t\tif (disposed) break;\n\t\tconst depIndex = i;\n\t\tdeps[depIndex].source(START, (type: number, data: any) => {\n\t\t\tif (type === START) {\n\t\t\t\ttalkbacks.push(data);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (disposed) return;\n\t\t\tif (type === STATE) {\n\t\t\t\tif (data === DIRTY) {\n\t\t\t\t\tif (dirtyDeps.empty()) anyDataReceived = false;\n\t\t\t\t\tdirtyDeps.set(depIndex);\n\t\t\t\t} else if (data === RESOLVED) {\n\t\t\t\t\tif (dirtyDeps.test(depIndex)) {\n\t\t\t\t\t\tdirtyDeps.clear(depIndex);\n\t\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\t\tif (anyDataReceived) run();\n\t\t\t\t\t\t\t// else: all deps RESOLVED, skip\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (type === DATA) {\n\t\t\t\tif (dirtyDeps.test(depIndex)) {\n\t\t\t\t\tdirtyDeps.clear(depIndex);\n\t\t\t\t\tanyDataReceived = true;\n\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\trun();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// DATA without prior DIRTY: raw callbag source or batch\n\t\t\t\t\t// edge case. Match derived's behavior — treat as immediate.\n\t\t\t\t\tif (dirtyDeps.empty()) {\n\t\t\t\t\t\trun();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tanyDataReceived = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (type === END) {\n\t\t\t\t// Dep completed or errored — dispose the effect.\n\t\t\t\tdisposed = true;\n\t\t\t\tif (cleanup) cleanup();\n\t\t\t\tcleanup = undefined;\n\t\t\t\tfor (const tb of talkbacks) tb(END);\n\t\t\t\ttalkbacks.length = 0;\n\t\t\t}\n\t\t});\n\t}\n\n\tendDeferredStart();\n\n\tconst dispose = () => {\n\t\tif (disposed) return;\n\t\tdisposed = true;\n\t\tif (cleanup) cleanup();\n\t\tcleanup = undefined;\n\t\tfor (const tb of talkbacks) tb(END);\n\t\ttalkbacks.length = 0;\n\t};\n\n\tInspector.register(dispose, { kind: \"effect\", ...opts, deps });\n\tfor (const dep of deps) Inspector.registerEdge(dep, dispose);\n\n\treturn dispose;\n}\n"],"mappings":"yKA6BO,SAASA,EACfC,EACAC,EACAC,EACa,CACb,IAAIC,EACEC,EAA2C,CAAC,EAC9CC,EAAW,GACTC,EAAY,IAAIC,EAAQP,EAAK,MAAM,EACrCQ,EAAkB,GAEtB,SAASC,GAAY,CAChBJ,IACAF,GAASA,EAAQ,EACrBA,EAAUF,EAAG,EACd,CAEAS,EAAmB,EAEnBD,EAAI,EAEJ,QAASE,EAAI,EAAGA,EAAIX,EAAK,QACpB,CAAAK,EAD4BM,IAAK,CAErC,IAAMC,EAAWD,EACjBX,EAAKY,CAAQ,EAAE,OAAOC,EAAO,CAACC,EAAcC,IAAc,CACzD,GAAID,IAASD,EAAO,CACnBT,EAAU,KAAKW,CAAI,EACnB,MACD,CACA,GAAI,CAAAV,IACAS,IAASE,IACRD,IAASE,GACRX,EAAU,MAAM,IAAGE,EAAkB,IACzCF,EAAU,IAAIM,CAAQ,GACZG,IAASG,GACfZ,EAAU,KAAKM,CAAQ,IAC1BN,EAAU,MAAMM,CAAQ,EACpBN,EAAU,MAAM,GACfE,GAAiBC,EAAI,IAMzBK,IAASK,IACRb,EAAU,KAAKM,CAAQ,GAC1BN,EAAU,MAAMM,CAAQ,EACxBJ,EAAkB,GACdF,EAAU,MAAM,GACnBG,EAAI,GAKDH,EAAU,MAAM,EACnBG,EAAI,EAEJD,EAAkB,IAIjBM,IAASM,GAAK,CAEjBf,EAAW,GACPF,GAASA,EAAQ,EACrBA,EAAU,OACV,QAAWkB,KAAMjB,EAAWiB,EAAGD,CAAG,EAClChB,EAAU,OAAS,CACpB,CACD,CAAC,CACF,CAEAkB,EAAiB,EAEjB,IAAMC,EAAU,IAAM,CACrB,GAAI,CAAAlB,EACJ,CAAAA,EAAW,GACPF,GAASA,EAAQ,EACrBA,EAAU,OACV,QAAWkB,KAAMjB,EAAWiB,EAAGD,CAAG,EAClChB,EAAU,OAAS,EACpB,EAEAoB,EAAU,SAASD,EAAS,CAAE,KAAM,SAAU,GAAGrB,EAAM,KAAAF,CAAK,CAAC,EAC7D,QAAWyB,KAAOzB,EAAMwB,EAAU,aAAaC,EAAKF,CAAO,EAE3D,OAAOA,CACR","names":["effect","deps","fn","opts","cleanup","talkbacks","disposed","dirtyDeps","Bitmask","anyDataReceived","run","beginDeferredStart","i","depIndex","START","type","data","STATE","DIRTY","RESOLVED","DATA","END","tb","endDeferredStart","dispose","Inspector","dep"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as S}from"./chunk-OHGZIPRU.js";import{h as b}from"./chunk-LM26JNAK.js";import{a as d}from"./chunk-7WTS4C5R.js";import{l as f,n as a}from"./chunk-QYUTDL4D.js";function I(s,r){return x=>{let l=b(({emit:c,error:p,complete:B})=>{let t=null,i=!1,m=!1,n=[],h=r?.maxBuffer??1/0;function g(){if(n.length===0){i=!1,m&&B();return}A(s(n.shift()))}function A(e){i=!0,c(e.get()),e.source(f,(u,o)=>{u===f&&(t=o),u===1&&c(o),u===a&&(t=null,o!==void 0?p(o):g())})}let v=S(x,e=>{i?(n.length>=h&&n.shift(),n.push(e)):A(s(e))},{onEnd:e=>{e!==void 0?p(e):(m=!0,i||B())}});return()=>{t&&t(a),v(),n.length=0}},r&&"initial"in r?{initial:r.initial}:void 0);return d.register(l,{kind:"concatMap"}),l}}export{I as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6YHJJXF4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extra/concatMap.ts"],"sourcesContent":["import { Inspector } from \"../core/inspector\";\nimport { producer } from \"../core/producer\";\nimport { END, START } from \"../core/protocol\";\nimport type { Store, StoreOperator } from \"../core/types\";\nimport { subscribe } from \"./subscribe\";\n\n/**\n * Maps each upstream value to an inner store via `fn`, subscribing sequentially.\n * New outer values are queued while an inner is active; the next queued value is\n * processed when the current inner completes (sends END).\n *\n * v5 (Option D3): Purely reactive — does NOT eagerly evaluate fn(outer.get()).\n * Inner subscription is only created when outer emits. get() returns `initial`\n * (if provided) or undefined before first inner emission.\n *\n * Tier 2 — dynamic subscription operator. Each inner is a cycle boundary;\n * each emit starts a new DIRTY+value cycle. No built-in dedup.\n * Forwards inner errors and upstream completion.\n *\n * `maxBuffer` limits queued outer values. When exceeded, oldest queued values\n * are dropped (backpressure). Default: no limit.\n */\nexport function concatMap<A, B>(fn: (value: A) => Store<B>): StoreOperator<A, B | undefined>;\nexport function concatMap<A, B>(\n\tfn: (value: A) => Store<B>,\n\topts: { initial: B; maxBuffer?: number },\n): StoreOperator<A, B>;\nexport function concatMap<A, B>(\n\tfn: (value: A) => Store<B>,\n\topts?: { initial?: B; maxBuffer?: number },\n): StoreOperator<A, B | undefined> {\n\treturn (outer: Store<A>) => {\n\t\tconst store = producer<B>(\n\t\t\t({ emit, error, complete }) => {\n\t\t\t\tlet innerTalkback: ((type: number) => void) | null = null;\n\t\t\t\tlet innerActive = false;\n\t\t\t\tlet outerDone = false;\n\t\t\t\tconst queue: A[] = [];\n\t\t\t\tconst maxBuffer = opts?.maxBuffer ?? Infinity;\n\n\t\t\t\tfunction processNext() {\n\t\t\t\t\tif (queue.length === 0) {\n\t\t\t\t\t\tinnerActive = false;\n\t\t\t\t\t\tif (outerDone) complete();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsubscribeInner(fn(queue.shift() as A));\n\t\t\t\t}\n\n\t\t\t\tfunction subscribeInner(innerStore: Store<B>) {\n\t\t\t\t\tinnerActive = true;\n\t\t\t\t\temit(innerStore.get());\n\t\t\t\t\tinnerStore.source(START, (type: number, data: unknown) => {\n\t\t\t\t\t\tif (type === START) innerTalkback = data as (type: number) => void;\n\t\t\t\t\t\tif (type === 1) emit(data as B);\n\t\t\t\t\t\tif (type === END) {\n\t\t\t\t\t\t\tinnerTalkback = null;\n\t\t\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\t\t\terror(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tprocessNext();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst outerUnsub = subscribe(\n\t\t\t\t\touter,\n\t\t\t\t\t(v) => {\n\t\t\t\t\t\tif (!innerActive) {\n\t\t\t\t\t\t\tsubscribeInner(fn(v));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (queue.length >= maxBuffer) queue.shift();\n\t\t\t\t\t\t\tqueue.push(v);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tonEnd: (err) => {\n\t\t\t\t\t\t\tif (err !== undefined) {\n\t\t\t\t\t\t\t\terror(err);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\touterDone = true;\n\t\t\t\t\t\t\t\tif (!innerActive) complete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tif (innerTalkback) innerTalkback(END);\n\t\t\t\t\touterUnsub();\n\t\t\t\t\tqueue.length = 0;\n\t\t\t\t};\n\t\t\t},\n\t\t\topts && \"initial\" in opts ? { initial: opts.initial as B } : undefined,\n\t\t);\n\n\t\tInspector.register(store, { kind: \"concatMap\" });\n\t\treturn store;\n\t};\n}\n"],"mappings":"uKA2BO,SAASA,EACfC,EACAC,EACkC,CAClC,OAAQC,GAAoB,CAC3B,IAAMC,EAAQC,EACb,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,SAAAC,CAAS,IAAM,CAC9B,IAAIC,EAAiD,KACjDC,EAAc,GACdC,EAAY,GACVC,EAAa,CAAC,EACdC,EAAYX,GAAM,WAAa,IAErC,SAASY,GAAc,CACtB,GAAIF,EAAM,SAAW,EAAG,CACvBF,EAAc,GACVC,GAAWH,EAAS,EACxB,MACD,CACAO,EAAed,EAAGW,EAAM,MAAM,CAAM,CAAC,CACtC,CAEA,SAASG,EAAeC,EAAsB,CAC7CN,EAAc,GACdJ,EAAKU,EAAW,IAAI,CAAC,EACrBA,EAAW,OAAOC,EAAO,CAACC,EAAcC,IAAkB,CACrDD,IAASD,IAAOR,EAAgBU,GAChCD,IAAS,GAAGZ,EAAKa,CAAS,EAC1BD,IAASE,IACZX,EAAgB,KACZU,IAAS,OACZZ,EAAMY,CAAI,EAEVL,EAAY,EAGf,CAAC,CACF,CAEA,IAAMO,EAAaC,EAClBnB,EACCoB,GAAM,CACDb,GAGAE,EAAM,QAAUC,GAAWD,EAAM,MAAM,EAC3CA,EAAM,KAAKW,CAAC,GAHZR,EAAed,EAAGsB,CAAC,CAAC,CAKtB,EACA,CACC,MAAQC,GAAQ,CACXA,IAAQ,OACXjB,EAAMiB,CAAG,GAETb,EAAY,GACPD,GAAaF,EAAS,EAE7B,CACD,CACD,EAEA,MAAO,IAAM,CACRC,GAAeA,EAAcW,CAAG,EACpCC,EAAW,EACXT,EAAM,OAAS,CAChB,CACD,EACAV,GAAQ,YAAaA,EAAO,CAAE,QAASA,EAAK,OAAa,EAAI,MAC9D,EAEA,OAAAuB,EAAU,SAASrB,EAAO,CAAE,KAAM,WAAY,CAAC,EACxCA,CACR,CACD","names":["concatMap","fn","opts","outer","store","producer","emit","error","complete","innerTalkback","innerActive","outerDone","queue","maxBuffer","processNext","subscribeInner","innerStore","START","type","data","END","outerUnsub","subscribe","v","err","Inspector"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as w}from"./chunk-IZ5GFMMK.js";import{a as x}from"./chunk-K7VPCAZD.js";import{p as l,v as m}from"./chunk-QYUTDL4D.js";var R=0;_.from=function(S){let i=_({id:S.id});for(let[n,s]of Object.entries(S.index))for(let d of s)i.add(d,[n]);return i};function _(I){let S=++R,i=I?.id??`ridx-${S}`,n=new Map,s=new Map,d=new Map,v=new Map,a=x(0,{name:`${i}:ver`}),z=w([a],()=>Array.from(n.keys()),{name:`${i}:keys`}),k=w([a],()=>n.size,{name:`${i}:size`}),g=!1,$=Object.freeze(new Set);function C(e){let t=d.get(e);return t||(t=x(n.get(e)??new Set,{name:`${i}:${e}`,equals:()=>!1}),d.set(e,t)),t}function p(e){let t=d.get(e);if(t){let r=n.get(e);t.set(r?new Set(r):new Set)}}function b(e,t){let r=n.get(t),o=!r;return r||(r=new Set,n.set(t,r)),r.add(e),o}function h(e,t){let r=n.get(t);return r?(r.delete(e),r.size===0?(n.delete(t),!0):!1):!1}return{get id(){return i},get version(){return a.get()},get(e){let t=n.get(e);return t?Object.freeze(new Set(t)):$},has(e){let t=n.get(e);return t!==void 0&&t.size>0},keys(){return Array.from(n.keys())},get size(){return n.size},select(e){let t=v.get(e);if(t)return t;let r=C(e);return t=w([r],()=>r.get(),{name:`${i}:${e}:select`}),v.set(e,t),t},keysStore:z,sizeStore:k,add(e,t){if(g||t.length===0)return;let r=s.get(e);r||(r=new Set,s.set(e,r)),l(()=>{let o=!1;for(let c of t)r.add(c),b(e,c)&&(o=!0),p(c);o&&a.update(c=>c+1)})},remove(e){if(g)return;let t=s.get(e);t&&l(()=>{let r=!1;for(let o of t)h(e,o)&&(r=!0),p(o);s.delete(e),r&&a.update(o=>o+1)})},update(e,t){if(g)return;let r=s.get(e),o=new Set(t);l(()=>{let c=!1;if(r)for(let f of r)o.has(f)||(h(e,f)&&(c=!0),p(f));let u=s.get(e);u||(u=new Set,s.set(e,u)),u.clear();for(let f of t)u.add(f),b(e,f)&&(c=!0),p(f);c&&a.update(f=>f+1)})},clear(){n.size!==0&&l(()=>{n.clear(),s.clear();for(let e of d.values())e.set(new Set);a.update(e=>e+1)})},snapshot(){let e={};for(let[t,r]of n)e[t]=Array.from(r);return{type:"reactiveIndex",id:i,version:a.get(),index:e}},destroy(){if(!g){g=!0,n.clear(),s.clear();for(let e of d.values())m(e);d.clear();for(let e of v.values())m(e);v.clear(),m(a)}}}}export{_ as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7CQ6XF2G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/data/reactiveIndex.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// ReactiveIndex — Level 3 reactive secondary index\n// ---------------------------------------------------------------------------\n// Maintains a reverse mapping: indexKey → Set<primaryKey>.\n// Designed to be driven by a source data structure (reactiveMap, collection)\n// that calls add/remove/update when entries change.\n//\n// Architecture:\n// - _index: Map<string, Set<string>> — source of truth\n// - _reverse: Map<string, Set<string>> — primaryKey → indexKeys (for fast update/remove)\n// - _states: Map<string, WritableStore<Set<string>>> — per-indexKey reactive stores\n// - _version: state<number> — bumped on structural changes (key add/remove)\n//\n// Usage:\n// const tagIndex = reactiveIndex<User>({ keyFn: (u) => u.tags });\n// tagIndex.add(\"u1\", [\"admin\", \"active\"]);\n// tagIndex.get(\"admin\"); // Set{\"u1\"}\n// tagIndex.select(\"admin\").get(); // reactive Set{\"u1\"}\n// ---------------------------------------------------------------------------\n\nimport { derived } from \"../core/derived\";\nimport { batch, teardown } from \"../core/protocol\";\nimport { state } from \"../core/state\";\nimport type { Store, WritableStore } from \"../core/types\";\nimport type { IndexSnapshot, ReactiveIndex } from \"./types\";\n\nlet indexCounter = 0;\n\nexport interface ReactiveIndexCreateOptions {\n\t/** User-specified ID. Auto-generated if omitted. */\n\tid?: string;\n}\n\n/**\n * Restore a reactiveIndex from a snapshot. Preserves id; version resets to 0.\n */\nreactiveIndex.from = function from(snap: IndexSnapshot): ReactiveIndex {\n\tconst idx = reactiveIndex({ id: snap.id });\n\tfor (const [indexKey, primaryKeys] of Object.entries(snap.index)) {\n\t\tfor (const pk of primaryKeys) idx.add(pk, [indexKey]);\n\t}\n\treturn idx;\n};\n\nexport function reactiveIndex(opts?: ReactiveIndexCreateOptions): ReactiveIndex {\n\tconst counter = ++indexCounter;\n\tconst nodeId = opts?.id ?? `ridx-${counter}`;\n\n\t// indexKey → Set<primaryKey>\n\tconst _index = new Map<string, Set<string>>();\n\n\t// primaryKey → Set<indexKey> (reverse map for fast update/remove)\n\tconst _reverse = new Map<string, Set<string>>();\n\n\t// Internal reactive stores per index key\n\tconst _states = new Map<string, WritableStore<Set<string>>>();\n\n\t// Cached select() derived stores\n\tconst _selects = new Map<string, Store<Set<string>>>();\n\n\t// Version counter — bumped on index key add/remove\n\tconst _version = state<number>(0, { name: `${nodeId}:ver` });\n\n\tconst _keysStore: Store<string[]> = derived([_version], () => Array.from(_index.keys()), {\n\t\tname: `${nodeId}:keys`,\n\t});\n\n\tconst _sizeStore: Store<number> = derived([_version], () => _index.size, {\n\t\tname: `${nodeId}:size`,\n\t});\n\n\tlet destroyed = false;\n\n\tconst _emptySet: Set<string> = Object.freeze(new Set<string>()) as Set<string>;\n\n\t// ---- Internal helpers ----\n\n\tfunction _getOrCreateState(indexKey: string): WritableStore<Set<string>> {\n\t\tlet s = _states.get(indexKey);\n\t\tif (!s) {\n\t\t\ts = state<Set<string>>(_index.get(indexKey) ?? new Set(), {\n\t\t\t\tname: `${nodeId}:${indexKey}`,\n\t\t\t\tequals: () => false, // Sets are mutable — always emit on update\n\t\t\t});\n\t\t\t_states.set(indexKey, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\tfunction _syncState(indexKey: string): void {\n\t\tconst s = _states.get(indexKey);\n\t\tif (s) {\n\t\t\tconst current = _index.get(indexKey);\n\t\t\ts.set(current ? new Set(current) : new Set());\n\t\t}\n\t}\n\n\tfunction _addToIndex(primaryKey: string, indexKey: string): boolean {\n\t\tlet set = _index.get(indexKey);\n\t\tconst isNewKey = !set;\n\t\tif (!set) {\n\t\t\tset = new Set();\n\t\t\t_index.set(indexKey, set);\n\t\t}\n\t\tset.add(primaryKey);\n\t\treturn isNewKey;\n\t}\n\n\tfunction _removeFromIndex(primaryKey: string, indexKey: string): boolean {\n\t\tconst set = _index.get(indexKey);\n\t\tif (!set) return false;\n\t\tset.delete(primaryKey);\n\t\tif (set.size === 0) {\n\t\t\t_index.delete(indexKey);\n\t\t\treturn true; // key removed\n\t\t}\n\t\treturn false;\n\t}\n\n\t// ---- Public API ----\n\n\tconst idx: ReactiveIndex = {\n\t\tget id() {\n\t\t\treturn nodeId;\n\t\t},\n\t\tget version() {\n\t\t\treturn _version.get();\n\t\t},\n\n\t\tget(indexKey: string): Set<string> {\n\t\t\tconst set = _index.get(indexKey);\n\t\t\treturn set ? (Object.freeze(new Set(set)) as Set<string>) : _emptySet;\n\t\t},\n\n\t\thas(indexKey: string): boolean {\n\t\t\tconst set = _index.get(indexKey);\n\t\t\treturn set !== undefined && set.size > 0;\n\t\t},\n\n\t\tkeys(): string[] {\n\t\t\treturn Array.from(_index.keys());\n\t\t},\n\n\t\tget size() {\n\t\t\treturn _index.size;\n\t\t},\n\n\t\t// --- Reactive ---\n\n\t\tselect(indexKey: string): Store<Set<string>> {\n\t\t\tlet cached = _selects.get(indexKey);\n\t\t\tif (cached) return cached;\n\n\t\t\tconst internal = _getOrCreateState(indexKey);\n\t\t\tcached = derived([internal], () => internal.get(), {\n\t\t\t\tname: `${nodeId}:${indexKey}:select`,\n\t\t\t});\n\t\t\t_selects.set(indexKey, cached);\n\t\t\treturn cached;\n\t\t},\n\n\t\tkeysStore: _keysStore,\n\t\tsizeStore: _sizeStore,\n\n\t\t// --- Mutation ---\n\n\t\tadd(primaryKey: string, indexKeys: string[]): void {\n\t\t\tif (destroyed || indexKeys.length === 0) return;\n\n\t\t\t// Track reverse mapping\n\t\t\tlet reverseSet = _reverse.get(primaryKey);\n\t\t\tif (!reverseSet) {\n\t\t\t\treverseSet = new Set();\n\t\t\t\t_reverse.set(primaryKey, reverseSet);\n\t\t\t}\n\n\t\t\tbatch(() => {\n\t\t\t\tlet structuralChange = false;\n\t\t\t\tfor (const indexKey of indexKeys) {\n\t\t\t\t\treverseSet!.add(indexKey);\n\t\t\t\t\tif (_addToIndex(primaryKey, indexKey)) structuralChange = true;\n\t\t\t\t\t_syncState(indexKey);\n\t\t\t\t}\n\t\t\t\tif (structuralChange) _version.update((v) => v + 1);\n\t\t\t});\n\t\t},\n\n\t\tremove(primaryKey: string): void {\n\t\t\tif (destroyed) return;\n\t\t\tconst reverseSet = _reverse.get(primaryKey);\n\t\t\tif (!reverseSet) return;\n\n\t\t\tbatch(() => {\n\t\t\t\tlet structuralChange = false;\n\t\t\t\tfor (const indexKey of reverseSet!) {\n\t\t\t\t\tif (_removeFromIndex(primaryKey, indexKey)) structuralChange = true;\n\t\t\t\t\t_syncState(indexKey);\n\t\t\t\t}\n\t\t\t\t_reverse.delete(primaryKey);\n\t\t\t\tif (structuralChange) _version.update((v) => v + 1);\n\t\t\t});\n\t\t},\n\n\t\tupdate(primaryKey: string, indexKeys: string[]): void {\n\t\t\tif (destroyed) return;\n\t\t\tconst oldKeys = _reverse.get(primaryKey);\n\t\t\tconst newKeySet = new Set(indexKeys);\n\n\t\t\tbatch(() => {\n\t\t\t\tlet structuralChange = false;\n\n\t\t\t\t// Remove from old keys not in new set\n\t\t\t\tif (oldKeys) {\n\t\t\t\t\tfor (const oldKey of oldKeys) {\n\t\t\t\t\t\tif (!newKeySet.has(oldKey)) {\n\t\t\t\t\t\t\tif (_removeFromIndex(primaryKey, oldKey)) structuralChange = true;\n\t\t\t\t\t\t\t_syncState(oldKey);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Add to new keys\n\t\t\t\tlet reverseSet = _reverse.get(primaryKey);\n\t\t\t\tif (!reverseSet) {\n\t\t\t\t\treverseSet = new Set();\n\t\t\t\t\t_reverse.set(primaryKey, reverseSet);\n\t\t\t\t}\n\t\t\t\treverseSet.clear();\n\n\t\t\t\tfor (const indexKey of indexKeys) {\n\t\t\t\t\treverseSet.add(indexKey);\n\t\t\t\t\tif (_addToIndex(primaryKey, indexKey)) structuralChange = true;\n\t\t\t\t\t_syncState(indexKey);\n\t\t\t\t}\n\n\t\t\t\tif (structuralChange) _version.update((v) => v + 1);\n\t\t\t});\n\t\t},\n\n\t\tclear(): void {\n\t\t\tif (_index.size === 0) return;\n\t\t\tbatch(() => {\n\t\t\t\t_index.clear();\n\t\t\t\t_reverse.clear();\n\t\t\t\t// Reset all tracked states to empty\n\t\t\t\tfor (const s of _states.values()) s.set(new Set());\n\t\t\t\t_version.update((v) => v + 1);\n\t\t\t});\n\t\t},\n\n\t\t// --- Serialization ---\n\n\t\tsnapshot(): IndexSnapshot {\n\t\t\tconst index: Record<string, string[]> = {};\n\t\t\tfor (const [key, set] of _index) {\n\t\t\t\tindex[key] = Array.from(set);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"reactiveIndex\",\n\t\t\t\tid: nodeId,\n\t\t\t\tversion: _version.get(),\n\t\t\t\tindex,\n\t\t\t};\n\t\t},\n\n\t\t// --- Lifecycle ---\n\n\t\tdestroy(): void {\n\t\t\tif (destroyed) return;\n\t\t\tdestroyed = true;\n\t\t\t_index.clear();\n\t\t\t_reverse.clear();\n\n\t\t\tfor (const s of _states.values()) teardown(s);\n\t\t\t_states.clear();\n\n\t\t\tfor (const s of _selects.values()) teardown(s);\n\t\t\t_selects.clear();\n\n\t\t\tteardown(_version);\n\t\t},\n\t};\n\n\treturn idx;\n}\n"],"mappings":"+HA0BA,IAAIA,EAAe,EAUnBC,EAAc,KAAO,SAAcC,EAAoC,CACtE,IAAMC,EAAMF,EAAc,CAAE,GAAIC,EAAK,EAAG,CAAC,EACzC,OAAW,CAACE,EAAUC,CAAW,IAAK,OAAO,QAAQH,EAAK,KAAK,EAC9D,QAAWI,KAAMD,EAAaF,EAAI,IAAIG,EAAI,CAACF,CAAQ,CAAC,EAErD,OAAOD,CACR,EAEO,SAASF,EAAcM,EAAkD,CAC/E,IAAMC,EAAU,EAAER,EACZS,EAASF,GAAM,IAAM,QAAQC,CAAO,GAGpCE,EAAS,IAAI,IAGbC,EAAW,IAAI,IAGfC,EAAU,IAAI,IAGdC,EAAW,IAAI,IAGfC,EAAWC,EAAc,EAAG,CAAE,KAAM,GAAGN,CAAM,MAAO,CAAC,EAErDO,EAA8BC,EAAQ,CAACH,CAAQ,EAAG,IAAM,MAAM,KAAKJ,EAAO,KAAK,CAAC,EAAG,CACxF,KAAM,GAAGD,CAAM,OAChB,CAAC,EAEKS,EAA4BD,EAAQ,CAACH,CAAQ,EAAG,IAAMJ,EAAO,KAAM,CACxE,KAAM,GAAGD,CAAM,OAChB,CAAC,EAEGU,EAAY,GAEVC,EAAyB,OAAO,OAAO,IAAI,GAAa,EAI9D,SAASC,EAAkBjB,EAA8C,CACxE,IAAIkB,EAAIV,EAAQ,IAAIR,CAAQ,EAC5B,OAAKkB,IACJA,EAAIP,EAAmBL,EAAO,IAAIN,CAAQ,GAAK,IAAI,IAAO,CACzD,KAAM,GAAGK,CAAM,IAAIL,CAAQ,GAC3B,OAAQ,IAAM,EACf,CAAC,EACDQ,EAAQ,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AAU,EACnCO,IACJA,EAAa,IAAI,IACjBtB,EAAS,IAAIe,EAAYO,CAAU,GAEpCA,EAAW,MAAM,EAEjB,QAAW7B,KAAY4B,EACtBC,EAAW,IAAI7B,CAAQ,EACnBqB,EAAYC,EAAYtB,CAAQ,IAAG+B,EAAmB,IAC1DZ,EAAWnB,CAAQ,EAGhB+B,GAAkBrB,EAAS,OAAQsB,GAAMA,EAAI,CAAC,CACnD,CAAC,CACF,EAEA,OAAc,CACT1B,EAAO,OAAS,GACpBwB,EAAM,IAAM,CACXxB,EAAO,MAAM,EACbC,EAAS,MAAM,EAEf,QAAWW,KAAKV,EAAQ,OAAO,EAAGU,EAAE,IAAI,IAAI,GAAK,EACjDR,EAAS,OAAQsB,GAAMA,EAAI,CAAC,CAC7B,CAAC,CACF,EAIA,UAA0B,CACzB,IAAMI,EAAkC,CAAC,EACzC,OAAW,CAACC,EAAKd,CAAG,IAAKjB,EACxB8B,EAAMC,CAAG,EAAI,MAAM,KAAKd,CAAG,EAE5B,MAAO,CACN,KAAM,gBACN,GAAIlB,EACJ,QAASK,EAAS,IAAI,EACtB,MAAA0B,CACD,CACD,EAIA,SAAgB,CACf,GAAI,CAAArB,EACJ,CAAAA,EAAY,GACZT,EAAO,MAAM,EACbC,EAAS,MAAM,EAEf,QAAWW,KAAKV,EAAQ,OAAO,EAAG8B,EAASpB,CAAC,EAC5CV,EAAQ,MAAM,EAEd,QAAWU,KAAKT,EAAS,OAAO,EAAG6B,EAASpB,CAAC,EAC7CT,EAAS,MAAM,EAEf6B,EAAS5B,CAAQ,EAClB,CACD,CAGD","names":["indexCounter","reactiveIndex","snap","idx","indexKey","primaryKeys","pk","opts","counter","nodeId","_index","_reverse","_states","_selects","_version","state","_keysStore","derived","_sizeStore","destroyed","_emptySet","_getOrCreateState","s","_syncState","current","_addToIndex","primaryKey","set","isNewKey","_removeFromIndex","cached","internal","indexKeys","reverseSet","batch","structuralChange","v","oldKeys","newKeySet","oldKey","index","key","teardown"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as g,b as f,l as c,m as p,n as l,o as v}from"./chunk-QYUTDL4D.js";var b=class e{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static get enabled(){if(e._explicitEnabled!==null)return e._explicitEnabled;if(e._cachedDefault!==null)return e._cachedDefault;try{e._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{e._cachedDefault=!0}return e._cachedDefault}static set enabled(t){e._explicitEnabled=t}static _depSuffix(t){if(!t?.length)return;let s=t.map(n=>e._names.get(n)??"?").join(",");return s.length>40?`${s.slice(0,37)}...`:s}static _resolveKey(t){return e._keys.get(t)??e._names.get(t)??"anonymous"}static register(t,a){if(!e.enabled)return;a?.name&&e._names.set(t,a.name),a?.kind&&e._kinds.set(t,a.kind);let s=e._nextId++,n=a?.name;if(!(n&&!e._usedKeys.has(n)))if(n){let r=e._depSuffix(a?.deps);n=r?`${n}(${r})`:`${n}_${s}`,e._usedKeys.has(n)&&(n=`${n}_${s}`)}else{let r=a?.kind??"store",i=e._depSuffix(a?.deps);n=i?`${r}(${i})`:`${r}_${s}`,e._usedKeys.has(n)&&(n=`${n}_${s}`)}e._usedKeys.add(n),e._keys.set(t,n),e._stores.add(new WeakRef(t))}static registerEdge(t,a){if(!e.enabled)return;let s=e._resolveKey(t),n=e._resolveKey(a),r=e._edges.get(s);r?r.includes(n)||r.push(n):e._edges.set(s,[n])}static getEdges(){return new Map(e._edges)}static getName(t){if(e.enabled)return e._names.get(t)}static getKind(t){return e._kinds.get(t)}static inspect(t){return{name:e._names.get(t),kind:e._kinds.get(t)??"unknown",value:typeof t.get=="function"?t.get():void 0,status:t._status}}static graph(){let t=new Map,a=new Set;for(let s of e._stores){let n=s.deref();if(!n){e._stores.delete(s);continue}let r=e._resolveKey(n);a.add(r),t.set(r,e.inspect(n))}for(let[s,n]of e._edges){if(!a.has(s)){e._edges.delete(s),e._usedKeys.delete(s);continue}let r=n.filter(i=>a.has(i));r.length===0?e._edges.delete(s):r.length!==n.length&&e._edges.set(s,r)}return t}static trace(t,a){let s=null,n=t.get();return t.source(c,(r,i)=>{if(r===c&&(s=i),r===l){s=null;return}if(r===1){let d=i;if(!Object.is(d,n)){let o=n;n=d,a(d,o)}}}),()=>s?.(l)}static dumpGraph(){let t=e.graph(),a=e.getEdges(),s=new Map;for(let[i,d]of a)for(let o of d){let u=s.get(o);u?u.includes(i)||u.push(i):s.set(o,[i])}let n=[];for(let[i,d]of t){let o=s.get(i),u=a.get(i),y=o?.length?` \u2190 [${o.join(", ")}]`:"",h=u?.length?` \u2192 [${u.join(", ")}]`:"";n.push(` ${i} (${d.kind}) = ${JSON.stringify(d.value)} [${d.status??"?"}]${y}${h}`)}return[`Store Graph (${t.size} nodes):`,...n].join(`
|
|
2
|
+
`)}static _observe(t,a,s){let n=null,r=a??e.getName(t),i={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:r,dispose:()=>n?.(l)};return t.source(c,(d,o)=>{if(d===c){n=o;return}d===p?(i.values.push(o),i.events.push({type:"data",data:o}),s&&s(`[${r}] DATA:`,o)):d===v?(i.signals.push(o),i.events.push({type:"signal",data:o}),o===g?i.dirtyCount++:o===f&&i.resolvedCount++,s&&s(`[${r}] STATE:`,o)):d===l&&(i.ended=!0,i.endError=o,i.events.push({type:"end",data:o}),s&&s(`[${r}] END`,o!==void 0?o:""),n=null)}),i}static observe(t){return e._observe(t)}static tap(t,a){let s=a??`tap(${e.getName(t)??"anon"})`,n={get:()=>t.get(),source:t.source};return e.register(n,{name:s,kind:"tap"}),e.registerEdge(t,n),n}static spy(t,a){let s=a?.name??e.getName(t)??"spy",n=a?.log??console.log;return e._observe(t,s,n)}static snapshot(){let t=e.graph(),a=e.getEdges(),s=[];for(let[r,i]of t)s.push({name:r,kind:i.kind,value:i.value,status:i.status});let n=[];for(let[r,i]of a)for(let d of i)n.push({from:r,to:d});return{nodes:s,edges:n}}static _reset(){e._names=new WeakMap,e._kinds=new WeakMap,e._keys=new WeakMap,e._stores=new Set,e._edges=new Map,e._usedKeys=new Set,e._nextId=0,e._explicitEnabled=null,e._cachedDefault=null}};export{b as a};
|
|
3
|
+
//# sourceMappingURL=chunk-7WTS4C5R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/inspector.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Inspector — static class for observability\n// ---------------------------------------------------------------------------\n// All debug metadata lives here in WeakMaps, not on the store objects.\n// Stores stay lean. Inspector is opt-in overhead.\n//\n// v5: Zero intrusion into primitives. No hooks in hot paths. All methods\n// are static — call directly as Inspector.observe(), Inspector.tap(), etc.\n// - register/registerEdge: metadata collection (called from constructors)\n// - inspect/graph/dumpGraph/snapshot: read-only graph queries\n// - observe/spy/trace: callbag sinks for debugging (subscribe externally)\n// - tap: transparent passthrough wrapper for graph visualization\n// ---------------------------------------------------------------------------\n\nimport type { NodeStatus, Signal } from \"./protocol\";\nimport { DATA, DIRTY, END, RESOLVED, START, STATE } from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport interface StoreInfo<T = unknown> {\n\tname: string | undefined;\n\tkind: string;\n\tvalue: T;\n\t/** v4: node lifecycle status */\n\tstatus: NodeStatus | undefined;\n}\n\nexport interface ObserveResult<T> {\n\t/** All DATA (type 1) values received, in order */\n\tvalues: T[];\n\t/** All STATE (type 3) payloads received (DIRTY, RESOLVED, or unknown) */\n\tsignals: Signal[];\n\t/** All events in protocol order: { type, data } */\n\tevents: Array<{ type: \"data\" | \"signal\" | \"end\"; data: unknown }>;\n\t/** Whether END (type 2) has been received */\n\tended: boolean;\n\t/** Error payload from END, if any */\n\tendError: unknown;\n\t/** Count of DIRTY signals received */\n\tdirtyCount: number;\n\t/** Count of RESOLVED signals received */\n\tresolvedCount: number;\n\t/** Store name (from Inspector, if registered) */\n\tname: string | undefined;\n\t/** Disconnect the observer */\n\tdispose: () => void;\n}\n\n// Static-only class is intentional API for Inspector namespace\n// biome-ignore lint/complexity/noStaticOnlyClass: public API surface\nexport class Inspector {\n\t// WeakMaps for metadata — keyed by any graph node (stores, effects, etc.)\n\tprivate static _names = new WeakMap<object, string>();\n\tprivate static _kinds = new WeakMap<object, string>();\n\tprivate static _keys = new WeakMap<object, string>();\n\n\t// WeakRef set for graph() — allows GC of unused nodes\n\tprivate static _stores = new Set<WeakRef<object>>();\n\n\t// Dependency edges: parent key → child keys\n\tprivate static _edges = new Map<string, string[]>();\n\n\t// Unique key generation\n\tprivate static _nextId = 0;\n\tprivate static _usedKeys = new Set<string>();\n\n\t// Enabled flag — when false, register/getName are no-ops\n\tprivate static _explicitEnabled: boolean | null = null;\n\tprivate static _cachedDefault: boolean | null = null;\n\n\tstatic get enabled(): boolean {\n\t\tif (Inspector._explicitEnabled !== null) return Inspector._explicitEnabled;\n\t\tif (Inspector._cachedDefault !== null) return Inspector._cachedDefault;\n\t\ttry {\n\t\t\tInspector._cachedDefault = (globalThis as any).process?.env?.NODE_ENV !== \"production\";\n\t\t} catch {\n\t\t\tInspector._cachedDefault = true;\n\t\t}\n\t\treturn Inspector._cachedDefault;\n\t}\n\n\tstatic set enabled(value: boolean) {\n\t\tInspector._explicitEnabled = value;\n\t}\n\n\t/** Compute a dep-name-based suffix for unique key generation */\n\tprivate static _depSuffix(deps?: object[]): string | undefined {\n\t\tif (!deps?.length) return undefined;\n\t\tconst names = deps.map((d) => Inspector._names.get(d) ?? \"?\");\n\t\tconst joined = names.join(\",\");\n\t\treturn joined.length > 40 ? `${joined.slice(0, 37)}...` : joined;\n\t}\n\n\t/** Resolve a node to its unique graph key */\n\tprivate static _resolveKey(node: object): string {\n\t\treturn Inspector._keys.get(node) ?? Inspector._names.get(node) ?? \"anonymous\";\n\t}\n\n\t/** Register a graph node (store, effect, etc.) with the inspector */\n\tstatic register(node: object, opts?: { name?: string; kind?: string; deps?: object[] }): void {\n\t\tif (!Inspector.enabled) return;\n\t\tif (opts?.name) Inspector._names.set(node, opts.name);\n\t\tif (opts?.kind) Inspector._kinds.set(node, opts.kind);\n\n\t\t// Compute unique key\n\t\tconst id = Inspector._nextId++;\n\t\tlet key = opts?.name;\n\t\tif (key && !Inspector._usedKeys.has(key)) {\n\t\t\t// Unique name — use as-is\n\t\t} else if (key) {\n\t\t\t// Name collision — differentiate with dep names or ID\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${key}(${depSuffix})` : `${key}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t} else {\n\t\t\t// Unnamed — use kind + dep names or ID\n\t\t\tconst kind = opts?.kind ?? \"store\";\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${kind}(${depSuffix})` : `${kind}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t}\n\n\t\tInspector._usedKeys.add(key);\n\t\tInspector._keys.set(node, key);\n\t\tInspector._stores.add(new WeakRef(node));\n\t}\n\n\t/** Register a dependency edge between parent and child nodes */\n\tstatic registerEdge(parent: object, child: object): void {\n\t\tif (!Inspector.enabled) return;\n\t\tconst parentKey = Inspector._resolveKey(parent);\n\t\tconst childKey = Inspector._resolveKey(child);\n\t\tconst children = Inspector._edges.get(parentKey);\n\t\tif (children) {\n\t\t\tif (!children.includes(childKey)) children.push(childKey);\n\t\t} else {\n\t\t\tInspector._edges.set(parentKey, [childKey]);\n\t\t}\n\t}\n\n\t/** Get dependency edges: parent → children */\n\tstatic getEdges(): Map<string, string[]> {\n\t\treturn new Map(Inspector._edges);\n\t}\n\n\t/** Get the name of a node */\n\tstatic getName(node: object): string | undefined {\n\t\tif (!Inspector.enabled) return undefined;\n\t\treturn Inspector._names.get(node);\n\t}\n\n\t/** Get the kind of a node */\n\tstatic getKind(node: object): string | undefined {\n\t\treturn Inspector._kinds.get(node);\n\t}\n\n\t/** Inspect a single graph node — includes status and value (if available) */\n\tstatic inspect<T = unknown>(node: object): StoreInfo<T> {\n\t\treturn {\n\t\t\tname: Inspector._names.get(node),\n\t\t\tkind: Inspector._kinds.get(node) ?? \"unknown\",\n\t\t\tvalue: (typeof (node as any).get === \"function\" ? (node as any).get() : undefined) as T,\n\t\t\tstatus: (node as any)._status,\n\t\t};\n\t}\n\n\t/** Get all living nodes as a Map. Also prunes dead edges from GC'd nodes. */\n\tstatic graph(): Map<string, StoreInfo> {\n\t\tconst result = new Map<string, StoreInfo>();\n\t\tconst livingKeys = new Set<string>();\n\t\tfor (const ref of Inspector._stores) {\n\t\t\tconst node = ref.deref();\n\t\t\tif (!node) {\n\t\t\t\tInspector._stores.delete(ref); // cleanup GC'd refs\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = Inspector._resolveKey(node);\n\t\t\tlivingKeys.add(key);\n\t\t\tresult.set(key, Inspector.inspect(node));\n\t\t}\n\t\t// Prune edges referencing GC'd stores\n\t\tfor (const [key, children] of Inspector._edges) {\n\t\t\tif (!livingKeys.has(key)) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t\tInspector._usedKeys.delete(key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst alive = children.filter((c) => livingKeys.has(c));\n\t\t\tif (alive.length === 0) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t} else if (alive.length !== children.length) {\n\t\t\t\tInspector._edges.set(key, alive);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Trace a specific store's value changes (raw callbag — no extra/ dependency) */\n\tstatic trace<T>(store: Store<T>, cb: (value: T, prev: T | undefined) => void): () => void {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tlet prev: T | undefined = store.get();\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) talkback = data;\n\t\t\tif (type === END) {\n\t\t\t\ttalkback = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === 1) {\n\t\t\t\tconst next = data as T;\n\t\t\t\tif (!Object.is(next, prev)) {\n\t\t\t\t\tconst p = prev;\n\t\t\t\t\tprev = next;\n\t\t\t\t\tcb(next, p);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn () => talkback?.(END);\n\t}\n\n\t/** Pretty-print the entire store graph for console/CLI debugging */\n\tstatic dumpGraph(): string {\n\t\tconst g = Inspector.graph();\n\t\tconst edges = Inspector.getEdges();\n\n\t\t// Build reverse map: child key → parent keys (deps)\n\t\tconst depsMap = new Map<string, string[]>();\n\t\tfor (const [parent, children] of edges) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst deps = depsMap.get(child);\n\t\t\t\tif (deps) {\n\t\t\t\t\tif (!deps.includes(parent)) deps.push(parent);\n\t\t\t\t} else {\n\t\t\t\t\tdepsMap.set(child, [parent]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines: string[] = [];\n\t\tfor (const [key, info] of g) {\n\t\t\tconst deps = depsMap.get(key);\n\t\t\tconst children = edges.get(key);\n\t\t\tconst depsStr = deps?.length ? ` ← [${deps.join(\", \")}]` : \"\";\n\t\t\tconst childStr = children?.length ? ` → [${children.join(\", \")}]` : \"\";\n\t\t\tlines.push(\n\t\t\t\t` ${key} (${info.kind}) = ${JSON.stringify(info.value)} [${info.status ?? \"?\"}]${depsStr}${childStr}`,\n\t\t\t);\n\t\t}\n\t\tconst header = `Store Graph (${g.size} nodes):`;\n\t\treturn [header, ...lines].join(\"\\n\");\n\t}\n\n\t/**\n\t * Internal observe implementation shared by observe() and spy().\n\t */\n\tprivate static _observe<T>(\n\t\tstore: Store<T>,\n\t\tlabel?: string,\n\t\tlog?: (...args: any[]) => void,\n\t): ObserveResult<T> {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tconst name = label ?? Inspector.getName(store);\n\t\tconst result: ObserveResult<T> = {\n\t\t\tvalues: [],\n\t\t\tsignals: [],\n\t\t\tevents: [],\n\t\t\tended: false,\n\t\t\tendError: undefined,\n\t\t\tdirtyCount: 0,\n\t\t\tresolvedCount: 0,\n\t\t\tname,\n\t\t\tdispose: () => talkback?.(END),\n\t\t};\n\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) {\n\t\t\t\ttalkback = data;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === DATA) {\n\t\t\t\tresult.values.push(data);\n\t\t\t\tresult.events.push({ type: \"data\", data });\n\t\t\t\tif (log) log(`[${name}] DATA:`, data);\n\t\t\t} else if (type === STATE) {\n\t\t\t\tresult.signals.push(data);\n\t\t\t\tresult.events.push({ type: \"signal\", data });\n\t\t\t\tif (data === DIRTY) result.dirtyCount++;\n\t\t\t\telse if (data === RESOLVED) result.resolvedCount++;\n\t\t\t\tif (log) log(`[${name}] STATE:`, data);\n\t\t\t} else if (type === END) {\n\t\t\t\tresult.ended = true;\n\t\t\t\tresult.endError = data;\n\t\t\t\tresult.events.push({ type: \"end\", data });\n\t\t\t\tif (log) log(`[${name}] END`, data !== undefined ? data : \"\");\n\t\t\t\ttalkback = null;\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Observe a store's full callbag protocol — the test-friendly alternative\n\t * to hooks. Captures DATA values, STATE signals, END, and provides\n\t * convenience accessors.\n\t *\n\t * Returns a live observation object — arrays grow as the store emits.\n\t *\n\t * ```ts\n\t * const obs = Inspector.observe(myStore);\n\t * myState.set(5);\n\t * obs.values // [5]\n\t * obs.signals // [DIRTY]\n\t * obs.ended // false\n\t * obs.dirtyCount // 1\n\t * obs.dispose() // stop observing\n\t * ```\n\t */\n\tstatic observe<T>(store: Store<T>): ObserveResult<T> {\n\t\treturn Inspector._observe(store);\n\t}\n\n\t/**\n\t * Create a transparent passthrough wrapper for graph visualization.\n\t * The wrapper delegates `get()` and `source()` to the original store,\n\t * appearing as a distinct node in the Inspector graph. Zero overhead —\n\t * subscribers connect directly to the original store's source.\n\t */\n\tstatic tap<T>(store: Store<T>, name?: string): Store<T> {\n\t\tconst tapName = name ?? `tap(${Inspector.getName(store) ?? \"anon\"})`;\n\t\tconst wrapper: Store<T> = {\n\t\t\tget: () => store.get(),\n\t\t\tsource: store.source,\n\t\t};\n\t\tInspector.register(wrapper, { name: tapName, kind: \"tap\" });\n\t\tInspector.registerEdge(store, wrapper);\n\t\treturn wrapper;\n\t}\n\n\t/**\n\t * Enhanced observe() with logging — for interactive debugging.\n\t * Returns the same observation object as observe(), but also logs each\n\t * event as it happens. Pass a custom logger or defaults to console.log.\n\t */\n\tstatic spy<T>(\n\t\tstore: Store<T>,\n\t\topts?: { name?: string; log?: (...args: any[]) => void },\n\t): ObserveResult<T> {\n\t\tconst label = opts?.name ?? Inspector.getName(store) ?? \"spy\";\n\t\tconst log = opts?.log ?? console.log;\n\t\treturn Inspector._observe(store, label, log);\n\t}\n\n\t/**\n\t * JSON-serializable snapshot of the entire graph — nodes + edges.\n\t * Designed for AI consumption during debugging sessions.\n\t */\n\tstatic snapshot(): {\n\t\tnodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }>;\n\t\tedges: Array<{ from: string; to: string }>;\n\t} {\n\t\tconst g = Inspector.graph();\n\t\tconst edgeMap = Inspector.getEdges();\n\t\tconst nodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }> =\n\t\t\t[];\n\t\tfor (const [key, info] of g) {\n\t\t\tnodes.push({ name: key, kind: info.kind, value: info.value, status: info.status });\n\t\t}\n\t\tconst edges: Array<{ from: string; to: string }> = [];\n\t\tfor (const [parent, children] of edgeMap) {\n\t\t\tfor (const child of children) {\n\t\t\t\tedges.push({ from: parent, to: child });\n\t\t\t}\n\t\t}\n\t\treturn { nodes, edges };\n\t}\n\n\t/** Reset all state (for testing) */\n\tstatic _reset(): void {\n\t\tInspector._names = new WeakMap<object, string>();\n\t\tInspector._kinds = new WeakMap<object, string>();\n\t\tInspector._keys = new WeakMap<object, string>();\n\t\tInspector._stores = new Set<WeakRef<object>>();\n\t\tInspector._edges = new Map();\n\t\tInspector._usedKeys = new Set();\n\t\tInspector._nextId = 0;\n\t\tInspector._explicitEnabled = null;\n\t\tInspector._cachedDefault = null;\n\t}\n}\n"],"mappings":"2EAiDO,IAAMA,EAAN,MAAMC,CAAU,CAEtB,OAAe,OAAS,IAAI,QAC5B,OAAe,OAAS,IAAI,QAC5B,OAAe,MAAQ,IAAI,QAG3B,OAAe,QAAU,IAAI,IAG7B,OAAe,OAAS,IAAI,IAG5B,OAAe,QAAU,EACzB,OAAe,UAAY,IAAI,IAG/B,OAAe,iBAAmC,KAClD,OAAe,eAAiC,KAEhD,WAAW,SAAmB,CAC7B,GAAIA,EAAU,mBAAqB,KAAM,OAAOA,EAAU,iBAC1D,GAAIA,EAAU,iBAAmB,KAAM,OAAOA,EAAU,eACxD,GAAI,CACHA,EAAU,eAAkB,WAAmB,SAAS,KAAK,WAAa,YAC3E,MAAQ,CACPA,EAAU,eAAiB,EAC5B,CACA,OAAOA,EAAU,cAClB,CAEA,WAAW,QAAQC,EAAgB,CAClCD,EAAU,iBAAmBC,CAC9B,CAGA,OAAe,WAAWC,EAAqC,CAC9D,GAAI,CAACA,GAAM,OAAQ,OAEnB,IAAMC,EADQD,EAAK,IAAKE,GAAMJ,EAAU,OAAO,IAAII,CAAC,GAAK,GAAG,EACvC,KAAK,GAAG,EAC7B,OAAOD,EAAO,OAAS,GAAK,GAAGA,EAAO,MAAM,EAAG,EAAE,CAAC,MAAQA,CAC3D,CAGA,OAAe,YAAYE,EAAsB,CAChD,OAAOL,EAAU,MAAM,IAAIK,CAAI,GAAKL,EAAU,OAAO,IAAIK,CAAI,GAAK,WACnE,CAGA,OAAO,SAASA,EAAcC,EAAgE,CAC7F,GAAI,CAACN,EAAU,QAAS,OACpBM,GAAM,MAAMN,EAAU,OAAO,IAAIK,EAAMC,EAAK,IAAI,EAChDA,GAAM,MAAMN,EAAU,OAAO,IAAIK,EAAMC,EAAK,IAAI,EAGpD,IAAMC,EAAKP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CAMA,OAAO,UAGL,CACD,IAAMR,EAAI/B,EAAU,MAAM,EACpB+C,EAAU/C,EAAU,SAAS,EAC7BgD,EACL,CAAC,EACF,OAAW,CAACxC,EAAK2B,CAAI,IAAKJ,EACzBiB,EAAM,KAAK,CAAE,KAAMxC,EAAK,KAAM2B,EAAK,KAAM,MAAOA,EAAK,MAAO,OAAQA,EAAK,MAAO,CAAC,EAElF,IAAMH,EAA6C,CAAC,EACpD,OAAW,CAACrB,EAAQI,CAAQ,IAAKgC,EAChC,QAAWnC,KAASG,EACnBiB,EAAM,KAAK,CAAE,KAAMrB,EAAQ,GAAIC,CAAM,CAAC,EAGxC,MAAO,CAAE,MAAAoC,EAAO,MAAAhB,CAAM,CACvB,CAGA,OAAO,QAAe,CACrBhC,EAAU,OAAS,IAAI,QACvBA,EAAU,OAAS,IAAI,QACvBA,EAAU,MAAQ,IAAI,QACtBA,EAAU,QAAU,IAAI,IACxBA,EAAU,OAAS,IAAI,IACvBA,EAAU,UAAY,IAAI,IAC1BA,EAAU,QAAU,EACpBA,EAAU,iBAAmB,KAC7BA,EAAU,eAAiB,IAC5B,CACD","names":["Inspector","_Inspector","value","deps","joined","d","node","opts","id","key","depSuffix","kind","parent","child","parentKey","childKey","children","result","livingKeys","ref","alive","c","store","cb","talkback","prev","START","type","data","END","next","p","g","edges","depsMap","lines","info","depsStr","childStr","label","log","name","DATA","STATE","DIRTY","RESOLVED","tapName","wrapper","edgeMap","nodes"]}
|