sibujs 1.0.2 → 1.0.3
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/browser.cjs +18 -0
- package/dist/browser.d.cts +19 -1
- package/dist/browser.d.ts +19 -1
- package/dist/browser.js +5 -1
- package/dist/build.cjs +17 -8
- package/dist/build.js +3 -3
- package/dist/cdn.global.js +4 -4
- package/dist/{chunk-ONCYDOK6.js → chunk-4EI4AG32.js} +17 -1
- package/dist/{chunk-MJ4LVHGX.js → chunk-7V26P53V.js} +1 -1
- package/dist/{chunk-6JGMNCD6.js → chunk-EWFVA3TJ.js} +1 -1
- package/dist/{chunk-HS6OOE3Q.js → chunk-G3BOQPVO.js} +1 -1
- package/dist/{chunk-QVKGGB2S.js → chunk-MDVXJWFN.js} +7 -3
- package/dist/{chunk-24WSRM54.js → chunk-MEZVEBPN.js} +13 -7
- package/dist/{chunk-OHQQWZ7P.js → chunk-QBMDLBU2.js} +10 -4
- package/dist/data.cjs +10 -4
- package/dist/data.d.cts +2 -0
- package/dist/data.d.ts +2 -0
- package/dist/data.js +1 -1
- package/dist/ecosystem.cjs +7 -3
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +2 -2
- package/dist/extras.cjs +35 -7
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +10 -6
- package/dist/index.cjs +18 -8
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +5 -3
- package/dist/plugins.cjs +7 -3
- package/dist/plugins.js +2 -2
- package/dist/ssr.cjs +7 -3
- package/dist/ssr.js +3 -3
- package/dist/{tagFactory-D9e0QGIE.d.cts → tagFactory-Dl8QCLga.d.cts} +2 -2
- package/dist/{tagFactory-D9e0QGIE.d.ts → tagFactory-Dl8QCLga.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-27QC4FPL.js +0 -67
- package/dist/chunk-2ABBWCGC.js +0 -65
- package/dist/chunk-2GLUWW3D.js +0 -567
- package/dist/chunk-2HYHL6VW.js +0 -269
- package/dist/chunk-2MUNQYZ7.js +0 -26
- package/dist/chunk-2PFRWZIE.js +0 -65
- package/dist/chunk-2PSPKNUI.js +0 -1711
- package/dist/chunk-2X5NDXNG.js +0 -877
- package/dist/chunk-34TOFKL7.js +0 -1803
- package/dist/chunk-353KB3DI.js +0 -271
- package/dist/chunk-35CDLDX5.js +0 -1758
- package/dist/chunk-36MU4CFV.js +0 -41
- package/dist/chunk-37NSPDPQ.js +0 -284
- package/dist/chunk-3CSF4TOG.js +0 -282
- package/dist/chunk-3FIQOFI6.js +0 -182
- package/dist/chunk-3GHNC2BN.js +0 -28
- package/dist/chunk-3GZTRYSY.js +0 -33
- package/dist/chunk-3HLWWEPU.js +0 -909
- package/dist/chunk-3IVI3J54.js +0 -252
- package/dist/chunk-3KZ72WNW.js +0 -944
- package/dist/chunk-4AU64SQV.js +0 -182
- package/dist/chunk-4MOK7HAR.js +0 -84
- package/dist/chunk-4QK6FBDH.js +0 -1429
- package/dist/chunk-526ENZ77.js +0 -58
- package/dist/chunk-566Z7HXB.js +0 -737
- package/dist/chunk-5CRBB7XP.js +0 -358
- package/dist/chunk-5G67D3IZ.js +0 -168
- package/dist/chunk-5KBEED6D.js +0 -361
- package/dist/chunk-5LJMSKBB.js +0 -26
- package/dist/chunk-5M7LJFWV.js +0 -271
- package/dist/chunk-5NCPAWBE.js +0 -99
- package/dist/chunk-5O2RKXR3.js +0 -1444
- package/dist/chunk-5OCBERWW.js +0 -1094
- package/dist/chunk-5XUAA53E.js +0 -99
- package/dist/chunk-5ZFVYPDG.js +0 -97
- package/dist/chunk-6BCDNGIH.js +0 -1839
- package/dist/chunk-6BDUQJ7K.js +0 -949
- package/dist/chunk-6BTBDO6A.js +0 -633
- package/dist/chunk-6DJQF4Z7.js +0 -33
- package/dist/chunk-6EYXAMBN.js +0 -1857
- package/dist/chunk-6IWEHW57.js +0 -43
- package/dist/chunk-6J6S4NI7.js +0 -398
- package/dist/chunk-6NBHAKHS.js +0 -1997
- package/dist/chunk-6QRLJNXR.js +0 -1425
- package/dist/chunk-6SNF5MZK.js +0 -282
- package/dist/chunk-7FYJUE77.js +0 -282
- package/dist/chunk-7HM5UE5T.js +0 -270
- package/dist/chunk-7JOLTGUH.js +0 -58
- package/dist/chunk-7LS3ITZB.js +0 -567
- package/dist/chunk-7MCWJCQK.js +0 -909
- package/dist/chunk-7RIIFP3E.js +0 -1758
- package/dist/chunk-7UASYN3G.js +0 -254
- package/dist/chunk-7W2WYHDI.js +0 -741
- package/dist/chunk-7XFBKLFB.js +0 -90
- package/dist/chunk-7Y35RDSJ.js +0 -872
- package/dist/chunk-A65GFJBL.js +0 -65
- package/dist/chunk-AD6ZIEDK.js +0 -67
- package/dist/chunk-AIPXZK5O.js +0 -295
- package/dist/chunk-AK5Y72F3.js +0 -1426
- package/dist/chunk-ANRSGGFC.js +0 -725
- package/dist/chunk-APOMMWH4.js +0 -282
- package/dist/chunk-ARZVTWIQ.js +0 -1750
- package/dist/chunk-AWWBM2BI.js +0 -664
- package/dist/chunk-AX5VEQTY.js +0 -58
- package/dist/chunk-AYTXVOW3.js +0 -1708
- package/dist/chunk-B4ASD5VC.js +0 -295
- package/dist/chunk-BG3HMX4C.js +0 -271
- package/dist/chunk-BG4A246G.js +0 -1746
- package/dist/chunk-BNFJJA2L.js +0 -1425
- package/dist/chunk-BPKPBVU5.js +0 -59
- package/dist/chunk-BPKPPSXC.js +0 -282
- package/dist/chunk-BPWKKK7F.js +0 -1711
- package/dist/chunk-BS5EYKCJ.js +0 -26
- package/dist/chunk-BS6ETCJ7.js +0 -949
- package/dist/chunk-BTTBAGD3.js +0 -365
- package/dist/chunk-BWBWJYBK.js +0 -271
- package/dist/chunk-CCKX6YTC.js +0 -1735
- package/dist/chunk-CIF5Z3MP.js +0 -58
- package/dist/chunk-CQNVF2FD.js +0 -282
- package/dist/chunk-CRTHZHU7.js +0 -26
- package/dist/chunk-CSXYU7IO.js +0 -457
- package/dist/chunk-D6JD4FDC.js +0 -26
- package/dist/chunk-DAUTHAYH.js +0 -20
- package/dist/chunk-DB243LB7.js +0 -877
- package/dist/chunk-DEQLPROY.js +0 -1094
- package/dist/chunk-DGUYCZJH.js +0 -654
- package/dist/chunk-DI3Z32TV.js +0 -1780
- package/dist/chunk-DKGHW6MX.js +0 -90
- package/dist/chunk-DKXVN442.js +0 -90
- package/dist/chunk-DLWLJZB3.js +0 -712
- package/dist/chunk-DNTTC4V5.js +0 -1803
- package/dist/chunk-DWQQ2GZK.js +0 -1787
- package/dist/chunk-DZZMIMGL.js +0 -725
- package/dist/chunk-E5SMAKQQ.js +0 -336
- package/dist/chunk-E6BNBVMK.js +0 -457
- package/dist/chunk-E7NGA7X2.js +0 -59
- package/dist/chunk-EEPPJKAE.js +0 -443
- package/dist/chunk-EGZGFIXV.js +0 -90
- package/dist/chunk-EJMSUPXQ.js +0 -346
- package/dist/chunk-EJMYGAGQ.js +0 -717
- package/dist/chunk-EL6Z5MDY.js +0 -55
- package/dist/chunk-EP7VRLEB.js +0 -41
- package/dist/chunk-EQACK65C.js +0 -63
- package/dist/chunk-ESPA7SCH.js +0 -567
- package/dist/chunk-ETMEC6FH.js +0 -99
- package/dist/chunk-EUFENPGJ.js +0 -290
- package/dist/chunk-EZ2WHYVL.js +0 -65
- package/dist/chunk-EZRVMSZK.js +0 -67
- package/dist/chunk-F25CZRUH.js +0 -282
- package/dist/chunk-F2TRGINX.js +0 -254
- package/dist/chunk-F4IYF3YU.js +0 -266
- package/dist/chunk-F5JCIH3Q.js +0 -642
- package/dist/chunk-FBNDOAHU.js +0 -54
- package/dist/chunk-FDRU7W6W.js +0 -365
- package/dist/chunk-FDW3E54J.js +0 -1767
- package/dist/chunk-FEPU4KL6.js +0 -63
- package/dist/chunk-FGK3JKMN.js +0 -909
- package/dist/chunk-FQWPKSTD.js +0 -1437
- package/dist/chunk-FWHVLMCI.js +0 -26
- package/dist/chunk-FYIGTFXO.js +0 -712
- package/dist/chunk-G4AX3DQ4.js +0 -54
- package/dist/chunk-GBEYQRO2.js +0 -303
- package/dist/chunk-GBLES3NK.js +0 -248
- package/dist/chunk-GQVGUQW6.js +0 -1436
- package/dist/chunk-GVDEIJ3G.js +0 -291
- package/dist/chunk-GXIM4TC3.js +0 -346
- package/dist/chunk-GY5AAP4H.js +0 -316
- package/dist/chunk-HCV2T76T.js +0 -457
- package/dist/chunk-HCWPQCZP.js +0 -279
- package/dist/chunk-HFHOFG6W.js +0 -282
- package/dist/chunk-HGKEBAW3.js +0 -63
- package/dist/chunk-HJNW3HLI.js +0 -255
- package/dist/chunk-HKUNBYN6.js +0 -949
- package/dist/chunk-HRIIH4JX.js +0 -712
- package/dist/chunk-HS7ZKVPR.js +0 -182
- package/dist/chunk-HXDVV7HZ.js +0 -909
- package/dist/chunk-HZWNWUPJ.js +0 -466
- package/dist/chunk-I6EZTMPB.js +0 -949
- package/dist/chunk-IB23VMO3.js +0 -1746
- package/dist/chunk-IC4K4EOD.js +0 -26
- package/dist/chunk-IEMZ7RTT.js +0 -99
- package/dist/chunk-IJU6TOZ6.js +0 -65
- package/dist/chunk-IK3NFZOA.js +0 -466
- package/dist/chunk-IPGRSN42.js +0 -1750
- package/dist/chunk-IVMOK2QN.js +0 -1750
- package/dist/chunk-J7PD6L4B.js +0 -1767
- package/dist/chunk-JCLGQO7T.js +0 -443
- package/dist/chunk-JDXL7KDB.js +0 -1436
- package/dist/chunk-JIIFW636.js +0 -270
- package/dist/chunk-JLOASJXU.js +0 -654
- package/dist/chunk-JRWAHOMS.js +0 -41
- package/dist/chunk-JWGEEH7H.js +0 -944
- package/dist/chunk-K2BESAG7.js +0 -1688
- package/dist/chunk-K2U5YGF4.js +0 -877
- package/dist/chunk-K45FQ4Y4.js +0 -175
- package/dist/chunk-K7BPE427.js +0 -1432
- package/dist/chunk-K7JUDY3C.js +0 -364
- package/dist/chunk-KALKXPC3.js +0 -297
- package/dist/chunk-KKUV25KB.js +0 -361
- package/dist/chunk-KKV3DOAW.js +0 -466
- package/dist/chunk-KL3266RS.js +0 -26
- package/dist/chunk-KNN4P7DZ.js +0 -84
- package/dist/chunk-KP2DZH5Q.js +0 -254
- package/dist/chunk-KZHAJSQR.js +0 -1636
- package/dist/chunk-L36YN45V.js +0 -949
- package/dist/chunk-L5IBT37O.js +0 -263
- package/dist/chunk-LAX5H35R.js +0 -90
- package/dist/chunk-LBKGHMQV.js +0 -1750
- package/dist/chunk-LBTEPL7A.js +0 -1731
- package/dist/chunk-LEBBPTDB.js +0 -1444
- package/dist/chunk-LHI25KS2.js +0 -654
- package/dist/chunk-LHNJSLC6.js +0 -297
- package/dist/chunk-LLH63WVQ.js +0 -98
- package/dist/chunk-LWNJN3IW.js +0 -295
- package/dist/chunk-LWVR2C4G.js +0 -1711
- package/dist/chunk-M3MDTVV2.js +0 -896
- package/dist/chunk-M3QSBCXC.js +0 -52
- package/dist/chunk-M3ZKZQNY.js +0 -282
- package/dist/chunk-M5GNLDEO.js +0 -303
- package/dist/chunk-MBINISSE.js +0 -35
- package/dist/chunk-MFHVGKET.js +0 -267
- package/dist/chunk-MGWSG3PM.js +0 -358
- package/dist/chunk-MGYRVG2A.js +0 -282
- package/dist/chunk-MJNB47HB.js +0 -19
- package/dist/chunk-MLN3JZ2E.js +0 -398
- package/dist/chunk-MM46JVR2.js +0 -359
- package/dist/chunk-MQWTY3JY.js +0 -944
- package/dist/chunk-MWE3PK5S.js +0 -551
- package/dist/chunk-MXR7LXGC.js +0 -1084
- package/dist/chunk-MZZOQHNI.js +0 -642
- package/dist/chunk-N6BRVUAP.js +0 -1805
- package/dist/chunk-N7UVR6SG.js +0 -877
- package/dist/chunk-NIHWGZS4.js +0 -1426
- package/dist/chunk-NMTRH4Q3.js +0 -97
- package/dist/chunk-NSVVHQK5.js +0 -41
- package/dist/chunk-NVI2WE7D.js +0 -443
- package/dist/chunk-NZNNXPEE.js +0 -56
- package/dist/chunk-O7QBO3PH.js +0 -58
- package/dist/chunk-OAUPQBO2.js +0 -270
- package/dist/chunk-OB2LMD7C.js +0 -297
- package/dist/chunk-OEGAHDEU.js +0 -1094
- package/dist/chunk-OHEYBWQU.js +0 -58
- package/dist/chunk-OI5B74HF.js +0 -26
- package/dist/chunk-OI6OXUHJ.js +0 -443
- package/dist/chunk-ONOO74UN.js +0 -361
- package/dist/chunk-OWLQ4HZI.js +0 -282
- package/dist/chunk-OX2VMRMV.js +0 -633
- package/dist/chunk-OXYMB6VB.js +0 -466
- package/dist/chunk-OZS4YOOP.js +0 -59
- package/dist/chunk-P4FYE5TX.js +0 -866
- package/dist/chunk-P5KFWM4H.js +0 -98
- package/dist/chunk-PLFQZ7SS.js +0 -90
- package/dist/chunk-PMVU6BI4.js +0 -1847
- package/dist/chunk-PPNH4Y6U.js +0 -282
- package/dist/chunk-PUMLE7RJ.js +0 -1711
- package/dist/chunk-Q4MFANBF.js +0 -282
- package/dist/chunk-Q54YZ4X3.js +0 -26
- package/dist/chunk-Q6XACQW3.js +0 -1847
- package/dist/chunk-QI6ZDDUR.js +0 -35
- package/dist/chunk-QJ5KLY2S.js +0 -1821
- package/dist/chunk-QLEKZMMU.js +0 -282
- package/dist/chunk-QLNWSBWK.js +0 -567
- package/dist/chunk-QQS7BSPA.js +0 -26
- package/dist/chunk-QUGIYF3F.js +0 -712
- package/dist/chunk-QYSW3K7A.js +0 -282
- package/dist/chunk-QZWTKX5K.js +0 -321
- package/dist/chunk-RGGNGVO3.js +0 -98
- package/dist/chunk-RKJDRVV6.js +0 -443
- package/dist/chunk-RUAJTILD.js +0 -26
- package/dist/chunk-S5BHU353.js +0 -43
- package/dist/chunk-S6YEHFC7.js +0 -654
- package/dist/chunk-SHQUSFH7.js +0 -1426
- package/dist/chunk-SMB4DBMD.js +0 -182
- package/dist/chunk-SNYHQP3D.js +0 -743
- package/dist/chunk-SR2DPCTT.js +0 -1803
- package/dist/chunk-SU63HSUU.js +0 -58
- package/dist/chunk-SXXKZJI2.js +0 -303
- package/dist/chunk-T24L3TBF.js +0 -1717
- package/dist/chunk-T2SPHHYU.js +0 -365
- package/dist/chunk-TAQNSOKT.js +0 -692
- package/dist/chunk-TBA46SVX.js +0 -1805
- package/dist/chunk-TCWKKKPP.js +0 -90
- package/dist/chunk-TDNY4SUA.js +0 -41
- package/dist/chunk-TK4P3V5G.js +0 -56
- package/dist/chunk-TNNF56IQ.js +0 -1750
- package/dist/chunk-TR7E6LYX.js +0 -457
- package/dist/chunk-TVV4JK5G.js +0 -282
- package/dist/chunk-UATXXETW.js +0 -278
- package/dist/chunk-UHFUQWST.js +0 -65
- package/dist/chunk-UKDBQVM3.js +0 -346
- package/dist/chunk-URWUFH45.js +0 -98
- package/dist/chunk-USPT25TC.js +0 -365
- package/dist/chunk-UUSIH3XH.js +0 -1429
- package/dist/chunk-UXDIPRCG.js +0 -26
- package/dist/chunk-UYFNXLKR.js +0 -1436
- package/dist/chunk-UZZFP2EE.js +0 -35
- package/dist/chunk-V4G5Y6YM.js +0 -1094
- package/dist/chunk-V6F7KUWD.js +0 -270
- package/dist/chunk-V6P4LDAV.js +0 -65
- package/dist/chunk-VAA4FG3Z.js +0 -365
- package/dist/chunk-VCZLXRMR.js +0 -254
- package/dist/chunk-VDHXSSBT.js +0 -1426
- package/dist/chunk-VI4KRBSU.js +0 -291
- package/dist/chunk-VM4QMKVK.js +0 -254
- package/dist/chunk-VUXB655T.js +0 -1999
- package/dist/chunk-VWGYKYL2.js +0 -737
- package/dist/chunk-VX2OFBJN.js +0 -1426
- package/dist/chunk-VXVIE6DG.js +0 -84
- package/dist/chunk-W3QH7BF5.js +0 -282
- package/dist/chunk-W4OH7HG4.js +0 -40
- package/dist/chunk-WBVJX4GZ.js +0 -98
- package/dist/chunk-WDU2ZV4I.js +0 -1426
- package/dist/chunk-WGCQNOEQ.js +0 -712
- package/dist/chunk-WZQNHS4J.js +0 -52
- package/dist/chunk-X6VUCICU.js +0 -457
- package/dist/chunk-XAY7FM7Y.js +0 -618
- package/dist/chunk-XFW7B23S.js +0 -282
- package/dist/chunk-XJ3MNGY5.js +0 -58
- package/dist/chunk-XJZ5Z2CM.js +0 -642
- package/dist/chunk-XKVFQTJJ.js +0 -254
- package/dist/chunk-XRLFASCY.js +0 -22
- package/dist/chunk-XZGY5ZJ4.js +0 -35
- package/dist/chunk-Y745CBVB.js +0 -944
- package/dist/chunk-YLBJSXYY.js +0 -944
- package/dist/chunk-YQJIKVPZ.js +0 -1429
- package/dist/chunk-YRM2VCZF.js +0 -457
- package/dist/chunk-YS33KBVJ.js +0 -944
- package/dist/chunk-Z27DZPDG.js +0 -41
- package/dist/chunk-Z6GZHJW5.js +0 -877
- package/dist/chunk-ZXQ5NAEN.js +0 -32
- package/dist/contracts-B552GopR.d.cts +0 -245
- package/dist/contracts-B552GopR.d.ts +0 -245
- package/dist/contracts-Bg1ECISC.d.cts +0 -245
- package/dist/contracts-Bg1ECISC.d.ts +0 -245
- package/dist/contracts-CMriKJ6P.d.cts +0 -245
- package/dist/contracts-CMriKJ6P.d.ts +0 -245
- package/dist/src/components/ErrorBoundary.d.ts +0 -15
- package/dist/src/components/ErrorBoundary.js +0 -119
- package/dist/src/core/catch.d.ts +0 -11
- package/dist/src/core/catch.js +0 -28
- package/dist/src/core/each.d.ts +0 -13
- package/dist/src/core/each.js +0 -68
- package/dist/src/core/for.d.ts +0 -12
- package/dist/src/core/for.js +0 -67
- package/dist/src/core/html.d.ts +0 -137
- package/dist/src/core/html.js +0 -155
- package/dist/src/core/htmlIf.d.ts +0 -11
- package/dist/src/core/htmlIf.js +0 -18
- package/dist/src/core/lazy.d.ts +0 -7
- package/dist/src/core/lazy.js +0 -16
- package/dist/src/core/mount.d.ts +0 -7
- package/dist/src/core/mount.js +0 -12
- package/dist/src/core/slots.d.ts +0 -3
- package/dist/src/core/slots.js +0 -3
- package/dist/src/core/suspense.d.ts +0 -10
- package/dist/src/core/suspense.js +0 -33
- package/dist/src/core/tagFactory.d.ts +0 -13
- package/dist/src/core/tagFactory.js +0 -86
- package/dist/src/core/test.d.ts +0 -11
- package/dist/src/core/test.js +0 -28
- package/dist/src/core/types.d.ts +0 -2
- package/dist/src/core/types.js +0 -1
- package/dist/src/core/useComputed.d.ts +0 -6
- package/dist/src/core/useComputed.js +0 -30
- package/dist/src/core/useEffect.d.ts +0 -6
- package/dist/src/core/useEffect.js +0 -23
- package/dist/src/core/useState.d.ts +0 -10
- package/dist/src/core/useState.js +0 -34
- package/dist/src/core/useStore.d.ts +0 -19
- package/dist/src/core/useStore.js +0 -53
- package/dist/src/core/useWatch.d.ts +0 -8
- package/dist/src/core/useWatch.js +0 -23
- package/dist/src/plugins/i18n.d.ts +0 -6
- package/dist/src/plugins/i18n.js +0 -16
- package/dist/src/plugins/router.d.ts +0 -188
- package/dist/src/plugins/router.js +0 -1178
- package/dist/src/reactivity/bindAttribute.d.ts +0 -5
- package/dist/src/reactivity/bindAttribute.js +0 -31
- package/dist/src/reactivity/bindChildNode.d.ts +0 -10
- package/dist/src/reactivity/bindChildNode.js +0 -46
- package/dist/src/reactivity/bindTextNode.d.ts +0 -10
- package/dist/src/reactivity/bindTextNode.js +0 -27
- package/dist/src/reactivity/signal.d.ts +0 -3
- package/dist/src/reactivity/signal.js +0 -1
- package/dist/src/reactivity/track.d.ts +0 -18
- package/dist/src/reactivity/track.js +0 -73
- package/dist/src/reactivity/useComputed.d.ts +0 -6
- package/dist/src/reactivity/useComputed.js +0 -30
- package/dist/src/reactivity/useEffect.d.ts +0 -6
- package/dist/src/reactivity/useEffect.js +0 -23
- package/dist/src/reactivity/useState.d.ts +0 -10
- package/dist/src/reactivity/useState.js +0 -34
- package/dist/src/reactivity/useStore.d.ts +0 -19
- package/dist/src/reactivity/useStore.js +0 -53
- package/dist/src/reactivity/useWatch.d.ts +0 -8
- package/dist/src/reactivity/useWatch.js +0 -23
- package/dist/src/utils/sanitize.d.ts +0 -1
- package/dist/src/utils/sanitize.js +0 -8
- package/dist/ssr-27FOM46T.js +0 -35
- package/dist/ssr-GEOEYQV7.js +0 -35
- package/dist/ssr-GFUTTSJD.js +0 -22
- package/dist/ssr-K7DCR6BZ.js +0 -35
- package/dist/ssr-NFAIHWJJ.js +0 -35
- package/dist/ssr-O6LFMRFP.js +0 -35
- package/dist/ssr-QZEVGMMK.js +0 -35
- package/dist/ssr-SGVBCAGC.js +0 -35
- package/dist/ssr-UB2IXCYX.js +0 -35
- package/dist/ssr-XBZQNV4O.js +0 -22
- package/dist/ssr-Y76FSXDU.js +0 -35
- package/dist/ssr-YQJ4AYBD.js +0 -35
- package/dist/tagFactory-BDN7gDEp.d.cts +0 -21
- package/dist/tagFactory-BDN7gDEp.d.ts +0 -21
- package/dist/tagFactory-CZPO4RXF.d.cts +0 -34
- package/dist/tagFactory-CZPO4RXF.d.ts +0 -34
- package/dist/tagFactory-CgImPVMY.d.cts +0 -22
- package/dist/tagFactory-CgImPVMY.d.ts +0 -22
- package/dist/tagFactory-Cw1iv5if.d.cts +0 -22
- package/dist/tagFactory-Cw1iv5if.d.ts +0 -22
- package/dist/tagFactory-DeAXq9ef.d.cts +0 -30
- package/dist/tagFactory-DeAXq9ef.d.ts +0 -30
- package/dist/tagFactory-SkY0a7L1.d.cts +0 -22
- package/dist/tagFactory-SkY0a7L1.d.ts +0 -22
package/dist/chunk-5OCBERWW.js
DELETED
|
@@ -1,1094 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
effect
|
|
3
|
-
} from "./chunk-6DJQF4Z7.js";
|
|
4
|
-
import {
|
|
5
|
-
signal
|
|
6
|
-
} from "./chunk-K7JUDY3C.js";
|
|
7
|
-
|
|
8
|
-
// src/devtools/debug.ts
|
|
9
|
-
var debugEnabled = false;
|
|
10
|
-
var perfMarks = /* @__PURE__ */ new Map();
|
|
11
|
-
function enableDebug() {
|
|
12
|
-
debugEnabled = true;
|
|
13
|
-
console.log("[SibuJS] Debug mode enabled");
|
|
14
|
-
}
|
|
15
|
-
function disableDebug() {
|
|
16
|
-
debugEnabled = false;
|
|
17
|
-
}
|
|
18
|
-
function isDebugEnabled() {
|
|
19
|
-
return debugEnabled;
|
|
20
|
-
}
|
|
21
|
-
function debugLog(component, action, data) {
|
|
22
|
-
if (!debugEnabled) return;
|
|
23
|
-
console.log(`[SibuJS:${component}] ${action}`, data !== void 0 ? data : "");
|
|
24
|
-
}
|
|
25
|
-
function perfTracker(label) {
|
|
26
|
-
if (!perfMarks.has(label)) {
|
|
27
|
-
perfMarks.set(label, []);
|
|
28
|
-
}
|
|
29
|
-
let startTime = 0;
|
|
30
|
-
function startMeasure2() {
|
|
31
|
-
startTime = globalThis.performance.now();
|
|
32
|
-
}
|
|
33
|
-
function endMeasure() {
|
|
34
|
-
const elapsed = globalThis.performance.now() - startTime;
|
|
35
|
-
perfMarks.get(label)?.push(elapsed);
|
|
36
|
-
if (debugEnabled) {
|
|
37
|
-
debugLog("Perf", `${label}: ${elapsed.toFixed(2)}ms`);
|
|
38
|
-
}
|
|
39
|
-
return elapsed;
|
|
40
|
-
}
|
|
41
|
-
function getAverageTime() {
|
|
42
|
-
const times = perfMarks.get(label) || [];
|
|
43
|
-
if (times.length === 0) return 0;
|
|
44
|
-
return times.reduce((a, b) => a + b, 0) / times.length;
|
|
45
|
-
}
|
|
46
|
-
function getRenderCount() {
|
|
47
|
-
return (perfMarks.get(label) || []).length;
|
|
48
|
-
}
|
|
49
|
-
return { startMeasure: startMeasure2, endMeasure, getAverageTime, getRenderCount };
|
|
50
|
-
}
|
|
51
|
-
function measureRender(label, component) {
|
|
52
|
-
const perf = perfTracker(label);
|
|
53
|
-
return (props) => {
|
|
54
|
-
perf.startMeasure();
|
|
55
|
-
const el = component(props);
|
|
56
|
-
perf.endMeasure();
|
|
57
|
-
return el;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function getPerformanceReport() {
|
|
61
|
-
const report = {};
|
|
62
|
-
for (const [label, times] of perfMarks) {
|
|
63
|
-
if (times.length === 0) continue;
|
|
64
|
-
report[label] = {
|
|
65
|
-
count: times.length,
|
|
66
|
-
average: times.reduce((a, b) => a + b, 0) / times.length,
|
|
67
|
-
min: Math.min(...times),
|
|
68
|
-
max: Math.max(...times),
|
|
69
|
-
total: times.reduce((a, b) => a + b, 0)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return report;
|
|
73
|
-
}
|
|
74
|
-
function clearPerformanceData() {
|
|
75
|
-
perfMarks.clear();
|
|
76
|
-
}
|
|
77
|
-
var trackedCleanups = /* @__PURE__ */ new Map();
|
|
78
|
-
function trackCleanup(component, cleanup) {
|
|
79
|
-
if (!trackedCleanups.has(component)) {
|
|
80
|
-
trackedCleanups.set(component, []);
|
|
81
|
-
}
|
|
82
|
-
trackedCleanups.get(component)?.push(cleanup);
|
|
83
|
-
}
|
|
84
|
-
function runCleanups(component) {
|
|
85
|
-
const cleanups = trackedCleanups.get(component);
|
|
86
|
-
if (cleanups) {
|
|
87
|
-
for (const cleanup of cleanups) {
|
|
88
|
-
try {
|
|
89
|
-
cleanup();
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
trackedCleanups.delete(component);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function checkLeaks() {
|
|
97
|
-
const leaks = {};
|
|
98
|
-
for (const [component, cleanups] of trackedCleanups) {
|
|
99
|
-
if (cleanups.length > 0) {
|
|
100
|
-
leaks[component] = cleanups.length;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (debugEnabled && Object.keys(leaks).length > 0) {
|
|
104
|
-
console.warn("[SibuJS] Potential memory leaks detected:", leaks);
|
|
105
|
-
}
|
|
106
|
-
return leaks;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// src/devtools/devtools.ts
|
|
110
|
-
function createGlobalHook() {
|
|
111
|
-
const listeners = /* @__PURE__ */ new Map();
|
|
112
|
-
const events = [];
|
|
113
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
114
|
-
const components = /* @__PURE__ */ new Map();
|
|
115
|
-
return {
|
|
116
|
-
on(event, fn) {
|
|
117
|
-
let set = listeners.get(event);
|
|
118
|
-
if (!set) {
|
|
119
|
-
set = /* @__PURE__ */ new Set();
|
|
120
|
-
listeners.set(event, set);
|
|
121
|
-
}
|
|
122
|
-
set.add(fn);
|
|
123
|
-
},
|
|
124
|
-
off(event, fn) {
|
|
125
|
-
listeners.get(event)?.delete(fn);
|
|
126
|
-
},
|
|
127
|
-
emit(event, payload) {
|
|
128
|
-
events.push({ event, payload, ts: Date.now() });
|
|
129
|
-
if (events.length > 2e3) events.splice(0, events.length - 2e3);
|
|
130
|
-
const set = listeners.get(event);
|
|
131
|
-
if (set)
|
|
132
|
-
for (const fn of set)
|
|
133
|
-
try {
|
|
134
|
-
fn(payload);
|
|
135
|
-
} catch {
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
nodes,
|
|
139
|
-
components,
|
|
140
|
-
events,
|
|
141
|
-
connected: false,
|
|
142
|
-
sibuVersion: "1.0.0"
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function getOrCreateHook() {
|
|
146
|
-
const g = globalThis;
|
|
147
|
-
if (!g.__SIBU_DEVTOOLS_GLOBAL_HOOK__) {
|
|
148
|
-
g.__SIBU_DEVTOOLS_GLOBAL_HOOK__ = createGlobalHook();
|
|
149
|
-
}
|
|
150
|
-
return g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
151
|
-
}
|
|
152
|
-
var activeDevTools = null;
|
|
153
|
-
var nextNodeId = 0;
|
|
154
|
-
function getActiveDevTools() {
|
|
155
|
-
return activeDevTools;
|
|
156
|
-
}
|
|
157
|
-
function initDevTools(config) {
|
|
158
|
-
const maxEvents = config?.maxEvents ?? 1e3;
|
|
159
|
-
const enabled = config?.enabled ?? true;
|
|
160
|
-
if (!enabled) return createNoopApi();
|
|
161
|
-
const hook = getOrCreateHook();
|
|
162
|
-
nextNodeId = 0;
|
|
163
|
-
const eventLog = [];
|
|
164
|
-
hook.on("signal:create", (payload) => {
|
|
165
|
-
const p = payload;
|
|
166
|
-
nextNodeId++;
|
|
167
|
-
const name = inferName();
|
|
168
|
-
const node = {
|
|
169
|
-
id: nextNodeId,
|
|
170
|
-
type: "signal",
|
|
171
|
-
name,
|
|
172
|
-
ref: p.signal,
|
|
173
|
-
getter: p.getter,
|
|
174
|
-
createdAt: Date.now()
|
|
175
|
-
};
|
|
176
|
-
hook.nodes.set(nextNodeId, node);
|
|
177
|
-
});
|
|
178
|
-
hook.on("signal:update", (payload) => {
|
|
179
|
-
if (!isActive) return;
|
|
180
|
-
const p = payload;
|
|
181
|
-
if (devStateManagedRefs.has(p.signal)) return;
|
|
182
|
-
const node = findNodeByRef(hook, p.signal);
|
|
183
|
-
pushEvent(eventLog, maxEvents, {
|
|
184
|
-
type: "state-change",
|
|
185
|
-
component: node?.name || "unknown",
|
|
186
|
-
key: "value",
|
|
187
|
-
oldValue: p.oldValue,
|
|
188
|
-
newValue: p.newValue,
|
|
189
|
-
timestamp: Date.now()
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
hook.on("computed:create", (payload) => {
|
|
193
|
-
const p = payload;
|
|
194
|
-
nextNodeId++;
|
|
195
|
-
const name = inferName();
|
|
196
|
-
const node = {
|
|
197
|
-
id: nextNodeId,
|
|
198
|
-
type: "computed",
|
|
199
|
-
name,
|
|
200
|
-
ref: p.signal,
|
|
201
|
-
getter: p.getter,
|
|
202
|
-
createdAt: Date.now()
|
|
203
|
-
};
|
|
204
|
-
hook.nodes.set(nextNodeId, node);
|
|
205
|
-
});
|
|
206
|
-
hook.on("computed:update", (payload) => {
|
|
207
|
-
const p = payload;
|
|
208
|
-
const node = findNodeByRef(hook, p.signal);
|
|
209
|
-
pushEvent(eventLog, maxEvents, {
|
|
210
|
-
type: "state-change",
|
|
211
|
-
component: node?.name || "computed",
|
|
212
|
-
key: "value",
|
|
213
|
-
oldValue: p.oldValue,
|
|
214
|
-
newValue: p.newValue,
|
|
215
|
-
timestamp: Date.now()
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
hook.on("effect:create", (payload) => {
|
|
219
|
-
nextNodeId++;
|
|
220
|
-
const name = inferName();
|
|
221
|
-
const p = payload;
|
|
222
|
-
const node = { id: nextNodeId, type: "effect", name, ref: p.effectFn, createdAt: Date.now() };
|
|
223
|
-
hook.nodes.set(nextNodeId, node);
|
|
224
|
-
});
|
|
225
|
-
hook.on("effect:run", (payload) => {
|
|
226
|
-
const p = payload;
|
|
227
|
-
const node = findNodeByRef(hook, p.effectFn);
|
|
228
|
-
pushEvent(eventLog, maxEvents, {
|
|
229
|
-
type: "render",
|
|
230
|
-
component: node?.name || "effect",
|
|
231
|
-
duration: 0,
|
|
232
|
-
timestamp: Date.now()
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
hook.on("app:init", (payload) => {
|
|
236
|
-
const p = payload;
|
|
237
|
-
pushEvent(eventLog, maxEvents, {
|
|
238
|
-
type: "render",
|
|
239
|
-
component: "App",
|
|
240
|
-
duration: p.duration,
|
|
241
|
-
timestamp: Date.now()
|
|
242
|
-
});
|
|
243
|
-
if (typeof document !== "undefined") {
|
|
244
|
-
queueMicrotask(() => discoverComponents(hook, eventLog, maxEvents));
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
function record(event) {
|
|
248
|
-
if (isActive) pushEvent(eventLog, maxEvents, event);
|
|
249
|
-
}
|
|
250
|
-
function getEvents(filter) {
|
|
251
|
-
if (!filter) return eventLog.slice();
|
|
252
|
-
return eventLog.filter((e) => {
|
|
253
|
-
if (filter.type && e.type !== filter.type) return false;
|
|
254
|
-
if (filter.component && e.component !== filter.component) return false;
|
|
255
|
-
return true;
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
function clearEvents() {
|
|
259
|
-
eventLog.length = 0;
|
|
260
|
-
}
|
|
261
|
-
function registerComponent(name, element, state) {
|
|
262
|
-
hook.components.set(name, { element, state });
|
|
263
|
-
}
|
|
264
|
-
function unregisterComponent(name) {
|
|
265
|
-
hook.components.delete(name);
|
|
266
|
-
}
|
|
267
|
-
function getComponents() {
|
|
268
|
-
return new Map(hook.components);
|
|
269
|
-
}
|
|
270
|
-
function getSignals() {
|
|
271
|
-
const result = [];
|
|
272
|
-
for (const [, node] of hook.nodes) {
|
|
273
|
-
let value;
|
|
274
|
-
try {
|
|
275
|
-
if (node.getter) value = node.getter();
|
|
276
|
-
else if (node.ref && "value" in node.ref) value = node.ref.value;
|
|
277
|
-
else value = void 0;
|
|
278
|
-
} catch {
|
|
279
|
-
value = "<error>";
|
|
280
|
-
}
|
|
281
|
-
const subs = node.ref?.__s;
|
|
282
|
-
result.push({
|
|
283
|
-
id: node.id,
|
|
284
|
-
name: node.name,
|
|
285
|
-
type: node.type,
|
|
286
|
-
value,
|
|
287
|
-
subscriberCount: subs instanceof Set ? subs.size : 0
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
return result;
|
|
291
|
-
}
|
|
292
|
-
let isActive = enabled;
|
|
293
|
-
function isEnabled() {
|
|
294
|
-
return isActive;
|
|
295
|
-
}
|
|
296
|
-
function setEnabled(v) {
|
|
297
|
-
isActive = v;
|
|
298
|
-
}
|
|
299
|
-
function snapshot() {
|
|
300
|
-
const snap = {};
|
|
301
|
-
for (const [name, entry] of hook.components) snap[name] = entry.state ? { ...entry.state } : {};
|
|
302
|
-
return snap;
|
|
303
|
-
}
|
|
304
|
-
function highlightElement(name) {
|
|
305
|
-
const prev = document.querySelector("[data-sibu-highlight]");
|
|
306
|
-
if (prev) {
|
|
307
|
-
prev.style.outline = "";
|
|
308
|
-
prev.removeAttribute("data-sibu-highlight");
|
|
309
|
-
}
|
|
310
|
-
const entry = hook.components.get(name);
|
|
311
|
-
if (entry?.element?.isConnected) {
|
|
312
|
-
entry.element.style.outline = "2px solid #89b4fa";
|
|
313
|
-
entry.element.setAttribute("data-sibu-highlight", "true");
|
|
314
|
-
entry.element.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
315
|
-
setTimeout(() => {
|
|
316
|
-
entry.element.style.outline = "";
|
|
317
|
-
entry.element.removeAttribute("data-sibu-highlight");
|
|
318
|
-
}, 3e3);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
function destroy() {
|
|
322
|
-
eventLog.length = 0;
|
|
323
|
-
hook.nodes.clear();
|
|
324
|
-
hook.components.clear();
|
|
325
|
-
hook.events.length = 0;
|
|
326
|
-
isActive = false;
|
|
327
|
-
activeDevTools = null;
|
|
328
|
-
const g = globalThis;
|
|
329
|
-
if (g.__SIBU_DEVTOOLS__ === api) delete g.__SIBU_DEVTOOLS__;
|
|
330
|
-
if (g.__SIBU_DEVTOOLS_GLOBAL_HOOK__ === hook) delete g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
331
|
-
}
|
|
332
|
-
const api = {
|
|
333
|
-
record,
|
|
334
|
-
getEvents,
|
|
335
|
-
clearEvents,
|
|
336
|
-
registerComponent,
|
|
337
|
-
unregisterComponent,
|
|
338
|
-
getComponents,
|
|
339
|
-
getSignals,
|
|
340
|
-
isEnabled,
|
|
341
|
-
setEnabled,
|
|
342
|
-
snapshot,
|
|
343
|
-
highlightElement,
|
|
344
|
-
destroy
|
|
345
|
-
};
|
|
346
|
-
if (typeof window !== "undefined") {
|
|
347
|
-
window.__SIBU_DEVTOOLS__ = api;
|
|
348
|
-
let changeVersion = 0;
|
|
349
|
-
const origPush = eventLog.push.bind(eventLog);
|
|
350
|
-
eventLog.push = (...args) => {
|
|
351
|
-
changeVersion++;
|
|
352
|
-
return origPush(...args);
|
|
353
|
-
};
|
|
354
|
-
const origNodeSet = hook.nodes.set.bind(hook.nodes);
|
|
355
|
-
hook.nodes.set = (k, v) => {
|
|
356
|
-
changeVersion++;
|
|
357
|
-
return origNodeSet(k, v);
|
|
358
|
-
};
|
|
359
|
-
const origCompSet = hook.components.set.bind(hook.components);
|
|
360
|
-
hook.components.set = (k, v) => {
|
|
361
|
-
changeVersion++;
|
|
362
|
-
return origCompSet(k, v);
|
|
363
|
-
};
|
|
364
|
-
window.__SIBU_DEVTOOLS_VERSION__ = () => changeVersion;
|
|
365
|
-
window.__SIBU_DEVTOOLS_DATA__ = () => {
|
|
366
|
-
const sArr = [];
|
|
367
|
-
for (const [, node] of hook.nodes) {
|
|
368
|
-
let val = "";
|
|
369
|
-
try {
|
|
370
|
-
let raw;
|
|
371
|
-
if (node.type === "signal" && node.ref && "value" in node.ref) {
|
|
372
|
-
raw = node.ref.value;
|
|
373
|
-
} else if (node.type === "computed" && node.ref) {
|
|
374
|
-
if (node.ref._d && node.ref._g) {
|
|
375
|
-
try {
|
|
376
|
-
raw = node.ref._g();
|
|
377
|
-
} catch {
|
|
378
|
-
raw = node.ref._v;
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
raw = node.ref._v;
|
|
382
|
-
}
|
|
383
|
-
} else if (node.type === "effect") {
|
|
384
|
-
raw = void 0;
|
|
385
|
-
} else if (node.ref && "value" in node.ref) {
|
|
386
|
-
raw = node.ref.value;
|
|
387
|
-
}
|
|
388
|
-
if (raw === void 0) val = "undefined";
|
|
389
|
-
else if (raw === null) val = "null";
|
|
390
|
-
else if (typeof raw === "object") val = JSON.stringify(raw);
|
|
391
|
-
else val = String(raw);
|
|
392
|
-
} catch {
|
|
393
|
-
val = "?";
|
|
394
|
-
}
|
|
395
|
-
const fullVal = val;
|
|
396
|
-
const shortVal = val.length > 80 ? `${val.substring(0, 80)}...` : val;
|
|
397
|
-
const subs = node.ref?.__s;
|
|
398
|
-
sArr.push({
|
|
399
|
-
id: node.id,
|
|
400
|
-
n: node.name,
|
|
401
|
-
tp: node.type,
|
|
402
|
-
v: shortVal,
|
|
403
|
-
fv: fullVal,
|
|
404
|
-
sc: subs instanceof Set ? subs.size : 0
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
function walkElement(el, depth) {
|
|
408
|
-
if (depth > 8) return [];
|
|
409
|
-
const result = [];
|
|
410
|
-
const max = Math.min(el.children.length, 50);
|
|
411
|
-
for (let i = 0; i < max; i++) {
|
|
412
|
-
const child = el.children[i];
|
|
413
|
-
const txtParts = [];
|
|
414
|
-
for (let ti = 0; ti < child.childNodes.length; ti++) {
|
|
415
|
-
const cn = child.childNodes[ti];
|
|
416
|
-
if (cn.nodeType === 3) {
|
|
417
|
-
const t = cn.textContent?.trim();
|
|
418
|
-
if (t) txtParts.push(t);
|
|
419
|
-
} else if (cn.nodeType === 1) {
|
|
420
|
-
const el2 = cn;
|
|
421
|
-
let directTxt = "";
|
|
422
|
-
for (let ci = 0; ci < el2.childNodes.length; ci++) {
|
|
423
|
-
if (el2.childNodes[ci].nodeType === 3) {
|
|
424
|
-
const t2 = el2.childNodes[ci].textContent?.trim();
|
|
425
|
-
if (t2) {
|
|
426
|
-
directTxt = t2;
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
if (directTxt) txtParts.push(directTxt);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
let txt = txtParts.join(" | ");
|
|
435
|
-
if (txt.length > 120) txt = `${txt.substring(0, 120)}...`;
|
|
436
|
-
let html = "";
|
|
437
|
-
try {
|
|
438
|
-
const outer = child.outerHTML || "";
|
|
439
|
-
html = outer.length > 500 ? `${outer.substring(0, 500)}...` : outer;
|
|
440
|
-
} catch {
|
|
441
|
-
html = "";
|
|
442
|
-
}
|
|
443
|
-
const ev = child.__sibu_events__ || [];
|
|
444
|
-
result.push({
|
|
445
|
-
tg: child.tagName ? child.tagName.toLowerCase() : "?",
|
|
446
|
-
id: child.id || "",
|
|
447
|
-
cl: (child.className || "").toString().split(" ").slice(0, 3).join(" "),
|
|
448
|
-
txt: txt.length > 60 ? `${txt.substring(0, 60)}...` : txt,
|
|
449
|
-
html,
|
|
450
|
-
ev,
|
|
451
|
-
ch: child.childElementCount > 0 ? walkElement(child, depth + 1) : []
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
return result;
|
|
455
|
-
}
|
|
456
|
-
const cArr = [];
|
|
457
|
-
for (const [name, entry] of hook.components) {
|
|
458
|
-
const el = entry.element;
|
|
459
|
-
cArr.push({
|
|
460
|
-
n: name,
|
|
461
|
-
tg: el?.tagName ? el.tagName.toLowerCase() : "?",
|
|
462
|
-
ch: el?.childElementCount || 0,
|
|
463
|
-
cn: !!el?.isConnected,
|
|
464
|
-
kids: el ? walkElement(el, 0) : []
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
const eArr = [];
|
|
468
|
-
const start = eventLog.length > 500 ? eventLog.length - 500 : 0;
|
|
469
|
-
for (let i = start; i < eventLog.length; i++) {
|
|
470
|
-
const e = eventLog[i];
|
|
471
|
-
let detail = "";
|
|
472
|
-
let ov = "";
|
|
473
|
-
let nv = "";
|
|
474
|
-
let key = "";
|
|
475
|
-
if (e.type === "state-change") {
|
|
476
|
-
const sc = e;
|
|
477
|
-
key = sc.key || "";
|
|
478
|
-
try {
|
|
479
|
-
ov = sc.oldValue === void 0 ? "undefined" : sc.oldValue === null ? "null" : typeof sc.oldValue === "object" ? JSON.stringify(sc.oldValue, null, 2) : String(sc.oldValue);
|
|
480
|
-
} catch {
|
|
481
|
-
ov = "?";
|
|
482
|
-
}
|
|
483
|
-
try {
|
|
484
|
-
nv = sc.newValue === void 0 ? "undefined" : sc.newValue === null ? "null" : typeof sc.newValue === "object" ? JSON.stringify(sc.newValue, null, 2) : String(sc.newValue);
|
|
485
|
-
} catch {
|
|
486
|
-
nv = "?";
|
|
487
|
-
}
|
|
488
|
-
const ovShort = ov.length > 40 ? `${ov.substring(0, 40)}...` : ov;
|
|
489
|
-
const nvShort = nv.length > 40 ? `${nv.substring(0, 40)}...` : nv;
|
|
490
|
-
detail = `${ovShort} \u2192 ${nvShort}`;
|
|
491
|
-
} else if (e.type === "render") {
|
|
492
|
-
detail = `${e.duration.toFixed(1)}ms`;
|
|
493
|
-
}
|
|
494
|
-
eArr.push({ t: e.type, c: e.component, ts: e.timestamp, d: detail, ov, nv, k: key });
|
|
495
|
-
}
|
|
496
|
-
return JSON.stringify({ s: sArr, c: cArr, e: eArr });
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
activeDevTools = api;
|
|
500
|
-
if (typeof document !== "undefined") {
|
|
501
|
-
const observer = new MutationObserver((mutations) => {
|
|
502
|
-
for (const m of mutations) {
|
|
503
|
-
for (const node of m.addedNodes) {
|
|
504
|
-
if (node instanceof HTMLElement) {
|
|
505
|
-
const name = node.getAttribute("data-component") || node.id;
|
|
506
|
-
if (name && !hook.components.has(name)) {
|
|
507
|
-
hook.components.set(name, { element: node });
|
|
508
|
-
pushEvent(eventLog, maxEvents, { type: "mount", component: name, element: node, timestamp: Date.now() });
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
for (const node of m.removedNodes) {
|
|
513
|
-
if (node instanceof HTMLElement) {
|
|
514
|
-
const name = node.getAttribute("data-component") || node.id;
|
|
515
|
-
if (name && hook.components.has(name)) {
|
|
516
|
-
pushEvent(eventLog, maxEvents, { type: "unmount", component: name, timestamp: Date.now() });
|
|
517
|
-
hook.components.delete(name);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
queueMicrotask(() => {
|
|
524
|
-
if (!document.body) return;
|
|
525
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
526
|
-
document.querySelectorAll("[data-component]").forEach((el) => {
|
|
527
|
-
const name = el.getAttribute("data-component");
|
|
528
|
-
if (!hook.components.has(name)) {
|
|
529
|
-
hook.components.set(name, { element: el });
|
|
530
|
-
pushEvent(eventLog, maxEvents, {
|
|
531
|
-
type: "mount",
|
|
532
|
-
component: name,
|
|
533
|
-
element: el,
|
|
534
|
-
timestamp: Date.now()
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
document.querySelectorAll("[id]").forEach((el) => {
|
|
539
|
-
if (el.id && !hook.components.has(el.id)) {
|
|
540
|
-
hook.components.set(el.id, { element: el });
|
|
541
|
-
pushEvent(eventLog, maxEvents, {
|
|
542
|
-
type: "mount",
|
|
543
|
-
component: el.id,
|
|
544
|
-
element: el,
|
|
545
|
-
timestamp: Date.now()
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
const semanticTags = ["section", "aside", "nav", "main", "header", "footer", "article"];
|
|
550
|
-
for (const tag of semanticTags) {
|
|
551
|
-
document.querySelectorAll(tag).forEach((el, i) => {
|
|
552
|
-
const name = el.getAttribute("data-component") || el.id || `${tag}-${i}`;
|
|
553
|
-
if (!hook.components.has(name)) {
|
|
554
|
-
hook.components.set(name, { element: el });
|
|
555
|
-
pushEvent(eventLog, maxEvents, {
|
|
556
|
-
type: "mount",
|
|
557
|
-
component: name,
|
|
558
|
-
element: el,
|
|
559
|
-
timestamp: Date.now()
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
return api;
|
|
567
|
-
}
|
|
568
|
-
function inferName() {
|
|
569
|
-
try {
|
|
570
|
-
const stack = new Error().stack || "";
|
|
571
|
-
for (const line of stack.split("\n")) {
|
|
572
|
-
const t = line.trim();
|
|
573
|
-
if (t.includes("signal") || t.includes("derived") || t.includes("effect") || t.includes("initDevTools") || t.includes("devtools") || t.includes("Error") || t.includes("emit") || t.includes("getOrCreateHook"))
|
|
574
|
-
continue;
|
|
575
|
-
const m = t.match(/at\s+(\w+)/);
|
|
576
|
-
if (m && m[1] !== "Object" && m[1] !== "Module" && m[1] !== "anonymous") return m[1];
|
|
577
|
-
const f = t.match(/\/([^/]+?)\.(?:ts|js|tsx|jsx)/);
|
|
578
|
-
if (f) return f[1];
|
|
579
|
-
}
|
|
580
|
-
} catch {
|
|
581
|
-
}
|
|
582
|
-
return "anonymous";
|
|
583
|
-
}
|
|
584
|
-
function findNodeByRef(hook, ref) {
|
|
585
|
-
for (const [, node] of hook.nodes) {
|
|
586
|
-
if (node.ref === ref) return node;
|
|
587
|
-
}
|
|
588
|
-
return void 0;
|
|
589
|
-
}
|
|
590
|
-
function pushEvent(log, max, event) {
|
|
591
|
-
log.push(event);
|
|
592
|
-
if (log.length > max) log.splice(0, log.length - max);
|
|
593
|
-
}
|
|
594
|
-
function discoverComponents(hook, log, max) {
|
|
595
|
-
if (!document.body) return;
|
|
596
|
-
document.querySelectorAll("[id]").forEach((el) => {
|
|
597
|
-
if (el.id && !hook.components.has(el.id)) {
|
|
598
|
-
hook.components.set(el.id, { element: el });
|
|
599
|
-
pushEvent(log, max, { type: "mount", component: el.id, element: el, timestamp: Date.now() });
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
document.querySelectorAll("[data-component]").forEach((el) => {
|
|
603
|
-
const name = el.getAttribute("data-component");
|
|
604
|
-
if (!hook.components.has(name)) {
|
|
605
|
-
hook.components.set(name, { element: el });
|
|
606
|
-
pushEvent(log, max, { type: "mount", component: name, element: el, timestamp: Date.now() });
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
function createNoopApi() {
|
|
611
|
-
const noop = () => {
|
|
612
|
-
};
|
|
613
|
-
return {
|
|
614
|
-
record: noop,
|
|
615
|
-
getEvents: () => [],
|
|
616
|
-
clearEvents: noop,
|
|
617
|
-
registerComponent: noop,
|
|
618
|
-
unregisterComponent: noop,
|
|
619
|
-
getComponents: () => /* @__PURE__ */ new Map(),
|
|
620
|
-
getSignals: () => [],
|
|
621
|
-
isEnabled: () => false,
|
|
622
|
-
setEnabled: noop,
|
|
623
|
-
snapshot: () => ({}),
|
|
624
|
-
highlightElement: noop,
|
|
625
|
-
destroy: noop
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
var devStateManagedRefs = /* @__PURE__ */ new WeakSet();
|
|
629
|
-
function devState(name, initial) {
|
|
630
|
-
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
631
|
-
const nodeCountBefore = hook ? hook.nodes.size : 0;
|
|
632
|
-
const [get, set] = signal(initial);
|
|
633
|
-
if (hook && hook.nodes.size > nodeCountBefore) {
|
|
634
|
-
const entries = Array.from(hook.nodes.values());
|
|
635
|
-
const lastNode = entries[entries.length - 1];
|
|
636
|
-
if (lastNode) {
|
|
637
|
-
lastNode.name = name;
|
|
638
|
-
if (lastNode.ref) devStateManagedRefs.add(lastNode.ref);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const dotIndex = name.indexOf(".");
|
|
642
|
-
const component = dotIndex !== -1 ? name.slice(0, dotIndex) : name;
|
|
643
|
-
const key = dotIndex !== -1 ? name.slice(dotIndex + 1) : name;
|
|
644
|
-
function trackedSet(next) {
|
|
645
|
-
const oldValue = get();
|
|
646
|
-
set(next);
|
|
647
|
-
const newValue = get();
|
|
648
|
-
const dt = activeDevTools;
|
|
649
|
-
if (dt?.isEnabled() && !Object.is(oldValue, newValue)) {
|
|
650
|
-
dt.record({ type: "state-change", component, key, oldValue, newValue, timestamp: Date.now() });
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
return [get, trackedSet];
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// src/devtools/hmr.ts
|
|
657
|
-
var hmrStateStore = /* @__PURE__ */ new Map();
|
|
658
|
-
var hmrRegistry = /* @__PURE__ */ new Map();
|
|
659
|
-
function hmrState(id, initial) {
|
|
660
|
-
const restored = hmrStateStore.has(id) ? hmrStateStore.get(id) : initial;
|
|
661
|
-
const [get, set] = signal(restored);
|
|
662
|
-
function hmrSet(next) {
|
|
663
|
-
set(next);
|
|
664
|
-
hmrStateStore.set(id, get());
|
|
665
|
-
}
|
|
666
|
-
hmrStateStore.set(id, restored);
|
|
667
|
-
return [get, hmrSet];
|
|
668
|
-
}
|
|
669
|
-
function registerHMR(id, component, container) {
|
|
670
|
-
const currentElement = component();
|
|
671
|
-
const entry = {
|
|
672
|
-
component,
|
|
673
|
-
container,
|
|
674
|
-
currentElement,
|
|
675
|
-
disposeCallbacks: []
|
|
676
|
-
};
|
|
677
|
-
hmrRegistry.set(id, entry);
|
|
678
|
-
if (container) {
|
|
679
|
-
container.appendChild(currentElement);
|
|
680
|
-
}
|
|
681
|
-
function update(newComponent) {
|
|
682
|
-
const reg = hmrRegistry.get(id);
|
|
683
|
-
if (!reg) return;
|
|
684
|
-
for (const cb of reg.disposeCallbacks) {
|
|
685
|
-
try {
|
|
686
|
-
cb();
|
|
687
|
-
} catch {
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
reg.disposeCallbacks.length = 0;
|
|
691
|
-
const newElement = newComponent();
|
|
692
|
-
if (reg.currentElement?.parentNode) {
|
|
693
|
-
reg.currentElement.parentNode.replaceChild(newElement, reg.currentElement);
|
|
694
|
-
}
|
|
695
|
-
reg.component = newComponent;
|
|
696
|
-
reg.currentElement = newElement;
|
|
697
|
-
}
|
|
698
|
-
function dispose() {
|
|
699
|
-
const reg = hmrRegistry.get(id);
|
|
700
|
-
if (!reg) return;
|
|
701
|
-
for (const cb of reg.disposeCallbacks) {
|
|
702
|
-
try {
|
|
703
|
-
cb();
|
|
704
|
-
} catch {
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
if (reg.currentElement?.parentNode) {
|
|
708
|
-
reg.currentElement.parentNode.removeChild(reg.currentElement);
|
|
709
|
-
}
|
|
710
|
-
hmrRegistry.delete(id);
|
|
711
|
-
}
|
|
712
|
-
return { update, dispose };
|
|
713
|
-
}
|
|
714
|
-
function createHMRBoundary(id) {
|
|
715
|
-
let currentElement = null;
|
|
716
|
-
let currentComponent = null;
|
|
717
|
-
const acceptCallbacks = [];
|
|
718
|
-
const disposeCallbacks = [];
|
|
719
|
-
function wrap(component) {
|
|
720
|
-
currentComponent = component;
|
|
721
|
-
const wrapper = document.createElement("div");
|
|
722
|
-
wrapper.setAttribute("data-hmr-boundary", id);
|
|
723
|
-
const element = component();
|
|
724
|
-
currentElement = element;
|
|
725
|
-
wrapper.appendChild(element);
|
|
726
|
-
hmrRegistry.set(`boundary:${id}`, {
|
|
727
|
-
component,
|
|
728
|
-
container: wrapper,
|
|
729
|
-
currentElement: element,
|
|
730
|
-
disposeCallbacks
|
|
731
|
-
});
|
|
732
|
-
return wrapper;
|
|
733
|
-
}
|
|
734
|
-
function accept(callback) {
|
|
735
|
-
if (callback) {
|
|
736
|
-
acceptCallbacks.push(callback);
|
|
737
|
-
}
|
|
738
|
-
if (typeof globalThis.__SIBU_HMR_ACCEPT__ === "function") {
|
|
739
|
-
globalThis.__SIBU_HMR_ACCEPT__(
|
|
740
|
-
id,
|
|
741
|
-
() => {
|
|
742
|
-
for (const cb of disposeCallbacks) {
|
|
743
|
-
try {
|
|
744
|
-
cb();
|
|
745
|
-
} catch {
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
disposeCallbacks.length = 0;
|
|
749
|
-
if (currentComponent && currentElement?.parentNode) {
|
|
750
|
-
const newElement = currentComponent();
|
|
751
|
-
currentElement.parentNode.replaceChild(newElement, currentElement);
|
|
752
|
-
currentElement = newElement;
|
|
753
|
-
}
|
|
754
|
-
for (const cb of acceptCallbacks) {
|
|
755
|
-
try {
|
|
756
|
-
cb();
|
|
757
|
-
} catch {
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
function disposeFn(callback) {
|
|
765
|
-
disposeCallbacks.push(callback);
|
|
766
|
-
}
|
|
767
|
-
return { wrap, accept, dispose: disposeFn };
|
|
768
|
-
}
|
|
769
|
-
function clearHMRState() {
|
|
770
|
-
hmrStateStore.clear();
|
|
771
|
-
hmrRegistry.clear();
|
|
772
|
-
}
|
|
773
|
-
function isHMRAvailable() {
|
|
774
|
-
const g = globalThis;
|
|
775
|
-
if (g.module?.hot) {
|
|
776
|
-
return true;
|
|
777
|
-
}
|
|
778
|
-
if (typeof g.__SIBU_HMR_ACCEPT__ === "function") {
|
|
779
|
-
return true;
|
|
780
|
-
}
|
|
781
|
-
if (g.module?.hot) {
|
|
782
|
-
return true;
|
|
783
|
-
}
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// src/devtools/sourceMaps.ts
|
|
788
|
-
var SibuError = class _SibuError extends Error {
|
|
789
|
-
constructor(message, options) {
|
|
790
|
-
super(message);
|
|
791
|
-
if (options?.cause) {
|
|
792
|
-
this.cause = options.cause;
|
|
793
|
-
}
|
|
794
|
-
this.name = "SibuError";
|
|
795
|
-
this.component = options?.component;
|
|
796
|
-
this.props = options?.props;
|
|
797
|
-
Object.setPrototypeOf(this, _SibuError.prototype);
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
function createErrorReporter(options) {
|
|
801
|
-
const logToConsole = options?.logToConsole ?? true;
|
|
802
|
-
const maxErrors = options?.maxErrors ?? 500;
|
|
803
|
-
const errors = [];
|
|
804
|
-
function report(error, context) {
|
|
805
|
-
let sibuError;
|
|
806
|
-
if (error instanceof SibuError) {
|
|
807
|
-
sibuError = error;
|
|
808
|
-
if (context?.component && !sibuError.component) {
|
|
809
|
-
sibuError.component = context.component;
|
|
810
|
-
}
|
|
811
|
-
if (context?.props && !sibuError.props) {
|
|
812
|
-
sibuError.props = context.props;
|
|
813
|
-
}
|
|
814
|
-
} else {
|
|
815
|
-
sibuError = new SibuError(error.message, {
|
|
816
|
-
component: context?.component,
|
|
817
|
-
props: context?.props,
|
|
818
|
-
cause: error
|
|
819
|
-
});
|
|
820
|
-
sibuError.stack = error.stack;
|
|
821
|
-
}
|
|
822
|
-
errors.push(sibuError);
|
|
823
|
-
if (errors.length > maxErrors) {
|
|
824
|
-
errors.splice(0, errors.length - maxErrors);
|
|
825
|
-
}
|
|
826
|
-
if (logToConsole) {
|
|
827
|
-
console.error(formatError(sibuError, { component: sibuError.component }));
|
|
828
|
-
}
|
|
829
|
-
if (options?.onError) {
|
|
830
|
-
try {
|
|
831
|
-
options.onError(sibuError);
|
|
832
|
-
} catch {
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
function getErrors() {
|
|
837
|
-
return errors.slice();
|
|
838
|
-
}
|
|
839
|
-
function clear() {
|
|
840
|
-
errors.length = 0;
|
|
841
|
-
}
|
|
842
|
-
function getErrorsByComponent() {
|
|
843
|
-
const map = /* @__PURE__ */ new Map();
|
|
844
|
-
for (const err of errors) {
|
|
845
|
-
const key = err.component ?? "<unknown>";
|
|
846
|
-
let list = map.get(key);
|
|
847
|
-
if (!list) {
|
|
848
|
-
list = [];
|
|
849
|
-
map.set(key, list);
|
|
850
|
-
}
|
|
851
|
-
list.push(err);
|
|
852
|
-
}
|
|
853
|
-
return map;
|
|
854
|
-
}
|
|
855
|
-
return { report, getErrors, clear, getErrorsByComponent };
|
|
856
|
-
}
|
|
857
|
-
function withErrorTracking(name, component, reporter) {
|
|
858
|
-
const rep = reporter ?? createErrorReporter();
|
|
859
|
-
return () => {
|
|
860
|
-
try {
|
|
861
|
-
return component();
|
|
862
|
-
} catch (err) {
|
|
863
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
864
|
-
rep.report(error, { component: name });
|
|
865
|
-
const fallback = document.createElement("div");
|
|
866
|
-
fallback.setAttribute("data-sibu-error", name);
|
|
867
|
-
fallback.style.cssText = "border:2px solid red;padding:12px;margin:4px;font-family:monospace;color:red;background:#fff0f0;";
|
|
868
|
-
fallback.textContent = `[SibuJS] ${name}: ${error.message}`;
|
|
869
|
-
return fallback;
|
|
870
|
-
}
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
function formatError(error, context) {
|
|
874
|
-
const lines = [];
|
|
875
|
-
const componentLabel = context?.component ?? (error instanceof SibuError ? error.component : void 0);
|
|
876
|
-
if (componentLabel) {
|
|
877
|
-
lines.push(`[SibuJS:${componentLabel}] ${error.name}: ${error.message}`);
|
|
878
|
-
} else {
|
|
879
|
-
lines.push(`[SibuJS] ${error.name}: ${error.message}`);
|
|
880
|
-
}
|
|
881
|
-
if (error instanceof SibuError && error.props) {
|
|
882
|
-
try {
|
|
883
|
-
lines.push(` Props: ${JSON.stringify(error.props)}`);
|
|
884
|
-
} catch {
|
|
885
|
-
lines.push(" Props: [unserializable]");
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
if (error.stack) {
|
|
889
|
-
const rawStack = error.stack;
|
|
890
|
-
const stackStart = rawStack.indexOf("\n");
|
|
891
|
-
const stackBody = stackStart !== -1 ? rawStack.slice(stackStart) : rawStack;
|
|
892
|
-
if (componentLabel) {
|
|
893
|
-
lines.push(` --- in <${componentLabel}> ---`);
|
|
894
|
-
}
|
|
895
|
-
lines.push(stackBody);
|
|
896
|
-
}
|
|
897
|
-
const cause = error.cause;
|
|
898
|
-
if (cause instanceof Error) {
|
|
899
|
-
lines.push("");
|
|
900
|
-
lines.push("Caused by:");
|
|
901
|
-
lines.push(formatError(cause));
|
|
902
|
-
}
|
|
903
|
-
return lines.join("\n");
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
// src/devtools/debugValue.ts
|
|
907
|
-
var debugValues = [];
|
|
908
|
-
function debugValue(value, formatter) {
|
|
909
|
-
const format = formatter ?? ((v) => String(v));
|
|
910
|
-
const entry = { value: void 0, label: "" };
|
|
911
|
-
debugValues.push(entry);
|
|
912
|
-
const dispose = effect(() => {
|
|
913
|
-
const resolved = value();
|
|
914
|
-
entry.value = resolved;
|
|
915
|
-
entry.label = format(resolved);
|
|
916
|
-
});
|
|
917
|
-
return () => {
|
|
918
|
-
dispose();
|
|
919
|
-
const idx = debugValues.indexOf(entry);
|
|
920
|
-
if (idx !== -1) debugValues.splice(idx, 1);
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
function getDebugValues() {
|
|
924
|
-
return [...debugValues];
|
|
925
|
-
}
|
|
926
|
-
function clearDebugValues() {
|
|
927
|
-
debugValues.length = 0;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
// src/devtools/componentProfiler.ts
|
|
931
|
-
var RECORD = /* @__PURE__ */ Symbol("profiler.record");
|
|
932
|
-
function createProfiler(_name) {
|
|
933
|
-
const [renderCount, setRenderCount] = signal(0);
|
|
934
|
-
const [lastRenderTime, setLastRenderTime] = signal(0);
|
|
935
|
-
const [totalRenderTime, setTotalRenderTime] = signal(0);
|
|
936
|
-
const averageRenderTime = () => {
|
|
937
|
-
const count = renderCount();
|
|
938
|
-
if (count === 0) return 0;
|
|
939
|
-
return totalRenderTime() / count;
|
|
940
|
-
};
|
|
941
|
-
const reset = () => {
|
|
942
|
-
setRenderCount(0);
|
|
943
|
-
setLastRenderTime(0);
|
|
944
|
-
setTotalRenderTime(0);
|
|
945
|
-
};
|
|
946
|
-
const profiler = {
|
|
947
|
-
renderCount,
|
|
948
|
-
lastRenderTime,
|
|
949
|
-
averageRenderTime,
|
|
950
|
-
totalRenderTime,
|
|
951
|
-
reset,
|
|
952
|
-
[RECORD]: (elapsed) => {
|
|
953
|
-
setRenderCount((prev) => prev + 1);
|
|
954
|
-
setLastRenderTime(elapsed);
|
|
955
|
-
setTotalRenderTime((prev) => prev + elapsed);
|
|
956
|
-
}
|
|
957
|
-
};
|
|
958
|
-
return profiler;
|
|
959
|
-
}
|
|
960
|
-
function startMeasure(profiler) {
|
|
961
|
-
const start = performance.now();
|
|
962
|
-
return () => {
|
|
963
|
-
const elapsed = performance.now() - start;
|
|
964
|
-
const internal = profiler;
|
|
965
|
-
if (internal[RECORD]) {
|
|
966
|
-
internal[RECORD](elapsed);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
// src/devtools/devtoolsOverlay.ts
|
|
972
|
-
function createDevtoolsOverlay(options) {
|
|
973
|
-
const [enabled, setEnabled] = signal(options?.enabled ?? false);
|
|
974
|
-
const panels = [];
|
|
975
|
-
const isEnabled = () => {
|
|
976
|
-
return enabled();
|
|
977
|
-
};
|
|
978
|
-
const toggle = () => {
|
|
979
|
-
setEnabled((prev) => !prev);
|
|
980
|
-
};
|
|
981
|
-
const addPanel = (name, render) => {
|
|
982
|
-
const existing = panels.findIndex((p) => p.name === name);
|
|
983
|
-
if (existing !== -1) {
|
|
984
|
-
panels[existing] = { name, render };
|
|
985
|
-
} else {
|
|
986
|
-
panels.push({ name, render });
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
const removePanel = (name) => {
|
|
990
|
-
const index = panels.findIndex((p) => p.name === name);
|
|
991
|
-
if (index !== -1) {
|
|
992
|
-
panels.splice(index, 1);
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
const getPanels = () => {
|
|
996
|
-
return [...panels];
|
|
997
|
-
};
|
|
998
|
-
const dispose = () => {
|
|
999
|
-
panels.length = 0;
|
|
1000
|
-
setEnabled(false);
|
|
1001
|
-
};
|
|
1002
|
-
return { isEnabled, toggle, addPanel, removePanel, getPanels, dispose };
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
// src/devtools/introspect.ts
|
|
1006
|
-
var SUBS = "__s";
|
|
1007
|
-
function getSignalName(getter) {
|
|
1008
|
-
return getter.__name;
|
|
1009
|
-
}
|
|
1010
|
-
function getSubscriberCount(getter) {
|
|
1011
|
-
const signal2 = getter.__signal;
|
|
1012
|
-
if (!signal2) return 0;
|
|
1013
|
-
const subs = signal2[SUBS];
|
|
1014
|
-
return subs ? subs.size : 0;
|
|
1015
|
-
}
|
|
1016
|
-
function getDependencies(subscriberFn) {
|
|
1017
|
-
const deps = subscriberFn._deps;
|
|
1018
|
-
return deps ? Array.from(deps) : [];
|
|
1019
|
-
}
|
|
1020
|
-
function inspectSignal(getter) {
|
|
1021
|
-
const signal2 = getter.__signal;
|
|
1022
|
-
if (!signal2) return null;
|
|
1023
|
-
const subs = signal2[SUBS];
|
|
1024
|
-
return {
|
|
1025
|
-
name: getter.__name,
|
|
1026
|
-
signal: signal2,
|
|
1027
|
-
subscriberCount: subs ? subs.size : 0
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
function walkDependencyGraph(getter, maxDepth = 10) {
|
|
1031
|
-
const signal2 = getter.__signal;
|
|
1032
|
-
if (!signal2 || maxDepth <= 0) {
|
|
1033
|
-
return { name: getSignalName(getter), subscribers: 0, downstream: [] };
|
|
1034
|
-
}
|
|
1035
|
-
const subs = signal2[SUBS];
|
|
1036
|
-
const downstream = [];
|
|
1037
|
-
if (subs) {
|
|
1038
|
-
for (const sub of subs) {
|
|
1039
|
-
const subSig = sub._sig;
|
|
1040
|
-
if (subSig) {
|
|
1041
|
-
const subName = subSig.__name;
|
|
1042
|
-
const subSubs = subSig[SUBS];
|
|
1043
|
-
downstream.push({
|
|
1044
|
-
name: subName,
|
|
1045
|
-
subscribers: subSubs ? subSubs.size : 0,
|
|
1046
|
-
downstream: []
|
|
1047
|
-
// Could recurse but we keep it simple
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
return {
|
|
1053
|
-
name: getSignalName(getter),
|
|
1054
|
-
subscribers: subs ? subs.size : 0,
|
|
1055
|
-
downstream
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
export {
|
|
1060
|
-
enableDebug,
|
|
1061
|
-
disableDebug,
|
|
1062
|
-
isDebugEnabled,
|
|
1063
|
-
debugLog,
|
|
1064
|
-
perfTracker,
|
|
1065
|
-
measureRender,
|
|
1066
|
-
getPerformanceReport,
|
|
1067
|
-
clearPerformanceData,
|
|
1068
|
-
trackCleanup,
|
|
1069
|
-
runCleanups,
|
|
1070
|
-
checkLeaks,
|
|
1071
|
-
getActiveDevTools,
|
|
1072
|
-
initDevTools,
|
|
1073
|
-
devState,
|
|
1074
|
-
hmrState,
|
|
1075
|
-
registerHMR,
|
|
1076
|
-
createHMRBoundary,
|
|
1077
|
-
clearHMRState,
|
|
1078
|
-
isHMRAvailable,
|
|
1079
|
-
SibuError,
|
|
1080
|
-
createErrorReporter,
|
|
1081
|
-
withErrorTracking,
|
|
1082
|
-
formatError,
|
|
1083
|
-
debugValue,
|
|
1084
|
-
getDebugValues,
|
|
1085
|
-
clearDebugValues,
|
|
1086
|
-
createProfiler,
|
|
1087
|
-
startMeasure,
|
|
1088
|
-
createDevtoolsOverlay,
|
|
1089
|
-
getSignalName,
|
|
1090
|
-
getSubscriberCount,
|
|
1091
|
-
getDependencies,
|
|
1092
|
-
inspectSignal,
|
|
1093
|
-
walkDependencyGraph
|
|
1094
|
-
};
|