@nanoforge-dev/editor 0.0.2-beta.8c768e4 → 0.0.2-beta.ddbefdc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/_app/immutable/assets/{0.CI0wrjoW.css → 0.PlL6w-dg.css} +1 -1
- package/dist/client/_app/immutable/assets/0.PlL6w-dg.css.br +0 -0
- package/dist/client/_app/immutable/assets/0.PlL6w-dg.css.gz +0 -0
- package/dist/client/_app/immutable/chunks/{B5BlQANa2.js → B4w9-fYM2.js} +1 -1
- package/dist/client/_app/immutable/chunks/B4w9-fYM2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/B4w9-fYM2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{BpsTeBMk2.js → BS47D1Yd2.js} +1 -1
- package/dist/client/_app/immutable/chunks/BS47D1Yd2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BS47D1Yd2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/BW1UW6Hp.js +1 -0
- package/dist/client/_app/immutable/chunks/BW1UW6Hp.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BW1UW6Hp.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{NRUHq-_72.js → BWDRzheF2.js} +1 -1
- package/dist/client/_app/immutable/chunks/BWDRzheF2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BWDRzheF2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{YpKUr6uE2.js → BZqFHUa32.js} +1 -1
- package/dist/client/_app/immutable/chunks/BZqFHUa32.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BZqFHUa32.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CwcsJxhS2.js → Bk9DeFcz2.js} +1 -1
- package/dist/client/_app/immutable/chunks/Bk9DeFcz2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Bk9DeFcz2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{D8Kk1mwW.js → BlGyHMDZ.js} +1 -1
- package/dist/client/_app/immutable/chunks/BlGyHMDZ.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BlGyHMDZ.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{DRG11iPc2.js → BwWAgYKi2.js} +1 -1
- package/dist/client/_app/immutable/chunks/BwWAgYKi2.js.br +3 -0
- package/dist/client/_app/immutable/chunks/BwWAgYKi2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CHHvlOt72.js → BzGBrbo22.js} +1 -1
- package/dist/client/_app/immutable/chunks/BzGBrbo22.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BzGBrbo22.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/C1k-YaT9.js +293 -0
- package/dist/client/_app/immutable/chunks/C1k-YaT9.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C1k-YaT9.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{D5kSEVHd2.js → C7bUlFLk2.js} +1 -1
- package/dist/client/_app/immutable/chunks/C7bUlFLk2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C7bUlFLk2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{B41NCdmk2.js → C83DJP9w2.js} +1 -1
- package/dist/client/_app/immutable/chunks/C83DJP9w2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C83DJP9w2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CsVJKLJK.js → C8VsmuzL.js} +1 -1
- package/dist/client/_app/immutable/chunks/C8VsmuzL.js.br +0 -0
- package/dist/client/_app/immutable/chunks/C8VsmuzL.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{Wjj5hwVF2.js → CKei9xPI2.js} +2 -2
- package/dist/client/_app/immutable/chunks/CKei9xPI2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CKei9xPI2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CUEbnJ91.js +6 -0
- package/dist/client/_app/immutable/chunks/CUEbnJ91.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CUEbnJ91.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CuyfOZTk2.js → CnhOha0Z2.js} +1 -1
- package/dist/client/_app/immutable/chunks/CnhOha0Z2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CnhOha0Z2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{Bfd-bGrZ2.js → DFXoGGM32.js} +1 -1
- package/dist/client/_app/immutable/chunks/DFXoGGM32.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DFXoGGM32.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{VTYQK3v_2.js → DH-ThjiG2.js} +2 -2
- package/dist/client/_app/immutable/chunks/DH-ThjiG2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DH-ThjiG2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CNh34b3X2.js → DHQLzCjY2.js} +1 -1
- package/dist/client/_app/immutable/chunks/DHQLzCjY2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DHQLzCjY2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{D8HnIxQ42.js → DT8Ddh1L2.js} +1 -1
- package/dist/client/_app/immutable/chunks/DT8Ddh1L2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DT8Ddh1L2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{Cx3ix-dL2.js → DuDzfUqN2.js} +1 -1
- package/dist/client/_app/immutable/chunks/DuDzfUqN2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DuDzfUqN2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{56adh18U.js → Fu4roQAh.js} +1 -1
- package/dist/client/_app/immutable/chunks/Fu4roQAh.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Fu4roQAh.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/ZLGReh43.js +3 -0
- package/dist/client/_app/immutable/chunks/ZLGReh43.js.br +0 -0
- package/dist/client/_app/immutable/chunks/ZLGReh43.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{CN98h0cI2.js → mRVEsFly2.js} +1 -1
- package/dist/client/_app/immutable/chunks/mRVEsFly2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/mRVEsFly2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{DJq0R92X.js → orCHVlgT.js} +1 -1
- package/dist/client/_app/immutable/chunks/orCHVlgT.js.br +0 -0
- package/dist/client/_app/immutable/chunks/orCHVlgT.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{Drjp27p72.js → uo5fvlDn2.js} +1 -1
- package/dist/client/_app/immutable/chunks/uo5fvlDn2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/uo5fvlDn2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{DbZ0P7x6.js → xJ1-16vC.js} +1 -1
- package/dist/client/_app/immutable/chunks/xJ1-16vC.js.br +0 -0
- package/dist/client/_app/immutable/chunks/xJ1-16vC.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/{BNmi28p2.js → y9jahtbD.js} +1 -1
- package/dist/client/_app/immutable/chunks/y9jahtbD.js.br +0 -0
- package/dist/client/_app/immutable/chunks/y9jahtbD.js.gz +0 -0
- package/dist/client/_app/immutable/entry/{app.CiLM39cw.js → app.qM3aoeOi.js} +2 -2
- package/dist/client/_app/immutable/entry/app.qM3aoeOi.js.br +0 -0
- package/dist/client/_app/immutable/entry/app.qM3aoeOi.js.gz +0 -0
- package/dist/client/_app/immutable/entry/start.CDMZxkmh.js +1 -0
- package/dist/client/_app/immutable/entry/start.CDMZxkmh.js.br +0 -0
- package/dist/client/_app/immutable/entry/start.CDMZxkmh.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/{0.CEpgzEwS.js → 0.Dd5fG40d.js} +1 -1
- package/dist/client/_app/immutable/nodes/0.Dd5fG40d.js.br +0 -0
- package/dist/client/_app/immutable/nodes/0.Dd5fG40d.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/{1.Sm4J_hJ5.js → 1.D-XWgJOb.js} +1 -1
- package/dist/client/_app/immutable/nodes/1.D-XWgJOb.js.br +2 -0
- package/dist/client/_app/immutable/nodes/1.D-XWgJOb.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/10.DkYlNzbR.js +6 -0
- package/dist/client/_app/immutable/nodes/10.DkYlNzbR.js.br +0 -0
- package/dist/client/_app/immutable/nodes/10.DkYlNzbR.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/2.D2mbM0C2.js +1 -0
- package/dist/client/_app/immutable/nodes/2.D2mbM0C2.js.br +0 -0
- package/dist/client/_app/immutable/nodes/2.D2mbM0C2.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/{9.C7P5VSNI.js → 9.BrWnGfyr.js} +1 -1
- package/dist/client/_app/immutable/nodes/9.BrWnGfyr.js.br +0 -0
- package/dist/client/_app/immutable/nodes/9.BrWnGfyr.js.gz +0 -0
- package/dist/client/_app/version.json +1 -1
- package/dist/client/_app/version.json.br +0 -0
- package/dist/client/_app/version.json.gz +0 -0
- package/dist/server/chunks/{0-BgMtbrE9.js → 0-CaJWcpu3.js} +6 -6
- package/dist/server/chunks/{0-BgMtbrE9.js.map → 0-CaJWcpu3.js.map} +1 -1
- package/dist/server/chunks/{1-JuWV7qB2.js → 1-na9Uh1hG.js} +6 -6
- package/dist/server/chunks/{1-JuWV7qB2.js.map → 1-na9Uh1hG.js.map} +1 -1
- package/dist/server/chunks/{10-x0FGzJF7.js → 10-Dh1abrew.js} +10 -10
- package/dist/server/chunks/10-Dh1abrew.js.map +1 -0
- package/dist/server/chunks/{2-Dkn4MH5F.js → 2-BM68e_rU.js} +9 -9
- package/dist/server/chunks/{2-Dkn4MH5F.js.map → 2-BM68e_rU.js.map} +1 -1
- package/dist/server/chunks/{3-CcIZ_M60.js → 3-CtfjP4uZ.js} +114 -3
- package/dist/server/chunks/3-CtfjP4uZ.js.map +1 -0
- package/dist/server/chunks/{4-DyArZX6h.js → 4-DP-_gDay.js} +10 -2
- package/dist/server/chunks/4-DP-_gDay.js.map +1 -0
- package/dist/server/chunks/{5-DVrv6Zto.js → 5-610NKQc3.js} +10 -2
- package/dist/server/chunks/5-610NKQc3.js.map +1 -0
- package/dist/server/chunks/{6-AD0Ee23-.js → 6-Dl_h_OyU.js} +35 -2
- package/dist/server/chunks/6-Dl_h_OyU.js.map +1 -0
- package/dist/server/chunks/{7-CuJ7XfzT.js → 7-BUEKgK7m.js} +2 -2
- package/dist/server/chunks/{7-CuJ7XfzT.js.map → 7-BUEKgK7m.js.map} +1 -1
- package/dist/server/chunks/{8-CRPOubhA.js → 8-s07Rj2Zo.js} +10 -2
- package/dist/server/chunks/8-s07Rj2Zo.js.map +1 -0
- package/dist/server/chunks/{9-BhWG76gi.js → 9-DkqE8li9.js} +10 -10
- package/dist/server/chunks/9-DkqE8li9.js.map +1 -0
- package/dist/server/chunks/{_layout.svelte-CP4jFwsK.js → _layout.svelte-uX7XiB9K.js} +6 -6
- package/dist/server/chunks/_layout.svelte-uX7XiB9K.js.map +1 -0
- package/dist/server/chunks/{_page.svelte-7KJNFri5.js → _page.svelte-1bR7bJ2y.js} +6 -6
- package/dist/server/chunks/_page.svelte-1bR7bJ2y.js.map +1 -0
- package/dist/server/chunks/{_page.svelte-BQLzgYrr.js → _page.svelte-B_0YFORc.js} +7 -7
- package/dist/server/chunks/_page.svelte-B_0YFORc.js.map +1 -0
- package/dist/server/chunks/{_page.svelte-B3Zfq6_t.js → _page.svelte-BmrR5-n-.js} +90 -27
- package/dist/server/chunks/_page.svelte-BmrR5-n-.js.map +1 -0
- package/dist/server/chunks/_server.ts-DlC2sxcm.js +35 -0
- package/dist/server/chunks/_server.ts-DlC2sxcm.js.map +1 -0
- package/dist/server/chunks/{_server.ts-BYvWhjnh.js → _server.ts-a-I4s4R9.js} +2 -2
- package/dist/server/chunks/{_server.ts-BYvWhjnh.js.map → _server.ts-a-I4s4R9.js.map} +1 -1
- package/dist/server/chunks/app-DUeJj5RD.js.map +1 -1
- package/dist/server/chunks/chunk-ByNZkrT6.js.map +1 -1
- package/dist/server/chunks/{client-BvtIF74Y.js → client-BkmWBFaS.js} +3 -3
- package/dist/server/chunks/client-BkmWBFaS.js.map +1 -0
- package/dist/server/chunks/decorate-CQ_JIwqD.js +11 -0
- package/dist/server/chunks/decorate-CQ_JIwqD.js.map +1 -0
- package/dist/server/chunks/{error-D23CGeyL.js → error-BGQyviUk.js} +118 -59
- package/dist/server/chunks/error-BGQyviUk.js.map +1 -0
- package/dist/server/chunks/{error.svelte-DZuW0iDP.js → error.svelte-T6M8Vz4W.js} +3 -3
- package/dist/server/chunks/{error.svelte-DZuW0iDP.js.map → error.svelte-T6M8Vz4W.js.map} +1 -1
- package/dist/server/chunks/{events-DeYJGjCt.js → events-Bhh2w-5S.js} +1063 -1059
- package/dist/server/chunks/events-Bhh2w-5S.js.map +1 -0
- package/dist/server/chunks/{exports-8wSs4fiF.js → exports-CWOtdr_a.js} +4 -4
- package/dist/server/chunks/{exports-8wSs4fiF.js.map → exports-CWOtdr_a.js.map} +1 -1
- package/dist/server/chunks/format-DGOlJxF5.js.map +1 -1
- package/dist/server/chunks/{hooks.server-Dox7llar.js → hooks.server-Bb56FM49.js} +4 -4
- package/dist/server/chunks/{hooks.server-Dox7llar.js.map → hooks.server-Bb56FM49.js.map} +1 -1
- package/dist/server/chunks/hooks.universal-DhGFdBkK.js.map +1 -1
- package/dist/server/chunks/{internal-eM0YTBgj.js → internal-DsA4iYdx.js} +2 -2
- package/dist/server/chunks/{internal-eM0YTBgj.js.map → internal-DsA4iYdx.js.map} +1 -1
- package/dist/server/chunks/{internal-B77zebhK.js → internal2-CeV_cIh4.js} +10 -10
- package/dist/server/chunks/internal2-CeV_cIh4.js.map +1 -0
- package/dist/server/chunks/{loader-circle-zqx69BdD.js → loader-circle-CFNm9vip.js} +2 -2
- package/dist/server/chunks/{loader-circle-zqx69BdD.js.map → loader-circle-CFNm9vip.js.map} +1 -1
- package/dist/server/chunks/{logo-BfI7zmyL.js → logo-Cit4wZkS.js} +4 -4
- package/dist/server/chunks/logo-Cit4wZkS.js.map +1 -0
- package/dist/server/chunks/{project-loader-BkV0zjlj.js → project-loader-BSqYC-7k.js} +4 -4
- package/dist/server/chunks/{project-loader-BkV0zjlj.js.map → project-loader-BSqYC-7k.js.map} +1 -1
- package/dist/server/chunks/{request-handler-D-qbwxhh.js → request-handler-guINVc1G.js} +12 -7
- package/dist/server/chunks/request-handler-guINVc1G.js.map +1 -0
- package/dist/server/chunks/runtime-CDHWD9vo.js.map +1 -1
- package/dist/server/chunks/{schemas-ENQuLVBq.js → schemas-DbJHhqwa.js} +165 -125
- package/dist/server/chunks/schemas-DbJHhqwa.js.map +1 -0
- package/dist/server/chunks/{session-CmQRz9-0.js → session-DLCjVGKo.js} +2 -2
- package/dist/server/chunks/{session-CmQRz9-0.js.map → session-DLCjVGKo.js.map} +1 -1
- package/dist/server/chunks/shared-server-Cha0Qlv9.js.map +1 -1
- package/dist/server/chunks/{state-q9lwVQK2.js → state-DpIO_6NS.js} +3 -3
- package/dist/server/chunks/{state-q9lwVQK2.js.map → state-DpIO_6NS.js.map} +1 -1
- package/dist/server/index.js +10 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/manifest.js +20 -20
- package/dist/server/manifest.js.map +1 -1
- package/package.json +7 -5
- package/dist/client/_app/immutable/assets/0.CI0wrjoW.css.br +0 -0
- package/dist/client/_app/immutable/assets/0.CI0wrjoW.css.gz +0 -0
- package/dist/client/_app/immutable/chunks/56adh18U.js.br +0 -0
- package/dist/client/_app/immutable/chunks/56adh18U.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/9tBtThMc.js +0 -1
- package/dist/client/_app/immutable/chunks/9tBtThMc.js.br +0 -0
- package/dist/client/_app/immutable/chunks/9tBtThMc.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/B41NCdmk2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/B41NCdmk2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/B5BlQANa2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/B5BlQANa2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/BNmi28p2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BNmi28p2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/Bfd-bGrZ2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Bfd-bGrZ2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/BpsTeBMk2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/BpsTeBMk2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CHHvlOt72.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CHHvlOt72.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CN98h0cI2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CN98h0cI2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CNh34b3X2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CNh34b3X2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CsVJKLJK.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CsVJKLJK.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CuyfOZTk2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CuyfOZTk2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/CwcsJxhS2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/CwcsJxhS2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/Cx3ix-dL2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Cx3ix-dL2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/D5kSEVHd2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/D5kSEVHd2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/D8HnIxQ42.js.br +0 -0
- package/dist/client/_app/immutable/chunks/D8HnIxQ42.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/D8Kk1mwW.js.br +0 -0
- package/dist/client/_app/immutable/chunks/D8Kk1mwW.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/DJq0R92X.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DJq0R92X.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/DRG11iPc2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DRG11iPc2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/DbZ0P7x6.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DbZ0P7x6.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/Drjp27p72.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Drjp27p72.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/DuEGqPrO.js +0 -6
- package/dist/client/_app/immutable/chunks/DuEGqPrO.js.br +0 -0
- package/dist/client/_app/immutable/chunks/DuEGqPrO.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/H2okCofJ.js +0 -3
- package/dist/client/_app/immutable/chunks/H2okCofJ.js.br +0 -0
- package/dist/client/_app/immutable/chunks/H2okCofJ.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/NRUHq-_72.js.br +0 -0
- package/dist/client/_app/immutable/chunks/NRUHq-_72.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/UeNcXxK4.js +0 -293
- package/dist/client/_app/immutable/chunks/UeNcXxK4.js.br +0 -0
- package/dist/client/_app/immutable/chunks/UeNcXxK4.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/VTYQK3v_2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/VTYQK3v_2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/Wjj5hwVF2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/Wjj5hwVF2.js.gz +0 -0
- package/dist/client/_app/immutable/chunks/YpKUr6uE2.js.br +0 -0
- package/dist/client/_app/immutable/chunks/YpKUr6uE2.js.gz +0 -0
- package/dist/client/_app/immutable/entry/app.CiLM39cw.js.br +0 -0
- package/dist/client/_app/immutable/entry/app.CiLM39cw.js.gz +0 -0
- package/dist/client/_app/immutable/entry/start.CIrA5P2h.js +0 -1
- package/dist/client/_app/immutable/entry/start.CIrA5P2h.js.br +0 -0
- package/dist/client/_app/immutable/entry/start.CIrA5P2h.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/0.CEpgzEwS.js.br +0 -0
- package/dist/client/_app/immutable/nodes/0.CEpgzEwS.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/1.Sm4J_hJ5.js.br +0 -0
- package/dist/client/_app/immutable/nodes/1.Sm4J_hJ5.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/10.BcE-uamz.js +0 -6
- package/dist/client/_app/immutable/nodes/10.BcE-uamz.js.br +0 -0
- package/dist/client/_app/immutable/nodes/10.BcE-uamz.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/2.BGBkNPlf.js +0 -1
- package/dist/client/_app/immutable/nodes/2.BGBkNPlf.js.br +0 -0
- package/dist/client/_app/immutable/nodes/2.BGBkNPlf.js.gz +0 -0
- package/dist/client/_app/immutable/nodes/9.C7P5VSNI.js.br +0 -0
- package/dist/client/_app/immutable/nodes/9.C7P5VSNI.js.gz +0 -0
- package/dist/server/chunks/10-x0FGzJF7.js.map +0 -1
- package/dist/server/chunks/3-CcIZ_M60.js.map +0 -1
- package/dist/server/chunks/4-DyArZX6h.js.map +0 -1
- package/dist/server/chunks/5-DVrv6Zto.js.map +0 -1
- package/dist/server/chunks/6-AD0Ee23-.js.map +0 -1
- package/dist/server/chunks/8-CRPOubhA.js.map +0 -1
- package/dist/server/chunks/9-BhWG76gi.js.map +0 -1
- package/dist/server/chunks/_layout.svelte-CP4jFwsK.js.map +0 -1
- package/dist/server/chunks/_page.svelte-7KJNFri5.js.map +0 -1
- package/dist/server/chunks/_page.svelte-B3Zfq6_t.js.map +0 -1
- package/dist/server/chunks/_page.svelte-BQLzgYrr.js.map +0 -1
- package/dist/server/chunks/_server.ts-B1t_0LJV.js +0 -19
- package/dist/server/chunks/_server.ts-B1t_0LJV.js.map +0 -1
- package/dist/server/chunks/client-BvtIF74Y.js.map +0 -1
- package/dist/server/chunks/error-D23CGeyL.js.map +0 -1
- package/dist/server/chunks/events-DeYJGjCt.js.map +0 -1
- package/dist/server/chunks/internal-B77zebhK.js.map +0 -1
- package/dist/server/chunks/logo-BfI7zmyL.js.map +0 -1
- package/dist/server/chunks/request-handler-D-qbwxhh.js.map +0 -1
- package/dist/server/chunks/schemas-ENQuLVBq.js.map +0 -1
|
@@ -1453,1195 +1453,1199 @@ function get$1(store) {
|
|
|
1453
1453
|
* schedule effects if the update takes place inside a `$:` effect
|
|
1454
1454
|
*/
|
|
1455
1455
|
var legacy_is_updating_store = false;
|
|
1456
|
-
/** @import { Fork } from 'svelte' */
|
|
1457
|
-
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
1458
|
-
/** @type {Batch | null} */
|
|
1459
|
-
var first_batch = null;
|
|
1460
|
-
/** @type {Batch | null} */
|
|
1461
|
-
var last_batch = null;
|
|
1462
|
-
/** @type {Batch | null} */
|
|
1463
|
-
var current_batch = null;
|
|
1464
1456
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1457
|
+
* Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
|
|
1458
|
+
* It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
|
|
1459
|
+
*
|
|
1460
|
+
* If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
|
|
1461
|
+
* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
|
|
1462
|
+
*
|
|
1463
|
+
* If `start` returns a cleanup function, it will be called when the effect is destroyed.
|
|
1464
|
+
*
|
|
1465
|
+
* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
|
|
1466
|
+
* are active, and the returned teardown function will only be called when all effects are destroyed.
|
|
1467
|
+
*
|
|
1468
|
+
* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
|
|
1469
|
+
*
|
|
1470
|
+
* ```js
|
|
1471
|
+
* import { createSubscriber } from 'svelte/reactivity';
|
|
1472
|
+
* import { on } from 'svelte/events';
|
|
1473
|
+
*
|
|
1474
|
+
* export class MediaQuery {
|
|
1475
|
+
* #query;
|
|
1476
|
+
* #subscribe;
|
|
1477
|
+
*
|
|
1478
|
+
* constructor(query) {
|
|
1479
|
+
* this.#query = window.matchMedia(`(${query})`);
|
|
1480
|
+
*
|
|
1481
|
+
* this.#subscribe = createSubscriber((update) => {
|
|
1482
|
+
* // when the `change` event occurs, re-run any effects that read `this.current`
|
|
1483
|
+
* const off = on(this.#query, 'change', update);
|
|
1484
|
+
*
|
|
1485
|
+
* // stop listening when all the effects are destroyed
|
|
1486
|
+
* return () => off();
|
|
1487
|
+
* });
|
|
1488
|
+
* }
|
|
1489
|
+
*
|
|
1490
|
+
* get current() {
|
|
1491
|
+
* // This makes the getter reactive, if read in an effect
|
|
1492
|
+
* this.#subscribe();
|
|
1493
|
+
*
|
|
1494
|
+
* // Return the current state of the query, whether or not we're in an effect
|
|
1495
|
+
* return this.#query.matches;
|
|
1496
|
+
* }
|
|
1497
|
+
* }
|
|
1498
|
+
* ```
|
|
1499
|
+
* @param {(update: () => void) => (() => void) | void} start
|
|
1500
|
+
* @since 5.7.0
|
|
1474
1501
|
*/
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1502
|
+
function createSubscriber(start) {
|
|
1503
|
+
let subscribers = 0;
|
|
1504
|
+
let version = source(0);
|
|
1505
|
+
/** @type {(() => void) | void} */
|
|
1506
|
+
let stop;
|
|
1507
|
+
return () => {
|
|
1508
|
+
if (effect_tracking()) {
|
|
1509
|
+
get(version);
|
|
1510
|
+
render_effect(() => {
|
|
1511
|
+
if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
|
|
1512
|
+
subscribers += 1;
|
|
1513
|
+
return () => {
|
|
1514
|
+
queue_micro_task(() => {
|
|
1515
|
+
subscribers -= 1;
|
|
1516
|
+
if (subscribers === 0) {
|
|
1517
|
+
stop?.();
|
|
1518
|
+
stop = void 0;
|
|
1519
|
+
increment(version);
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
};
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
/** @import { Effect, Source, TemplateNode, } from '#client' */
|
|
1480
1528
|
/**
|
|
1481
|
-
*
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1529
|
+
* @typedef {{
|
|
1530
|
+
* onerror?: ((error: unknown, reset: () => void) => void) | null;
|
|
1531
|
+
* failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
|
|
1532
|
+
* pending?: ((anchor: Node) => void) | null;
|
|
1533
|
+
* }} BoundaryProps
|
|
1485
1534
|
*/
|
|
1486
|
-
var
|
|
1535
|
+
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
|
|
1487
1536
|
/**
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* @
|
|
1492
|
-
* @
|
|
1537
|
+
* @param {TemplateNode} node
|
|
1538
|
+
* @param {BoundaryProps} props
|
|
1539
|
+
* @param {((anchor: Node) => void)} children
|
|
1540
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
1541
|
+
* @returns {void}
|
|
1493
1542
|
*/
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
var
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
linked = true;
|
|
1502
|
-
/** @type {Batch | null} */
|
|
1503
|
-
#prev = null;
|
|
1504
|
-
/** @type {Batch | null} */
|
|
1505
|
-
#next = null;
|
|
1506
|
-
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
|
|
1507
|
-
async_deriveds = /* @__PURE__ */ new Map();
|
|
1508
|
-
/**
|
|
1509
|
-
* The current values of any signals that are updated in this batch.
|
|
1510
|
-
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
1511
|
-
* They keys of this map are identical to `this.#previous`
|
|
1512
|
-
* @type {Map<Value, [any, boolean]>}
|
|
1513
|
-
*/
|
|
1514
|
-
current = /* @__PURE__ */ new Map();
|
|
1515
|
-
/**
|
|
1516
|
-
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
1517
|
-
* They keys of this map are identical to `this.#current`
|
|
1518
|
-
* @type {Map<Value, any>}
|
|
1519
|
-
*/
|
|
1520
|
-
previous = /* @__PURE__ */ new Map();
|
|
1521
|
-
/**
|
|
1522
|
-
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
1523
|
-
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
1524
|
-
* @type {Set<(batch: Batch) => void>}
|
|
1525
|
-
*/
|
|
1526
|
-
#commit_callbacks = /* @__PURE__ */ new Set();
|
|
1527
|
-
/**
|
|
1528
|
-
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
1529
|
-
* @type {Set<(batch: Batch) => void>}
|
|
1530
|
-
*/
|
|
1531
|
-
#discard_callbacks = /* @__PURE__ */ new Set();
|
|
1532
|
-
/**
|
|
1533
|
-
* The number of async effects that are currently in flight
|
|
1534
|
-
*/
|
|
1535
|
-
#pending = 0;
|
|
1536
|
-
/**
|
|
1537
|
-
* Async effects that are currently in flight, _not_ inside a pending boundary
|
|
1538
|
-
* @type {Map<Effect, number>}
|
|
1539
|
-
*/
|
|
1540
|
-
#blocking_pending = /* @__PURE__ */ new Map();
|
|
1541
|
-
/**
|
|
1542
|
-
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
1543
|
-
* TODO replace with Promise.withResolvers once supported widely enough
|
|
1544
|
-
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
1545
|
-
*/
|
|
1546
|
-
#deferred = null;
|
|
1547
|
-
/**
|
|
1548
|
-
* The root effects that need to be flushed
|
|
1549
|
-
* @type {Effect[]}
|
|
1550
|
-
*/
|
|
1551
|
-
#roots = [];
|
|
1552
|
-
/**
|
|
1553
|
-
* Effects created while this batch was active.
|
|
1554
|
-
* @type {Effect[]}
|
|
1555
|
-
*/
|
|
1556
|
-
#new_effects = [];
|
|
1543
|
+
function boundary(node, props, children, transform_error) {
|
|
1544
|
+
new Boundary(node, props, children, transform_error);
|
|
1545
|
+
}
|
|
1546
|
+
var Boundary = class {
|
|
1547
|
+
/** @type {Boundary | null} */
|
|
1548
|
+
parent;
|
|
1549
|
+
is_pending = false;
|
|
1557
1550
|
/**
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1551
|
+
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
|
|
1552
|
+
* Inherited from parent boundary, or defaults to identity.
|
|
1553
|
+
* @type {(error: unknown) => unknown}
|
|
1560
1554
|
*/
|
|
1555
|
+
transform_error;
|
|
1556
|
+
/** @type {TemplateNode} */
|
|
1557
|
+
#anchor;
|
|
1558
|
+
/** @type {TemplateNode | null} */
|
|
1559
|
+
#hydrate_open = hydrating ? hydrate_node : null;
|
|
1560
|
+
/** @type {BoundaryProps} */
|
|
1561
|
+
#props;
|
|
1562
|
+
/** @type {((anchor: Node) => void)} */
|
|
1563
|
+
#children;
|
|
1564
|
+
/** @type {Effect} */
|
|
1565
|
+
#effect;
|
|
1566
|
+
/** @type {Effect | null} */
|
|
1567
|
+
#main_effect = null;
|
|
1568
|
+
/** @type {Effect | null} */
|
|
1569
|
+
#pending_effect = null;
|
|
1570
|
+
/** @type {Effect | null} */
|
|
1571
|
+
#failed_effect = null;
|
|
1572
|
+
/** @type {DocumentFragment | null} */
|
|
1573
|
+
#offscreen_fragment = null;
|
|
1574
|
+
#local_pending_count = 0;
|
|
1575
|
+
#pending_count = 0;
|
|
1576
|
+
#pending_count_update_queued = false;
|
|
1577
|
+
/** @type {Set<Effect>} */
|
|
1561
1578
|
#dirty_effects = /* @__PURE__ */ new Set();
|
|
1562
|
-
/**
|
|
1563
|
-
* Deferred effects that are MAYBE_DIRTY
|
|
1564
|
-
* @type {Set<Effect>}
|
|
1565
|
-
*/
|
|
1579
|
+
/** @type {Set<Effect>} */
|
|
1566
1580
|
#maybe_dirty_effects = /* @__PURE__ */ new Set();
|
|
1567
1581
|
/**
|
|
1568
|
-
* A
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
* @type {
|
|
1582
|
+
* A source containing the number of pending async deriveds/expressions.
|
|
1583
|
+
* Only created if `$effect.pending()` is used inside the boundary,
|
|
1584
|
+
* otherwise updating the source results in needless `Batch.ensure()`
|
|
1585
|
+
* calls followed by no-op flushes
|
|
1586
|
+
* @type {Source<number> | null}
|
|
1573
1587
|
*/
|
|
1574
|
-
#
|
|
1588
|
+
#effect_pending = null;
|
|
1589
|
+
#effect_pending_subscriber = createSubscriber(() => {
|
|
1590
|
+
this.#effect_pending = source(this.#local_pending_count);
|
|
1591
|
+
return () => {
|
|
1592
|
+
this.#effect_pending = null;
|
|
1593
|
+
};
|
|
1594
|
+
});
|
|
1575
1595
|
/**
|
|
1576
|
-
*
|
|
1577
|
-
* @
|
|
1596
|
+
* @param {TemplateNode} node
|
|
1597
|
+
* @param {BoundaryProps} props
|
|
1598
|
+
* @param {((anchor: Node) => void)} children
|
|
1599
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
1578
1600
|
*/
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1601
|
+
constructor(node, props, children, transform_error) {
|
|
1602
|
+
this.#anchor = node;
|
|
1603
|
+
this.#props = props;
|
|
1604
|
+
this.#children = (anchor) => {
|
|
1605
|
+
var effect = active_effect;
|
|
1606
|
+
effect.b = this;
|
|
1607
|
+
effect.f |= 128;
|
|
1608
|
+
children(anchor);
|
|
1609
|
+
};
|
|
1610
|
+
this.parent = active_effect.b;
|
|
1611
|
+
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
|
|
1612
|
+
this.#effect = block(() => {
|
|
1613
|
+
if (hydrating) {
|
|
1614
|
+
const comment = this.#hydrate_open;
|
|
1615
|
+
hydrate_next();
|
|
1616
|
+
const server_rendered_pending = comment.data === "[!";
|
|
1617
|
+
if (comment.data.startsWith("[?")) {
|
|
1618
|
+
const serialized_error = JSON.parse(comment.data.slice(2));
|
|
1619
|
+
this.#hydrate_failed_content(serialized_error);
|
|
1620
|
+
} else if (server_rendered_pending) this.#hydrate_pending_content();
|
|
1621
|
+
else this.#hydrate_resolved_content();
|
|
1622
|
+
} else this.#render();
|
|
1623
|
+
}, flags);
|
|
1624
|
+
if (hydrating) this.#anchor = hydrate_node;
|
|
1625
|
+
}
|
|
1626
|
+
#hydrate_resolved_content() {
|
|
1627
|
+
try {
|
|
1628
|
+
this.#main_effect = branch(() => this.#children(this.#anchor));
|
|
1629
|
+
} catch (error) {
|
|
1630
|
+
this.error(error);
|
|
1603
1631
|
}
|
|
1604
|
-
return false;
|
|
1605
1632
|
}
|
|
1606
1633
|
/**
|
|
1607
|
-
*
|
|
1608
|
-
* @param {Effect} effect
|
|
1634
|
+
* @param {unknown} error The deserialized error from the server's hydration comment
|
|
1609
1635
|
*/
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1636
|
+
#hydrate_failed_content(error) {
|
|
1637
|
+
const failed = this.#props.failed;
|
|
1638
|
+
if (!failed) return;
|
|
1639
|
+
this.#failed_effect = branch(() => {
|
|
1640
|
+
failed(this.#anchor, () => error, () => () => {});
|
|
1614
1641
|
});
|
|
1615
|
-
|
|
1642
|
+
}
|
|
1643
|
+
#hydrate_pending_content() {
|
|
1644
|
+
const pending = this.#props.pending;
|
|
1645
|
+
if (!pending) return;
|
|
1646
|
+
this.is_pending = true;
|
|
1647
|
+
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
1648
|
+
queue_micro_task(() => {
|
|
1649
|
+
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
|
|
1650
|
+
var anchor = create_text();
|
|
1651
|
+
fragment.append(anchor);
|
|
1652
|
+
this.#main_effect = this.#run(() => {
|
|
1653
|
+
return branch(() => this.#children(anchor));
|
|
1654
|
+
});
|
|
1655
|
+
if (this.#pending_count === 0) {
|
|
1656
|
+
this.#anchor.before(fragment);
|
|
1657
|
+
this.#offscreen_fragment = null;
|
|
1658
|
+
pause_effect(this.#pending_effect, () => {
|
|
1659
|
+
this.#pending_effect = null;
|
|
1660
|
+
});
|
|
1661
|
+
this.#resolve(current_batch);
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
#render() {
|
|
1666
|
+
try {
|
|
1667
|
+
this.is_pending = this.has_pending_snippet();
|
|
1668
|
+
this.#pending_count = 0;
|
|
1669
|
+
this.#local_pending_count = 0;
|
|
1670
|
+
this.#main_effect = branch(() => {
|
|
1671
|
+
this.#children(this.#anchor);
|
|
1672
|
+
});
|
|
1673
|
+
if (this.#pending_count > 0) {
|
|
1674
|
+
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
|
|
1675
|
+
move_effect(this.#main_effect, fragment);
|
|
1676
|
+
const pending = this.#props.pending;
|
|
1677
|
+
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
1678
|
+
} else this.#resolve(current_batch);
|
|
1679
|
+
} catch (error) {
|
|
1680
|
+
this.error(error);
|
|
1681
|
+
}
|
|
1616
1682
|
}
|
|
1617
1683
|
/**
|
|
1618
|
-
*
|
|
1619
|
-
|
|
1684
|
+
* @param {Batch} batch
|
|
1685
|
+
*/
|
|
1686
|
+
#resolve(batch) {
|
|
1687
|
+
this.is_pending = false;
|
|
1688
|
+
batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Defer an effect inside a pending boundary until the boundary resolves
|
|
1620
1692
|
* @param {Effect} effect
|
|
1621
|
-
* @param {(e: Effect) => void} callback
|
|
1622
1693
|
*/
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
if (tracked) {
|
|
1626
|
-
this.#skipped_branches.delete(effect);
|
|
1627
|
-
for (var e of tracked.d) {
|
|
1628
|
-
set_signal_status(e, DIRTY);
|
|
1629
|
-
callback(e);
|
|
1630
|
-
}
|
|
1631
|
-
for (e of tracked.m) {
|
|
1632
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
1633
|
-
callback(e);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
this.#unskipped_branches.add(effect);
|
|
1694
|
+
defer_effect(effect) {
|
|
1695
|
+
defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
|
|
1637
1696
|
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
1663
|
-
*/
|
|
1664
|
-
var updates = legacy_updates = [];
|
|
1665
|
-
for (const root of roots) try {
|
|
1666
|
-
this.#traverse(root, effects, render_effects);
|
|
1697
|
+
/**
|
|
1698
|
+
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
|
1699
|
+
* @returns {boolean}
|
|
1700
|
+
*/
|
|
1701
|
+
is_rendered() {
|
|
1702
|
+
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
|
1703
|
+
}
|
|
1704
|
+
has_pending_snippet() {
|
|
1705
|
+
return !!this.#props.pending;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* @template T
|
|
1709
|
+
* @param {() => T} fn
|
|
1710
|
+
*/
|
|
1711
|
+
#run(fn) {
|
|
1712
|
+
var previous_effect = active_effect;
|
|
1713
|
+
var previous_reaction = active_reaction;
|
|
1714
|
+
var previous_ctx = component_context;
|
|
1715
|
+
set_active_effect(this.#effect);
|
|
1716
|
+
set_active_reaction(this.#effect);
|
|
1717
|
+
set_component_context(this.#effect.ctx);
|
|
1718
|
+
try {
|
|
1719
|
+
Batch.ensure();
|
|
1720
|
+
return fn();
|
|
1667
1721
|
} catch (e) {
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
var batch = Batch.ensure();
|
|
1675
|
-
for (const e of updates) batch.schedule(e);
|
|
1722
|
+
handle_error(e);
|
|
1723
|
+
return null;
|
|
1724
|
+
} finally {
|
|
1725
|
+
set_active_effect(previous_effect);
|
|
1726
|
+
set_active_reaction(previous_reaction);
|
|
1727
|
+
set_component_context(previous_ctx);
|
|
1676
1728
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Updates the pending count associated with the currently visible pending snippet,
|
|
1732
|
+
* if any, such that we can replace the snippet with content once work is done
|
|
1733
|
+
* @param {1 | -1} d
|
|
1734
|
+
* @param {Batch} batch
|
|
1735
|
+
*/
|
|
1736
|
+
#update_pending_count(d, batch) {
|
|
1737
|
+
if (!this.has_pending_snippet()) {
|
|
1738
|
+
if (this.parent) this.parent.#update_pending_count(d, batch);
|
|
1685
1739
|
return;
|
|
1686
1740
|
}
|
|
1687
|
-
|
|
1688
|
-
if (
|
|
1689
|
-
this.#
|
|
1690
|
-
this.#
|
|
1691
|
-
|
|
1692
|
-
|
|
1741
|
+
this.#pending_count += d;
|
|
1742
|
+
if (this.#pending_count === 0) {
|
|
1743
|
+
this.#resolve(batch);
|
|
1744
|
+
if (this.#pending_effect) pause_effect(this.#pending_effect, () => {
|
|
1745
|
+
this.#pending_effect = null;
|
|
1746
|
+
});
|
|
1747
|
+
if (this.#offscreen_fragment) {
|
|
1748
|
+
this.#anchor.before(this.#offscreen_fragment);
|
|
1749
|
+
this.#offscreen_fragment = null;
|
|
1750
|
+
}
|
|
1693
1751
|
}
|
|
1694
|
-
this.#dirty_effects.clear();
|
|
1695
|
-
this.#maybe_dirty_effects.clear();
|
|
1696
|
-
for (const fn of this.#commit_callbacks) fn(this);
|
|
1697
|
-
this.#commit_callbacks.clear();
|
|
1698
|
-
previous_batch = this;
|
|
1699
|
-
flush_queued_effects(render_effects);
|
|
1700
|
-
flush_queued_effects(effects);
|
|
1701
|
-
previous_batch = null;
|
|
1702
|
-
this.#deferred?.resolve();
|
|
1703
|
-
var next_batch = current_batch;
|
|
1704
|
-
if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) this.#unlink();
|
|
1705
|
-
if (this.#roots.length > 0) if (next_batch !== null) {
|
|
1706
|
-
const batch = next_batch;
|
|
1707
|
-
batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
|
|
1708
|
-
} else next_batch = this;
|
|
1709
|
-
if (next_batch !== null) next_batch.#process();
|
|
1710
1752
|
}
|
|
1711
1753
|
/**
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
* @param {
|
|
1716
|
-
* @param {
|
|
1754
|
+
* Update the source that powers `$effect.pending()` inside this boundary,
|
|
1755
|
+
* and controls when the current `pending` snippet (if any) is removed.
|
|
1756
|
+
* Do not call from inside the class
|
|
1757
|
+
* @param {1 | -1} d
|
|
1758
|
+
* @param {Batch} batch
|
|
1717
1759
|
*/
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
else if (is_dirty(effect)) {
|
|
1728
|
-
if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
|
|
1729
|
-
update_effect(effect);
|
|
1730
|
-
}
|
|
1731
|
-
var child = effect.first;
|
|
1732
|
-
if (child !== null) {
|
|
1733
|
-
effect = child;
|
|
1734
|
-
continue;
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
while (effect !== null) {
|
|
1738
|
-
var next = effect.next;
|
|
1739
|
-
if (next !== null) {
|
|
1740
|
-
effect = next;
|
|
1741
|
-
break;
|
|
1742
|
-
}
|
|
1743
|
-
effect = effect.parent;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1760
|
+
update_pending_count(d, batch) {
|
|
1761
|
+
this.#update_pending_count(d, batch);
|
|
1762
|
+
this.#local_pending_count += d;
|
|
1763
|
+
if (!this.#effect_pending || this.#pending_count_update_queued) return;
|
|
1764
|
+
this.#pending_count_update_queued = true;
|
|
1765
|
+
queue_micro_task(() => {
|
|
1766
|
+
this.#pending_count_update_queued = false;
|
|
1767
|
+
if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count);
|
|
1768
|
+
});
|
|
1746
1769
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1770
|
+
get_effect_pending() {
|
|
1771
|
+
this.#effect_pending_subscriber();
|
|
1772
|
+
return get(this.#effect_pending);
|
|
1773
|
+
}
|
|
1774
|
+
/** @param {unknown} error */
|
|
1775
|
+
error(error) {
|
|
1776
|
+
if (!this.#props.onerror && !this.#props.failed) throw error;
|
|
1777
|
+
if (current_batch?.is_fork) {
|
|
1778
|
+
if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
|
|
1779
|
+
if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
|
|
1780
|
+
if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
|
|
1781
|
+
current_batch.oncommit(() => {
|
|
1782
|
+
this.#handle_error(error);
|
|
1783
|
+
});
|
|
1784
|
+
} else this.#handle_error(error);
|
|
1756
1785
|
}
|
|
1757
1786
|
/**
|
|
1758
|
-
* @param {
|
|
1787
|
+
* @param {unknown} error
|
|
1759
1788
|
*/
|
|
1760
|
-
#
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
this
|
|
1789
|
+
#handle_error(error) {
|
|
1790
|
+
if (this.#main_effect) {
|
|
1791
|
+
destroy_effect(this.#main_effect);
|
|
1792
|
+
this.#main_effect = null;
|
|
1764
1793
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1794
|
+
if (this.#pending_effect) {
|
|
1795
|
+
destroy_effect(this.#pending_effect);
|
|
1796
|
+
this.#pending_effect = null;
|
|
1768
1797
|
}
|
|
1769
|
-
this
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
* async effects that we just resolved (TODO unless they depend
|
|
1773
|
-
* on values in this batch that are NOT in the later batch?).
|
|
1774
|
-
* Through this we also will populate the correct #skipped_branches,
|
|
1775
|
-
* oncommit callbacks etc, so we don't need to merge them separately.
|
|
1776
|
-
* @param {Value} value
|
|
1777
|
-
*/
|
|
1778
|
-
const mark = (value) => {
|
|
1779
|
-
var reactions = value.reactions;
|
|
1780
|
-
if (reactions === null) return;
|
|
1781
|
-
for (const reaction of reactions) {
|
|
1782
|
-
var flags = reaction.f;
|
|
1783
|
-
if ((flags & 2) !== 0) mark(reaction);
|
|
1784
|
-
else {
|
|
1785
|
-
var effect = reaction;
|
|
1786
|
-
if (flags & 4194320 && !this.async_deriveds.has(effect)) {
|
|
1787
|
-
this.#maybe_dirty_effects.delete(effect);
|
|
1788
|
-
set_signal_status(effect, DIRTY);
|
|
1789
|
-
this.schedule(effect);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
};
|
|
1794
|
-
for (const source of this.current.keys()) mark(source);
|
|
1795
|
-
this.oncommit(() => batch.discard());
|
|
1796
|
-
batch.#unlink();
|
|
1797
|
-
current_batch = this;
|
|
1798
|
-
this.#process();
|
|
1799
|
-
}
|
|
1800
|
-
/**
|
|
1801
|
-
* @param {Effect[]} effects
|
|
1802
|
-
*/
|
|
1803
|
-
#defer_effects(effects) {
|
|
1804
|
-
for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
|
|
1805
|
-
}
|
|
1806
|
-
/**
|
|
1807
|
-
* Associate a change to a given source with the current
|
|
1808
|
-
* batch, noting its previous and current values
|
|
1809
|
-
* @param {Value} source
|
|
1810
|
-
* @param {any} value
|
|
1811
|
-
* @param {boolean} [is_derived]
|
|
1812
|
-
*/
|
|
1813
|
-
capture(source, value, is_derived = false) {
|
|
1814
|
-
if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
|
|
1815
|
-
if ((source.f & 8388608) === 0) {
|
|
1816
|
-
this.current.set(source, [value, is_derived]);
|
|
1817
|
-
batch_values?.set(source, value);
|
|
1798
|
+
if (this.#failed_effect) {
|
|
1799
|
+
destroy_effect(this.#failed_effect);
|
|
1800
|
+
this.#failed_effect = null;
|
|
1818
1801
|
}
|
|
1819
|
-
if (
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
}
|
|
1824
|
-
deactivate() {
|
|
1825
|
-
current_batch = null;
|
|
1826
|
-
batch_values = null;
|
|
1827
|
-
}
|
|
1828
|
-
flush() {
|
|
1829
|
-
try {
|
|
1830
|
-
is_processing = true;
|
|
1831
|
-
current_batch = this;
|
|
1832
|
-
this.#process();
|
|
1833
|
-
} finally {
|
|
1834
|
-
flush_count = 0;
|
|
1835
|
-
last_scheduled_effect = null;
|
|
1836
|
-
collected_effects = null;
|
|
1837
|
-
legacy_updates = null;
|
|
1838
|
-
is_processing = false;
|
|
1839
|
-
current_batch = null;
|
|
1840
|
-
batch_values = null;
|
|
1841
|
-
old_values.clear();
|
|
1802
|
+
if (hydrating) {
|
|
1803
|
+
set_hydrate_node(this.#hydrate_open);
|
|
1804
|
+
next();
|
|
1805
|
+
set_hydrate_node(skip_nodes());
|
|
1842
1806
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
* @param {Effect} effect
|
|
1852
|
-
*/
|
|
1853
|
-
register_created_effect(effect) {
|
|
1854
|
-
this.#new_effects.push(effect);
|
|
1855
|
-
}
|
|
1856
|
-
#commit() {
|
|
1857
|
-
for (let batch = first_batch; batch !== null; batch = batch.#next) {
|
|
1858
|
-
var is_earlier = batch.id < this.id;
|
|
1859
|
-
/** @type {Source[]} */
|
|
1860
|
-
var sources = [];
|
|
1861
|
-
for (const [source, [value, is_derived]] of this.current) {
|
|
1862
|
-
if (batch.current.has(source)) {
|
|
1863
|
-
var batch_value = batch.current.get(source)[0];
|
|
1864
|
-
if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
|
|
1865
|
-
else continue;
|
|
1866
|
-
}
|
|
1867
|
-
sources.push(source);
|
|
1807
|
+
var onerror = this.#props.onerror;
|
|
1808
|
+
let failed = this.#props.failed;
|
|
1809
|
+
var did_reset = false;
|
|
1810
|
+
var calling_on_error = false;
|
|
1811
|
+
const reset = () => {
|
|
1812
|
+
if (did_reset) {
|
|
1813
|
+
svelte_boundary_reset_noop();
|
|
1814
|
+
return;
|
|
1868
1815
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1816
|
+
did_reset = true;
|
|
1817
|
+
if (calling_on_error) svelte_boundary_reset_onerror();
|
|
1818
|
+
if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => {
|
|
1819
|
+
this.#failed_effect = null;
|
|
1820
|
+
});
|
|
1821
|
+
this.#run(() => {
|
|
1822
|
+
this.#render();
|
|
1823
|
+
});
|
|
1824
|
+
};
|
|
1825
|
+
/** @param {unknown} transformed_error */
|
|
1826
|
+
const handle_error_result = (transformed_error) => {
|
|
1827
|
+
try {
|
|
1828
|
+
calling_on_error = true;
|
|
1829
|
+
onerror?.(transformed_error, reset);
|
|
1830
|
+
calling_on_error = false;
|
|
1831
|
+
} catch (error) {
|
|
1832
|
+
invoke_error_boundary(error, this.#effect && this.#effect.parent);
|
|
1872
1833
|
}
|
|
1873
|
-
if (
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
})
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
var marked = /* @__PURE__ */ new Set();
|
|
1885
|
-
/** @type {Map<Reaction, boolean>} */
|
|
1886
|
-
var checked = /* @__PURE__ */ new Map();
|
|
1887
|
-
for (var source of sources) mark_effects(source, others, marked, checked);
|
|
1888
|
-
checked = /* @__PURE__ */ new Map();
|
|
1889
|
-
var current_unequal = [...batch.current].filter(([c, v1]) => {
|
|
1890
|
-
const v2 = this.current.get(c);
|
|
1891
|
-
if (!v2) return true;
|
|
1892
|
-
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
1893
|
-
}).map(([c]) => c);
|
|
1894
|
-
if (current_unequal.length > 0) {
|
|
1895
|
-
for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
|
|
1896
|
-
set_signal_status(effect, DIRTY);
|
|
1897
|
-
batch.schedule(effect);
|
|
1898
|
-
} else batch.#dirty_effects.add(effect);
|
|
1899
|
-
}
|
|
1900
|
-
if (batch.#roots.length > 0 && !batch.#decrement_queued) {
|
|
1901
|
-
batch.apply();
|
|
1902
|
-
for (var root of batch.#roots) batch.#traverse(root, [], []);
|
|
1903
|
-
batch.#roots = [];
|
|
1834
|
+
if (failed) this.#failed_effect = this.#run(() => {
|
|
1835
|
+
try {
|
|
1836
|
+
return branch(() => {
|
|
1837
|
+
var effect = active_effect;
|
|
1838
|
+
effect.b = this;
|
|
1839
|
+
effect.f |= 128;
|
|
1840
|
+
failed(this.#anchor, () => transformed_error, () => reset);
|
|
1841
|
+
});
|
|
1842
|
+
} catch (error) {
|
|
1843
|
+
invoke_error_boundary(error, this.#effect.parent);
|
|
1844
|
+
return null;
|
|
1904
1845
|
}
|
|
1905
|
-
|
|
1846
|
+
});
|
|
1847
|
+
};
|
|
1848
|
+
queue_micro_task(() => {
|
|
1849
|
+
/** @type {unknown} */
|
|
1850
|
+
var result;
|
|
1851
|
+
try {
|
|
1852
|
+
result = this.transform_error(error);
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
invoke_error_boundary(e, this.#effect && this.#effect.parent);
|
|
1855
|
+
return;
|
|
1906
1856
|
}
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
this.#pending += 1;
|
|
1915
|
-
if (blocking) {
|
|
1916
|
-
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
1917
|
-
this.#blocking_pending.set(effect, blocking_pending_count + 1);
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
/**
|
|
1921
|
-
* @param {boolean} blocking
|
|
1922
|
-
* @param {Effect} effect
|
|
1923
|
-
*/
|
|
1924
|
-
decrement(blocking, effect) {
|
|
1925
|
-
this.#pending -= 1;
|
|
1926
|
-
if (blocking) {
|
|
1927
|
-
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
1928
|
-
if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
|
|
1929
|
-
else this.#blocking_pending.set(effect, blocking_pending_count - 1);
|
|
1930
|
-
}
|
|
1931
|
-
if (this.#decrement_queued) return;
|
|
1932
|
-
this.#decrement_queued = true;
|
|
1933
|
-
queue_micro_task(() => {
|
|
1934
|
-
this.#decrement_queued = false;
|
|
1935
|
-
if (this.linked) this.flush();
|
|
1857
|
+
if (result !== null && typeof result === "object" && typeof result.then === "function")
|
|
1858
|
+
/** @type {any} */ result.then(
|
|
1859
|
+
handle_error_result,
|
|
1860
|
+
/** @param {unknown} e */
|
|
1861
|
+
(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
|
|
1862
|
+
);
|
|
1863
|
+
else handle_error_result(result);
|
|
1936
1864
|
});
|
|
1937
1865
|
}
|
|
1938
|
-
/**
|
|
1939
|
-
* @param {Set<Effect>} dirty_effects
|
|
1940
|
-
* @param {Set<Effect>} maybe_dirty_effects
|
|
1941
|
-
*/
|
|
1942
|
-
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
1943
|
-
for (const e of dirty_effects) this.#dirty_effects.add(e);
|
|
1944
|
-
for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
|
|
1945
|
-
dirty_effects.clear();
|
|
1946
|
-
maybe_dirty_effects.clear();
|
|
1947
|
-
}
|
|
1948
|
-
/** @param {(batch: Batch) => void} fn */
|
|
1949
|
-
oncommit(fn) {
|
|
1950
|
-
this.#commit_callbacks.add(fn);
|
|
1951
|
-
}
|
|
1952
|
-
/** @param {(batch: Batch) => void} fn */
|
|
1953
|
-
ondiscard(fn) {
|
|
1954
|
-
this.#discard_callbacks.add(fn);
|
|
1955
|
-
}
|
|
1956
|
-
settled() {
|
|
1957
|
-
return (this.#deferred ??= deferred()).promise;
|
|
1958
|
-
}
|
|
1959
|
-
static ensure() {
|
|
1960
|
-
if (current_batch === null) {
|
|
1961
|
-
const batch = current_batch = new Batch();
|
|
1962
|
-
if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
|
|
1963
|
-
if (!batch.#started) batch.flush();
|
|
1964
|
-
});
|
|
1965
|
-
}
|
|
1966
|
-
return current_batch;
|
|
1967
|
-
}
|
|
1968
|
-
apply() {
|
|
1969
|
-
batch_values = null;
|
|
1970
|
-
}
|
|
1971
|
-
/**
|
|
1972
|
-
*
|
|
1973
|
-
* @param {Effect} effect
|
|
1974
|
-
*/
|
|
1975
|
-
schedule(effect) {
|
|
1976
|
-
last_scheduled_effect = effect;
|
|
1977
|
-
if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
|
|
1978
|
-
effect.b.defer_effect(effect);
|
|
1979
|
-
return;
|
|
1980
|
-
}
|
|
1981
|
-
var e = effect;
|
|
1982
|
-
while (e.parent !== null) {
|
|
1983
|
-
e = e.parent;
|
|
1984
|
-
var flags = e.f;
|
|
1985
|
-
if (collected_effects !== null && e === active_effect) {
|
|
1986
|
-
if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
|
|
1987
|
-
}
|
|
1988
|
-
if ((flags & 96) !== 0) {
|
|
1989
|
-
if ((flags & 1024) === 0) return;
|
|
1990
|
-
e.f ^= CLEAN;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
this.#roots.push(e);
|
|
1994
|
-
}
|
|
1995
|
-
#unlink() {
|
|
1996
|
-
if (!this.linked) return;
|
|
1997
|
-
var prev = this.#prev;
|
|
1998
|
-
var next = this.#next;
|
|
1999
|
-
if (prev === null) first_batch = next;
|
|
2000
|
-
else prev.#next = next;
|
|
2001
|
-
if (next === null) last_batch = prev;
|
|
2002
|
-
else next.#prev = prev;
|
|
2003
|
-
this.linked = false;
|
|
2004
|
-
}
|
|
2005
1866
|
};
|
|
1867
|
+
var OBSOLETE = Symbol("obsolete");
|
|
2006
1868
|
/**
|
|
2007
|
-
*
|
|
2008
|
-
* Returns void if no callback is provided, otherwise returns the result of calling the callback.
|
|
2009
|
-
* @template [T=void]
|
|
2010
|
-
* @param {(() => T) | undefined} [fn]
|
|
2011
|
-
* @returns {T}
|
|
2012
|
-
*/
|
|
2013
|
-
function flushSync(fn) {
|
|
2014
|
-
var was_flushing_sync = is_flushing_sync;
|
|
2015
|
-
is_flushing_sync = true;
|
|
2016
|
-
try {
|
|
2017
|
-
var result;
|
|
2018
|
-
if (fn) {
|
|
2019
|
-
if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
|
|
2020
|
-
result = fn();
|
|
2021
|
-
}
|
|
2022
|
-
while (true) {
|
|
2023
|
-
flush_tasks();
|
|
2024
|
-
if (current_batch === null) return result;
|
|
2025
|
-
current_batch.flush();
|
|
2026
|
-
}
|
|
2027
|
-
} finally {
|
|
2028
|
-
is_flushing_sync = was_flushing_sync;
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
function infinite_loop_guard() {
|
|
2032
|
-
try {
|
|
2033
|
-
effect_update_depth_exceeded();
|
|
2034
|
-
} catch (error) {
|
|
2035
|
-
invoke_error_boundary(error, last_scheduled_effect);
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
/** @type {Set<Effect> | null} */
|
|
2039
|
-
var eager_block_effects = null;
|
|
2040
|
-
/**
|
|
2041
|
-
* @param {Array<Effect>} effects
|
|
2042
|
-
* @returns {void}
|
|
2043
|
-
*/
|
|
2044
|
-
function flush_queued_effects(effects) {
|
|
2045
|
-
var length = effects.length;
|
|
2046
|
-
if (length === 0) return;
|
|
2047
|
-
var i = 0;
|
|
2048
|
-
while (i < length) {
|
|
2049
|
-
var effect = effects[i++];
|
|
2050
|
-
if ((effect.f & 24576) === 0 && is_dirty(effect)) {
|
|
2051
|
-
eager_block_effects = /* @__PURE__ */ new Set();
|
|
2052
|
-
update_effect(effect);
|
|
2053
|
-
if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
|
|
2054
|
-
if (eager_block_effects?.size > 0) {
|
|
2055
|
-
old_values.clear();
|
|
2056
|
-
for (const e of eager_block_effects) {
|
|
2057
|
-
if ((e.f & 24576) !== 0) continue;
|
|
2058
|
-
/** @type {Effect[]} */
|
|
2059
|
-
const ordered_effects = [e];
|
|
2060
|
-
let ancestor = e.parent;
|
|
2061
|
-
while (ancestor !== null) {
|
|
2062
|
-
if (eager_block_effects.has(ancestor)) {
|
|
2063
|
-
eager_block_effects.delete(ancestor);
|
|
2064
|
-
ordered_effects.push(ancestor);
|
|
2065
|
-
}
|
|
2066
|
-
ancestor = ancestor.parent;
|
|
2067
|
-
}
|
|
2068
|
-
for (let j = ordered_effects.length - 1; j >= 0; j--) {
|
|
2069
|
-
const e = ordered_effects[j];
|
|
2070
|
-
if ((e.f & 24576) !== 0) continue;
|
|
2071
|
-
update_effect(e);
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
eager_block_effects.clear();
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
eager_block_effects = null;
|
|
2079
|
-
}
|
|
2080
|
-
/**
|
|
2081
|
-
* This is similar to `mark_reactions`, but it only marks async/block effects
|
|
2082
|
-
* depending on `value` and at least one of the other `sources`, so that
|
|
2083
|
-
* these effects can re-run after another batch has been committed
|
|
2084
|
-
* @param {Value} value
|
|
2085
|
-
* @param {Source[]} sources
|
|
2086
|
-
* @param {Set<Value>} marked
|
|
2087
|
-
* @param {Map<Reaction, boolean>} checked
|
|
2088
|
-
*/
|
|
2089
|
-
function mark_effects(value, sources, marked, checked) {
|
|
2090
|
-
if (marked.has(value)) return;
|
|
2091
|
-
marked.add(value);
|
|
2092
|
-
if (value.reactions !== null) for (const reaction of value.reactions) {
|
|
2093
|
-
const flags = reaction.f;
|
|
2094
|
-
if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
|
|
2095
|
-
else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
|
|
2096
|
-
set_signal_status(reaction, DIRTY);
|
|
2097
|
-
schedule_effect(reaction);
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
/**
|
|
2102
|
-
* @param {Reaction} reaction
|
|
2103
|
-
* @param {Source[]} sources
|
|
2104
|
-
* @param {Map<Reaction, boolean>} checked
|
|
2105
|
-
*/
|
|
2106
|
-
function depends_on(reaction, sources, checked) {
|
|
2107
|
-
const depends = checked.get(reaction);
|
|
2108
|
-
if (depends !== void 0) return depends;
|
|
2109
|
-
if (reaction.deps !== null) for (const dep of reaction.deps) {
|
|
2110
|
-
if (includes.call(sources, dep)) return true;
|
|
2111
|
-
if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
|
|
2112
|
-
checked.set(dep, true);
|
|
2113
|
-
return true;
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
checked.set(reaction, false);
|
|
2117
|
-
return false;
|
|
2118
|
-
}
|
|
2119
|
-
/**
|
|
2120
|
-
* @param {Effect} effect
|
|
1869
|
+
* @param {Derived} derived
|
|
2121
1870
|
* @returns {void}
|
|
2122
1871
|
*/
|
|
2123
|
-
function
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
* they can be correctly rescheduled later. Tracks dirty and maybe_dirty
|
|
2129
|
-
* effects so they can be rescheduled if the branch survives.
|
|
2130
|
-
* @param {Effect} effect
|
|
2131
|
-
* @param {{ d: Effect[], m: Effect[] }} tracked
|
|
2132
|
-
*/
|
|
2133
|
-
function reset_branch(effect, tracked) {
|
|
2134
|
-
if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
|
|
2135
|
-
if ((effect.f & 2048) !== 0) tracked.d.push(effect);
|
|
2136
|
-
else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
|
|
2137
|
-
set_signal_status(effect, CLEAN);
|
|
2138
|
-
var e = effect.first;
|
|
2139
|
-
while (e !== null) {
|
|
2140
|
-
reset_branch(e, tracked);
|
|
2141
|
-
e = e.next;
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* Mark an entire effect tree clean following an error
|
|
2146
|
-
* @param {Effect} effect
|
|
2147
|
-
*/
|
|
2148
|
-
function reset_all(effect) {
|
|
2149
|
-
set_signal_status(effect, CLEAN);
|
|
2150
|
-
var e = effect.first;
|
|
2151
|
-
while (e !== null) {
|
|
2152
|
-
reset_all(e);
|
|
2153
|
-
e = e.next;
|
|
1872
|
+
function destroy_derived_effects(derived) {
|
|
1873
|
+
var effects = derived.effects;
|
|
1874
|
+
if (effects !== null) {
|
|
1875
|
+
derived.effects = null;
|
|
1876
|
+
for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
|
|
2154
1877
|
}
|
|
2155
1878
|
}
|
|
2156
1879
|
/**
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
*
|
|
2160
|
-
* If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
|
|
2161
|
-
* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
|
|
2162
|
-
*
|
|
2163
|
-
* If `start` returns a cleanup function, it will be called when the effect is destroyed.
|
|
2164
|
-
*
|
|
2165
|
-
* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
|
|
2166
|
-
* are active, and the returned teardown function will only be called when all effects are destroyed.
|
|
2167
|
-
*
|
|
2168
|
-
* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
|
|
2169
|
-
*
|
|
2170
|
-
* ```js
|
|
2171
|
-
* import { createSubscriber } from 'svelte/reactivity';
|
|
2172
|
-
* import { on } from 'svelte/events';
|
|
2173
|
-
*
|
|
2174
|
-
* export class MediaQuery {
|
|
2175
|
-
* #query;
|
|
2176
|
-
* #subscribe;
|
|
2177
|
-
*
|
|
2178
|
-
* constructor(query) {
|
|
2179
|
-
* this.#query = window.matchMedia(`(${query})`);
|
|
2180
|
-
*
|
|
2181
|
-
* this.#subscribe = createSubscriber((update) => {
|
|
2182
|
-
* // when the `change` event occurs, re-run any effects that read `this.current`
|
|
2183
|
-
* const off = on(this.#query, 'change', update);
|
|
2184
|
-
*
|
|
2185
|
-
* // stop listening when all the effects are destroyed
|
|
2186
|
-
* return () => off();
|
|
2187
|
-
* });
|
|
2188
|
-
* }
|
|
2189
|
-
*
|
|
2190
|
-
* get current() {
|
|
2191
|
-
* // This makes the getter reactive, if read in an effect
|
|
2192
|
-
* this.#subscribe();
|
|
2193
|
-
*
|
|
2194
|
-
* // Return the current state of the query, whether or not we're in an effect
|
|
2195
|
-
* return this.#query.matches;
|
|
2196
|
-
* }
|
|
2197
|
-
* }
|
|
2198
|
-
* ```
|
|
2199
|
-
* @param {(update: () => void) => (() => void) | void} start
|
|
2200
|
-
* @since 5.7.0
|
|
1880
|
+
* @template T
|
|
1881
|
+
* @param {Derived} derived
|
|
1882
|
+
* @returns {T}
|
|
2201
1883
|
*/
|
|
2202
|
-
function
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
1884
|
+
function execute_derived(derived) {
|
|
1885
|
+
var value;
|
|
1886
|
+
var prev_active_effect = active_effect;
|
|
1887
|
+
var parent = derived.parent;
|
|
1888
|
+
if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
|
|
1889
|
+
derived_inert();
|
|
1890
|
+
return derived.v;
|
|
1891
|
+
}
|
|
1892
|
+
set_active_effect(parent);
|
|
1893
|
+
try {
|
|
1894
|
+
derived.f &= ~WAS_MARKED;
|
|
1895
|
+
destroy_derived_effects(derived);
|
|
1896
|
+
value = update_reaction(derived);
|
|
1897
|
+
} finally {
|
|
1898
|
+
set_active_effect(prev_active_effect);
|
|
1899
|
+
}
|
|
1900
|
+
return value;
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* @param {Derived} derived
|
|
1904
|
+
* @returns {void}
|
|
1905
|
+
*/
|
|
1906
|
+
function update_derived(derived) {
|
|
1907
|
+
var value = execute_derived(derived);
|
|
1908
|
+
if (!derived.equals(value)) {
|
|
1909
|
+
derived.wv = increment_write_version();
|
|
1910
|
+
if (!current_batch?.is_fork || derived.deps === null) {
|
|
1911
|
+
if (current_batch !== null) {
|
|
1912
|
+
current_batch.capture(derived, value, true);
|
|
1913
|
+
previous_batch?.capture(derived, value, true);
|
|
1914
|
+
} else derived.v = value;
|
|
1915
|
+
if (derived.deps === null) {
|
|
1916
|
+
set_signal_status(derived, CLEAN);
|
|
1917
|
+
return;
|
|
1918
|
+
}
|
|
2224
1919
|
}
|
|
2225
|
-
}
|
|
1920
|
+
}
|
|
1921
|
+
if (is_destroying_effect) return;
|
|
1922
|
+
if (batch_values !== null) {
|
|
1923
|
+
if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
|
|
1924
|
+
} else update_derived_status(derived);
|
|
2226
1925
|
}
|
|
2227
|
-
/** @import { Effect, Source, TemplateNode, } from '#client' */
|
|
2228
1926
|
/**
|
|
2229
|
-
* @
|
|
2230
|
-
* onerror?: ((error: unknown, reset: () => void) => void) | null;
|
|
2231
|
-
* failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
|
|
2232
|
-
* pending?: ((anchor: Node) => void) | null;
|
|
2233
|
-
* }} BoundaryProps
|
|
1927
|
+
* @param {Derived} derived
|
|
2234
1928
|
*/
|
|
2235
|
-
|
|
1929
|
+
function freeze_derived_effects(derived) {
|
|
1930
|
+
if (derived.effects === null) return;
|
|
1931
|
+
for (const e of derived.effects) if (e.teardown || e.ac) {
|
|
1932
|
+
e.teardown?.();
|
|
1933
|
+
e.ac?.abort(STALE_REACTION);
|
|
1934
|
+
if (e.fn !== null) e.teardown = noop;
|
|
1935
|
+
e.ac = null;
|
|
1936
|
+
remove_reactions(e, 0);
|
|
1937
|
+
destroy_effect_children(e);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
2236
1940
|
/**
|
|
2237
|
-
* @param {
|
|
2238
|
-
* @param {BoundaryProps} props
|
|
2239
|
-
* @param {((anchor: Node) => void)} children
|
|
2240
|
-
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
2241
|
-
* @returns {void}
|
|
1941
|
+
* @param {Derived} derived
|
|
2242
1942
|
*/
|
|
2243
|
-
function
|
|
2244
|
-
|
|
1943
|
+
function unfreeze_derived_effects(derived) {
|
|
1944
|
+
if (derived.effects === null) return;
|
|
1945
|
+
for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
|
|
2245
1946
|
}
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
1947
|
+
/** @import { Fork } from 'svelte' */
|
|
1948
|
+
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
1949
|
+
/** @type {Batch | null} */
|
|
1950
|
+
var first_batch = null;
|
|
1951
|
+
/** @type {Batch | null} */
|
|
1952
|
+
var last_batch = null;
|
|
1953
|
+
/** @type {Batch | null} */
|
|
1954
|
+
var current_batch = null;
|
|
1955
|
+
/**
|
|
1956
|
+
* This is needed to avoid overwriting inputs
|
|
1957
|
+
* @type {Batch | null}
|
|
1958
|
+
*/
|
|
1959
|
+
var previous_batch = null;
|
|
1960
|
+
/**
|
|
1961
|
+
* When time travelling (i.e. working in one batch, while other batches
|
|
1962
|
+
* still have ongoing work), we ignore the real values of affected
|
|
1963
|
+
* signals in favour of their values within the batch
|
|
1964
|
+
* @type {Map<Value, any> | null}
|
|
1965
|
+
*/
|
|
1966
|
+
var batch_values = null;
|
|
1967
|
+
/** @type {Effect | null} */
|
|
1968
|
+
var last_scheduled_effect = null;
|
|
1969
|
+
var is_flushing_sync = false;
|
|
1970
|
+
var is_processing = false;
|
|
1971
|
+
/**
|
|
1972
|
+
* During traversal, this is an array. Newly created effects are (if not immediately
|
|
1973
|
+
* executed) pushed to this array, rather than going through the scheduling
|
|
1974
|
+
* rigamarole that would cause another turn of the flush loop.
|
|
1975
|
+
* @type {Effect[] | null}
|
|
1976
|
+
*/
|
|
1977
|
+
var collected_effects = null;
|
|
1978
|
+
/**
|
|
1979
|
+
* An array of effects that are marked during traversal as a result of a `set`
|
|
1980
|
+
* (not `internal_set`) call. These will be added to the next batch and
|
|
1981
|
+
* trigger another `batch.process()`
|
|
1982
|
+
* @type {Effect[] | null}
|
|
1983
|
+
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
1984
|
+
*/
|
|
1985
|
+
var legacy_updates = null;
|
|
1986
|
+
var flush_count = 0;
|
|
1987
|
+
var uid = 1;
|
|
1988
|
+
var Batch = class Batch {
|
|
1989
|
+
id = uid++;
|
|
1990
|
+
/** True as soon as `#process` was called */
|
|
1991
|
+
#started = false;
|
|
1992
|
+
linked = true;
|
|
1993
|
+
/** @type {Batch | null} */
|
|
1994
|
+
#prev = null;
|
|
1995
|
+
/** @type {Batch | null} */
|
|
1996
|
+
#next = null;
|
|
1997
|
+
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
|
|
1998
|
+
async_deriveds = /* @__PURE__ */ new Map();
|
|
2250
1999
|
/**
|
|
2251
|
-
*
|
|
2252
|
-
*
|
|
2253
|
-
*
|
|
2000
|
+
* The current values of any signals that are updated in this batch.
|
|
2001
|
+
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
2002
|
+
* They keys of this map are identical to `this.#previous`
|
|
2003
|
+
* @type {Map<Value, [any, boolean]>}
|
|
2004
|
+
*/
|
|
2005
|
+
current = /* @__PURE__ */ new Map();
|
|
2006
|
+
/**
|
|
2007
|
+
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
2008
|
+
* They keys of this map are identical to `this.#current`
|
|
2009
|
+
* @type {Map<Value, any>}
|
|
2010
|
+
*/
|
|
2011
|
+
previous = /* @__PURE__ */ new Map();
|
|
2012
|
+
/**
|
|
2013
|
+
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
2014
|
+
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
2015
|
+
* @type {Set<(batch: Batch) => void>}
|
|
2016
|
+
*/
|
|
2017
|
+
#commit_callbacks = /* @__PURE__ */ new Set();
|
|
2018
|
+
/**
|
|
2019
|
+
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
2020
|
+
* @type {Set<(batch: Batch) => void>}
|
|
2021
|
+
*/
|
|
2022
|
+
#discard_callbacks = /* @__PURE__ */ new Set();
|
|
2023
|
+
/**
|
|
2024
|
+
* The number of async effects that are currently in flight
|
|
2025
|
+
*/
|
|
2026
|
+
#pending = 0;
|
|
2027
|
+
/**
|
|
2028
|
+
* Async effects that are currently in flight, _not_ inside a pending boundary
|
|
2029
|
+
* @type {Map<Effect, number>}
|
|
2030
|
+
*/
|
|
2031
|
+
#blocking_pending = /* @__PURE__ */ new Map();
|
|
2032
|
+
/**
|
|
2033
|
+
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
2034
|
+
* TODO replace with Promise.withResolvers once supported widely enough
|
|
2035
|
+
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
2036
|
+
*/
|
|
2037
|
+
#deferred = null;
|
|
2038
|
+
/**
|
|
2039
|
+
* The root effects that need to be flushed
|
|
2040
|
+
* @type {Effect[]}
|
|
2041
|
+
*/
|
|
2042
|
+
#roots = [];
|
|
2043
|
+
/**
|
|
2044
|
+
* Effects created while this batch was active.
|
|
2045
|
+
* @type {Effect[]}
|
|
2046
|
+
*/
|
|
2047
|
+
#new_effects = [];
|
|
2048
|
+
/**
|
|
2049
|
+
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
2050
|
+
* @type {Set<Effect>}
|
|
2254
2051
|
*/
|
|
2255
|
-
transform_error;
|
|
2256
|
-
/** @type {TemplateNode} */
|
|
2257
|
-
#anchor;
|
|
2258
|
-
/** @type {TemplateNode | null} */
|
|
2259
|
-
#hydrate_open = hydrating ? hydrate_node : null;
|
|
2260
|
-
/** @type {BoundaryProps} */
|
|
2261
|
-
#props;
|
|
2262
|
-
/** @type {((anchor: Node) => void)} */
|
|
2263
|
-
#children;
|
|
2264
|
-
/** @type {Effect} */
|
|
2265
|
-
#effect;
|
|
2266
|
-
/** @type {Effect | null} */
|
|
2267
|
-
#main_effect = null;
|
|
2268
|
-
/** @type {Effect | null} */
|
|
2269
|
-
#pending_effect = null;
|
|
2270
|
-
/** @type {Effect | null} */
|
|
2271
|
-
#failed_effect = null;
|
|
2272
|
-
/** @type {DocumentFragment | null} */
|
|
2273
|
-
#offscreen_fragment = null;
|
|
2274
|
-
#local_pending_count = 0;
|
|
2275
|
-
#pending_count = 0;
|
|
2276
|
-
#pending_count_update_queued = false;
|
|
2277
|
-
/** @type {Set<Effect>} */
|
|
2278
2052
|
#dirty_effects = /* @__PURE__ */ new Set();
|
|
2279
|
-
/**
|
|
2053
|
+
/**
|
|
2054
|
+
* Deferred effects that are MAYBE_DIRTY
|
|
2055
|
+
* @type {Set<Effect>}
|
|
2056
|
+
*/
|
|
2280
2057
|
#maybe_dirty_effects = /* @__PURE__ */ new Set();
|
|
2281
2058
|
/**
|
|
2282
|
-
* A
|
|
2283
|
-
*
|
|
2284
|
-
*
|
|
2285
|
-
*
|
|
2286
|
-
* @type {
|
|
2059
|
+
* A map of branches that still exist, but will be destroyed when this batch
|
|
2060
|
+
* is committed — we skip over these during `process`.
|
|
2061
|
+
* The value contains child effects that were dirty/maybe_dirty before being reset,
|
|
2062
|
+
* so they can be rescheduled if the branch survives.
|
|
2063
|
+
* @type {Map<Effect, { d: Effect[], m: Effect[] }>}
|
|
2287
2064
|
*/
|
|
2288
|
-
#
|
|
2289
|
-
#effect_pending_subscriber = createSubscriber(() => {
|
|
2290
|
-
this.#effect_pending = source(this.#local_pending_count);
|
|
2291
|
-
return () => {
|
|
2292
|
-
this.#effect_pending = null;
|
|
2293
|
-
};
|
|
2294
|
-
});
|
|
2065
|
+
#skipped_branches = /* @__PURE__ */ new Map();
|
|
2295
2066
|
/**
|
|
2296
|
-
*
|
|
2297
|
-
* @
|
|
2298
|
-
* @param {((anchor: Node) => void)} children
|
|
2299
|
-
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
2067
|
+
* Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
|
|
2068
|
+
* @type {Set<Effect>}
|
|
2300
2069
|
*/
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
|
|
2312
|
-
this.#effect = block(() => {
|
|
2313
|
-
if (hydrating) {
|
|
2314
|
-
const comment = this.#hydrate_open;
|
|
2315
|
-
hydrate_next();
|
|
2316
|
-
const server_rendered_pending = comment.data === "[!";
|
|
2317
|
-
if (comment.data.startsWith("[?")) {
|
|
2318
|
-
const serialized_error = JSON.parse(comment.data.slice(2));
|
|
2319
|
-
this.#hydrate_failed_content(serialized_error);
|
|
2320
|
-
} else if (server_rendered_pending) this.#hydrate_pending_content();
|
|
2321
|
-
else this.#hydrate_resolved_content();
|
|
2322
|
-
} else this.#render();
|
|
2323
|
-
}, flags);
|
|
2324
|
-
if (hydrating) this.#anchor = hydrate_node;
|
|
2070
|
+
#unskipped_branches = /* @__PURE__ */ new Set();
|
|
2071
|
+
is_fork = false;
|
|
2072
|
+
#decrement_queued = false;
|
|
2073
|
+
constructor() {
|
|
2074
|
+
if (last_batch === null) first_batch = last_batch = this;
|
|
2075
|
+
else {
|
|
2076
|
+
last_batch.#next = this;
|
|
2077
|
+
this.#prev = last_batch;
|
|
2078
|
+
}
|
|
2079
|
+
last_batch = this;
|
|
2325
2080
|
}
|
|
2326
|
-
#
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2081
|
+
#is_deferred() {
|
|
2082
|
+
if (this.is_fork) return true;
|
|
2083
|
+
for (const effect of this.#blocking_pending.keys()) {
|
|
2084
|
+
var e = effect;
|
|
2085
|
+
var skipped = false;
|
|
2086
|
+
while (e.parent !== null) {
|
|
2087
|
+
if (this.#skipped_branches.has(e)) {
|
|
2088
|
+
skipped = true;
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
e = e.parent;
|
|
2092
|
+
}
|
|
2093
|
+
if (!skipped) return true;
|
|
2331
2094
|
}
|
|
2095
|
+
return false;
|
|
2332
2096
|
}
|
|
2333
2097
|
/**
|
|
2334
|
-
*
|
|
2098
|
+
* Add an effect to the #skipped_branches map and reset its children
|
|
2099
|
+
* @param {Effect} effect
|
|
2335
2100
|
*/
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
failed(this.#anchor, () => error, () => () => {});
|
|
2101
|
+
skip_effect(effect) {
|
|
2102
|
+
if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
|
|
2103
|
+
d: [],
|
|
2104
|
+
m: []
|
|
2341
2105
|
});
|
|
2106
|
+
this.#unskipped_branches.delete(effect);
|
|
2342
2107
|
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
this.#
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
this.#anchor.before(fragment);
|
|
2357
|
-
this.#offscreen_fragment = null;
|
|
2358
|
-
pause_effect(this.#pending_effect, () => {
|
|
2359
|
-
this.#pending_effect = null;
|
|
2360
|
-
});
|
|
2361
|
-
this.#resolve(current_batch);
|
|
2108
|
+
/**
|
|
2109
|
+
* Remove an effect from the #skipped_branches map and reschedule
|
|
2110
|
+
* any tracked dirty/maybe_dirty child effects
|
|
2111
|
+
* @param {Effect} effect
|
|
2112
|
+
* @param {(e: Effect) => void} callback
|
|
2113
|
+
*/
|
|
2114
|
+
unskip_effect(effect, callback = (e) => this.schedule(e)) {
|
|
2115
|
+
var tracked = this.#skipped_branches.get(effect);
|
|
2116
|
+
if (tracked) {
|
|
2117
|
+
this.#skipped_branches.delete(effect);
|
|
2118
|
+
for (var e of tracked.d) {
|
|
2119
|
+
set_signal_status(e, DIRTY);
|
|
2120
|
+
callback(e);
|
|
2362
2121
|
}
|
|
2363
|
-
|
|
2122
|
+
for (e of tracked.m) {
|
|
2123
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
2124
|
+
callback(e);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
this.#unskipped_branches.add(effect);
|
|
2364
2128
|
}
|
|
2365
|
-
#
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
this.#
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2129
|
+
#process() {
|
|
2130
|
+
this.#started = true;
|
|
2131
|
+
if (flush_count++ > 1e3) {
|
|
2132
|
+
this.#unlink();
|
|
2133
|
+
infinite_loop_guard();
|
|
2134
|
+
}
|
|
2135
|
+
for (const e of this.#dirty_effects) {
|
|
2136
|
+
this.#maybe_dirty_effects.delete(e);
|
|
2137
|
+
set_signal_status(e, DIRTY);
|
|
2138
|
+
this.schedule(e);
|
|
2139
|
+
}
|
|
2140
|
+
for (const e of this.#maybe_dirty_effects) {
|
|
2141
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
2142
|
+
this.schedule(e);
|
|
2143
|
+
}
|
|
2144
|
+
const roots = this.#roots;
|
|
2145
|
+
this.#roots = [];
|
|
2146
|
+
this.apply();
|
|
2147
|
+
/** @type {Effect[]} */
|
|
2148
|
+
var effects = collected_effects = [];
|
|
2149
|
+
/** @type {Effect[]} */
|
|
2150
|
+
var render_effects = [];
|
|
2151
|
+
/**
|
|
2152
|
+
* @type {Effect[]}
|
|
2153
|
+
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
2154
|
+
*/
|
|
2155
|
+
var updates = legacy_updates = [];
|
|
2156
|
+
for (const root of roots) try {
|
|
2157
|
+
this.#traverse(root, effects, render_effects);
|
|
2158
|
+
} catch (e) {
|
|
2159
|
+
reset_all(root);
|
|
2160
|
+
if (!this.#is_deferred()) this.discard();
|
|
2161
|
+
throw e;
|
|
2381
2162
|
}
|
|
2163
|
+
current_batch = null;
|
|
2164
|
+
if (updates.length > 0) {
|
|
2165
|
+
var batch = Batch.ensure();
|
|
2166
|
+
for (const e of updates) batch.schedule(e);
|
|
2167
|
+
}
|
|
2168
|
+
collected_effects = null;
|
|
2169
|
+
legacy_updates = null;
|
|
2170
|
+
if (this.#is_deferred()) {
|
|
2171
|
+
this.#defer_effects(render_effects);
|
|
2172
|
+
this.#defer_effects(effects);
|
|
2173
|
+
for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
|
|
2174
|
+
if (updates.length > 0)
|
|
2175
|
+
/** @type {Batch} */ current_batch.#process();
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const earlier_batch = this.#find_earlier_batch();
|
|
2179
|
+
if (earlier_batch) {
|
|
2180
|
+
this.#defer_effects(render_effects);
|
|
2181
|
+
this.#defer_effects(effects);
|
|
2182
|
+
earlier_batch.#merge(this);
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
this.#dirty_effects.clear();
|
|
2186
|
+
this.#maybe_dirty_effects.clear();
|
|
2187
|
+
for (const fn of this.#commit_callbacks) fn(this);
|
|
2188
|
+
this.#commit_callbacks.clear();
|
|
2189
|
+
previous_batch = this;
|
|
2190
|
+
flush_queued_effects(render_effects);
|
|
2191
|
+
flush_queued_effects(effects);
|
|
2192
|
+
previous_batch = null;
|
|
2193
|
+
this.#deferred?.resolve();
|
|
2194
|
+
var next_batch = current_batch;
|
|
2195
|
+
if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) this.#unlink();
|
|
2196
|
+
if (this.#roots.length > 0) if (next_batch !== null) {
|
|
2197
|
+
const batch = next_batch;
|
|
2198
|
+
batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
|
|
2199
|
+
} else next_batch = this;
|
|
2200
|
+
if (next_batch !== null) next_batch.#process();
|
|
2382
2201
|
}
|
|
2383
2202
|
/**
|
|
2384
|
-
*
|
|
2203
|
+
* Traverse the effect tree, executing effects or stashing
|
|
2204
|
+
* them for later execution as appropriate
|
|
2205
|
+
* @param {Effect} root
|
|
2206
|
+
* @param {Effect[]} effects
|
|
2207
|
+
* @param {Effect[]} render_effects
|
|
2385
2208
|
*/
|
|
2386
|
-
#
|
|
2387
|
-
|
|
2388
|
-
|
|
2209
|
+
#traverse(root, effects, render_effects) {
|
|
2210
|
+
root.f ^= CLEAN;
|
|
2211
|
+
var effect = root.first;
|
|
2212
|
+
while (effect !== null) {
|
|
2213
|
+
var flags = effect.f;
|
|
2214
|
+
var is_branch = (flags & 96) !== 0;
|
|
2215
|
+
if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
|
|
2216
|
+
if (is_branch) effect.f ^= CLEAN;
|
|
2217
|
+
else if ((flags & 4) !== 0) effects.push(effect);
|
|
2218
|
+
else if (is_dirty(effect)) {
|
|
2219
|
+
if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
|
|
2220
|
+
update_effect(effect);
|
|
2221
|
+
}
|
|
2222
|
+
var child = effect.first;
|
|
2223
|
+
if (child !== null) {
|
|
2224
|
+
effect = child;
|
|
2225
|
+
continue;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
while (effect !== null) {
|
|
2229
|
+
var next = effect.next;
|
|
2230
|
+
if (next !== null) {
|
|
2231
|
+
effect = next;
|
|
2232
|
+
break;
|
|
2233
|
+
}
|
|
2234
|
+
effect = effect.parent;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
#find_earlier_batch() {
|
|
2239
|
+
var batch = this.#prev;
|
|
2240
|
+
while (batch !== null) {
|
|
2241
|
+
if (!batch.is_fork) {
|
|
2242
|
+
for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
|
|
2243
|
+
}
|
|
2244
|
+
batch = batch.#prev;
|
|
2245
|
+
}
|
|
2246
|
+
return null;
|
|
2389
2247
|
}
|
|
2390
2248
|
/**
|
|
2391
|
-
*
|
|
2392
|
-
* @param {Effect} effect
|
|
2249
|
+
* @param {Batch} batch
|
|
2393
2250
|
*/
|
|
2394
|
-
|
|
2395
|
-
|
|
2251
|
+
#merge(batch) {
|
|
2252
|
+
for (const [source, value] of batch.current) {
|
|
2253
|
+
if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
|
|
2254
|
+
this.current.set(source, value);
|
|
2255
|
+
}
|
|
2256
|
+
for (const [effect, deferred] of batch.async_deriveds) {
|
|
2257
|
+
const d = this.async_deriveds.get(effect);
|
|
2258
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
2259
|
+
}
|
|
2260
|
+
batch.async_deriveds.clear();
|
|
2261
|
+
this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
|
|
2262
|
+
/**
|
|
2263
|
+
* mark all effects that depend on `batch.current`, except the
|
|
2264
|
+
* async effects that we just resolved (TODO unless they depend
|
|
2265
|
+
* on values in this batch that are NOT in the later batch?).
|
|
2266
|
+
* Through this we also will populate the correct #skipped_branches,
|
|
2267
|
+
* oncommit callbacks etc, so we don't need to merge them separately.
|
|
2268
|
+
* @param {Value} value
|
|
2269
|
+
*/
|
|
2270
|
+
const mark = (value) => {
|
|
2271
|
+
var reactions = value.reactions;
|
|
2272
|
+
if (reactions === null) return;
|
|
2273
|
+
for (const reaction of reactions) {
|
|
2274
|
+
var flags = reaction.f;
|
|
2275
|
+
if ((flags & 2) !== 0) mark(reaction);
|
|
2276
|
+
else {
|
|
2277
|
+
var effect = reaction;
|
|
2278
|
+
if (flags & 4194320 && !this.async_deriveds.has(effect)) {
|
|
2279
|
+
this.#maybe_dirty_effects.delete(effect);
|
|
2280
|
+
set_signal_status(effect, DIRTY);
|
|
2281
|
+
this.schedule(effect);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
for (const source of this.current.keys()) mark(source);
|
|
2287
|
+
this.oncommit(() => batch.discard());
|
|
2288
|
+
batch.#unlink();
|
|
2289
|
+
current_batch = this;
|
|
2290
|
+
this.#process();
|
|
2396
2291
|
}
|
|
2397
2292
|
/**
|
|
2398
|
-
*
|
|
2399
|
-
* @returns {boolean}
|
|
2293
|
+
* @param {Effect[]} effects
|
|
2400
2294
|
*/
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
}
|
|
2404
|
-
has_pending_snippet() {
|
|
2405
|
-
return !!this.#props.pending;
|
|
2295
|
+
#defer_effects(effects) {
|
|
2296
|
+
for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
|
|
2406
2297
|
}
|
|
2407
2298
|
/**
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2299
|
+
* Associate a change to a given source with the current
|
|
2300
|
+
* batch, noting its previous and current values
|
|
2301
|
+
* @param {Value} source
|
|
2302
|
+
* @param {any} value
|
|
2303
|
+
* @param {boolean} [is_derived]
|
|
2410
2304
|
*/
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2305
|
+
capture(source, value, is_derived = false) {
|
|
2306
|
+
if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
|
|
2307
|
+
if ((source.f & 8388608) === 0) {
|
|
2308
|
+
this.current.set(source, [value, is_derived]);
|
|
2309
|
+
batch_values?.set(source, value);
|
|
2310
|
+
}
|
|
2311
|
+
if (!this.is_fork) source.v = value;
|
|
2312
|
+
}
|
|
2313
|
+
activate() {
|
|
2314
|
+
current_batch = this;
|
|
2315
|
+
}
|
|
2316
|
+
deactivate() {
|
|
2317
|
+
current_batch = null;
|
|
2318
|
+
batch_values = null;
|
|
2319
|
+
}
|
|
2320
|
+
flush() {
|
|
2418
2321
|
try {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
handle_error(e);
|
|
2423
|
-
return null;
|
|
2322
|
+
is_processing = true;
|
|
2323
|
+
current_batch = this;
|
|
2324
|
+
this.#process();
|
|
2424
2325
|
} finally {
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2326
|
+
flush_count = 0;
|
|
2327
|
+
last_scheduled_effect = null;
|
|
2328
|
+
collected_effects = null;
|
|
2329
|
+
legacy_updates = null;
|
|
2330
|
+
is_processing = false;
|
|
2331
|
+
current_batch = null;
|
|
2332
|
+
batch_values = null;
|
|
2333
|
+
old_values.clear();
|
|
2428
2334
|
}
|
|
2429
2335
|
}
|
|
2336
|
+
discard() {
|
|
2337
|
+
for (const fn of this.#discard_callbacks) fn(this);
|
|
2338
|
+
this.#discard_callbacks.clear();
|
|
2339
|
+
for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
|
|
2340
|
+
this.#unlink();
|
|
2341
|
+
this.#deferred?.resolve();
|
|
2342
|
+
}
|
|
2430
2343
|
/**
|
|
2431
|
-
*
|
|
2432
|
-
* if any, such that we can replace the snippet with content once work is done
|
|
2433
|
-
* @param {1 | -1} d
|
|
2434
|
-
* @param {Batch} batch
|
|
2344
|
+
* @param {Effect} effect
|
|
2435
2345
|
*/
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2346
|
+
register_created_effect(effect) {
|
|
2347
|
+
this.#new_effects.push(effect);
|
|
2348
|
+
}
|
|
2349
|
+
#commit() {
|
|
2350
|
+
for (let batch = first_batch; batch !== null; batch = batch.#next) {
|
|
2351
|
+
var is_earlier = batch.id < this.id;
|
|
2352
|
+
/** @type {Source[]} */
|
|
2353
|
+
var sources = [];
|
|
2354
|
+
for (const [source, [value, is_derived]] of this.current) {
|
|
2355
|
+
if (batch.current.has(source)) {
|
|
2356
|
+
var batch_value = batch.current.get(source)[0];
|
|
2357
|
+
if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
|
|
2358
|
+
else continue;
|
|
2359
|
+
}
|
|
2360
|
+
sources.push(source);
|
|
2361
|
+
}
|
|
2362
|
+
if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
|
|
2363
|
+
const d = batch.async_deriveds.get(effect);
|
|
2364
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
2365
|
+
}
|
|
2366
|
+
var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
|
|
2367
|
+
if (!batch.#started || current.length === 0) continue;
|
|
2368
|
+
var others = current.filter((source) => !this.current.has(source));
|
|
2369
|
+
if (others.length === 0) {
|
|
2370
|
+
if (is_earlier) batch.discard();
|
|
2371
|
+
} else if (sources.length > 0) {
|
|
2372
|
+
if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
|
|
2373
|
+
if ((e.f & 4194320) !== 0) batch.schedule(e);
|
|
2374
|
+
else batch.#defer_effects([e]);
|
|
2375
|
+
});
|
|
2376
|
+
batch.activate();
|
|
2377
|
+
/** @type {Set<Value>} */
|
|
2378
|
+
var marked = /* @__PURE__ */ new Set();
|
|
2379
|
+
/** @type {Map<Reaction, boolean>} */
|
|
2380
|
+
var checked = /* @__PURE__ */ new Map();
|
|
2381
|
+
for (var source of sources) mark_effects(source, others, marked, checked);
|
|
2382
|
+
checked = /* @__PURE__ */ new Map();
|
|
2383
|
+
var current_unequal = [...batch.current].filter(([c, v1]) => {
|
|
2384
|
+
const v2 = this.current.get(c);
|
|
2385
|
+
if (!v2) return true;
|
|
2386
|
+
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
2387
|
+
}).map(([c]) => c);
|
|
2388
|
+
if (current_unequal.length > 0) {
|
|
2389
|
+
for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
|
|
2390
|
+
set_signal_status(effect, DIRTY);
|
|
2391
|
+
batch.schedule(effect);
|
|
2392
|
+
} else batch.#dirty_effects.add(effect);
|
|
2393
|
+
}
|
|
2394
|
+
if (batch.#roots.length > 0 && !batch.#decrement_queued) {
|
|
2395
|
+
batch.apply();
|
|
2396
|
+
for (var root of batch.#roots) batch.#traverse(root, [], []);
|
|
2397
|
+
batch.#roots = [];
|
|
2398
|
+
}
|
|
2399
|
+
batch.deactivate();
|
|
2450
2400
|
}
|
|
2451
2401
|
}
|
|
2452
2402
|
}
|
|
2453
2403
|
/**
|
|
2454
|
-
*
|
|
2455
|
-
*
|
|
2456
|
-
* Do not call from inside the class
|
|
2457
|
-
* @param {1 | -1} d
|
|
2458
|
-
* @param {Batch} batch
|
|
2404
|
+
* @param {boolean} blocking
|
|
2405
|
+
* @param {Effect} effect
|
|
2459
2406
|
*/
|
|
2460
|
-
|
|
2461
|
-
this.#
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2407
|
+
increment(blocking, effect) {
|
|
2408
|
+
this.#pending += 1;
|
|
2409
|
+
if (blocking) {
|
|
2410
|
+
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
2411
|
+
this.#blocking_pending.set(effect, blocking_pending_count + 1);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
/**
|
|
2415
|
+
* @param {boolean} blocking
|
|
2416
|
+
* @param {Effect} effect
|
|
2417
|
+
*/
|
|
2418
|
+
decrement(blocking, effect) {
|
|
2419
|
+
this.#pending -= 1;
|
|
2420
|
+
if (blocking) {
|
|
2421
|
+
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
|
|
2422
|
+
if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
|
|
2423
|
+
else this.#blocking_pending.set(effect, blocking_pending_count - 1);
|
|
2424
|
+
}
|
|
2425
|
+
if (this.#decrement_queued) return;
|
|
2426
|
+
this.#decrement_queued = true;
|
|
2465
2427
|
queue_micro_task(() => {
|
|
2466
|
-
this.#
|
|
2467
|
-
if (this
|
|
2428
|
+
this.#decrement_queued = false;
|
|
2429
|
+
if (this.linked) this.flush();
|
|
2468
2430
|
});
|
|
2469
2431
|
}
|
|
2470
|
-
get_effect_pending() {
|
|
2471
|
-
this.#effect_pending_subscriber();
|
|
2472
|
-
return get(this.#effect_pending);
|
|
2473
|
-
}
|
|
2474
|
-
/** @param {unknown} error */
|
|
2475
|
-
error(error) {
|
|
2476
|
-
if (!this.#props.onerror && !this.#props.failed) throw error;
|
|
2477
|
-
if (current_batch?.is_fork) {
|
|
2478
|
-
if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
|
|
2479
|
-
if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
|
|
2480
|
-
if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
|
|
2481
|
-
current_batch.oncommit(() => {
|
|
2482
|
-
this.#handle_error(error);
|
|
2483
|
-
});
|
|
2484
|
-
} else this.#handle_error(error);
|
|
2485
|
-
}
|
|
2486
2432
|
/**
|
|
2487
|
-
* @param {
|
|
2433
|
+
* @param {Set<Effect>} dirty_effects
|
|
2434
|
+
* @param {Set<Effect>} maybe_dirty_effects
|
|
2488
2435
|
*/
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
const reset = () => {
|
|
2512
|
-
if (did_reset) {
|
|
2513
|
-
svelte_boundary_reset_noop();
|
|
2514
|
-
return;
|
|
2515
|
-
}
|
|
2516
|
-
did_reset = true;
|
|
2517
|
-
if (calling_on_error) svelte_boundary_reset_onerror();
|
|
2518
|
-
if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => {
|
|
2519
|
-
this.#failed_effect = null;
|
|
2520
|
-
});
|
|
2521
|
-
this.#run(() => {
|
|
2522
|
-
this.#render();
|
|
2523
|
-
});
|
|
2524
|
-
};
|
|
2525
|
-
/** @param {unknown} transformed_error */
|
|
2526
|
-
const handle_error_result = (transformed_error) => {
|
|
2527
|
-
try {
|
|
2528
|
-
calling_on_error = true;
|
|
2529
|
-
onerror?.(transformed_error, reset);
|
|
2530
|
-
calling_on_error = false;
|
|
2531
|
-
} catch (error) {
|
|
2532
|
-
invoke_error_boundary(error, this.#effect && this.#effect.parent);
|
|
2533
|
-
}
|
|
2534
|
-
if (failed) this.#failed_effect = this.#run(() => {
|
|
2535
|
-
try {
|
|
2536
|
-
return branch(() => {
|
|
2537
|
-
var effect = active_effect;
|
|
2538
|
-
effect.b = this;
|
|
2539
|
-
effect.f |= 128;
|
|
2540
|
-
failed(this.#anchor, () => transformed_error, () => reset);
|
|
2541
|
-
});
|
|
2542
|
-
} catch (error) {
|
|
2543
|
-
invoke_error_boundary(error, this.#effect.parent);
|
|
2544
|
-
return null;
|
|
2545
|
-
}
|
|
2436
|
+
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
2437
|
+
for (const e of dirty_effects) this.#dirty_effects.add(e);
|
|
2438
|
+
for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
|
|
2439
|
+
dirty_effects.clear();
|
|
2440
|
+
maybe_dirty_effects.clear();
|
|
2441
|
+
}
|
|
2442
|
+
/** @param {(batch: Batch) => void} fn */
|
|
2443
|
+
oncommit(fn) {
|
|
2444
|
+
this.#commit_callbacks.add(fn);
|
|
2445
|
+
}
|
|
2446
|
+
/** @param {(batch: Batch) => void} fn */
|
|
2447
|
+
ondiscard(fn) {
|
|
2448
|
+
this.#discard_callbacks.add(fn);
|
|
2449
|
+
}
|
|
2450
|
+
settled() {
|
|
2451
|
+
return (this.#deferred ??= deferred()).promise;
|
|
2452
|
+
}
|
|
2453
|
+
static ensure() {
|
|
2454
|
+
if (current_batch === null) {
|
|
2455
|
+
const batch = current_batch = new Batch();
|
|
2456
|
+
if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
|
|
2457
|
+
if (!batch.#started) batch.flush();
|
|
2546
2458
|
});
|
|
2547
|
-
}
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2459
|
+
}
|
|
2460
|
+
return current_batch;
|
|
2461
|
+
}
|
|
2462
|
+
apply() {
|
|
2463
|
+
batch_values = null;
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
*
|
|
2467
|
+
* @param {Effect} effect
|
|
2468
|
+
*/
|
|
2469
|
+
schedule(effect) {
|
|
2470
|
+
last_scheduled_effect = effect;
|
|
2471
|
+
if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
|
|
2472
|
+
effect.b.defer_effect(effect);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2475
|
+
var e = effect;
|
|
2476
|
+
while (e.parent !== null) {
|
|
2477
|
+
e = e.parent;
|
|
2478
|
+
var flags = e.f;
|
|
2479
|
+
if (collected_effects !== null && e === active_effect) {
|
|
2480
|
+
if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
|
|
2556
2481
|
}
|
|
2557
|
-
if (
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
else handle_error_result(result);
|
|
2564
|
-
});
|
|
2482
|
+
if ((flags & 96) !== 0) {
|
|
2483
|
+
if ((flags & 1024) === 0) return;
|
|
2484
|
+
e.f ^= CLEAN;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
this.#roots.push(e);
|
|
2565
2488
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
|
|
2489
|
+
#unlink() {
|
|
2490
|
+
if (!this.linked) return;
|
|
2491
|
+
var prev = this.#prev;
|
|
2492
|
+
var next = this.#next;
|
|
2493
|
+
if (prev === null) first_batch = next;
|
|
2494
|
+
else prev.#next = next;
|
|
2495
|
+
if (next === null) last_batch = prev;
|
|
2496
|
+
else next.#prev = prev;
|
|
2497
|
+
this.linked = false;
|
|
2576
2498
|
}
|
|
2577
|
-
}
|
|
2499
|
+
};
|
|
2578
2500
|
/**
|
|
2579
|
-
*
|
|
2580
|
-
*
|
|
2501
|
+
* Synchronously flush any pending updates.
|
|
2502
|
+
* Returns void if no callback is provided, otherwise returns the result of calling the callback.
|
|
2503
|
+
* @template [T=void]
|
|
2504
|
+
* @param {(() => T) | undefined} [fn]
|
|
2581
2505
|
* @returns {T}
|
|
2582
2506
|
*/
|
|
2583
|
-
function
|
|
2584
|
-
var
|
|
2585
|
-
|
|
2586
|
-
var parent = derived.parent;
|
|
2587
|
-
if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
|
|
2588
|
-
derived_inert();
|
|
2589
|
-
return derived.v;
|
|
2590
|
-
}
|
|
2591
|
-
set_active_effect(parent);
|
|
2507
|
+
function flushSync(fn) {
|
|
2508
|
+
var was_flushing_sync = is_flushing_sync;
|
|
2509
|
+
is_flushing_sync = true;
|
|
2592
2510
|
try {
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2511
|
+
var result;
|
|
2512
|
+
if (fn) {
|
|
2513
|
+
if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
|
|
2514
|
+
result = fn();
|
|
2515
|
+
}
|
|
2516
|
+
while (true) {
|
|
2517
|
+
flush_tasks();
|
|
2518
|
+
if (current_batch === null) return result;
|
|
2519
|
+
current_batch.flush();
|
|
2520
|
+
}
|
|
2596
2521
|
} finally {
|
|
2597
|
-
|
|
2522
|
+
is_flushing_sync = was_flushing_sync;
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
function infinite_loop_guard() {
|
|
2526
|
+
try {
|
|
2527
|
+
effect_update_depth_exceeded();
|
|
2528
|
+
} catch (error) {
|
|
2529
|
+
invoke_error_boundary(error, last_scheduled_effect);
|
|
2598
2530
|
}
|
|
2599
|
-
return value;
|
|
2600
2531
|
}
|
|
2532
|
+
/** @type {Set<Effect> | null} */
|
|
2533
|
+
var eager_block_effects = null;
|
|
2601
2534
|
/**
|
|
2602
|
-
* @param {
|
|
2535
|
+
* @param {Array<Effect>} effects
|
|
2603
2536
|
* @returns {void}
|
|
2604
2537
|
*/
|
|
2605
|
-
function
|
|
2606
|
-
var
|
|
2607
|
-
if (
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
if (
|
|
2615
|
-
|
|
2616
|
-
|
|
2538
|
+
function flush_queued_effects(effects) {
|
|
2539
|
+
var length = effects.length;
|
|
2540
|
+
if (length === 0) return;
|
|
2541
|
+
var i = 0;
|
|
2542
|
+
while (i < length) {
|
|
2543
|
+
var effect = effects[i++];
|
|
2544
|
+
if ((effect.f & 24576) === 0 && is_dirty(effect)) {
|
|
2545
|
+
eager_block_effects = /* @__PURE__ */ new Set();
|
|
2546
|
+
update_effect(effect);
|
|
2547
|
+
if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
|
|
2548
|
+
if (eager_block_effects?.size > 0) {
|
|
2549
|
+
old_values.clear();
|
|
2550
|
+
for (const e of eager_block_effects) {
|
|
2551
|
+
if ((e.f & 24576) !== 0) continue;
|
|
2552
|
+
/** @type {Effect[]} */
|
|
2553
|
+
const ordered_effects = [e];
|
|
2554
|
+
let ancestor = e.parent;
|
|
2555
|
+
while (ancestor !== null) {
|
|
2556
|
+
if (eager_block_effects.has(ancestor)) {
|
|
2557
|
+
eager_block_effects.delete(ancestor);
|
|
2558
|
+
ordered_effects.push(ancestor);
|
|
2559
|
+
}
|
|
2560
|
+
ancestor = ancestor.parent;
|
|
2561
|
+
}
|
|
2562
|
+
for (let j = ordered_effects.length - 1; j >= 0; j--) {
|
|
2563
|
+
const e = ordered_effects[j];
|
|
2564
|
+
if ((e.f & 24576) !== 0) continue;
|
|
2565
|
+
update_effect(e);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
eager_block_effects.clear();
|
|
2617
2569
|
}
|
|
2618
2570
|
}
|
|
2619
2571
|
}
|
|
2620
|
-
|
|
2621
|
-
if (batch_values !== null) {
|
|
2622
|
-
if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
|
|
2623
|
-
} else update_derived_status(derived);
|
|
2572
|
+
eager_block_effects = null;
|
|
2624
2573
|
}
|
|
2625
2574
|
/**
|
|
2626
|
-
*
|
|
2575
|
+
* This is similar to `mark_reactions`, but it only marks async/block effects
|
|
2576
|
+
* depending on `value` and at least one of the other `sources`, so that
|
|
2577
|
+
* these effects can re-run after another batch has been committed
|
|
2578
|
+
* @param {Value} value
|
|
2579
|
+
* @param {Source[]} sources
|
|
2580
|
+
* @param {Set<Value>} marked
|
|
2581
|
+
* @param {Map<Reaction, boolean>} checked
|
|
2627
2582
|
*/
|
|
2628
|
-
function
|
|
2629
|
-
if (
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
if (
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2583
|
+
function mark_effects(value, sources, marked, checked) {
|
|
2584
|
+
if (marked.has(value)) return;
|
|
2585
|
+
marked.add(value);
|
|
2586
|
+
if (value.reactions !== null) for (const reaction of value.reactions) {
|
|
2587
|
+
const flags = reaction.f;
|
|
2588
|
+
if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
|
|
2589
|
+
else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
|
|
2590
|
+
set_signal_status(reaction, DIRTY);
|
|
2591
|
+
schedule_effect(reaction);
|
|
2592
|
+
}
|
|
2637
2593
|
}
|
|
2638
2594
|
}
|
|
2639
2595
|
/**
|
|
2640
|
-
* @param {
|
|
2596
|
+
* @param {Reaction} reaction
|
|
2597
|
+
* @param {Source[]} sources
|
|
2598
|
+
* @param {Map<Reaction, boolean>} checked
|
|
2641
2599
|
*/
|
|
2642
|
-
function
|
|
2643
|
-
|
|
2644
|
-
|
|
2600
|
+
function depends_on(reaction, sources, checked) {
|
|
2601
|
+
const depends = checked.get(reaction);
|
|
2602
|
+
if (depends !== void 0) return depends;
|
|
2603
|
+
if (reaction.deps !== null) for (const dep of reaction.deps) {
|
|
2604
|
+
if (includes.call(sources, dep)) return true;
|
|
2605
|
+
if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
|
|
2606
|
+
checked.set(dep, true);
|
|
2607
|
+
return true;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
checked.set(reaction, false);
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* @param {Effect} effect
|
|
2615
|
+
* @returns {void}
|
|
2616
|
+
*/
|
|
2617
|
+
function schedule_effect(effect) {
|
|
2618
|
+
/** @type {Batch} */ current_batch.schedule(effect);
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Mark all the effects inside a skipped branch CLEAN, so that
|
|
2622
|
+
* they can be correctly rescheduled later. Tracks dirty and maybe_dirty
|
|
2623
|
+
* effects so they can be rescheduled if the branch survives.
|
|
2624
|
+
* @param {Effect} effect
|
|
2625
|
+
* @param {{ d: Effect[], m: Effect[] }} tracked
|
|
2626
|
+
*/
|
|
2627
|
+
function reset_branch(effect, tracked) {
|
|
2628
|
+
if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
|
|
2629
|
+
if ((effect.f & 2048) !== 0) tracked.d.push(effect);
|
|
2630
|
+
else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
|
|
2631
|
+
set_signal_status(effect, CLEAN);
|
|
2632
|
+
var e = effect.first;
|
|
2633
|
+
while (e !== null) {
|
|
2634
|
+
reset_branch(e, tracked);
|
|
2635
|
+
e = e.next;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Mark an entire effect tree clean following an error
|
|
2640
|
+
* @param {Effect} effect
|
|
2641
|
+
*/
|
|
2642
|
+
function reset_all(effect) {
|
|
2643
|
+
set_signal_status(effect, CLEAN);
|
|
2644
|
+
var e = effect.first;
|
|
2645
|
+
while (e !== null) {
|
|
2646
|
+
reset_all(e);
|
|
2647
|
+
e = e.next;
|
|
2648
|
+
}
|
|
2645
2649
|
}
|
|
2646
2650
|
/** @import { Derived, Effect, Source, Value } from '#client' */
|
|
2647
2651
|
/** @type {Set<Effect>} */
|
|
@@ -4897,4 +4901,4 @@ function handle_event_propagation(event) {
|
|
|
4897
4901
|
//#endregion
|
|
4898
4902
|
export { onDestroy as $, flushSync as A, hydrating as B, define_property as C, clsx as Ct, ensure_array_like as D, element as E, get_first_child as F, is_passive_event as G, hydration_mismatch as H, get_next_sibling as I, is_valid_array_index as J, is_plain_object as K, get_type as L, get$1 as M, getAllContexts as N, enumerable_symbols as O, getContext as P, noop as Q, hasContext as R, create_text as S, writable as St, derived$1 as T, index_server_exports as U, hydration_failed as V, init_operations as W, mount as X, is_valid_array_len as Y, mutable_source as Z, boundary as _, to_array as _t, ATTACHMENT_KEY as a, render as at, component_context as b, unsubscribe_stores as bt, LEGACY_PROPS as c, setContext as ct, array_from as d, spread_props as dt, pop as et, attr as f, store_get as ft, bind_props as g, tick as gt, attributes as h, stringify_string as ht, root_event_handles as i, readonly as it, get as j, escape_html as k, MAX_ARRAY_INDEX as l, set_hydrate_node as lt, attr_style as m, stringify_key as mt, handle_event_propagation as n, push as nt, DevalueError as o, run as ot, attr_class as p, stringify as pt, is_primitive as q, on as r, readable as rt, HYDRATION_ERROR as s, set as st, all_registered_events as t, props_id as tt, active_effect as u, set_hydrating as ut, clear_text_content as v, uneval as vt, derived as w, component_root as x, valid_array_indices as xt, clsx$1 as y, unmount as yt, hydrate_node as z };
|
|
4899
4903
|
|
|
4900
|
-
//# sourceMappingURL=events-
|
|
4904
|
+
//# sourceMappingURL=events-Bhh2w-5S.js.map
|