boardplot 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +408 -0
- package/README.md +49 -15
- package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-VGSL4NJK.js} +1 -1
- package/dist/{ReaderBox-GLCKYXBU.js → ReaderBox-MHMXIDAJ.js} +8 -7
- package/dist/{annotateEngine-QVNAE3EH.js → annotateEngine-753KQBNN.js} +2 -1
- package/dist/build-identity.json +3 -3
- package/dist/{chunk-HZUAEMN5.js → chunk-2CQBBN7M.js} +4 -4
- package/dist/{chunk-K3VZ5QJK.js → chunk-2ETK5TSA.js} +4 -4
- package/dist/{chunk-HHXIVFAU.js → chunk-2ETSI2EL.js} +11 -9
- package/dist/{chunk-ECBUFKCP.js → chunk-2GRXHWRH.js} +3 -3
- package/dist/{chunk-ZVM5TFGR.js → chunk-2HII2B6S.js} +6 -2
- package/dist/{chunk-WBETBGSC.js → chunk-2LC2H3ZM.js} +1003 -907
- package/dist/chunk-2NX7EO7H.js +23 -0
- package/dist/{chunk-52WNCUIN.js → chunk-2QI2PK2O.js} +1 -1
- package/dist/{chunk-QWCLWFKC.js → chunk-2VKQQLP7.js} +180 -58
- package/dist/chunk-3DOVXJ6K.js +602 -0
- package/dist/{chunk-CAJ54IEP.js → chunk-3E6NLODZ.js} +1 -1
- package/dist/{chunk-MOS6WFWM.js → chunk-3HA4IJTO.js} +9 -9
- package/dist/{chunk-JCIXYOND.js → chunk-3HPPTQEW.js} +4 -4
- package/dist/{chunk-7VVHTOE7.js → chunk-3KT2647F.js} +4 -2
- package/dist/{chunk-O6ZTIDWB.js → chunk-3MFVJMP6.js} +3 -2
- package/dist/{chunk-KQCKK3LD.js → chunk-3P3FKPFN.js} +170 -73
- package/dist/{chunk-WI5VOSQX.js → chunk-3XAJSMYD.js} +2 -2
- package/dist/{chunk-CPGASWNN.js → chunk-42QKUSHJ.js} +13 -3
- package/dist/{chunk-QB5HV4IY.js → chunk-44JU3VOT.js} +7 -8
- package/dist/{chunk-BYCJ6TKI.js → chunk-44K75CYE.js} +3 -3
- package/dist/{chunk-MS7O3KDJ.js → chunk-4FNM4D57.js} +6 -6
- package/dist/{chunk-BVYIKLQ5.js → chunk-4ROZ4TFL.js} +1 -1
- package/dist/{chunk-3V62N3Z7.js → chunk-4VV3KUFT.js} +7 -8
- package/dist/{chunk-MAFPVR4G.js → chunk-54YO56IK.js} +10 -5
- package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
- package/dist/{chunk-6AMN7IKJ.js → chunk-5JEU6MWC.js} +49 -28
- package/dist/{chunk-NCLRZQR6.js → chunk-5JIB4VJA.js} +18 -10
- package/dist/{chunk-SXD3OYAR.js → chunk-5OP3E2ZD.js} +205 -96
- package/dist/{chunk-SS4YGK3E.js → chunk-5SLBD4BT.js} +72 -304
- package/dist/{chunk-XMP2DNLI.js → chunk-5SVGTQTW.js} +4 -4
- package/dist/chunk-5U567TYU.js +23 -0
- package/dist/chunk-5ZLF4S7X.js +40 -0
- package/dist/{chunk-T2YDWT54.js → chunk-5ZMTQATF.js} +261 -147
- package/dist/{chunk-WXJ5MHLH.js → chunk-62BDQTO6.js} +2 -2
- package/dist/chunk-64K3V4VN.js +25 -0
- package/dist/{chunk-BK6P6KMW.js → chunk-67YJJJIB.js} +1 -1
- package/dist/{chunk-32LLDRPI.js → chunk-6DJNFT2K.js} +42 -32
- package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
- package/dist/{chunk-7STMIK2X.js → chunk-6JFQCVNN.js} +4 -4
- package/dist/chunk-6JXBLQJ2.js +32 -0
- package/dist/{chunk-5TWY3ZIC.js → chunk-6XPV6M3Q.js} +5 -5
- package/dist/{chunk-MPO5TVGF.js → chunk-6ZDSEITW.js} +3 -3
- package/dist/{chunk-75WIUG2W.js → chunk-72HVDLMT.js} +172 -78
- package/dist/chunk-75NU5RLX.js +24 -0
- package/dist/chunk-76GPN6AT.js +72 -0
- package/dist/chunk-7BQK2UDV.js +13 -0
- package/dist/{chunk-CF4NMRN7.js → chunk-7CAYRPJV.js} +45 -25
- package/dist/{chunk-U3A6FMSI.js → chunk-7GWWBHVQ.js} +7 -7
- package/dist/{chunk-CHAS5A5B.js → chunk-7NYUFMLJ.js} +149 -86
- package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
- package/dist/chunk-A65B23JK.js +113 -0
- package/dist/{chunk-4KMZAK6J.js → chunk-A7R6FUS6.js} +4 -4
- package/dist/{chunk-E2ZUBP4Q.js → chunk-AEVGUOPB.js} +7 -8
- package/dist/chunk-AHIK2N72.js +53 -0
- package/dist/{chunk-KLB2QC24.js → chunk-AICO24HJ.js} +5 -2
- package/dist/{chunk-7KSUMFBK.js → chunk-AJGSCVVW.js} +5 -1
- package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
- package/dist/{chunk-E7V3OHQQ.js → chunk-AN2V2LC4.js} +37 -22
- package/dist/{chunk-JIEVDGAF.js → chunk-AOFUA5XP.js} +1 -1
- package/dist/chunk-B5A7X2BA.js +44 -0
- package/dist/{chunk-2HTYGMMG.js → chunk-BCMEGJRX.js} +2 -2
- package/dist/{chunk-KD5GOR2K.js → chunk-BDIKWR45.js} +124 -69
- package/dist/{chunk-FNRPQIQE.js → chunk-BG6AIWAK.js} +4 -6
- package/dist/{chunk-ZMPH2OC4.js → chunk-BOT6W3VB.js} +7 -8
- package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
- package/dist/{chunk-2DOEZ5QY.js → chunk-BZ67BJBH.js} +11 -10
- package/dist/{chunk-UBCVBBJJ.js → chunk-C47POAC5.js} +4 -3
- package/dist/{chunk-O7REHICC.js → chunk-C5OBPO4Z.js} +36 -28
- package/dist/{chunk-IGNBQT23.js → chunk-CCAAI56H.js} +121 -10
- package/dist/{chunk-RPIKNMZA.js → chunk-CDUR3KWV.js} +7 -2
- package/dist/{chunk-MZACASZY.js → chunk-CMPHT2LS.js} +14 -2
- package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
- package/dist/{chunk-IVRYF7QA.js → chunk-CR5FP5SF.js} +1 -1
- package/dist/{chunk-DD6RVD3S.js → chunk-D2TQX7UJ.js} +5 -1
- package/dist/{chunk-VVXKFU72.js → chunk-DEANHDXU.js} +62 -41
- package/dist/{chunk-GM3EGUYW.js → chunk-DHGE46UK.js} +1 -1
- package/dist/{chunk-UZTQUPTB.js → chunk-DIHX6NUB.js} +5 -5
- package/dist/{chunk-MD6DCQMA.js → chunk-DILQ34NW.js} +37 -37
- package/dist/{chunk-YMTXTQCN.js → chunk-DJKRYJP7.js} +6 -6
- package/dist/{chunk-JCAGVAB3.js → chunk-DKLC6QLF.js} +1200 -21
- package/dist/{chunk-SRAV6FPB.js → chunk-DNHTMCUP.js} +3 -3
- package/dist/{chunk-CKGSGRP7.js → chunk-DORE2RHL.js} +21 -5
- package/dist/{chunk-SMHZXHHD.js → chunk-DZYTXZNS.js} +15 -5
- package/dist/chunk-E262NRFP.js +39 -0
- package/dist/{chunk-V5JQQMFQ.js → chunk-E5YF236N.js} +4 -1
- package/dist/{chunk-IGJ2G5C6.js → chunk-EBUK7HJP.js} +6 -6
- package/dist/{chunk-ZL6IHMOW.js → chunk-ECBHC272.js} +198 -119
- package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
- package/dist/chunk-EFW43JQJ.js +24 -0
- package/dist/{chunk-5P2TTHBZ.js → chunk-EHRRHSPV.js} +2 -2
- package/dist/{chunk-JXBZIJCG.js → chunk-EILNJQMN.js} +32 -12
- package/dist/{chunk-GELSK76Y.js → chunk-ERDKMZ7O.js} +3 -3
- package/dist/{chunk-T2CYNDYU.js → chunk-ETRAPN5G.js} +366 -130
- package/dist/{chunk-JEUL777U.js → chunk-ETUKDEGL.js} +21 -12
- package/dist/chunk-F2ET5ZTT.js +49 -0
- package/dist/{chunk-2YO4WRJN.js → chunk-F3XOBFS4.js} +40 -29
- package/dist/{chunk-SPSGUFTI.js → chunk-FB6X7QHA.js} +1 -1
- package/dist/{chunk-5PPQIF4D.js → chunk-FGW54I23.js} +7 -8
- package/dist/{chunk-JTC5SEAQ.js → chunk-FP5B5XIL.js} +7 -3
- package/dist/{chunk-RJGCYGC3.js → chunk-FRHQGA5Q.js} +86 -250
- package/dist/{chunk-YZZLIYPA.js → chunk-FRR7BJ3B.js} +5 -1
- package/dist/{chunk-4DZFR52I.js → chunk-FVWHEM2N.js} +7 -5
- package/dist/{chunk-YPYD6OJ3.js → chunk-FWSMENKH.js} +2 -2
- package/dist/{chunk-YYJORENB.js → chunk-FWTUGNSF.js} +8 -8
- package/dist/{chunk-GIHH6VC2.js → chunk-FZKDZQ6U.js} +10 -6
- package/dist/{chunk-S7NRL66K.js → chunk-G4FF6G3I.js} +26 -17
- package/dist/{chunk-PQLAZEQV.js → chunk-GB6BZSTL.js} +248 -92
- package/dist/chunk-GCIHRRDJ.js +24 -0
- package/dist/{chunk-X3KCQEYZ.js → chunk-GHCU6OSE.js} +9 -1
- package/dist/chunk-GKDUIDU6.js +138 -0
- package/dist/chunk-GO66OCN7.js +24 -0
- package/dist/chunk-GOFS336W.js +24 -0
- package/dist/{chunk-AGDDH6XY.js → chunk-GQYT7G4F.js} +5 -1
- package/dist/{chunk-WN3HEU3P.js → chunk-GUTLXO7Q.js} +140 -89
- package/dist/chunk-H3VICNTN.js +47 -0
- package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
- package/dist/{chunk-CB4CERXZ.js → chunk-HBQHSZ6S.js} +11 -2
- package/dist/chunk-HTQGJQZN.js +124 -0
- package/dist/{chunk-F77TMAUY.js → chunk-HUQRO6VF.js} +39 -36
- package/dist/{chunk-4KQHKPB3.js → chunk-I5VDW2XZ.js} +543 -509
- package/dist/{chunk-43GGVT7W.js → chunk-I5VNHDPR.js} +11 -4
- package/dist/{chunk-4LTN7SND.js → chunk-IDXYHDQY.js} +1 -1
- package/dist/{chunk-Y54LU4CU.js → chunk-IIWZJ5ZM.js} +1 -1
- package/dist/{chunk-FMDNJ6PC.js → chunk-IPBOREIY.js} +2 -2
- package/dist/chunk-IU335UO7.js +27 -0
- package/dist/{chunk-JVZTKQFS.js → chunk-IVDTP6SV.js} +9 -5
- package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
- package/dist/{chunk-EIL3KHAL.js → chunk-J4QRB6DQ.js} +5 -5
- package/dist/{chunk-3465633G.js → chunk-JCMGKQVS.js} +3 -3
- package/dist/{chunk-YK2KWNTU.js → chunk-JM7UTLF3.js} +28 -14
- package/dist/{chunk-CXETOLPX.js → chunk-JNDWRV34.js} +4 -4
- package/dist/{chunk-DLUNQHFO.js → chunk-JSRQTDZZ.js} +26 -24
- package/dist/{chunk-WTQAG2OT.js → chunk-JT3UTEWZ.js} +8 -3
- package/dist/{chunk-GQT2SY2S.js → chunk-JUYRDZSV.js} +291 -151
- package/dist/{chunk-LKMFMNQX.js → chunk-JVGL2SCN.js} +1 -1
- package/dist/{chunk-4JC3SE4G.js → chunk-JY4LTPOV.js} +1 -1
- package/dist/chunk-K7XPTQBJ.js +267 -0
- package/dist/{chunk-P4SMC4BY.js → chunk-KGBUXMFP.js} +120 -86
- package/dist/{chunk-XC5IRUEL.js → chunk-KIE5V3DA.js} +2 -2
- package/dist/{chunk-RT66UTLJ.js → chunk-KU4PCG4W.js} +2 -2
- package/dist/{chunk-VPL3JYC6.js → chunk-KVBLTAO7.js} +52 -10
- package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
- package/dist/{chunk-PJBEJR2U.js → chunk-KWIP5YRA.js} +24 -7
- package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
- package/dist/{chunk-R2IKOLBK.js → chunk-LG6M2JTH.js} +3 -3
- package/dist/{chunk-DF3XEFQ7.js → chunk-LIE2WSB4.js} +21 -18
- package/dist/{chunk-Z55DXFWS.js → chunk-LJDATBPB.js} +26 -16
- package/dist/{chunk-KLIZXSBK.js → chunk-LMMS675D.js} +10 -9
- package/dist/{chunk-MRAP2UVV.js → chunk-LPKGZ664.js} +286 -35
- package/dist/{chunk-JFFREZGT.js → chunk-LPMSGO7L.js} +6 -2
- package/dist/chunk-LQWINE7K.js +211 -0
- package/dist/{chunk-6MJUW5R5.js → chunk-MKMMQDIY.js} +139 -71
- package/dist/{chunk-F5BYLT3M.js → chunk-MQ4IEDM5.js} +462 -138
- package/dist/{chunk-QGFKSDQO.js → chunk-MRM4KJ2O.js} +2 -2
- package/dist/{chunk-ETMHDCEH.js → chunk-MX2OZHIT.js} +102 -42
- package/dist/{chunk-6EYTD777.js → chunk-MXUPMGRY.js} +2 -2
- package/dist/{chunk-2FKEF2AC.js → chunk-NHU26HQ7.js} +58 -35
- package/dist/{chunk-KBJMLXNW.js → chunk-NQVJ4FPY.js} +161 -78
- package/dist/chunk-NZ7FX3AE.js +65 -0
- package/dist/chunk-OALBVELJ.js +23 -0
- package/dist/{chunk-5S3JQ5AT.js → chunk-OGZ4UPYK.js} +183 -137
- package/dist/{chunk-6WHWXCHJ.js → chunk-OMNB27GM.js} +7 -3
- package/dist/{chunk-EGGDPDYJ.js → chunk-OO63YP35.js} +1 -1
- package/dist/{chunk-ZYQYX66L.js → chunk-OPYDTW5Q.js} +6 -6
- package/dist/{chunk-A2GAWGVJ.js → chunk-OSJN7KDS.js} +68 -39
- package/dist/{chunk-RMC4OONA.js → chunk-OSJXIW6I.js} +1030 -1123
- package/dist/{chunk-X23SZHV5.js → chunk-OVVE42P4.js} +6 -6
- package/dist/{chunk-CCJP6QZO.js → chunk-OZA7HA6L.js} +1 -1
- package/dist/chunk-OZLKEBCD.js +54 -0
- package/dist/{chunk-TE4M52AA.js → chunk-P6DEFCMQ.js} +18 -2
- package/dist/{chunk-AMR4SUAN.js → chunk-PDTIQL3B.js} +6 -6
- package/dist/{chunk-BIVL764T.js → chunk-PJ5BYZPN.js} +2 -2
- package/dist/{chunk-BISJK67O.js → chunk-PK7Z7WRJ.js} +98 -46
- package/dist/{chunk-7VMEM3LN.js → chunk-PL6NWB5U.js} +178 -113
- package/dist/chunk-PMT75APP.js +94 -0
- package/dist/chunk-PP6A4X55.js +11 -0
- package/dist/{chunk-I7H5DU34.js → chunk-PPCH3PLO.js} +25 -13
- package/dist/{chunk-BIGQKCU7.js → chunk-PPE6S7WU.js} +42 -24
- package/dist/{chunk-2NSQIPAA.js → chunk-PT7KSIEO.js} +23 -36
- package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
- package/dist/{chunk-ZJFJ2IKQ.js → chunk-QAUGRVRU.js} +122 -23
- package/dist/{chunk-BTDGWHGJ.js → chunk-QMFWZG2P.js} +39 -19
- package/dist/{chunk-L6YVK6VC.js → chunk-QZGGCE45.js} +2 -2
- package/dist/{chunk-67QSW5RW.js → chunk-R2RJQ3BM.js} +4 -4
- package/dist/{chunk-ZY72LSQK.js → chunk-R7HBIQ63.js} +102 -61
- package/dist/{chunk-4JHMCXOB.js → chunk-RBNDZLYS.js} +77 -36
- package/dist/chunk-RCSY4CT4.js +2170 -0
- package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
- package/dist/{chunk-2NN676RI.js → chunk-RHQRPJHS.js} +7 -8
- package/dist/chunk-RI6XQKWJ.js +26 -0
- package/dist/{chunk-YOOHNQ3L.js → chunk-RJICOOB3.js} +18 -8
- package/dist/{chunk-5DTCOOLU.js → chunk-RLAVNCQJ.js} +2 -2
- package/dist/{chunk-CYKXROFG.js → chunk-ROPPWJQB.js} +23 -12
- package/dist/{chunk-54ROMBU7.js → chunk-SELOV32X.js} +105 -50
- package/dist/{chunk-TUW5IYGA.js → chunk-SQI4NWTQ.js} +9 -9
- package/dist/{chunk-ZEYBI47P.js → chunk-SRJ74CMG.js} +11 -3
- package/dist/{chunk-NHC2ADGI.js → chunk-STWOURLG.js} +253 -144
- package/dist/chunk-SWMFXSVW.js +23 -0
- package/dist/chunk-SXAZDIGM.js +84 -0
- package/dist/{chunk-EMFUZKYK.js → chunk-SZ5VGWDY.js} +3 -3
- package/dist/{chunk-R5MEBBAA.js → chunk-T26G23RS.js} +442 -119
- package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
- package/dist/chunk-T7GPIJ4L.js +89 -0
- package/dist/{chunk-MJPXHCBW.js → chunk-TAEB3RU6.js} +5 -5
- package/dist/{chunk-V7F4F6JA.js → chunk-TBDIMTRD.js} +37 -16
- package/dist/{chunk-63Y3ROZ7.js → chunk-TFFPEWNP.js} +102 -64
- package/dist/{chunk-EZZ533MH.js → chunk-TMEUK2WS.js} +6 -2
- package/dist/{chunk-37PKNVLS.js → chunk-TVOMGNFQ.js} +1 -1
- package/dist/{chunk-HJRNBKIT.js → chunk-TX5FSNAU.js} +436 -30
- package/dist/{chunk-V634AXDM.js → chunk-U52PNFPX.js} +1 -1
- package/dist/{chunk-QLANK3VN.js → chunk-U74AWJ3X.js} +6 -6
- package/dist/chunk-UC7LBW7N.js +26 -0
- package/dist/{chunk-PZ46S2SY.js → chunk-UCKUAKYQ.js} +2 -2
- package/dist/{chunk-KF7HD3EH.js → chunk-UCYL3YA7.js} +77 -55
- package/dist/{chunk-HOU2MZHC.js → chunk-UD2GI3CS.js} +11 -4
- package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
- package/dist/{chunk-LGNJCPFP.js → chunk-ULQIC76A.js} +10 -13
- package/dist/{chunk-KTHFHD6C.js → chunk-UY34DDUM.js} +11 -6
- package/dist/{chunk-6QDMRPXI.js → chunk-UYMFLWM6.js} +215 -258
- package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
- package/dist/{chunk-JTFKRDDA.js → chunk-V7FV66KL.js} +1 -1
- package/dist/{chunk-27OIGDRK.js → chunk-V7NUJEJE.js} +1 -1
- package/dist/{chunk-CCDXK5NA.js → chunk-VESSIKBG.js} +8 -3
- package/dist/{chunk-QSMGZOT5.js → chunk-VRFJAF3R.js} +7 -8
- package/dist/chunk-VS2R3OGN.js +34 -0
- package/dist/{chunk-RLMC5CUP.js → chunk-VS5B4J2D.js} +7 -8
- package/dist/{chunk-7M2GK7XQ.js → chunk-W4R6SGU3.js} +252 -121
- package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
- package/dist/{chunk-7DAH2E4T.js → chunk-WFBN2HXR.js} +2 -2
- package/dist/{chunk-DLDDRXAI.js → chunk-WJS6SAWA.js} +296 -145
- package/dist/{chunk-WWGPTEQB.js → chunk-WQYNKF33.js} +73 -22
- package/dist/{chunk-64LJDGJH.js → chunk-WUP6C4ZD.js} +4 -2
- package/dist/{chunk-F2EVCJ4U.js → chunk-X24WAHHV.js} +87 -43
- package/dist/{chunk-OJ5CQV7H.js → chunk-X3UCQPVV.js} +209 -96
- package/dist/{chunk-7FKY6YWU.js → chunk-X46PSAJ7.js} +6 -6
- package/dist/{chunk-H3IBJQ5A.js → chunk-XD5XB22R.js} +2 -2
- package/dist/chunk-XDIAQEYK.js +28 -0
- package/dist/{chunk-7PPMT5EJ.js → chunk-XFPNYHX3.js} +372 -105
- package/dist/{chunk-FCECYJVA.js → chunk-XIBVAKCO.js} +1 -1
- package/dist/{chunk-OG2YUVBW.js → chunk-XMX4PCFL.js} +8 -3
- package/dist/{chunk-2NRHD2G7.js → chunk-XRRG4MBM.js} +12 -4
- package/dist/{chunk-FNMH5WEY.js → chunk-XTFO6D4L.js} +1 -1
- package/dist/chunk-XWRI3N5O.js +70 -0
- package/dist/{chunk-ZKJ5L35C.js → chunk-XXPLPSOE.js} +36 -25
- package/dist/{chunk-XQMYQ4TN.js → chunk-XZXZNI7A.js} +1 -1
- package/dist/{chunk-E555EDOQ.js → chunk-YEJZ2OYS.js} +490 -182
- package/dist/chunk-YGZEG3JV.js +123 -0
- package/dist/{chunk-F6OLHND5.js → chunk-Z3WQXVFV.js} +2 -2
- package/dist/{chunk-FFJGC2DX.js → chunk-Z6DUNKFU.js} +173 -40
- package/dist/{chunk-N5HN5QGH.js → chunk-Z6H5ED2I.js} +1 -1
- package/dist/{chunk-7Q37C6GZ.js → chunk-ZBOOMLHD.js} +1 -1
- package/dist/{chunk-MOK3ZS6P.js → chunk-ZDJ7C64T.js} +1 -1
- package/dist/{chunk-GLQ3KCTY.js → chunk-ZGZLEUKM.js} +7 -8
- package/dist/{chunk-YHD2FZFP.js → chunk-ZHRGX225.js} +6 -6
- package/dist/{chunk-76Q7E3TM.js → chunk-ZIVCPXXL.js} +510 -646
- package/dist/{chunk-BSATR6ZO.js → chunk-ZNRSYS76.js} +21 -3
- package/dist/{chunk-DMAMWUYY.js → chunk-ZSLTSCTI.js} +5 -5
- package/dist/{chunk-IGVAWAOK.js → chunk-ZSYFQSPF.js} +43 -9
- package/dist/cli/index.js +8 -3
- package/dist/{core-7Y5BZZON.js → core-43GLGBOY.js} +8 -1
- package/dist/{core-7S3XMW5O.js → core-5GI3ERXO.js} +4 -1
- package/dist/{core-K3JX5WPM.js → core-5L7TMK7I.js} +6 -1
- package/dist/{core-LB5M7XL4.js → core-7TO4OVY5.js} +6 -1
- package/dist/{core-ILPXXC2Z.js → core-BJVENHFQ.js} +7 -1
- package/dist/{core-JDFUZFRH.js → core-BX4MFWKC.js} +6 -1
- package/dist/{core-XW7UJFJZ.js → core-C3KXTOIZ.js} +7 -1
- package/dist/{core-WJNK7F2J.js → core-C5Y6BFLL.js} +7 -1
- package/dist/{core-WZ4CHVYL.js → core-CLUSJ2SK.js} +5 -1
- package/dist/{core-TCSW24N6.js → core-E3IN2VVH.js} +5 -1
- package/dist/{core-MU4ALRR7.js → core-FD67NQOV.js} +6 -1
- package/dist/{core-YMXYUGF5.js → core-FDKMLRAK.js} +5 -1
- package/dist/{core-VKZSQFRG.js → core-FL6Z3VVX.js} +5 -1
- package/dist/{core-5UF44NDI.js → core-JC7JUFPY.js} +8 -1
- package/dist/{core-RR2CAZC5.js → core-JF33TADA.js} +8 -1
- package/dist/{core-4RR6VSXM.js → core-JH32ZAKM.js} +4 -1
- package/dist/{core-G3LXHW73.js → core-JYYZPPQV.js} +7 -1
- package/dist/{core-4HFVG4CP.js → core-KJTKCV4U.js} +4 -1
- package/dist/{core-GSILPKUR.js → core-LCQPE5Y6.js} +8 -1
- package/dist/{core-GLOZY6Z7.js → core-LHVGWE54.js} +6 -1
- package/dist/{core-J2JD5ODO.js → core-OVSNBOCE.js} +9 -1
- package/dist/{core-BLHEJ5OK.js → core-PPEC236B.js} +5 -1
- package/dist/{core-ZLSQHZ3I.js → core-QTJZDK5H.js} +5 -1
- package/dist/{core-TKZZZ6UW.js → core-R3YZCOUZ.js} +7 -1
- package/dist/{core-HTD5RHE7.js → core-RIBW5XU4.js} +7 -1
- package/dist/{core-AR2T32Y3.js → core-RJFILBWL.js} +8 -1
- package/dist/{core-A5AKUB7H.js → core-RWSXEKTE.js} +4 -1
- package/dist/{core-DD62MWEW.js → core-SOPPZLEH.js} +5 -1
- package/dist/{core-HDNWVLJW.js → core-TBUZCXLX.js} +5 -1
- package/dist/{core-BOG33BFD.js → core-TZ5QLTAX.js} +5 -1
- package/dist/{core-H5HO2CED.js → core-U7E5W4MY.js} +3 -1
- package/dist/{core-QPSAYRFT.js → core-UBNVSL44.js} +7 -1
- package/dist/{core-E2XOSHPR.js → core-UDRD4WIU.js} +6 -1
- package/dist/{core-DFZMOO7E.js → core-UVJZ4HY2.js} +7 -1
- package/dist/{core-LGJZUP6H.js → core-X7WWYQH4.js} +8 -1
- package/dist/{core-BBNY2BX4.js → core-XP56X47I.js} +5 -1
- package/dist/{core-3KLQSYWB.js → core-XQG54CYG.js} +6 -1
- package/dist/{dataTable-CNDRVGA5.js → dataTable-U7W4I6IF.js} +15 -2
- package/dist/{engine-FVEIM3WV.js → engine-O5V26MGR.js} +32 -19
- package/dist/fixtures.js +4 -1
- package/dist/flags-BVLSAXT3.js +10 -0
- package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -1
- package/dist/fonts.js +1 -1
- package/dist/geo/dach.js +1 -1
- package/dist/geo/de-states.js +1 -1
- package/dist/geo/eu27.js +1 -1
- package/dist/geo/europe.js +1 -1
- package/dist/geo/index.js +2 -2
- package/dist/geo/us-states.js +1 -1
- package/dist/geo/world.js +1 -1
- package/dist/index.js +41 -22
- package/dist/{main-THU6VIVU.js → main-35GS47XC.js} +68 -123
- package/dist/mcp/server.js +131 -118
- package/dist/react/bar.js +10 -1
- package/dist/react/bartable.js +10 -1
- package/dist/react/box.js +8 -1
- package/dist/react/bullet.js +10 -1
- package/dist/react/butterfly.js +10 -1
- package/dist/react/choropleth.js +10 -1
- package/dist/react/cohort.js +11 -1
- package/dist/react/column.js +10 -1
- package/dist/react/combo.js +10 -1
- package/dist/react/creative.js +11 -1
- package/dist/react/diagram.js +10 -1
- package/dist/react/dimswitch.js +11 -1
- package/dist/react/dot.js +9 -1
- package/dist/react/export.js +36 -18
- package/dist/react/funnel.js +9 -1
- package/dist/react/gantt.js +9 -1
- package/dist/react/grid.js +10 -1
- package/dist/react/heatmap.js +9 -1
- package/dist/react/histogram.js +11 -1
- package/dist/react/index.js +101 -85
- package/dist/react/kpi.js +10 -1
- package/dist/react/likert.js +11 -1
- package/dist/react/line.js +9 -1
- package/dist/react/mekko.js +10 -1
- package/dist/react/pareto.js +11 -1
- package/dist/react/pie.js +9 -1
- package/dist/react/prepare.js +49 -21
- package/dist/react/pvm.js +12 -1
- package/dist/react/pyramid.js +10 -1
- package/dist/react/sankey.js +10 -1
- package/dist/react/scatter.js +8 -1
- package/dist/react/slope.js +10 -1
- package/dist/react/sparkline.js +10 -1
- package/dist/react/spec.js +24 -14
- package/dist/react/status.js +9 -1
- package/dist/react/story.js +5 -2
- package/dist/react/table.js +9 -1
- package/dist/react/theme.js +10 -3
- package/dist/react/tilemap.js +9 -1
- package/dist/react/treemap.js +9 -1
- package/dist/react/variance.js +10 -1
- package/dist/react/waffle.js +9 -1
- package/dist/react/waterfall.js +11 -1
- package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
- package/dist/rows.js +3 -2
- package/dist/{rowsModule-LI6KOS46.js → rowsModule-H2S6WW4D.js} +2 -1
- package/dist/{schema-CGQID64D.js → schema-2R32F6AW.js} +1 -1
- package/dist/{schema-H2EC4GAQ.js → schema-2TPGJGVR.js} +1 -1
- package/dist/{schema-THXXFY6I.js → schema-47BG2TZA.js} +1 -3
- package/dist/{schema-AMT7P7KB.js → schema-56MOEOVR.js} +1 -1
- package/dist/{schema-GNTKL5DN.js → schema-5MSR4LNN.js} +1 -1
- package/dist/{schema-5ZTGVQAJ.js → schema-5RIYEWE6.js} +1 -1
- package/dist/{schema-LOQ3AFC7.js → schema-A26ZNGTZ.js} +1 -3
- package/dist/{schema-MMVPMJEF.js → schema-ALBF6V7Y.js} +1 -3
- package/dist/{schema-BKUFZLLI.js → schema-BA6WP5YZ.js} +1 -1
- package/dist/{schema-PQZWO3BP.js → schema-CBL2SMVR.js} +1 -3
- package/dist/{schema-BBTXTWYI.js → schema-CWKGLDSR.js} +1 -3
- package/dist/{schema-5KDEQBBT.js → schema-DBIQFL56.js} +1 -1
- package/dist/{schema-KPEPBGAX.js → schema-DL7V6NN2.js} +1 -1
- package/dist/{schema-PL3EU6EQ.js → schema-DUVJMFKQ.js} +4 -2
- package/dist/{schema-L5U4OROI.js → schema-ECJERHKF.js} +2 -1
- package/dist/{schema-YLE4XXQQ.js → schema-EDSEKZDJ.js} +1 -1
- package/dist/{schema-HH5HOORE.js → schema-ESR6ZIK4.js} +1 -3
- package/dist/{schema-5DUTAVO7.js → schema-F7TWGLRZ.js} +1 -3
- package/dist/{schema-B2GCEYXD.js → schema-FGB6IGZM.js} +1 -3
- package/dist/{schema-7NSV542V.js → schema-FKGGTM4Z.js} +2 -1
- package/dist/{schema-72EEMYS3.js → schema-FU2AFIEE.js} +1 -1
- package/dist/{schema-QORUB6EK.js → schema-JNJFCYBM.js} +18 -1
- package/dist/{schema-JH57NFXJ.js → schema-JYZ4RF6S.js} +2 -1
- package/dist/{schema-25INXAMY.js → schema-K7F6TEDK.js} +1 -2
- package/dist/{schema-OU35XA3Z.js → schema-KAK6DZX4.js} +1 -1
- package/dist/{schema-R5Y6NVBH.js → schema-MOKWIGF7.js} +1 -1
- package/dist/{schema-ZQSIR5UC.js → schema-MQT6BMNK.js} +1 -3
- package/dist/{schema-FDFQKIO5.js → schema-MR3BPPQR.js} +1 -1
- package/dist/{schema-VYECMPON.js → schema-OPXZYIW7.js} +1 -3
- package/dist/{schema-ZEVJMFLV.js → schema-PV7JGX5H.js} +1 -1
- package/dist/{schema-QPOBZUAR.js → schema-PWPQF5RC.js} +1 -1
- package/dist/{schema-GN6GAIU5.js → schema-PYQEUC5P.js} +1 -3
- package/dist/{schema-M5JBHQIV.js → schema-QPIC5MAG.js} +9 -2
- package/dist/{schema-QCIE6M2P.js → schema-R42VXFIS.js} +1 -1
- package/dist/{schema-J7TNCZIP.js → schema-TVUJNEX7.js} +1 -1
- package/dist/{schema-AXRDF6ND.js → schema-Y4TI2T3T.js} +1 -1
- package/dist/{schema-ZG6ZKFRZ.js → schema-ZU2EU2VP.js} +1 -1
- package/dist/{specValidation-VHLGDEME.js → specValidation-2NHJT7TQ.js} +4 -1
- package/dist/theme.js +7 -2
- package/dist/{themeShapeRules-PW4BQHKL.js → themeShapeRules-G7UZX6GJ.js} +1 -1
- package/dist/types/core/annotate.d.ts +27 -2
- package/dist/types/core/annotateArms.d.ts +3 -1
- package/dist/types/core/annotateTargets.d.ts +4 -0
- package/dist/types/core/annotationOrigin.d.ts +13 -0
- package/dist/types/core/axis.d.ts +2 -2
- package/dist/types/core/charts/band/stacks.d.ts +7 -1
- package/dist/types/core/charts/bartable/types.d.ts +14 -1
- package/dist/types/core/charts/box/types.d.ts +3 -1
- package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
- package/dist/types/core/charts/choropleth/types.d.ts +19 -0
- package/dist/types/core/charts/cohort/types.d.ts +16 -3
- package/dist/types/core/charts/column/model.d.ts +13 -0
- package/dist/types/core/charts/combo/layout.d.ts +7 -0
- package/dist/types/core/charts/creative/types.d.ts +21 -0
- package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
- package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
- package/dist/types/core/charts/gantt/calendar.d.ts +24 -0
- package/dist/types/core/charts/gantt/columns.d.ts +56 -0
- package/dist/types/core/charts/gantt/layout.d.ts +8 -2
- package/dist/types/core/charts/gantt/model.d.ts +296 -0
- package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
- package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
- package/dist/types/core/charts/grid/normalize.d.ts +5 -0
- package/dist/types/core/charts/grid/schema.d.ts +2 -2
- package/dist/types/core/charts/histogram/types.d.ts +8 -0
- package/dist/types/core/charts/likert/layout.d.ts +10 -8
- package/dist/types/core/charts/pareto/layout.d.ts +2 -0
- package/dist/types/core/charts/pvm/types.d.ts +10 -1
- package/dist/types/core/charts/pyramid/types.d.ts +3 -1
- package/dist/types/core/charts/sankey/types.d.ts +5 -1
- package/dist/types/core/charts/scatter/clamp.d.ts +2 -1
- package/dist/types/core/charts/scatter/model.d.ts +5 -0
- package/dist/types/core/charts/scatter/valueLines.d.ts +3 -1
- package/dist/types/core/charts/status/layout.d.ts +3 -0
- package/dist/types/core/charts/table/resolve.d.ts +22 -3
- package/dist/types/core/charts/table/view.d.ts +24 -1
- package/dist/types/core/claims/browser.d.ts +2 -0
- package/dist/types/core/claims/ids.d.ts +38 -0
- package/dist/types/core/deferred.d.ts +1 -0
- package/dist/types/core/doc/diagnostics.d.ts +3 -2
- package/dist/types/core/footer.d.ts +2 -0
- package/dist/types/core/formatSpec.d.ts +43 -14
- package/dist/types/core/frame.d.ts +26 -59
- package/dist/types/core/frameText.d.ts +203 -0
- package/dist/types/core/geo/types.d.ts +2 -0
- package/dist/types/core/geometry.d.ts +3 -1
- package/dist/types/core/label/categoryRow.d.ts +19 -2
- package/dist/types/core/label/solver.d.ts +23 -2
- package/dist/types/core/normalize/shared.d.ts +14 -2
- package/dist/types/core/notes.d.ts +15 -2
- package/dist/types/core/reading.d.ts +12 -1
- package/dist/types/core/registry.d.ts +4 -5
- package/dist/types/core/request.d.ts +7 -1
- package/dist/types/core/schema/capability.d.ts +32 -7
- package/dist/types/core/schema/generatedColumns.d.ts +168 -0
- package/dist/types/core/seriesIdentity.d.ts +4 -1
- package/dist/types/core/sizing.d.ts +32 -1
- package/dist/types/core/structureCounts.d.ts +3 -1
- package/dist/types/core/text.d.ts +16 -0
- package/dist/types/core/theme.d.ts +33 -4
- package/dist/types/core/themeGeometry.d.ts +9 -0
- package/dist/types/core/themeRules.d.ts +2 -0
- package/dist/types/core/timeAxis.d.ts +6 -1
- package/dist/types/core/types/annotations.d.ts +74 -4
- package/dist/types/core/types/diagram.d.ts +7 -0
- package/dist/types/core/types/options.d.ts +118 -15
- package/dist/types/core/types/scene.d.ts +30 -2
- package/dist/types/core/types/table.d.ts +27 -3
- package/dist/types/core/types/theme.d.ts +23 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/TableChart.d.ts +5 -0
- package/dist/types/react/barrelCharts.d.ts +16 -5
- package/dist/types/react/charts/butterfly.d.ts +2 -2
- package/dist/types/react/charts/dot.d.ts +7 -1
- package/dist/types/react/charts/pareto.d.ts +4 -1
- package/dist/types/react/charts/variance.d.ts +3 -1
- package/dist/types/react/hover/labelCard.d.ts +11 -2
- package/dist/types/react/prepare.d.ts +7 -1
- package/dist/types/theme.d.ts +2 -0
- package/dist/validate.js +23 -6
- package/docs/TELEMETRY.md +2 -2
- package/docs/manual.md +283 -65
- package/docs/reference/bar.md +15 -4
- package/docs/reference/bartable.md +17 -2
- package/docs/reference/box.md +15 -4
- package/docs/reference/bullet.md +21 -6
- package/docs/reference/butterfly.md +17 -6
- package/docs/reference/choropleth.md +16 -5
- package/docs/reference/cohort.md +25 -5
- package/docs/reference/column.md +19 -4
- package/docs/reference/combo.md +11 -5
- package/docs/reference/creative.md +17 -8
- package/docs/reference/diagram.md +6 -1
- package/docs/reference/dimswitch.md +71 -118
- package/docs/reference/dot.md +16 -7
- package/docs/reference/fixtures.md +94 -1
- package/docs/reference/funnel.md +14 -5
- package/docs/reference/gantt.md +17 -16
- package/docs/reference/grid.md +13 -3
- package/docs/reference/heatmap.md +16 -6
- package/docs/reference/histogram.md +2 -2
- package/docs/reference/kpi.md +5 -1
- package/docs/reference/likert.md +17 -4
- package/docs/reference/line.md +18 -5
- package/docs/reference/mekko.md +10 -5
- package/docs/reference/options.md +20 -15
- package/docs/reference/pareto.md +9 -5
- package/docs/reference/pie.md +9 -5
- package/docs/reference/pvm.md +16 -6
- package/docs/reference/pyramid.md +14 -4
- package/docs/reference/react.md +6 -7
- package/docs/reference/sankey.md +7 -3
- package/docs/reference/scatter.md +8 -4
- package/docs/reference/slope.md +15 -5
- package/docs/reference/sparkline.md +1 -1
- package/docs/reference/status.md +7 -1
- package/docs/reference/table.md +41 -110
- package/docs/reference/theme.md +12 -4
- package/docs/reference/tilemap.md +2 -4
- package/docs/reference/treemap.md +1 -1
- package/docs/reference/variance.md +12 -6
- package/docs/reference/waffle.md +1 -1
- package/docs/reference/warnings.md +1077 -0
- package/docs/reference/waterfall.md +20 -5
- package/docs/use-cases.md +25 -13
- package/llms.txt +19 -6
- package/package.json +18 -3
- package/dist/chunk-6364WO5D.js +0 -47
- package/dist/chunk-DQ7YMQVX.js +0 -26
- package/dist/chunk-EBB4PYBN.js +0 -24
- package/dist/chunk-FG5L2LUK.js +0 -89
- package/dist/chunk-IFQN4GKK.js +0 -1852
- package/dist/chunk-IRXVV65V.js +0 -24
- package/dist/chunk-JGFHNAHS.js +0 -22
- package/dist/chunk-JHWYG7V5.js +0 -24
- package/dist/chunk-M4SPKUZE.js +0 -7
- package/dist/chunk-O36WX56O.js +0 -13
- package/dist/chunk-QJWLNP64.js +0 -24
- package/dist/chunk-QZIHKQRH.js +0 -26
- package/dist/chunk-SE7MJ2LQ.js +0 -24
- package/dist/chunk-TXBO2LWM.js +0 -25
- package/dist/chunk-UPTXFTKH.js +0 -25
- package/dist/chunk-UREXN6WG.js +0 -25
- package/dist/chunk-UZLR25BW.js +0 -24
- package/dist/chunk-WIVFIVFZ.js +0 -27
- package/dist/chunk-WZL4EEBS.js +0 -11
- package/dist/chunk-XHRUXZD7.js +0 -28
- package/dist/chunk-ZWNRLIFT.js +0 -24
|
@@ -0,0 +1,2170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chartTheme
|
|
3
|
+
} from "./chunk-WFBN2HXR.js";
|
|
4
|
+
import {
|
|
5
|
+
prepareTableWidthRung,
|
|
6
|
+
solveTableWidthRung,
|
|
7
|
+
tableWidths
|
|
8
|
+
} from "./chunk-3DOVXJ6K.js";
|
|
9
|
+
import {
|
|
10
|
+
ZERO_LIFT,
|
|
11
|
+
arrowKey,
|
|
12
|
+
badSide,
|
|
13
|
+
cellDrawsTabular,
|
|
14
|
+
cellHoldsNumber,
|
|
15
|
+
emitArrow,
|
|
16
|
+
emitHeat,
|
|
17
|
+
emptyMessageRow,
|
|
18
|
+
expansionRootsHidden,
|
|
19
|
+
finalClosers,
|
|
20
|
+
groupSpans,
|
|
21
|
+
heatColumn,
|
|
22
|
+
heatKey,
|
|
23
|
+
heatRanges,
|
|
24
|
+
isCohortDensity,
|
|
25
|
+
isTotalRow,
|
|
26
|
+
labelOnlyRow,
|
|
27
|
+
levelLadder,
|
|
28
|
+
noteLineIndex,
|
|
29
|
+
prepareTableData,
|
|
30
|
+
presetLanguage,
|
|
31
|
+
printsFigures,
|
|
32
|
+
resolvePreparedTable,
|
|
33
|
+
resolveTable,
|
|
34
|
+
rowGrounds,
|
|
35
|
+
tableCellKey,
|
|
36
|
+
tableCellNodeId,
|
|
37
|
+
tableFootnotes,
|
|
38
|
+
tableFrameUnit,
|
|
39
|
+
visibleColumns,
|
|
40
|
+
visibleInlineRows,
|
|
41
|
+
visibleRows
|
|
42
|
+
} from "./chunk-OSJXIW6I.js";
|
|
43
|
+
import {
|
|
44
|
+
columnOwnsFormat
|
|
45
|
+
} from "./chunk-X3YP4DUV.js";
|
|
46
|
+
import {
|
|
47
|
+
TABLE_SPARK_STYLE,
|
|
48
|
+
emitSparklineMarks,
|
|
49
|
+
lastObservedIndex,
|
|
50
|
+
plotSparkline,
|
|
51
|
+
sparklineDomain
|
|
52
|
+
} from "./chunk-PT7KSIEO.js";
|
|
53
|
+
import {
|
|
54
|
+
structureCount
|
|
55
|
+
} from "./chunk-KW4JXWHO.js";
|
|
56
|
+
import {
|
|
57
|
+
liftOrFallback,
|
|
58
|
+
missesSize,
|
|
59
|
+
tightAdvice,
|
|
60
|
+
tightSpacingWarning
|
|
61
|
+
} from "./chunk-XWRI3N5O.js";
|
|
62
|
+
import {
|
|
63
|
+
CHIP_PAD_X,
|
|
64
|
+
ENGINE_NOTES,
|
|
65
|
+
HEADING_CUT_MIN,
|
|
66
|
+
HINT_GAP,
|
|
67
|
+
INDENT_BASE,
|
|
68
|
+
INLINE_LABEL_INDENT,
|
|
69
|
+
MARK_SIZE,
|
|
70
|
+
SECTION_CHIP_GAP,
|
|
71
|
+
SORT_BUTTON_MIN,
|
|
72
|
+
cellPadX,
|
|
73
|
+
changeLineFitFont,
|
|
74
|
+
changeLineFont,
|
|
75
|
+
figureFont,
|
|
76
|
+
groupHeadingFaces,
|
|
77
|
+
groupHeadingLabel,
|
|
78
|
+
groupHeadingNote,
|
|
79
|
+
groupHeadingWidth,
|
|
80
|
+
groupHeadingWrap,
|
|
81
|
+
inlineFont,
|
|
82
|
+
kindFont,
|
|
83
|
+
rowFont,
|
|
84
|
+
strongColumnFont,
|
|
85
|
+
tableFonts
|
|
86
|
+
} from "./chunk-F3XOBFS4.js";
|
|
87
|
+
import {
|
|
88
|
+
chartString
|
|
89
|
+
} from "./chunk-PMT75APP.js";
|
|
90
|
+
import {
|
|
91
|
+
chipHeight,
|
|
92
|
+
chipPaints,
|
|
93
|
+
hasPolarityBadge,
|
|
94
|
+
isFigureCell,
|
|
95
|
+
onTableGround,
|
|
96
|
+
polarityBadgeInk,
|
|
97
|
+
statusSquare,
|
|
98
|
+
statusSquarePaint,
|
|
99
|
+
tableGround,
|
|
100
|
+
toneTextPaint
|
|
101
|
+
} from "./chunk-4ROZ4TFL.js";
|
|
102
|
+
import {
|
|
103
|
+
qualifierFont,
|
|
104
|
+
tableInk,
|
|
105
|
+
tableRuleInk
|
|
106
|
+
} from "./chunk-Z2MGTKDR.js";
|
|
107
|
+
import {
|
|
108
|
+
DEFAULT_EMPTY_MESSAGE,
|
|
109
|
+
hasNoDataRows
|
|
110
|
+
} from "./chunk-QZGGCE45.js";
|
|
111
|
+
import {
|
|
112
|
+
ACCEPTANCE_PROBE,
|
|
113
|
+
FIXED_SIZE_PROBE,
|
|
114
|
+
FORCE_COMPACT,
|
|
115
|
+
PLAN_ONLY,
|
|
116
|
+
VERIFY_ADVICE,
|
|
117
|
+
WIDTH_PROBE,
|
|
118
|
+
copyPlannedValue,
|
|
119
|
+
deferLayout,
|
|
120
|
+
fixedHeightCanvas,
|
|
121
|
+
heightOmitted,
|
|
122
|
+
isPlanned,
|
|
123
|
+
layoutKey,
|
|
124
|
+
materializeLayout,
|
|
125
|
+
optionKey,
|
|
126
|
+
plannedCutCount,
|
|
127
|
+
rowDrivenHeight,
|
|
128
|
+
rowSizing,
|
|
129
|
+
spareShare,
|
|
130
|
+
tableTextMeasure,
|
|
131
|
+
withPlanInputs
|
|
132
|
+
} from "./chunk-ETRAPN5G.js";
|
|
133
|
+
import {
|
|
134
|
+
authoredNotes,
|
|
135
|
+
composedTextRole,
|
|
136
|
+
cutWithTitle,
|
|
137
|
+
distinctCut,
|
|
138
|
+
fitText,
|
|
139
|
+
frameTextOptions,
|
|
140
|
+
groundTextWarnings,
|
|
141
|
+
legendOff,
|
|
142
|
+
legendRequired,
|
|
143
|
+
solveFrame
|
|
144
|
+
} from "./chunk-I5VDW2XZ.js";
|
|
145
|
+
import {
|
|
146
|
+
disclosureNote,
|
|
147
|
+
staticFrame
|
|
148
|
+
} from "./chunk-DZYTXZNS.js";
|
|
149
|
+
import {
|
|
150
|
+
AUTOMATIC_FORMAT,
|
|
151
|
+
MAGNITUDE_DIVISOR,
|
|
152
|
+
MAGNITUDE_GROUP,
|
|
153
|
+
MAGNITUDE_LABEL,
|
|
154
|
+
effectiveScale,
|
|
155
|
+
formatWithSpec,
|
|
156
|
+
parseFormatExample,
|
|
157
|
+
specUnitKind,
|
|
158
|
+
unitOfSpec
|
|
159
|
+
} from "./chunk-Z6DUNKFU.js";
|
|
160
|
+
import {
|
|
161
|
+
formatExactNumber,
|
|
162
|
+
nonzeroDecimals,
|
|
163
|
+
roundHalfUp,
|
|
164
|
+
roundsToZero,
|
|
165
|
+
zeroLifts
|
|
166
|
+
} from "./chunk-MSYTF3DZ.js";
|
|
167
|
+
import {
|
|
168
|
+
canvasMargin,
|
|
169
|
+
colorblindRoles,
|
|
170
|
+
createOccupiedIndex,
|
|
171
|
+
markRolePaint,
|
|
172
|
+
panelTypeClass,
|
|
173
|
+
resolveSemanticPaletteTheme,
|
|
174
|
+
resolveSurface,
|
|
175
|
+
resolveTheme,
|
|
176
|
+
semanticPalettePaint,
|
|
177
|
+
signedFillPaint,
|
|
178
|
+
strokeToken,
|
|
179
|
+
textScaleOf,
|
|
180
|
+
typeWidthClass
|
|
181
|
+
} from "./chunk-TX5FSNAU.js";
|
|
182
|
+
import {
|
|
183
|
+
TARGET_SIZE,
|
|
184
|
+
accessibleTitle,
|
|
185
|
+
resolveSize
|
|
186
|
+
} from "./chunk-RJICOOB3.js";
|
|
187
|
+
import {
|
|
188
|
+
WIDTH_SAFETY,
|
|
189
|
+
defaultMeasurer,
|
|
190
|
+
ellipsize
|
|
191
|
+
} from "./chunk-UIHGGWES.js";
|
|
192
|
+
import {
|
|
193
|
+
maxOf,
|
|
194
|
+
minOf,
|
|
195
|
+
pushAll
|
|
196
|
+
} from "./chunk-WYJEOMNY.js";
|
|
197
|
+
|
|
198
|
+
// src/core/charts/table/fitPolicy.ts
|
|
199
|
+
var COMPACT_RETRY = /* @__PURE__ */ Symbol("tableCompactRetry"), SIZING_ONLY = /* @__PURE__ */ Symbol("tableSizingOnly"), HEAD_LINES = /* @__PURE__ */ Symbol("tableHeadLines"), TIGHT_SPACING = /* @__PURE__ */ Symbol("tableTightSpacing"), HEAD_AIR_MIN = /* @__PURE__ */ Symbol("tableHeadAirMin"), HEAD_LOOSE = /* @__PURE__ */ Symbol("tableHeadLoose"), TIGHT_PAD = 2, SUB_LINES = /* @__PURE__ */ Symbol("tableSubLines"), REGULAR_SPACING = /* @__PURE__ */ Symbol("tableRegularSpacing"), CARD_GUTTER = 12;
|
|
200
|
+
function executeTableFit(authoredData, options, resolved, preserveCompactFloor, run, cutCount2, hasHeadAir2) {
|
|
201
|
+
let sizingOnly = options[SIZING_ONLY] === !0, once = (step, widthOnly = !0) => run(step, sizingOnly, fits, widthOnly), targetSize = options[TARGET_SIZE], fullSizingOnly = sizingOnly && resolveSize(options.size).width !== targetSize?.sizePx.width, open = options[TARGET_SIZE]?.fixed, widthFits = (geometry) => open?.width === !1 || geometry.size.width >= (geometry.sizing?.minWidth ?? 0), heightFits = (geometry) => options.size === void 0 || open?.height === !1 || geometry.size.height >= (geometry.sizing?.minHeight ?? 0), fits = (geometry) => widthFits(geometry) && heightFits(geometry), full = run({}, fullSizingOnly, options.belowMinimum === "refuse" ? void 0 : fits, options.belowMinimum !== "refuse"), widthRepair = full.warnings.find((warning) => warning.code === "table-overflow" && warning.fix?.length), withWidthRepair = (drawn) => (widthRepair && (drawn.warnings = drawn.warnings.map((warning) => warning.code === "table-overflow" && warning.fix?.length ? widthRepair : warning)), drawn), pad = options.cellPadX ?? cellPadX(full.marks.columns.length), margin = { ...options.margin, left: Math.min(options.margin?.left ?? CARD_GUTTER, CARD_GUTTER), right: Math.min(options.margin?.right ?? CARD_GUTTER, CARD_GUTTER) }, gutterHelps = full.plot.x > margin.left + 0.5 || full.size.width - (full.plot.x + full.plot.w) > margin.right + 0.5, fixedHeight = !heightOmitted(options.size) && open?.height !== !1, withFloor = (drawn) => {
|
|
202
|
+
if (!sizingOnly && !preserveCompactFloor && !options[VERIFY_ADVICE]) return withWidthRepair(drawn);
|
|
203
|
+
let compact = drawn.sizing === void 0 ? void 0 : compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, !0, run);
|
|
204
|
+
return compact?.sizing && !compact.refused && (drawn.sizing = {
|
|
205
|
+
...drawn.sizing,
|
|
206
|
+
minWidth: Math.min(drawn.sizing.minWidth, compact.sizing.minWidth),
|
|
207
|
+
minHeight: fixedHeight ? Math.min(drawn.sizing.minHeight, compact.sizing.minHeight) : drawn.sizing.minHeight
|
|
208
|
+
}), withWidthRepair(drawn);
|
|
209
|
+
};
|
|
210
|
+
if (options.belowMinimum === "refuse" || !full.sizing) return full;
|
|
211
|
+
if (fits(full)) {
|
|
212
|
+
fullSizingOnly && (full = run({}, !1));
|
|
213
|
+
let cut = cutCount2(full), gutter = cut === 0 || !gutterHelps ? void 0 : run({ margin }, !1), drawn = gutter?.sizing !== void 0 && fits(gutter) && cutCount2(gutter) < cut ? gutter : full;
|
|
214
|
+
return open?.width === !1 ? drawn : withFloor(drawn);
|
|
215
|
+
}
|
|
216
|
+
if (widthFits(full) && fixedHeight && hasHeadAir2(options)) {
|
|
217
|
+
let lean = once({ [HEAD_AIR_MIN]: !0 });
|
|
218
|
+
if (lean.sizing !== void 0 && fits(lean))
|
|
219
|
+
return withFloor(lean), lean.warnings.push({ code: "table-compact-fallback", severity: "info", message: "The full table did not fit. The head and group rows took their least air." }), lean;
|
|
220
|
+
}
|
|
221
|
+
if (widthFits(full)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 6), void 0, resolved, sizingOnly, run));
|
|
222
|
+
let rung = (step) => once({ margin, cellPadX: step.pad, ...step.heads === void 0 ? {} : { [HEAD_LINES]: step.heads } }, "regular-rung"), narrowest = rung({ pad: Math.min(pad, 3), heads: 2 });
|
|
223
|
+
if (narrowest.sizing !== void 0 && !widthFits(narrowest)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, run));
|
|
224
|
+
let tried = new Set(gutterHelps ? [] : [`${pad}`]);
|
|
225
|
+
for (let step of [{ pad }, { pad: Math.min(pad, 6) }, { pad: Math.min(pad, 3) }, { pad: Math.min(pad, 3), heads: 2 }]) {
|
|
226
|
+
let key = `${step.pad}${step.heads === void 0 ? "" : `:${step.heads}`}`;
|
|
227
|
+
if (tried.has(key)) continue;
|
|
228
|
+
tried.add(key);
|
|
229
|
+
let last = step.heads === void 0 ? rung(step) : narrowest;
|
|
230
|
+
if (last.sizing === void 0 || widthFits(last) && heightFits(last))
|
|
231
|
+
return withFloor(last), last.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. ${step.pad === pad && step.heads === void 0 ? "12 px side margins were" : `${step.pad} px cell air${step.heads === void 0 ? "" : ", heads on two lines"} and 12 px side margins were`} used.` }), last;
|
|
232
|
+
}
|
|
233
|
+
return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, run));
|
|
234
|
+
}
|
|
235
|
+
function compactTable(authoredData, options, full, margin, cellPadX2, heads, resolved, sizingOnly, run) {
|
|
236
|
+
let compactOptions = {
|
|
237
|
+
density: isCohortDensity(options.density ?? "regular") ? options.density : "compact",
|
|
238
|
+
margin,
|
|
239
|
+
// Tighter than the full table, never wider: a dense table already pads 3 or 5 px.
|
|
240
|
+
cellPadX: cellPadX2,
|
|
241
|
+
labelIndent: { base: 8 + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: 8 },
|
|
242
|
+
// A fixed height never grows (docs/manual.md, "Fixed height"): only an omitted height turns automatic.
|
|
243
|
+
size: heightOmitted(options.size) ? { width: full.size.width } : { width: full.size.width, height: full.size.height },
|
|
244
|
+
[COMPACT_RETRY]: full.size.height,
|
|
245
|
+
...heads === void 0 ? {} : { [HEAD_LINES]: heads }
|
|
246
|
+
}, tightens = (geometry) => {
|
|
247
|
+
let across = 2 * Math.max(0, cellPadX2 - TIGHT_PAD) * geometry.marks.columns.length + Math.max(0, geometry.plot.x - TIGHT_PAD * 2) + Math.max(0, geometry.size.width - geometry.plot.x - geometry.plot.w - TIGHT_PAD * 2) + (authoredData.columnGroups ?? []).reduce((sum, group) => sum + Math.max(0, (group.spacer ?? 0) - TIGHT_PAD * 2), 0) + 6 + 4 * Math.max(0, maxOf(resolved.rows.map((row) => row.level))) + 4, missed = missesSize(geometry, options), reachable = !missed.width || (geometry.sizing?.minWidth ?? 0) - geometry.size.width <= across;
|
|
248
|
+
return !options[REGULAR_SPACING] && geometry.sizing !== void 0 && (missed.width || missed.height) && reachable;
|
|
249
|
+
}, compact = run(compactOptions, sizingOnly, (geometry) => !tightens(geometry)), misses = missesSize(compact, options), { width: missesWidth, height: missesHeight } = misses, lastOptions = compactOptions;
|
|
250
|
+
if (tightens(compact) && compact.sizing) {
|
|
251
|
+
let tightWarning = tightSpacingWarning(misses, { width: "cell air, column gaps and side margins", height: "row air and top and bottom margins" }, "the table", "compact", { ...compact, sizing: compact.sizing }, options);
|
|
252
|
+
if (compact = run(lastOptions = {
|
|
253
|
+
...compactOptions,
|
|
254
|
+
[TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight },
|
|
255
|
+
...missesWidth ? {
|
|
256
|
+
cellPadX: Math.min(cellPadX2, TIGHT_PAD),
|
|
257
|
+
labelIndent: { base: TIGHT_PAD + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: TIGHT_PAD * 2 }
|
|
258
|
+
} : {},
|
|
259
|
+
margin: {
|
|
260
|
+
...missesHeight ? { top: TIGHT_PAD * 2, bottom: TIGHT_PAD * 2 } : {},
|
|
261
|
+
...margin,
|
|
262
|
+
...missesWidth ? { left: Math.min(margin.left ?? CARD_GUTTER, TIGHT_PAD * 2), right: Math.min(margin.right ?? CARD_GUTTER, TIGHT_PAD * 2) } : {}
|
|
263
|
+
}
|
|
264
|
+
}, sizingOnly), missesSize(compact, options).width && resolved.columns.some((col) => / \S{1,2}$/u.test(col.label ?? ""))) {
|
|
265
|
+
let loose = run({ ...lastOptions, [HEAD_LOOSE]: !0 }, sizingOnly);
|
|
266
|
+
missesSize(loose, options).width || (compact = loose, lastOptions = { ...lastOptions, [HEAD_LOOSE]: !0 });
|
|
267
|
+
}
|
|
268
|
+
compact.warnings.push(tightWarning);
|
|
269
|
+
}
|
|
270
|
+
if (missesHeight && compact.sizing && compact.size.height + 0.5 < compact.sizing.minHeight && resolved.columns.some((col) => col.subLabel !== void 0)) {
|
|
271
|
+
let warnings = compact.warnings;
|
|
272
|
+
compact = run({ ...lastOptions, [SUB_LINES]: 1 }, sizingOnly);
|
|
273
|
+
for (let warning of warnings) warning.code === "table-tight-spacing" && !compact.warnings.includes(warning) && compact.warnings.push(warning);
|
|
274
|
+
}
|
|
275
|
+
return compact.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. Compact spacing and tight margins${heightOmitted(options.size) ? " and automatic height" : ""} were used.` }), compact;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// src/core/charts/table/need.ts
|
|
279
|
+
function tableRung({ table, surface }) {
|
|
280
|
+
let rungs = /* @__PURE__ */ new WeakMap(), fullPad, run = (candidate2, ...rest) => {
|
|
281
|
+
let geometry = surface.run(candidate2, ...rest);
|
|
282
|
+
return rungs.set(geometry, candidate2), fullPad ??= surface.cellPadOf(geometry), geometry;
|
|
283
|
+
}, undrawn = executeTableFit(surface.data, surface.options, table, surface.preserveCompactFloor, run, surface.cutCount, surface.hasHeadAir), candidate = rungs.get(undrawn) ?? {}, cellPadX2 = surface.cellPadOf(undrawn);
|
|
284
|
+
return { rung: rungOf(candidate, cellPadX2 < fullPad), cellPadX: cellPadX2, headLines: candidate[HEAD_LINES] ?? 1, undrawn };
|
|
285
|
+
}
|
|
286
|
+
function tableNeed(choice, drawn) {
|
|
287
|
+
let { size, plot, sizing, marks, warnings } = drawn;
|
|
288
|
+
return {
|
|
289
|
+
rung: choice.rung,
|
|
290
|
+
cellPadX: choice.cellPadX,
|
|
291
|
+
headLines: choice.headLines,
|
|
292
|
+
tracks: marks.columns.map((column) => ({ id: column.id, width: column.w })),
|
|
293
|
+
margins: { left: plot.x, right: size.width - plot.x - plot.w },
|
|
294
|
+
minWidth: sizing?.minWidth ?? size.width,
|
|
295
|
+
naturalWidth: sizing?.naturalWidth ?? size.width,
|
|
296
|
+
height: size.height,
|
|
297
|
+
warnings,
|
|
298
|
+
advice: advisedSize(warnings),
|
|
299
|
+
geometry: drawn
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function rungOf(candidate, lessAir) {
|
|
303
|
+
return candidate[TIGHT_SPACING] !== void 0 ? "tight" : candidate[COMPACT_RETRY] !== void 0 ? "compact" : candidate[HEAD_AIR_MIN] ? "head-air" : lessAir || candidate[HEAD_LINES] !== void 0 ? "cell-air" : candidate.margin === void 0 ? "full" : "gutter";
|
|
304
|
+
}
|
|
305
|
+
function advisedSize(warnings) {
|
|
306
|
+
let overflow = warnings.find((warning) => warning.code === "table-overflow")?.fix?.[0];
|
|
307
|
+
return tightAdvice(warnings.find((warning) => warning.code === "table-tight-spacing")) ?? (overflow !== void 0 && "value" in overflow ? overflow.value : void 0);
|
|
308
|
+
}
|
|
309
|
+
var ADVICE_PASSES = 3;
|
|
310
|
+
function tableScrollNeed({ table, surface }) {
|
|
311
|
+
let { theme, measure, options, view, at } = surface, plan = tableWidths(table, theme, measure, options, { ...view, scroll: !0 }), warnings = at === void 0 ? plan.warnings : plan.warnings.map((warning) => warning.code === "table-overflow" ? checkedOverflow(warning, (width) => {
|
|
312
|
+
let frame = at(width), size = { ...overflowSize(warning), width };
|
|
313
|
+
return tableWidths(table, frame.theme, measure, { ...options, size }, { ...view, scroll: !0, available: frame.available, scrollBox: frame.scrollBox }).warnings.find((next) => next.code === "table-overflow");
|
|
314
|
+
}) : warning), sides = surface.margins.left + surface.margins.right;
|
|
315
|
+
return {
|
|
316
|
+
rung: "full",
|
|
317
|
+
tracks: plan.tracks.map(({ id, width }) => ({ id, width })),
|
|
318
|
+
cellPadX: plan.cellPadX,
|
|
319
|
+
margins: surface.margins,
|
|
320
|
+
headLines: 1,
|
|
321
|
+
// The host draws every track at its natural width and scrolls under it.
|
|
322
|
+
minWidth: Math.ceil(plan.tracks.reduce((sum, track) => sum + track.natural, plan.spacerTotal)) + sides,
|
|
323
|
+
naturalWidth: Math.ceil(plan.totalW) + sides,
|
|
324
|
+
height: void 0,
|
|
325
|
+
warnings,
|
|
326
|
+
advice: overflowSize(warnings.find((warning) => warning.code === "table-overflow")),
|
|
327
|
+
plan
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function tableScrollRung({ table, data, surface }) {
|
|
331
|
+
let full = { ...tableScrollNeed({ table, surface }), density: surface.options.density }, available = surface.view.available;
|
|
332
|
+
if (available === void 0 || !full.warnings.some((warning) => warning.code === "table-overflow")) return full;
|
|
333
|
+
let { theme, measure, view, margins: sides } = surface, host = available + sides.left + sides.right, box = view.scrollBox?.width ?? available, run = (candidate2) => {
|
|
334
|
+
let left = candidate2.margin?.left ?? sides.left, room = Math.min(host - left - (candidate2.margin?.right ?? sides.right), box), plan2 = tableWidths(table, theme, measure, {
|
|
335
|
+
...surface.options,
|
|
336
|
+
...candidate2.density === void 0 ? {} : { density: candidate2.density },
|
|
337
|
+
...candidate2.cellPadX === void 0 ? {} : { cellPadX: candidate2.cellPadX },
|
|
338
|
+
...candidate2.labelIndent === void 0 ? {} : { labelIndent: candidate2.labelIndent }
|
|
339
|
+
}, { ...view, scroll: !0, available: room, headLines: candidate2[HEAD_LINES], headGlue: candidate2[HEAD_LOOSE] !== !0 }), drawn = plan2.tracks.reduce((sum, track) => sum + track.width, plan2.spacerTotal), sortRoom = (track) => track.width === 0 || !view.sortable?.has(track.id) || track.width - plan2.cellPadX - (view.groupStart?.has(track.id) ? 1 : 0) - (view.groupEnd?.has(track.id) ? 1 : 0) >= SORT_BUTTON_MIN, fits2 = !plan2.warnings.some((warning) => warning.code === "table-overflow") && drawn <= box && plan2.tracks.every(sortRoom);
|
|
340
|
+
return {
|
|
341
|
+
size: { width: host, height: 0 },
|
|
342
|
+
plot: { x: left, w: room },
|
|
343
|
+
sizing: { minWidth: fits2 ? host : host + Math.max(1, Math.ceil(drawn - box)), minHeight: 0 },
|
|
344
|
+
marks: { columns: plan2.tracks },
|
|
345
|
+
warnings: [...plan2.warnings],
|
|
346
|
+
plan: plan2,
|
|
347
|
+
candidate: candidate2,
|
|
348
|
+
fits: fits2
|
|
349
|
+
};
|
|
350
|
+
}, options = { ...surface.options, size: { width: host }, ...view.withMarks ? { outlineMarks: !0 } : {} }, choice = tableRung({ table, surface: { data, options, run, cutCount: () => 0, hasHeadAir: () => !1, preserveCompactFloor: !1, cellPadOf: (rung) => rung.plan.cellPadX } }), { plan, candidate, fits, plot } = choice.undrawn;
|
|
351
|
+
return fits ? {
|
|
352
|
+
...full,
|
|
353
|
+
rung: choice.rung,
|
|
354
|
+
cellPadX: plan.cellPadX,
|
|
355
|
+
headLines: choice.headLines,
|
|
356
|
+
margins: { left: plot.x, right: host - plot.x - plot.w },
|
|
357
|
+
plan,
|
|
358
|
+
warnings: plan.warnings,
|
|
359
|
+
advice: void 0,
|
|
360
|
+
density: candidate.density ?? surface.options.density
|
|
361
|
+
} : full;
|
|
362
|
+
}
|
|
363
|
+
function overflowSize(warning) {
|
|
364
|
+
let op = warning?.fix?.[0];
|
|
365
|
+
return op !== void 0 && "value" in op ? op.value : void 0;
|
|
366
|
+
}
|
|
367
|
+
function checkedOverflow(warning, overflowAt) {
|
|
368
|
+
let asked = overflowSize(warning);
|
|
369
|
+
if (asked === void 0) return warning;
|
|
370
|
+
let width = asked.width;
|
|
371
|
+
for (let pass = 0; pass < ADVICE_PASSES; pass++) {
|
|
372
|
+
let next = overflowSize(overflowAt(width));
|
|
373
|
+
if (next === void 0) {
|
|
374
|
+
if (width === asked.width) return warning;
|
|
375
|
+
let swap = (text) => text.replaceAll(`${asked.width} px`, `${width} px`);
|
|
376
|
+
return {
|
|
377
|
+
...warning,
|
|
378
|
+
message: swap(warning.message),
|
|
379
|
+
...warning.suggest === void 0 ? {} : { suggest: swap(warning.suggest) },
|
|
380
|
+
detail: { ...warning.detail, naturalWidth: width },
|
|
381
|
+
fix: [{ op: "add", path: "/options/size", value: { ...asked, width } }]
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
width = next.width;
|
|
385
|
+
}
|
|
386
|
+
let { fix: _unsettled, ...rest } = warning;
|
|
387
|
+
return { ...rest, suggest: "No frame width was found at which the table fits without scrolling. Reduce the content or change the table settings." };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/core/charts/table/encodings/inCellBar.ts
|
|
391
|
+
var TEXT_GAP = 8, BAR_HEIGHT = 10;
|
|
392
|
+
function emitInCellBar(context, metrics) {
|
|
393
|
+
let value = context.cell.raw;
|
|
394
|
+
if (context.cell.state !== "value" || typeof value != "number" || value === 0 || metrics.maxAbs <= 0)
|
|
395
|
+
return [];
|
|
396
|
+
let width = Math.max(0, metrics.contentBox.w - metrics.textReserve - TEXT_GAP) * Math.min(1, Math.abs(value) / metrics.maxAbs);
|
|
397
|
+
if (width <= 0) return [];
|
|
398
|
+
let height = Math.min(BAR_HEIGHT, metrics.contentBox.h), fill = badSide(value < 0, context.cell.polarity) ? { ...signedFillPaint("bad"), tint: 0.55 } : semanticPalettePaint(context.theme, context.palette, "focus", 0.55);
|
|
399
|
+
return [
|
|
400
|
+
{
|
|
401
|
+
t: "rect",
|
|
402
|
+
id: context.nodeId("bar"),
|
|
403
|
+
rect: {
|
|
404
|
+
x: metrics.contentBox.x,
|
|
405
|
+
y: metrics.contentBox.y + (metrics.contentBox.h - height) / 2,
|
|
406
|
+
w: width,
|
|
407
|
+
h: height
|
|
408
|
+
},
|
|
409
|
+
fill,
|
|
410
|
+
owner: context.owner,
|
|
411
|
+
part: "tableBar"
|
|
412
|
+
}
|
|
413
|
+
];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/core/charts/table/encodings/sparkline.ts
|
|
417
|
+
function sparklineSourceValues(row, sourceColumns) {
|
|
418
|
+
return sourceColumns.map((sourceId) => {
|
|
419
|
+
let source = row.cells[sourceId];
|
|
420
|
+
return source?.state === "value" && typeof source.raw == "number" ? source.raw : null;
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function tableSparklineDomain(rows, sourceColumns, shape) {
|
|
424
|
+
return sparklineDomain(
|
|
425
|
+
rows.filter((row) => row.role !== "section").map((row) => sparklineSourceValues(row, sourceColumns)),
|
|
426
|
+
shape
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function sparklineDomains(columns, rows) {
|
|
430
|
+
let domains = /* @__PURE__ */ new Map();
|
|
431
|
+
for (let column of columns)
|
|
432
|
+
column.kind !== "encoding" || column.encoding?.type !== "sparkline" || domains.set(column.id, tableSparklineDomain(rows, column.encoding.sourceColumns, column.encoding.kind ?? "line"));
|
|
433
|
+
return domains;
|
|
434
|
+
}
|
|
435
|
+
function emitSparkline(context, values, metrics) {
|
|
436
|
+
if (!values.some((value) => value !== null)) {
|
|
437
|
+
let font2 = { family: context.theme.type.family, ...context.theme.type.label }, mark = context.theme.table?.glyphs?.missing ?? "\u2014";
|
|
438
|
+
return [
|
|
439
|
+
{
|
|
440
|
+
t: "text",
|
|
441
|
+
typeRole: "label",
|
|
442
|
+
id: context.nodeId("sparkEmpty"),
|
|
443
|
+
x: context.box.x + context.box.w / 2,
|
|
444
|
+
y: context.box.y + (context.box.h - context.measure(mark, font2).height) / 2,
|
|
445
|
+
lines: [mark],
|
|
446
|
+
align: "middle",
|
|
447
|
+
font: font2,
|
|
448
|
+
ink: { token: "inkMuted" },
|
|
449
|
+
owner: context.owner,
|
|
450
|
+
part: "tableSparkEmpty"
|
|
451
|
+
}
|
|
452
|
+
];
|
|
453
|
+
}
|
|
454
|
+
let kind = metrics.kind ?? "line", font = { family: context.theme.type.family, ...context.theme.type.label }, lastIndex = lastObservedIndex(values), lastText = metrics.lastText ?? (lastIndex === void 0 ? void 0 : formatExactNumber(values[lastIndex], metrics.language)), plot = plotSparkline({
|
|
455
|
+
box: context.box,
|
|
456
|
+
values,
|
|
457
|
+
shape: kind,
|
|
458
|
+
domain: metrics.domain,
|
|
459
|
+
style: TABLE_SPARK_STYLE,
|
|
460
|
+
lastText,
|
|
461
|
+
font,
|
|
462
|
+
measure: context.measure
|
|
463
|
+
});
|
|
464
|
+
return emitSparklineMarks({
|
|
465
|
+
plot,
|
|
466
|
+
shape: kind,
|
|
467
|
+
theme: context.theme,
|
|
468
|
+
palette: context.palette,
|
|
469
|
+
style: TABLE_SPARK_STYLE,
|
|
470
|
+
nodeId: context.nodeId,
|
|
471
|
+
owner: context.owner,
|
|
472
|
+
partPrefix: "table",
|
|
473
|
+
language: metrics.language
|
|
474
|
+
}).map((node) => node.t === "text" ? { ...node, typeRole: "label" } : node);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// src/core/charts/table/fitFormats.ts
|
|
478
|
+
var NEXT_MAGNITUDE = {
|
|
479
|
+
none: "k",
|
|
480
|
+
k: "m",
|
|
481
|
+
m: "bn",
|
|
482
|
+
bn: "t",
|
|
483
|
+
t: void 0
|
|
484
|
+
}, FIT_DIGITS = 2;
|
|
485
|
+
function keptDigits(value, magnitude, decimals) {
|
|
486
|
+
return roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[magnitude], decimals).replace(".", "").replace(/^0+/, "").length;
|
|
487
|
+
}
|
|
488
|
+
var ONE_DIGIT_TOLERANCE = 0.05;
|
|
489
|
+
function printsNear(value, magnitude, decimals) {
|
|
490
|
+
let scaled = Math.abs(value) / MAGNITUDE_DIVISOR[magnitude];
|
|
491
|
+
return Math.abs(Number(roundHalfUp(scaled, decimals)) / scaled - 1) <= ONE_DIGIT_TOLERANCE;
|
|
492
|
+
}
|
|
493
|
+
function keepsDigits(figures, spec, next) {
|
|
494
|
+
return figures.every((value) => {
|
|
495
|
+
let kept = keptDigits(value, next.magnitude, next.decimals);
|
|
496
|
+
return kept === 0 && spec.automatic ? !0 : kept < Math.min(FIT_DIGITS, keptDigits(value, spec.magnitude, spec.decimals)) ? !1 : kept === 0 || kept >= FIT_DIGITS || printsNear(value, next.magnitude, next.decimals);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function floorDecimals(figures, spec, magnitude, from = 0) {
|
|
500
|
+
let decimals = from;
|
|
501
|
+
for (; decimals < 6 && !keepsDigits(figures, spec, { magnitude, decimals }); ) decimals++;
|
|
502
|
+
return decimals;
|
|
503
|
+
}
|
|
504
|
+
function shorterSpec(spec, figures) {
|
|
505
|
+
if (spec.glyphs || spec.negative === "trailing" || spec.ordinal || spec.exponent || spec.magnitudeInAffix) return;
|
|
506
|
+
let maxAbs = figures === void 0 ? 1 / 0 : Math.max(0, maxOf(figures));
|
|
507
|
+
if (figures ??= [], spec.significantDigits !== void 0) return;
|
|
508
|
+
if (spec.decimals > 0) {
|
|
509
|
+
let decimals = spec.decimals === 4 && spec.thousandsSep === "" ? 2 : spec.decimals - 1, plain = { ...spec, decimals }, next2 = plain.magnitude === "none" || maxAbs === 1 / 0 ? plain : { ...plain, ...effectiveScale(maxAbs, plain) };
|
|
510
|
+
return keepsDigits(figures, spec, next2) ? next2 : void 0;
|
|
511
|
+
}
|
|
512
|
+
if (specUnitKind(spec) !== "number" || !/^(?:|\p{Sc}|[A-Z]{3})$/u.test(spec.suffix.trim())) return;
|
|
513
|
+
let magnitude = NEXT_MAGNITUDE[spec.magnitude];
|
|
514
|
+
if (magnitude === void 0 || maxAbs / MAGNITUDE_DIVISOR[magnitude] < 1) return;
|
|
515
|
+
let next = { ...spec, magnitude, decimals: 1, rollMagnitude: void 0 };
|
|
516
|
+
if (maxAbs === 1 / 0) return next;
|
|
517
|
+
let rolled = { ...next, ...effectiveScale(maxAbs, next) };
|
|
518
|
+
rolled.decimals = floorDecimals(figures, spec, rolled.magnitude, rolled.decimals);
|
|
519
|
+
let widest = (candidate) => maxOf(figures.map((value) => formatWithSpec(value, candidate).length)), held = { ...next, decimals: floorDecimals(figures, spec, magnitude), thousandsSep: spec.thousandsSep || ",", rollMagnitude: !1 }, step = rolled.magnitude === magnitude || widest(held) > widest(rolled) ? rolled : held;
|
|
520
|
+
return widest(step) >= widest(spec) ? void 0 : step;
|
|
521
|
+
}
|
|
522
|
+
function exampleOf(spec) {
|
|
523
|
+
let whole = spec.thousandsSep === "" ? spec.decimals === 3 ? "0" : "1" : `1${spec.thousandsSep}234`, fraction = spec.decimals > 0 ? `${spec.decimalSep}${"2345678".slice(0, spec.decimals)}` : "", ordinal = spec.ordinal ? spec.thousandsSep ? "th" : "st" : "", numberStyle = spec.exponent ? `${spec.exponent.letter}${spec.exponent.sign}${"6".padStart(spec.exponent.digits, "0")}` : spec.ordinal === "upper" ? ordinal.toUpperCase() : ordinal, body = `${spec.signed && !spec.glyphs ? "+" : ""}${spec.prefix}${whole}${fraction}${numberStyle}${spec.magnitudeInAffix ? "" : MAGNITUDE_LABEL[spec.magnitude]}${spec.suffix}`;
|
|
524
|
+
return spec.glyphs && (body = spec.glyphs.at === "start" ? spec.glyphs.up + spec.glyphs.space + body : body + spec.glyphs.space + spec.glyphs.up), spec.negative === "parens" ? `(${body})` : spec.negative === "trailing" ? body + spec.trailingMinus : body;
|
|
525
|
+
}
|
|
526
|
+
function withRowFormats(rows, formats) {
|
|
527
|
+
return rows.map((row) => {
|
|
528
|
+
let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withRowFormats(row.children, formats);
|
|
529
|
+
return next === void 0 && children === row.children ? row : {
|
|
530
|
+
...row,
|
|
531
|
+
...next === void 0 ? {} : { format: next.format },
|
|
532
|
+
...next?.unitAffix === void 0 ? {} : { unitAffix: next.unitAffix },
|
|
533
|
+
...children === void 0 ? {} : { children }
|
|
534
|
+
};
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
function withCellFormats(rows, formats) {
|
|
538
|
+
return rows.map((row) => {
|
|
539
|
+
let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withCellFormats(row.children, formats);
|
|
540
|
+
if (next === void 0 && children === void 0) return row;
|
|
541
|
+
let cells = next === void 0 ? row.cells : { ...row.cells };
|
|
542
|
+
for (let [columnId, format] of next ?? []) {
|
|
543
|
+
let cell = row.cells[columnId];
|
|
544
|
+
cells[columnId] = typeof cell == "number" ? { v: cell, format } : { ...cell, format };
|
|
545
|
+
}
|
|
546
|
+
return { ...row, ...cells === void 0 ? {} : { cells }, ...children === void 0 ? {} : { children } };
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
function rowExample(row, decimal) {
|
|
550
|
+
if (row === void 0) return;
|
|
551
|
+
if (row.format !== void 0) return row.format;
|
|
552
|
+
let calc = row.calc;
|
|
553
|
+
return calc !== void 0 && "op" in calc && (calc.op === "share" || calc.op === "percentDelta") ? `1${decimal}2%` : void 0;
|
|
554
|
+
}
|
|
555
|
+
function authoredRows(rows, into = /* @__PURE__ */ new Map()) {
|
|
556
|
+
for (let row of rows)
|
|
557
|
+
into.set(row.id, row), row.children && authoredRows(row.children, into);
|
|
558
|
+
return into;
|
|
559
|
+
}
|
|
560
|
+
function fitTableFormats(data, options, resolved, columns, ctx) {
|
|
561
|
+
let current = data, unlifted = { ...options, [ZERO_LIFT]: "none" }, result = resolved.lifted ? resolveTable(data, unlifted) : resolved, fitted, exhausted = /* @__PURE__ */ new Set(), decimal = ctx.decimal ?? ".", fittedRows = /* @__PURE__ */ new Set(), fittedColumns = /* @__PURE__ */ new Set(), fittedCells = /* @__PURE__ */ new Set();
|
|
562
|
+
for (let round = 0; round < 8; round++) {
|
|
563
|
+
let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), authoredColumns = new Map(current.columns.map((column) => [column.id, column])), rowOverflow = /* @__PURE__ */ new Set(), rowPrinting = /* @__PURE__ */ new Set(), columnOverflow = /* @__PURE__ */ new Set(), cellOverflow = [], rowFigures = /* @__PURE__ */ new Map(), columnFigures = /* @__PURE__ */ new Map(), figure = (map, id, value) => {
|
|
564
|
+
value !== 0 && map.set(id, [...map.get(id) ?? [], Math.abs(value)]);
|
|
565
|
+
};
|
|
566
|
+
for (let column of columns(table)) {
|
|
567
|
+
if (column.width === void 0 || column.kind !== "value" && column.kind !== "computed") continue;
|
|
568
|
+
let room = column.width - 2 * ctx.padX, authoredColumn = authoredColumns.get(column.id);
|
|
569
|
+
for (let row of table.rows) {
|
|
570
|
+
if (row.role === "section") continue;
|
|
571
|
+
let parent = row.inline === !0 && row.parentId !== void 0 ? resolvedById.get(row.parentId) : void 0;
|
|
572
|
+
if (row.inline === !0 && (parent === void 0 || ctx.lineFont === void 0)) continue;
|
|
573
|
+
let cell = row.cells[column.id];
|
|
574
|
+
if (cell === void 0 || cell.state !== "value" || typeof cell.raw != "number") continue;
|
|
575
|
+
let tabular = ctx.figures?.(column, cell.displayed), font = parent !== void 0 ? ctx.lineFont(parent, row, cell.displayed, tabular) : ctx.cellFont(cell), measured = ctx.measure(cell.displayed, figureFont(font, tabular)).width, overflows = measured + (ctx.slack?.(font, measured) ?? 0) > room;
|
|
576
|
+
if (cell.format !== void 0) {
|
|
577
|
+
overflows && cellOverflow.push({ rowId: row.id, columnId: column.id, format: cell.format, max: Math.abs(cell.raw) });
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
figure(rowFigures, row.id, cell.raw), figure(columnFigures, column.id, cell.raw);
|
|
581
|
+
let authoredRow = rowsById.get(row.id), rowFormatted = rowExample(authoredRow, decimal) !== void 0 && (authoredRow.calc !== void 0 || authoredRow.inline === !0 || authoredColumn === void 0 || !columnOwnsFormat(authoredColumn)), fits = authoredRow?.fitFormat !== !1 && !(authoredRow?.scale === "money" && authoredRow[MAGNITUDE_GROUP] !== void 0);
|
|
582
|
+
rowFormatted && fits && rowPrinting.add(row.id), overflows && (rowFormatted ? fits : authoredColumn?.fitFormat !== !1) && (rowFormatted ? rowOverflow.add(row.id) : columnOverflow.add(column.id));
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
let rowFormattedColumn = (columnId) => {
|
|
586
|
+
let authoredColumn = authoredColumns.get(columnId);
|
|
587
|
+
return authoredColumn !== void 0 && columnOwnsFormat(authoredColumn) ? !1 : table.rows.some((row) => {
|
|
588
|
+
let authored = rowsById.get(row.id);
|
|
589
|
+
return authored?.format !== void 0 && authored.calc === void 0 && row.inline !== !0 && typeof row.cells[columnId]?.raw == "number";
|
|
590
|
+
});
|
|
591
|
+
}, rowFormats = /* @__PURE__ */ new Map();
|
|
592
|
+
for (let rowId of rowOverflow) {
|
|
593
|
+
if (exhausted.has(`row:${rowId}`)) continue;
|
|
594
|
+
let row = rowsById.get(rowId), spec = parseFormatExample(rowExample(row, decimal)), automatic = row.format === void 0 || row[AUTOMATIC_FORMAT] === !0, next = shorterSpec({ ...spec, automatic }, rowFigures.get(rowId) ?? []);
|
|
595
|
+
if (next === void 0) {
|
|
596
|
+
exhausted.add(`row:${rowId}`);
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
let before = unitOfSpec(spec), after = unitOfSpec(next);
|
|
600
|
+
rowFormats.set(rowId, {
|
|
601
|
+
format: exampleOf(next),
|
|
602
|
+
// The label names the unit the cells now read in.
|
|
603
|
+
...row.unitAffix !== void 0 && before !== null && after !== null && row.unitAffix === before && before !== after ? { unitAffix: after } : {}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
let unitOf = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, caps = /* @__PURE__ */ new Map();
|
|
607
|
+
for (let [rowId, next] of rowFormats) {
|
|
608
|
+
let row = resolvedById.get(rowId);
|
|
609
|
+
if (row === void 0) continue;
|
|
610
|
+
let spec = parseFormatExample(next.format), key = unitOf(row, spec);
|
|
611
|
+
caps.set(key, Math.min(caps.get(key) ?? 1 / 0, spec.decimals));
|
|
612
|
+
}
|
|
613
|
+
for (let rowId of rowPrinting) {
|
|
614
|
+
if (exhausted.has(`row:${rowId}`)) continue;
|
|
615
|
+
let row = resolvedById.get(rowId), shortened = rowFormats.get(rowId), example = shortened?.format ?? rowExample(rowsById.get(rowId), decimal);
|
|
616
|
+
if (row === void 0 || example === void 0) continue;
|
|
617
|
+
let spec = parseFormatExample(example), cap = caps.get(unitOf(row, spec));
|
|
618
|
+
if (cap === void 0 || spec.significantDigits !== void 0 || spec.decimals <= cap || cap === 3 && spec.thousandsSep === "") continue;
|
|
619
|
+
let decimals = floorDecimals(rowFigures.get(rowId) ?? [], spec, spec.magnitude, cap);
|
|
620
|
+
decimals >= spec.decimals || rowFormats.set(rowId, { ...shortened, format: exampleOf({ ...spec, decimals }) });
|
|
621
|
+
}
|
|
622
|
+
let columnFormats = /* @__PURE__ */ new Map();
|
|
623
|
+
for (let columnId of columnOverflow) {
|
|
624
|
+
if (exhausted.has(`col:${columnId}`)) continue;
|
|
625
|
+
if (rowFormattedColumn(columnId)) {
|
|
626
|
+
exhausted.add(`col:${columnId}`);
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
let authoredExample = authoredColumns.get(columnId), example = authoredExample?.format ?? table.columns.find((column) => column.id === columnId)?.format, automatic = options.format === void 0 && (authoredExample?.format === void 0 || authoredExample[AUTOMATIC_FORMAT] === !0), next = example === void 0 ? void 0 : shorterSpec({ ...parseFormatExample(example), automatic }, columnFigures.get(columnId) ?? []);
|
|
630
|
+
if (next === void 0) {
|
|
631
|
+
exhausted.add(`col:${columnId}`);
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
columnFormats.set(columnId, exampleOf(next));
|
|
635
|
+
}
|
|
636
|
+
let cellFormats = /* @__PURE__ */ new Map();
|
|
637
|
+
for (let { rowId, columnId, format, max } of cellOverflow) {
|
|
638
|
+
let key = tableCellNodeId("cell", rowId, columnId);
|
|
639
|
+
if (exhausted.has(key)) continue;
|
|
640
|
+
let next = shorterSpec(parseFormatExample(format), [max]);
|
|
641
|
+
if (next === void 0) {
|
|
642
|
+
exhausted.add(key);
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
645
|
+
cellFormats.set(rowId, (cellFormats.get(rowId) ?? /* @__PURE__ */ new Map()).set(columnId, exampleOf(next)));
|
|
646
|
+
}
|
|
647
|
+
if (rowFormats.size === 0 && columnFormats.size === 0 && cellFormats.size === 0) break;
|
|
648
|
+
for (let rowId of rowFormats.keys()) fittedRows.add(rowId);
|
|
649
|
+
for (let columnId of columnFormats.keys()) fittedColumns.add(columnId);
|
|
650
|
+
for (let [rowId, formats] of cellFormats) for (let columnId of formats.keys()) fittedCells.add(`${rowId}\0${columnId}`);
|
|
651
|
+
let rows = rowFormats.size === 0 ? current.rows : withRowFormats(current.rows, rowFormats);
|
|
652
|
+
current = {
|
|
653
|
+
...current,
|
|
654
|
+
columns: current.columns.map((column) => columnFormats.has(column.id) ? { ...column, format: columnFormats.get(column.id) } : column),
|
|
655
|
+
rows: cellFormats.size === 0 ? rows : withCellFormats(rows, cellFormats)
|
|
656
|
+
}, fitted = resolveTable(current, unlifted, data), result = fitted;
|
|
657
|
+
}
|
|
658
|
+
if (fitted === void 0) return;
|
|
659
|
+
{
|
|
660
|
+
let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), familyKey = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, families = /* @__PURE__ */ new Map();
|
|
661
|
+
for (let [id, authored] of rowsById) {
|
|
662
|
+
let row = resolvedById.get(id), example = rowExample(authored, decimal);
|
|
663
|
+
if (row === void 0 || example === void 0 || authored.calc !== void 0 || authored.fitFormat === !1) continue;
|
|
664
|
+
let spec = parseFormatExample(example);
|
|
665
|
+
if (spec.significantDigits !== void 0) continue;
|
|
666
|
+
let key = familyKey(row, spec);
|
|
667
|
+
families.set(key, [...families.get(key) ?? [], { id, spec }]);
|
|
668
|
+
}
|
|
669
|
+
let unified = /* @__PURE__ */ new Map();
|
|
670
|
+
for (let members of families.values()) {
|
|
671
|
+
if (!members.some((member) => fittedRows.has(member.id))) continue;
|
|
672
|
+
let least = minOf(members.map((member) => member.spec.decimals));
|
|
673
|
+
for (let member of members) {
|
|
674
|
+
if (member.spec.decimals <= least || least === 3 && member.spec.thousandsSep === "") continue;
|
|
675
|
+
let figures = Object.values(resolvedById.get(member.id).cells).flatMap((cell) => cell?.state === "value" && typeof cell.raw == "number" && cell.raw !== 0 && cell.format === void 0 ? [Math.abs(cell.raw)] : []), decimals = floorDecimals(figures, member.spec, member.spec.magnitude, least);
|
|
676
|
+
decimals < member.spec.decimals && unified.set(member.id, { format: exampleOf({ ...member.spec, decimals }) });
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (unified.size > 0) {
|
|
680
|
+
for (let id of unified.keys()) fittedRows.add(id);
|
|
681
|
+
current = { ...current, rows: withRowFormats(current.rows, unified) }, fitted = resolveTable(current, unlifted, data);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
let lifts = zeroFigureFormats(current, fitted.table, fittedRows, fittedColumns, fittedCells, decimal, options, data);
|
|
685
|
+
return lifts.size > 0 && (current = { ...current, rows: withCellFormats(current.rows, lifts) }), (lifts.size > 0 || options[ZERO_LIFT] !== "none") && (fitted = resolveTable(current, options, data)), { data: current, resolved: fitted, changes: formatChanges(data, current, decimal) };
|
|
686
|
+
}
|
|
687
|
+
function formatsFittedWarning(changes) {
|
|
688
|
+
if (changes.length === 0) return;
|
|
689
|
+
let name = (change) => change.row !== void 0 && change.column !== void 0 ? `cell '${change.row}/${change.column}'` : change.row !== void 0 ? `row '${change.row}'` : `column '${change.column}'`, listed = changes.slice(0, 6).map((change) => `${name(change)} ${change.from ?? "derived"} to ${change.to}`).join("; ");
|
|
690
|
+
return {
|
|
691
|
+
code: "table-formats-fitted",
|
|
692
|
+
severity: "info",
|
|
693
|
+
message: `fitFormats shortened ${changes.length} format${changes.length === 1 ? "" : "s"} to fit authored widths: ${listed}${changes.length > 6 ? `; and ${changes.length - 6} more` : ""}`,
|
|
694
|
+
detail: { changes },
|
|
695
|
+
suggest: "Widen the column, or set fitFormat: false on the row or column to keep its format as authored."
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
function formatChanges(before, after, decimal) {
|
|
699
|
+
let changes = [], rowsBefore = authoredRows(before.rows), rowsAfter = authoredRows(after.rows);
|
|
700
|
+
for (let [id, row] of rowsAfter) {
|
|
701
|
+
let from = rowExample(rowsBefore.get(id), decimal), to = rowExample(row, decimal);
|
|
702
|
+
from !== to && to !== void 0 && changes.push({ row: id, ...from === void 0 ? {} : { from }, to });
|
|
703
|
+
}
|
|
704
|
+
let columnsBefore = new Map(before.columns.map((column) => [column.id, column]));
|
|
705
|
+
for (let column of after.columns) {
|
|
706
|
+
let from = columnsBefore.get(column.id)?.format, to = column.format;
|
|
707
|
+
from !== to && to !== void 0 && changes.push({ column: column.id, ...from === void 0 ? {} : { from }, to });
|
|
708
|
+
}
|
|
709
|
+
for (let [id, row] of rowsAfter)
|
|
710
|
+
for (let [columnId, cell] of Object.entries(row.cells ?? {})) {
|
|
711
|
+
let to = typeof cell == "object" && cell !== null ? cell.format : void 0, earlier = rowsBefore.get(id)?.cells?.[columnId], from = typeof earlier == "object" && earlier !== null ? earlier.format : void 0;
|
|
712
|
+
to !== void 0 && from !== to && changes.push({ row: id, column: columnId, ...from === void 0 ? {} : { from }, to });
|
|
713
|
+
}
|
|
714
|
+
return changes;
|
|
715
|
+
}
|
|
716
|
+
function zeroFigureFormats(data, table, fittedRows, fittedColumns, fittedCells, decimal, options, source) {
|
|
717
|
+
let lifts = /* @__PURE__ */ new Map();
|
|
718
|
+
if (fittedRows.size === 0 && fittedColumns.size === 0 && fittedCells.size === 0) return lifts;
|
|
719
|
+
let rowsById = authoredRows(data.rows), sourceRows = authoredRows(source.rows), automatic = options.format === void 0 && options.unit === void 0 && options.magnitude !== "million" && options.magnitude !== "thousand";
|
|
720
|
+
for (let column of data.columns) {
|
|
721
|
+
if (column.kind !== "value") continue;
|
|
722
|
+
let columnFormat = column.format, automaticColumn = automatic && source.columns.find((entry) => entry.id === column.id)?.format === void 0;
|
|
723
|
+
for (let row of table.rows) {
|
|
724
|
+
let authoredRow = rowsById.get(row.id), authored = authoredRow?.cells?.[column.id], ownFitted = typeof authored == "object" && authored !== null && authored.format !== void 0 && fittedCells.has(`${row.id}\0${column.id}`) ? authored.format : void 0, raw = typeof authored == "number" ? authored : typeof authored == "object" && authored !== null && typeof authored.v == "number" && (authored.format === void 0 || ownFitted !== void 0) ? authored.v : void 0;
|
|
725
|
+
if (raw === void 0 || raw === 0 || authoredRow.calc !== void 0) continue;
|
|
726
|
+
let rowFormat = rowExample(authoredRow, decimal), line = row.inline === !0, rowFormatted = rowFormat !== void 0 && (columnFormat === void 0 || line), example = ownFitted ?? (rowFormatted ? fittedRows.has(row.id) && (line || specUnitKind(parseFormatExample(rowFormat)) !== "number") ? rowFormat : void 0 : fittedColumns.has(column.id) ? columnFormat ?? table.columns.find((entry) => entry.id === column.id)?.format : void 0);
|
|
727
|
+
if (example === void 0) continue;
|
|
728
|
+
let sourceRow = sourceRows.get(row.id);
|
|
729
|
+
if (ownFitted === void 0 && (rowFormatted ? automatic && (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) : automaticColumn)) continue;
|
|
730
|
+
let spec = parseFormatExample(example), scaled = raw / MAGNITUDE_DIVISOR[spec.magnitude];
|
|
731
|
+
if (roundsToZero(scaled, spec.decimals)) {
|
|
732
|
+
if (ownFitted !== void 0 || row.inline === !0) {
|
|
733
|
+
if (options[ZERO_LIFT] !== void 0) continue;
|
|
734
|
+
zeroLifts.count++;
|
|
735
|
+
}
|
|
736
|
+
lifts.set(row.id, (lifts.get(row.id) ?? /* @__PURE__ */ new Map()).set(column.id, exampleOf({ ...spec, decimals: nonzeroDecimals(scaled, spec.decimals) })));
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
return lifts;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// src/core/charts/table/layout.ts
|
|
744
|
+
var CRISP = 0.5, NOTE_BASELINE_LOCK = 0.88, HEADER_RULE_GAP = 7, GROUP_PAD_TOP = 6, GROUP_PAD_BOTTOM = 2, HEAT_ONLY_ROW_H = 14;
|
|
745
|
+
function cellRole(kind, text) {
|
|
746
|
+
return cellHoldsNumber(kind, text) ? {} : { role: "category" };
|
|
747
|
+
}
|
|
748
|
+
var TABLE_PAD_MAX = 16, STANDOFF_BELOW = 12, isLeafRow = (row) => row.role !== "total" && row.role !== "section" && !row.hasChildren, cellPads = /* @__PURE__ */ new WeakMap(), cellPadOf = (geometry) => cellPads.get(geometry);
|
|
749
|
+
function cutCount(geometry) {
|
|
750
|
+
return plannedCutCount(geometry) ?? geometry.scene.filter((node) => node.t === "text" && node.id.startsWith("cell:") && node.title !== void 0).length;
|
|
751
|
+
}
|
|
752
|
+
function layoutTable(authoredData, options = {}, resolved = resolvedForSize(authoredData, options), preserveCompactFloor = !1) {
|
|
753
|
+
return prepareTableExecutor(authoredData, options, resolved).run(options, preserveCompactFloor);
|
|
754
|
+
}
|
|
755
|
+
function snapshotTableOptions(options) {
|
|
756
|
+
let theme = { preset: typeof options.theme == "string" ? options.theme : options.theme?.preset, overrides: resolveTheme(options.theme) };
|
|
757
|
+
return { ...copyPlannedValue({ ...options, theme: void 0 }), theme };
|
|
758
|
+
}
|
|
759
|
+
function prepareTableExecutor(authoredData, initialOptions = {}, initialResolved) {
|
|
760
|
+
let candidates = /* @__PURE__ */ new WeakMap(), run = (options = initialOptions, preserveCompactFloor = !1, suppliedResolved, preparedInput, answer) => withPlanInputs(() => {
|
|
761
|
+
let input = preparedInput ?? prepareTableData(authoredData, options), resolved = suppliedResolved ?? (options === initialOptions && initialResolved ? initialResolved : resolvePreparedTable(input, options));
|
|
762
|
+
preparedInput || (options = snapshotTableOptions(options));
|
|
763
|
+
let choice = liftOrFallback((mode) => {
|
|
764
|
+
let variant = mode === "full" ? options : { ...options, [ZERO_LIFT]: mode }, model = mode === "full" ? resolved : resolvedForSize(authoredData, variant), formatFits = /* @__PURE__ */ new Map(), {
|
|
765
|
+
size: _size,
|
|
766
|
+
mode: _mode,
|
|
767
|
+
belowMinimum: _below,
|
|
768
|
+
[TARGET_SIZE]: _target,
|
|
769
|
+
[PLAN_ONLY]: _plan,
|
|
770
|
+
[WIDTH_PROBE]: _width,
|
|
771
|
+
[FIXED_SIZE_PROBE]: _fixed,
|
|
772
|
+
[FORCE_COMPACT]: _forced,
|
|
773
|
+
[ACCEPTANCE_PROBE]: _accept,
|
|
774
|
+
[SIZING_ONLY]: _sizing,
|
|
775
|
+
[COMPACT_RETRY]: _retry,
|
|
776
|
+
[ENGINE_NOTES]: _notes,
|
|
777
|
+
...stable
|
|
778
|
+
} = variant, variantKey = optionKey(stable);
|
|
779
|
+
return tableRung({ table: model.table, surface: {
|
|
780
|
+
data: input.source,
|
|
781
|
+
options: variant,
|
|
782
|
+
preserveCompactFloor,
|
|
783
|
+
cutCount,
|
|
784
|
+
hasHeadAir,
|
|
785
|
+
cellPadOf,
|
|
786
|
+
run: (candidate, sizingOnly, selected, widthOnlyOnMiss = !1) => {
|
|
787
|
+
let current = Object.keys(candidate).length === 0 && Object.getOwnPropertySymbols(candidate).length === 0 ? variant : { ...variant, ...candidate }, { size: _candidateSize, [COMPACT_RETRY]: _candidateHeight, ...spacing } = candidate, typeClass = panelTypeClass(current) ?? typeWidthClass(resolveSize(current.size).width), key = variantKey + ":" + optionKey(spacing) + ":" + typeClass + (givesSectionAir(current) ? ":air" : ""), byKey = candidates.get(model);
|
|
788
|
+
byKey || candidates.set(model, byKey = /* @__PURE__ */ new Map());
|
|
789
|
+
let prepared = byKey.get(key);
|
|
790
|
+
return prepared || (prepared = prepareTableCandidate(input.source, current, model, formatFits), byKey.size >= 256 && byKey.delete(byKey.keys().next().value), byKey.set(key, prepared)), prepared(current, sizingOnly, selected, widthOnlyOnMiss);
|
|
791
|
+
}
|
|
792
|
+
} });
|
|
793
|
+
}, (lifted, plain) => costsWidth(lifted.undrawn, plain.undrawn, options), resolved.lifted);
|
|
794
|
+
answer?.(choice);
|
|
795
|
+
let geometry = choice.undrawn;
|
|
796
|
+
return options[PLAN_ONLY] || options[SIZING_ONLY] ? geometry : materializeLayout(geometry);
|
|
797
|
+
}), runCard = (options = initialOptions) => withPlanInputs(() => {
|
|
798
|
+
let input = prepareTableData(authoredData, options), { [WIDTH_PROBE]: _width, ...keyOptions } = options;
|
|
799
|
+
return typeof options.theme != "string" && (keyOptions.theme = { preset: options.theme?.preset, overrides: resolveTheme(options.theme) }), memoLayout(input, keyOptions, () => {
|
|
800
|
+
let planned = { ...snapshotTableOptions(options), [PLAN_ONLY]: !0 }, geometry = run(planned, !1, void 0, input), sized = options[SIZING_ONLY] || options[VERIFY_ADVICE] || missesFrame(geometry, options) ? classFloor((_data, frame) => run(frame, !1, void 0, input), input.source, planned, geometry) : geometry;
|
|
801
|
+
return widthRepairHeight(input.source, planned, sized, runCard);
|
|
802
|
+
}, 8);
|
|
803
|
+
});
|
|
804
|
+
return { run, runCard, need: (options = initialOptions) => {
|
|
805
|
+
let choice, geometry = run(options, !1, void 0, void 0, (found) => {
|
|
806
|
+
choice = found;
|
|
807
|
+
});
|
|
808
|
+
return tableNeed(choice, isPlanned(geometry) ? materializeLayout(geometry) : geometry);
|
|
809
|
+
} };
|
|
810
|
+
}
|
|
811
|
+
function prepareTableCardExecutor(data) {
|
|
812
|
+
return prepareTableExecutor(data).runCard;
|
|
813
|
+
}
|
|
814
|
+
function resolvedForSize(data, options) {
|
|
815
|
+
return resolvePreparedTable(prepareTableData(data, options), options);
|
|
816
|
+
}
|
|
817
|
+
var widthPlans = /* @__PURE__ */ new WeakMap();
|
|
818
|
+
function sharedWidthPlan(table, theme, measure, options, view, probe) {
|
|
819
|
+
if (typeof options.theme == "string") return tableWidths(table, theme, measure, options, view, probe);
|
|
820
|
+
let { size, [TARGET_SIZE]: target, [WIDTH_PROBE]: _probe, [COMPACT_RETRY]: _retry, [PLAN_ONLY]: _plan, ...rest } = options, widthOptions = rest;
|
|
821
|
+
for (let symbol of [SIZING_ONLY, REGULAR_SPACING, VERIFY_ADVICE, WIDTH_REPAIR_PROBE, HEAD_LINES, HEAD_AIR_MIN, HEAD_LOOSE, SUB_LINES, TIGHT_SPACING, ENGINE_NOTES]) delete widthOptions[symbol];
|
|
822
|
+
let heightOpen = target?.fixed.height === !1 || typeof size == "object" && size.height === void 0, key = `${optionKey(rest)}:${JSON.stringify({
|
|
823
|
+
rows: view.rows.map((row) => row.id),
|
|
824
|
+
widthRows: view.widthRows.map((row) => row.id),
|
|
825
|
+
columns: view.columns.map((col) => col.id),
|
|
826
|
+
available: view.available,
|
|
827
|
+
spacerTotal: view.spacerTotal,
|
|
828
|
+
headLines: view.headLines,
|
|
829
|
+
subLines: view.subLines,
|
|
830
|
+
headGlue: view.headGlue,
|
|
831
|
+
height: heightOpen || size === void 0 ? void 0 : resolveSize(size).height,
|
|
832
|
+
// The theme's fonts follow the frame's type class, and two classes can share one plot width.
|
|
833
|
+
typeClass: panelTypeClass(options) ?? typeWidthClass(resolveSize(size).width)
|
|
834
|
+
})}`, byKey = widthPlans.get(table);
|
|
835
|
+
byKey || widthPlans.set(table, byKey = /* @__PURE__ */ new Map());
|
|
836
|
+
let plan = byKey.get(key);
|
|
837
|
+
if (plan === void 0) {
|
|
838
|
+
let measured = tableWidths(table, theme, measure, options, view, probe);
|
|
839
|
+
if ("widthMiss" in measured) return measured;
|
|
840
|
+
byKey.size >= 32 && byKey.delete(byKey.keys().next().value), byKey.set(key, plan = measured);
|
|
841
|
+
}
|
|
842
|
+
return plan;
|
|
843
|
+
}
|
|
844
|
+
function missesFrame(geometry, options) {
|
|
845
|
+
let open = options[TARGET_SIZE]?.fixed;
|
|
846
|
+
return geometry.sizing !== void 0 && (open?.width !== !1 && geometry.size.width < geometry.sizing.minWidth || options.size !== void 0 && open?.height !== !1 && geometry.size.height < geometry.sizing.minHeight);
|
|
847
|
+
}
|
|
848
|
+
function costsWidth(lifted, plain, options) {
|
|
849
|
+
let misses = (geometry) => missesFrame(geometry, options);
|
|
850
|
+
if (misses(plain)) return !1;
|
|
851
|
+
if (misses(lifted) || cutCount(lifted) > cutCount(plain)) return !0;
|
|
852
|
+
let stepped = /* @__PURE__ */ new Set(["table-compact-fallback", "table-column-clipped", "table-overflow", "table-formats-fitted"]), before = new Set(plain.warnings.map((warning) => warning.code));
|
|
853
|
+
return lifted.warnings.some((warning) => stepped.has(warning.code) && !before.has(warning.code));
|
|
854
|
+
}
|
|
855
|
+
function themeGroupPad(theme) {
|
|
856
|
+
let pad = theme.table?.groupPad;
|
|
857
|
+
return pad?.top === void 0 && pad?.bottom === void 0 ? void 0 : { top: pad?.top ?? GROUP_PAD_TOP, bottom: pad?.bottom ?? GROUP_PAD_BOTTOM };
|
|
858
|
+
}
|
|
859
|
+
var groupAirAboveLeast = (pad, ruleSpace) => pad.top + ruleSpace + pad.bottom > 9;
|
|
860
|
+
function hasHeadAir(options) {
|
|
861
|
+
let theme = chartTheme(options), group = themeGroupPad(theme);
|
|
862
|
+
return (theme.table?.headPad?.top ?? 0) > 0 || (theme.table?.headPad?.bottom ?? HEADER_RULE_GAP) > HEADER_RULE_GAP || group !== void 0 && groupAirAboveLeast(group, Math.ceil(strokeToken(theme, "hair")));
|
|
863
|
+
}
|
|
864
|
+
var WIDTH_REPAIR_PROBE = /* @__PURE__ */ Symbol("tableWidthRepairProbe");
|
|
865
|
+
function widthRepairHeight(data, options, geometry, run = (options2) => layoutTableCard(data, options2)) {
|
|
866
|
+
if (options[WIDTH_REPAIR_PROBE] || options[SIZING_ONLY]) return geometry;
|
|
867
|
+
let warning = geometry.warnings.find((w) => w.code === "table-overflow" && w.fix?.length), patch = warning?.fix?.[0], size = patch && "value" in patch ? patch.value : void 0;
|
|
868
|
+
if (!warning || !size || size.height === void 0) return geometry;
|
|
869
|
+
if (!options[VERIFY_ADVICE])
|
|
870
|
+
return geometry.warnings = geometry.warnings.map((w) => {
|
|
871
|
+
if (w !== warning) return w;
|
|
872
|
+
let { fix: _unverified, ...rest } = w;
|
|
873
|
+
return { ...rest, suggest: `${w.suggest ?? ""} Call measure for a size that keeps the height and draws.`.trim() };
|
|
874
|
+
}), geometry;
|
|
875
|
+
let wider = run({ ...options, size, [WIDTH_REPAIR_PROBE]: !0 }), needed = wider.refused || !wider.sizing ? void 0 : Math.ceil(wider.sizing.minHeight);
|
|
876
|
+
return needed !== void 0 && needed > size.height && (geometry.warnings = geometry.warnings.map((w) => w === warning ? { ...w, fix: [{ op: "add", path: "/options/size", value: { width: size.width, height: needed } }] } : w)), geometry;
|
|
877
|
+
}
|
|
878
|
+
function layoutTableCard(data, options = {}) {
|
|
879
|
+
return prepareTableExecutor(data).runCard(options);
|
|
880
|
+
}
|
|
881
|
+
var layouts = /* @__PURE__ */ new WeakMap();
|
|
882
|
+
function memoLayout(data, options, layout, limit = 32) {
|
|
883
|
+
return withPlanInputs(() => {
|
|
884
|
+
let finish = (value) => isPlanned(value) ? options[PLAN_ONLY] ? { ...value, warnings: [...value.warnings] } : materializeLayout(value) : copyPlannedValue(value);
|
|
885
|
+
if (typeof options.theme == "string") return finish(layout());
|
|
886
|
+
let { [PLAN_ONLY]: _plan, ...answerOptions } = options, key = layoutKey(data, answerOptions), byKey = layouts.get(data);
|
|
887
|
+
return byKey || layouts.set(data, byKey = /* @__PURE__ */ new Map()), byKey.size >= limit && !byKey.has(key) && byKey.delete(byKey.keys().next().value), byKey.has(key) || byKey.set(key, layout()), finish(byKey.get(key));
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
function classFloor(layout, data, options, geometry) {
|
|
891
|
+
if (geometry.refused || !geometry.sizing || panelTypeClass(options) !== void 0) return geometry;
|
|
892
|
+
let sizing = geometry.sizing;
|
|
893
|
+
if (sizing.minWidth >= geometry.size.width || typeWidthClass(sizing.minWidth) === typeWidthClass(geometry.size.width)) return geometry;
|
|
894
|
+
let height = Math.max(geometry.size.height, sizing.minHeight), byKey = classFloors.get(data);
|
|
895
|
+
byKey || classFloors.set(data, byKey = /* @__PURE__ */ new Map());
|
|
896
|
+
let key = layoutKey(data, { ...options, size: [sizing.minWidth, typeWidthClass(geometry.size.width), height] });
|
|
897
|
+
byKey.size >= 32 && !byKey.has(key) && byKey.delete(byKey.keys().next().value);
|
|
898
|
+
let floor = byKey.get(key);
|
|
899
|
+
if (floor === void 0) {
|
|
900
|
+
floor = sizing.minWidth;
|
|
901
|
+
for (let pass = 0; pass < 3 && typeWidthClass(floor) !== typeWidthClass(geometry.size.width); pass++) {
|
|
902
|
+
let probe = layout(data, { ...options, size: { width: floor, height }, [SIZING_ONLY]: !0, [REGULAR_SPACING]: !0 });
|
|
903
|
+
if (probe.refused || !probe.sizing || probe.sizing.minWidth >= floor) break;
|
|
904
|
+
floor = probe.sizing.minWidth;
|
|
905
|
+
}
|
|
906
|
+
byKey.set(key, floor);
|
|
907
|
+
}
|
|
908
|
+
return floor !== sizing.minWidth && (geometry.sizing = { ...sizing, minWidth: floor }), geometry;
|
|
909
|
+
}
|
|
910
|
+
var classFloors = /* @__PURE__ */ new WeakMap();
|
|
911
|
+
function prepareTableView(data, options, table) {
|
|
912
|
+
let dataRows = visibleRows(table, void 0, expansionRootsHidden(table, options.expansion)), rows = hasNoDataRows(table) ? [...dataRows, emptyMessageRow(table, DEFAULT_EMPTY_MESSAGE)] : dataRows, expandedIds = new Set(rows.map((row) => row.parentId).filter((id) => id !== void 0)), fullRows = options.topN ? resolvedForSize(data, { ...options, topN: void 0 }).table.rows : table.rows, fullIds = new Set(fullRows.map((row) => row.id)), widthRows = [...fullRows, ...table.rows.filter((row) => !fullIds.has(row.id)), ...rows.filter((row) => !fullIds.has(row.id) && !table.rows.includes(row))], cols = visibleColumns(table), spans = groupSpans(table, cols), bandedColumnRuns = [];
|
|
913
|
+
for (let col of cols) {
|
|
914
|
+
if (col.band !== !0) continue;
|
|
915
|
+
let previous = bandedColumnRuns[bandedColumnRuns.length - 1];
|
|
916
|
+
previous !== void 0 && cols[cols.indexOf(col) - 1]?.id === previous.columnIds[previous.columnIds.length - 1] ? previous.columnIds.push(col.id) : bandedColumnRuns.push({ columnIds: [col.id] });
|
|
917
|
+
}
|
|
918
|
+
return {
|
|
919
|
+
dataRows,
|
|
920
|
+
rows,
|
|
921
|
+
expandedIds,
|
|
922
|
+
fullRows,
|
|
923
|
+
widthRows,
|
|
924
|
+
cols,
|
|
925
|
+
spans,
|
|
926
|
+
bandedColumnRuns,
|
|
927
|
+
heatLanes: heatRanges(cols, rows),
|
|
928
|
+
arrowShapes: arrowKey(cols, rows, options.locale?.language),
|
|
929
|
+
notes: tableFootnotes(table, rows, cols, options.locale?.language),
|
|
930
|
+
textColumns: cols.filter((col) => col.kind === "rowLabel" || col.kind === "text"),
|
|
931
|
+
statusColumns: cols.filter((col) => col.kind === "status")
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
var tableViews = /* @__PURE__ */ new WeakMap();
|
|
935
|
+
function tableA11y(options, rowCount, columnCount) {
|
|
936
|
+
return {
|
|
937
|
+
title: accessibleTitle(options.title, chartString(options, "tableTitle")),
|
|
938
|
+
counts: [structureCount("rows", rowCount, void 0, options), structureCount("columns", columnCount, void 0, options)],
|
|
939
|
+
desc: chartString(options, "tableDesc", { v1: String(rowCount), v2: String(columnCount) })
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function sharedTableView(data, options, table) {
|
|
943
|
+
let key = layoutKey(data, { expansion: options.expansion, topN: options.topN }), known = tableViews.get(table);
|
|
944
|
+
return (!known || known.key !== key) && tableViews.set(table, known = { key, view: prepareTableView(data, options, table) }), known.view.notes.forEach(disclosureNote), known.view;
|
|
945
|
+
}
|
|
946
|
+
var tableFrames = /* @__PURE__ */ new WeakMap();
|
|
947
|
+
function sharedTableFrame(table, input) {
|
|
948
|
+
let key = `${staticFrame.pinned}:${staticFrame.live}:${optionKey(input)}`, frames = tableFrames.get(table);
|
|
949
|
+
frames || tableFrames.set(table, frames = /* @__PURE__ */ new Map());
|
|
950
|
+
let value = frames.get(key);
|
|
951
|
+
if (!value) {
|
|
952
|
+
let occupied = createOccupiedIndex({ x: 0, y: 0, w: input.size.width, h: input.size.height });
|
|
953
|
+
value = { frame: solveFrame(input, occupied), claims: occupied.snapshot() }, frames.size >= 64 && frames.delete(frames.keys().next().value), frames.set(key, value);
|
|
954
|
+
}
|
|
955
|
+
return value;
|
|
956
|
+
}
|
|
957
|
+
function givesSectionAir(options) {
|
|
958
|
+
return options[COMPACT_RETRY] !== void 0 && !heightOmitted(options.size) && options[TARGET_SIZE]?.fixed.height !== !1;
|
|
959
|
+
}
|
|
960
|
+
function prepareTableCandidate(authoredData, options, initialResolved, formatFits) {
|
|
961
|
+
let tight = options[TIGHT_SPACING]?.columns === !0, tightRows = options[TIGHT_SPACING]?.rows === !0, sectionAirGiven = givesSectionAir(options), measure = tableTextMeasure(options.measure ?? defaultMeasurer), data = authoredData, resolved = initialResolved, warnings = [...resolved.warnings], theme = resolveSemanticPaletteTheme(
|
|
962
|
+
chartTheme(options),
|
|
963
|
+
options.palette,
|
|
964
|
+
warnings
|
|
965
|
+
), ruleSpace = Math.ceil(strokeToken(theme, "hair")), heavySectionRule = theme.table?.section?.rule !== "hair", rowRuleWidth = theme.table?.ruleWidths?.row ?? strokeToken(theme, "hair"), sectionRuleWidth = heavySectionRule ? 2 * strokeToken(theme, "rule") : rowRuleWidth, sectionRuleSpace = Math.ceil(sectionRuleWidth);
|
|
966
|
+
if (options.fitFormats === !0) {
|
|
967
|
+
let padX = options.cellPadX ?? cellPadX(visibleColumns(resolved.table).length), fitKey = `${options.density ?? "regular"}:${padX}`, fitted = formatFits.get(fitKey);
|
|
968
|
+
if (!formatFits.has(fitKey)) {
|
|
969
|
+
let fitLadder = levelLadder(theme, options.density ?? "regular", options.target, textScaleOf(options)), fitFonts = tableFonts(theme, fitLadder), rowById = new Map(resolved.table.rows.map((row) => [row.id, row])), fitChanges = new Set(resolved.table.rows.filter((row) => visibleInlineRows(row, options.inlineVisibility).length > 0).map((row) => row.id));
|
|
970
|
+
fitted = fitTableFormats(data, options, resolved, (table2) => visibleColumns(table2), {
|
|
971
|
+
measure,
|
|
972
|
+
padX,
|
|
973
|
+
cellFont: (cell) => {
|
|
974
|
+
let row = rowById.get(cell.rowId);
|
|
975
|
+
return kindFont(rowFont(theme, fitLadder, fitFonts, cell.role, row?.step ?? cell.level, row?.hasChildren === !0, fitChanges.size > 0 && fitChanges.has(cell.rowId)), row?.kind, cell.kind === "rowLabel", theme);
|
|
976
|
+
},
|
|
977
|
+
figures: (col, text) => cellDrawsTabular(theme, col.kind, text),
|
|
978
|
+
lineFont: (parent, line, text, tabular) => changeLineFitFont(theme, fitLadder, parent.step, line.polarity !== void 0, text, measure, tabular),
|
|
979
|
+
...options.locale?.decimal === void 0 ? {} : { decimal: options.locale.decimal }
|
|
980
|
+
}), formatFits.set(fitKey, fitted);
|
|
981
|
+
}
|
|
982
|
+
if (fitted !== void 0) {
|
|
983
|
+
let warningsAfter = warnings.splice(resolved.warnings.length);
|
|
984
|
+
warnings.length = 0, pushAll(warnings, fitted.resolved.warnings), pushAll(warnings, warningsAfter);
|
|
985
|
+
let fittedNote = formatsFittedWarning(fitted.changes);
|
|
986
|
+
fittedNote !== void 0 && warnings.push(fittedNote), data = fitted.data, resolved = fitted.resolved;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
let table = resolved.table, { dataRows, rows, expandedIds, fullRows, widthRows, cols, spans, bandedColumnRuns, heatLanes, arrowShapes, notes: tableNotes, textColumns, statusColumns } = sharedTableView(data, options, table), spacerBefore = /* @__PURE__ */ new Map();
|
|
990
|
+
for (let group of table.columnGroups) {
|
|
991
|
+
if (group.spacer === void 0 || group.spacer <= 0) continue;
|
|
992
|
+
let first = cols.find((col) => group.columnIds.includes(col.id));
|
|
993
|
+
first === void 0 || first.id === cols[0]?.id || spacerBefore.set(first.id, tight ? Math.min(group.spacer, TIGHT_PAD * 2) : group.spacer);
|
|
994
|
+
}
|
|
995
|
+
let spacerTotal = [...spacerBefore.values()].reduce((a, b) => a + b, 0), figures = printsFigures(options.figures, cols), rowRule = figures ? { paint: tableRuleInk(), width: rowRuleWidth } : { paint: { token: "grid" }, width: strokeToken(theme, "hair") };
|
|
996
|
+
options.figures === !1 && figures && warnings.push({
|
|
997
|
+
code: "figures-need-heat",
|
|
998
|
+
severity: "warn",
|
|
999
|
+
message: "figures: false needs a heat column, and this table draws none, so it prints its figures",
|
|
1000
|
+
field: ["options", "figures"],
|
|
1001
|
+
suggest: "Remove figures: false, or give a column a heat lane in options.encodings."
|
|
1002
|
+
});
|
|
1003
|
+
let initialCellPadX = options.cellPadX ?? cellPadX(cols.length), keyless = options.legend === "none", heatEntries = heatKey(cols, heatLanes, theme, options.strings, options.locale?.language);
|
|
1004
|
+
keyless && legendOff(warnings, "table", [...heatEntries, ...arrowShapes].map((entry) => entry.label));
|
|
1005
|
+
let keyEntries = keyless ? [] : heatEntries, arrowEntries = keyless ? [] : arrowShapes, authored = authoredNotes(options), surface = resolveSurface(theme), density = options.density ?? "regular", language = presetLanguage(options.variant), ladder = levelLadder(theme, density, options.target, textScaleOf(options));
|
|
1006
|
+
tightRows && (ladder.pad = () => 1, ladder.totalPad = 1, ladder.rowHeight !== void 0 && (ladder.rowHeight = ladder.lineBox(ladder.label) + 2));
|
|
1007
|
+
let { lineBox, pad: levelPad } = ladder, widthViewBase = {
|
|
1008
|
+
columns: cols,
|
|
1009
|
+
rows,
|
|
1010
|
+
widthRows,
|
|
1011
|
+
fullRows,
|
|
1012
|
+
spacerTotal,
|
|
1013
|
+
headLines: options[HEAD_LINES],
|
|
1014
|
+
subLines: options[SUB_LINES],
|
|
1015
|
+
headGlue: options[HEAD_LOOSE] !== !0
|
|
1016
|
+
}, preparedWidth = options.cellPadX !== void 0 && options.columnHeads !== !1 ? prepareTableWidthRung(table, theme, measure, options, widthViewBase) : void 0;
|
|
1017
|
+
function prepareRows(options2, widthPlan, size, plot) {
|
|
1018
|
+
let gridX = Math.round(plot.x), cellPadX2 = widthPlan.cellPadX, { fonts, regularFonts, columnHeaderText, cellFont, indentStep, rowIndent, hasChanges: hasChangesById } = widthPlan, statusCuts = /* @__PURE__ */ new Map(), statusFits = /* @__PURE__ */ new Map(), rowFont2 = (role, level, hasChildren, hasChanges = !1) => rowFont(theme, ladder, regularFonts, role, level, hasChildren, hasChanges), sectionInk = theme.table?.section?.ink, ofWhichMuted = theme.table?.ofWhich !== "ink";
|
|
1019
|
+
function rowHeight(row) {
|
|
1020
|
+
if (row.role === "total" && row.kind !== "result" && row.kind !== "driver")
|
|
1021
|
+
return ladder.totalPad * 2 + lineBox(fonts.total.size) + 2 * ruleSpace;
|
|
1022
|
+
if (row.role === "section") {
|
|
1023
|
+
if (tightRows || sectionAirGiven) return sectionNatural();
|
|
1024
|
+
let space = theme.table?.section?.spaceBefore ?? lineBox(ladder.label);
|
|
1025
|
+
return sectionNatural() + Math.round(row.id === rows[0]?.id ? Math.min(space, lineBox(ladder.label) / 4) : space);
|
|
1026
|
+
}
|
|
1027
|
+
let pad = levelPad(row.step, row.hasChildren);
|
|
1028
|
+
return figures ? ladder.rowHeight !== void 0 ? ladder.rowHeight + inlineBlock(row).extra : pad * 2 + lineBox(rowFont2(row.role, row.step, row.hasChildren, hasChangesById.size > 0 && hasChangesById.has(row.id)).size) + ruleSpace + inlineBlock(row).extra : Math.max(HEAT_ONLY_ROW_H, lineBox(ladder.size(0)));
|
|
1029
|
+
}
|
|
1030
|
+
function sectionNatural() {
|
|
1031
|
+
return levelPad(1, !1) * 2 + ladder.sectionBox(fonts.section.size) + sectionRuleSpace;
|
|
1032
|
+
}
|
|
1033
|
+
let labelColumnId = cols.find((col) => col.kind === "rowLabel")?.id;
|
|
1034
|
+
function labelNoteOf(row) {
|
|
1035
|
+
if (!(labelColumnId === void 0 || row.role === "section"))
|
|
1036
|
+
return row.cells[labelColumnId]?.note;
|
|
1037
|
+
}
|
|
1038
|
+
let inlineBlocks = /* @__PURE__ */ new Map();
|
|
1039
|
+
function inlineBlock(row) {
|
|
1040
|
+
let cached = inlineBlocks.get(row);
|
|
1041
|
+
if (cached !== void 0) return cached;
|
|
1042
|
+
let lines = visibleInlineRows(row, options2.inlineVisibility), box = ladder.inlineBox(Math.max(ladder.inlineSize(), lines.length ? changeLineFont(theme, ladder, row.step).size : 0)), note = labelNoteOf(row), base = note === void 0 ? 0 : 1, stacked = base + lines.length, noteSlots = /* @__PURE__ */ new Map();
|
|
1043
|
+
for (let col of cols) {
|
|
1044
|
+
if (col.noteLine !== !0 || col.kind === "rowLabel" || row.cells[col.id]?.note === void 0) continue;
|
|
1045
|
+
let slot = base + noteLineIndex(lines, col.id);
|
|
1046
|
+
noteSlots.set(col.id, slot), stacked = Math.max(stacked, slot + 1);
|
|
1047
|
+
}
|
|
1048
|
+
let block = {
|
|
1049
|
+
lines,
|
|
1050
|
+
...note === void 0 ? {} : { note },
|
|
1051
|
+
box,
|
|
1052
|
+
noteSlots,
|
|
1053
|
+
extra: stacked === 0 ? 0 : ladder.inlineGap + stacked * box
|
|
1054
|
+
};
|
|
1055
|
+
return inlineBlocks.set(row, block), block;
|
|
1056
|
+
}
|
|
1057
|
+
let inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed);
|
|
1058
|
+
function affixRoom(row, font) {
|
|
1059
|
+
return row.unitAffix === void 0 ? 0 : theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, inlineFont2(row.step, !1)).width : measure(row.unitAffix, qualifierFont(font, theme)).width + (theme.table.qualifier.gap ?? 4);
|
|
1060
|
+
}
|
|
1061
|
+
function noteStatusCut(col, row, shown, full) {
|
|
1062
|
+
let cuts2 = statusCuts.get(col.id);
|
|
1063
|
+
cuts2 || statusCuts.set(col.id, cuts2 = /* @__PURE__ */ new Map());
|
|
1064
|
+
let key = `${shown}\0${full}`, cut = cuts2.get(key) ?? { shown, full, rows: [] };
|
|
1065
|
+
cuts2.set(key, cut), shown === "" && !cut.rows.includes(row.label) && cut.rows.push(row.label);
|
|
1066
|
+
}
|
|
1067
|
+
function statusFit(col, label, font, room, trackRoom) {
|
|
1068
|
+
let key = `${col.id}\0${room}\0${trackRoom}`, fits = statusFits.get(key);
|
|
1069
|
+
if (fits === void 0) {
|
|
1070
|
+
let labels = [...new Set(widthRows.flatMap((row) => {
|
|
1071
|
+
let cell = row.cells[col.id];
|
|
1072
|
+
return cell?.kind === "status" && cell.state === "value" ? [cell.displayed] : [];
|
|
1073
|
+
}))];
|
|
1074
|
+
fits = new Map(labels.map((text) => {
|
|
1075
|
+
let fit2 = fitStatusLabel(text, font, room, trackRoom, measure), distinct = fit2?.title === void 0 ? void 0 : distinctCut(text, [fit2.text], labels, font, room, measure), cut = distinct === void 0 ? fit2 : { text: distinct, title: text };
|
|
1076
|
+
return [text, cut && cut.text !== text && cut.text.slice(text.startsWith("\u2026") ? 1 : 0).startsWith("\u2026") ? null : cut];
|
|
1077
|
+
}));
|
|
1078
|
+
let keeper = /* @__PURE__ */ new Map();
|
|
1079
|
+
for (let [text, fit2] of fits) {
|
|
1080
|
+
let kept = fit2?.title === void 0 ? void 0 : keeper.get(fit2.text);
|
|
1081
|
+
fit2?.title !== void 0 && (kept === void 0 || text.length < kept.length) && keeper.set(fit2.text, text);
|
|
1082
|
+
}
|
|
1083
|
+
for (let [text, fit2] of fits) fit2?.title !== void 0 && keeper.get(fit2.text) !== text && fits.set(text, null);
|
|
1084
|
+
statusFits.set(key, fits);
|
|
1085
|
+
}
|
|
1086
|
+
let fit = fits.get(label);
|
|
1087
|
+
return fit === void 0 ? fitStatusLabel(label, font, room, trackRoom, measure) : fit;
|
|
1088
|
+
}
|
|
1089
|
+
let hasGroups = table.columnGroups.length > 0, headsDrawn = options2.columnHeads !== !1, hasGroupHeads = headsDrawn && table.columnGroups.some((g) => g.heading !== !1), leanHead = options2[HEAD_AIR_MIN] === !0 || options2[COMPACT_RETRY] !== void 0, headPadTop = tightRows || leanHead ? 0 : theme.table?.headPad?.top ?? 0, themeHeadBottom = theme.table?.headPad?.bottom ?? HEADER_RULE_GAP, headPadBottom = tightRows ? 2 : leanHead ? Math.min(themeHeadBottom, HEADER_RULE_GAP) : themeHeadBottom, themeGroup = themeGroupPad(theme), groupPad = tightRows ? { top: 2, bottom: 2 } : leanHead && themeGroup !== void 0 && groupAirAboveLeast(themeGroup, ruleSpace) ? void 0 : themeGroup, headRoom = (col) => Math.max(1, Math.round(widthAt(widthPlan, col.id)) - 2 * cellPadX2 - (col.kind === "rowLabel" ? rowIndent(0) : 0)), headerFits = new Map(cols.map((col) => {
|
|
1090
|
+
let text = columnHeaderText(col), headFit = (head) => fitText(head, fonts.header, headRoom(col), 1 / 0, measure, { target: options2.target, typeRole: "axis" }), fit = headFit(text);
|
|
1091
|
+
return fit.title !== void 0 && text.includes("\xA0") && (fit = headFit(text.replace(/\u00a0/g, " "))), [col.id, { ...fit, lines: fit.lines.map((line) => line.replace(/\u00a0/g, " ")) }];
|
|
1092
|
+
})), subFits = new Map(cols.flatMap((col) => col.subLabel === void 0 ? [] : [[col.id, fitText(
|
|
1093
|
+
col.subLabel,
|
|
1094
|
+
fonts.sub,
|
|
1095
|
+
headRoom(col),
|
|
1096
|
+
!col.label && col.kind === "rowLabel" ? 1 : options2[SUB_LINES] ?? 1 / 0,
|
|
1097
|
+
measure,
|
|
1098
|
+
{ target: options2.target, typeRole: "axis" }
|
|
1099
|
+
)]])), headerSubH = subFits.size === 0 ? 0 : maxOf([...subFits.values()].map((fit) => lineBox(fonts.sub.size) + (fit.lines.length > 1 ? fit.h * (fit.lines.length - 1) / fit.lines.length : 0))), headerTextH = Math.max(fonts.header.size * 1.2, maxOf([...headerFits.values()].map((fit) => fit.h))), headerLabelH = headsDrawn ? headPadTop + Math.max(ladder.headBox(fonts.header.size), headerTextH) + headerSubH + headPadBottom + ruleSpace : 0, colX = /* @__PURE__ */ new Map(), x = gridX;
|
|
1100
|
+
for (let col of cols) {
|
|
1101
|
+
x += spacerBefore.get(col.id) ?? 0;
|
|
1102
|
+
let w = Math.round(widthAt(widthPlan, col.id));
|
|
1103
|
+
colX.set(col.id, { x, w }), x += w;
|
|
1104
|
+
}
|
|
1105
|
+
let groupWraps = /* @__PURE__ */ new Map();
|
|
1106
|
+
if (hasGroupHeads)
|
|
1107
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
1108
|
+
if (spans[groupIndex].span === 0 || g.heading === !1) continue;
|
|
1109
|
+
let tracks = g.columnIds.filter((columnId) => colX.has(columnId)).map((columnId) => colX.get(columnId)), from = Math.round(Math.min(...tracks.map((track) => track.x)) + cellPadX2), to = Math.round(Math.max(...tracks.map((track) => track.x + track.w)) - cellPadX2), wrap = groupHeadingWrap(g, groupHeadingFaces(fonts.group), measure, to - from);
|
|
1110
|
+
wrap !== void 0 && groupWraps.set(g.id, wrap);
|
|
1111
|
+
}
|
|
1112
|
+
let groupLineCount = (id) => {
|
|
1113
|
+
let wrap = groupWraps.get(id);
|
|
1114
|
+
return wrap === void 0 ? 1 : wrap.label.length + (wrap.note === void 0 ? 0 : 1);
|
|
1115
|
+
}, groupLines = Math.max(1, ...[...groupWraps.keys()].map(groupLineCount)), groupLineH = fonts.group.size * (fonts.group.lineHeight ?? 1.2), groupExtraH = Math.ceil((groupLines - 1) * groupLineH), headerGroupH = hasGroupHeads ? groupExtraH + (groupPad === void 0 ? ladder.headBox(fonts.group.size) + 9 : groupPad.top + ladder.headBox(fonts.group.size) + ruleSpace + groupPad.bottom) : 0, headerH = headerGroupH + headerLabelH, spanRule = (options2.groupRule ?? "span") === "span", groupAlign = options2.groupAlign ?? "center", tableW = x - gridX, rowX = options2.rowExtent === "frame" && (options2.margin?.left ?? 0) > 0 ? 0 : gridX, filledShort = options2.rowExtent === void 0 && options2.frameFill !== "none" && Math.floor(plot.w - tableW) >= 1, rowW = (options2.rowExtent ?? "frame") === "frame" && !filledShort ? Math.max(tableW + gridX - rowX, (options2.rowExtent === "frame" && (options2.margin?.right ?? 0) > 0 ? size.width : Math.round(plot.x + plot.w)) - rowX) : tableW + gridX - rowX, wrappedLines = /* @__PURE__ */ new Map(), cutTitles = /* @__PURE__ */ new Map(), rowExtra = /* @__PURE__ */ new Map(), labelHead = /* @__PURE__ */ new Map(), affixBelow = /* @__PURE__ */ new Set(), labelTexts = (colId) => rows.flatMap((row) => row.role === "section" ? [] : [row.cells[colId]?.displayed ?? ""]);
|
|
1116
|
+
for (let row of rows) {
|
|
1117
|
+
let sectionCol = row.role === "section" ? cols.find((col) => col.kind === "rowLabel") : void 0, sectionCell = sectionCol === void 0 ? void 0 : row.cells[sectionCol.id];
|
|
1118
|
+
if (sectionCol !== void 0 && sectionCell?.displayed) {
|
|
1119
|
+
let font = cellFont(sectionCell), text = theme.table?.section?.case === "asis" ? sectionCell.displayed : sectionCell.displayed.toUpperCase(), badgeW = row.badge === void 0 ? 0 : Math.round(measure(row.badge.text, fonts.chip).width + 2 * CHIP_PAD_X) + SECTION_CHIP_GAP, room = tableW - (colX.get(sectionCol.id).x - gridX) - 2 * cellPadX2 - rowIndent(indentStep(sectionCell)) - affixRoom(row, font) - badgeW;
|
|
1120
|
+
if (measure(text, font).width > room) {
|
|
1121
|
+
let wrap = fitText(text, font, Math.max(room, 20), 2, measure, { target: options2.target, typeRole: "label" });
|
|
1122
|
+
wrappedLines.set(tableCellKey(row.id, sectionCol.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, sectionCol.id), wrap.title), wrap.lines.length > 1 && rowExtra.set(row.id, Math.ceil((wrap.lines.length - 1) * font.size * 1.2));
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
for (let col of textColumns) {
|
|
1126
|
+
let rowLabel = col.kind === "rowLabel" && row.role !== "section";
|
|
1127
|
+
if (col.kind !== "text" && !rowLabel) continue;
|
|
1128
|
+
let cell = row.cells[col.id];
|
|
1129
|
+
if (!cell || !cell.displayed) continue;
|
|
1130
|
+
let font = cellFont(cell), w = colX.get(col.id).w, indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, room = w - 2 * cellPadX2 - indent - (cell.note && cell.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), affix = cell.kind === "rowLabel" ? affixRoom(row, font) : 0, textW = measure(cell.displayed, font).width, authoredBreak = col.kind === "text" && col.wrap === !0 && cell.displayed.includes(`
|
|
1131
|
+
`);
|
|
1132
|
+
if (textW <= room - affix && !authoredBreak) continue;
|
|
1133
|
+
let ownLine = rowLabel && affix > 0, maxW = ownLine ? room : room - affix, slack = rowLabel && !visibleInlineRows(row, options2.inlineVisibility).some((line) => line.label !== "") ? inlineBlock(row).extra : 0, affixHead = ownLine ? Math.ceil((theme.table?.qualifier === void 0 ? inlineFont2(row.step, !1) : qualifierFont(font, theme)).size * 1.2) : 0, setHead = (own) => {
|
|
1134
|
+
let head = Math.max(0, own - slack);
|
|
1135
|
+
head > 0 && labelHead.set(row.id, head), head > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, head));
|
|
1136
|
+
};
|
|
1137
|
+
if (ownLine && (affixBelow.add(row.id), textW <= maxW)) {
|
|
1138
|
+
wrappedLines.set(tableCellKey(row.id, col.id), [cell.displayed]), setHead(affixHead);
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
let wrap = rowLabel ? fitText(cell.displayed, font, Math.max(maxW, 20), options2.rowLabelLines ?? 2, measure, { target: options2.target, typeRole: "label", breakAfter: !0 }) : fitText(cell.displayed, font, Math.max(maxW, 20), col.kind === "text" && col.wrap ? 1 / 0 : 2, measure, { target: options2.target, typeRole: "label" }), last = rowLabel && wrap.title !== void 0 ? distinctCut(cell.displayed, wrap.lines, labelTexts(col.id), font, Math.max(maxW, 20), measure, !0) : void 0;
|
|
1142
|
+
last !== void 0 && (wrap.lines = [...wrap.lines.slice(0, -1), last]), wrappedLines.set(tableCellKey(row.id, col.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, col.id), wrap.title);
|
|
1143
|
+
let grow = Math.ceil((wrap.lines.length - 1) * font.size * 1.2);
|
|
1144
|
+
rowLabel ? setHead(grow + affixHead) : grow > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, grow));
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
let plannedCellText = /* @__PURE__ */ new Map(), cuts = 0;
|
|
1148
|
+
for (let row of rows) for (let col of statusColumns) {
|
|
1149
|
+
let cell = row.cells[col.id];
|
|
1150
|
+
if (!cell || col.kind === "encoding" || labelOnlyRow(row, expandedIds) && col.kind !== "rowLabel") continue;
|
|
1151
|
+
let track = colX.get(col.id);
|
|
1152
|
+
if (cell.kind === "status" && cell.state === "value") {
|
|
1153
|
+
let square = col.statusMark === "square" ? statusSquare(fonts.body.size) : void 0, reserve = square ? square.side + square.gap : 2 * CHIP_PAD_X, fit = statusFit(col, cell.displayed, square ? fonts.body : fonts.chip, track.w - 2 * cellPadX2 - reserve, track.w - reserve);
|
|
1154
|
+
fit === null ? noteStatusCut(col, row, "", cell.displayed) : fit.title !== void 0 && (noteStatusCut(col, row, fit.text, fit.title), cuts++);
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
let cellsFitted = !1, plannedCuts = () => {
|
|
1159
|
+
if (cellsFitted) return cuts;
|
|
1160
|
+
cellsFitted = !0;
|
|
1161
|
+
for (let row of rows) for (let col of textColumns) {
|
|
1162
|
+
let cell = row.cells[col.id], isSection = row.role === "section";
|
|
1163
|
+
if (!cell || col.kind === "encoding" || labelOnlyRow(row, expandedIds) && col.kind !== "rowLabel") continue;
|
|
1164
|
+
let track = colX.get(col.id);
|
|
1165
|
+
if (col.kind !== "rowLabel" && col.kind !== "text") continue;
|
|
1166
|
+
let font = cellFont(cell), indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, badge = isSection && col.kind === "rowLabel" ? row.badge : void 0, badgeW = badge === void 0 ? 0 : Math.round(measure(badge.text, fonts.chip).width + 2 * CHIP_PAD_X), affixFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), weight: theme.type.label.weight, ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme), affixWidth = col.kind === "rowLabel" && row.unitAffix !== void 0 && !(row.kind === "member" && expandedIds.has(row.id)) ? theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, affixFont).width : measure(row.unitAffix, affixFont).width + (theme.table.qualifier.gap ?? 4) : 0, maxW = (isSection ? tableW - (track.x - gridX) : track.w) - 2 * cellPadX2 - indent - (badgeW === 0 ? 0 : badgeW + SECTION_CHIP_GAP) - (affixBelow.has(row.id) ? 0 : affixWidth) - (cell.note && col.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), key = tableCellKey(row.id, col.id), fit = cellText(cell, col.kind, isSection, font, maxW, wrappedLines.get(key), cutTitles.get(key), measure, theme.table?.section?.case);
|
|
1167
|
+
plannedCellText.set(key, fit), fit.title !== void 0 && cuts++;
|
|
1168
|
+
}
|
|
1169
|
+
return cuts;
|
|
1170
|
+
}, cutNotes = cols.flatMap((col) => {
|
|
1171
|
+
let cut = statusCuts.get(col.id), entry = ({ shown, full, rows: named }) => `${shown !== "" ? shown : named.join(", ")} = ${full}`;
|
|
1172
|
+
return cut ? [`${col.label}: ${[...cut.values()].map(entry).join("; ")}`] : [];
|
|
1173
|
+
});
|
|
1174
|
+
return { sectionInk, ofWhichMuted, rowHeight, sectionNatural, inlineBlock, inlineFont: inlineFont2, noteStatusCut, statusFit, hasGroups, headsDrawn, hasGroupHeads, headPadBottom, groupPad, headerFits, subFits, headerSubH, colX, groupWraps, groupLineCount, groupLineH, groupExtraH, headerGroupH, headerH, spanRule, groupAlign, tableW, rowX, rowW, wrappedLines, cutTitles, rowExtra, labelHead, affixBelow, plannedCellText, plannedCuts, cutNotes };
|
|
1175
|
+
}
|
|
1176
|
+
let previousRows;
|
|
1177
|
+
function rowsAt(options2, widthPlan, size, plot) {
|
|
1178
|
+
let compact = options2[COMPACT_RETRY] !== void 0;
|
|
1179
|
+
if (previousRows && previousRows.x === plot.x && previousRows.y === plot.y && previousRows.width === plot.w && previousRows.canvasWidth === size.width && previousRows.cellPadX === widthPlan.cellPadX && previousRows.compact === compact && previousRows.fonts === widthPlan.fonts && cols.every((col, index) => previousRows.widths[index] === widthAt(widthPlan, col.id))) return previousRows.value;
|
|
1180
|
+
let value = prepareRows(options2, widthPlan, size, plot);
|
|
1181
|
+
return previousRows = {
|
|
1182
|
+
x: plot.x,
|
|
1183
|
+
y: plot.y,
|
|
1184
|
+
width: plot.w,
|
|
1185
|
+
canvasWidth: size.width,
|
|
1186
|
+
cellPadX: widthPlan.cellPadX,
|
|
1187
|
+
compact,
|
|
1188
|
+
fonts: widthPlan.fonts,
|
|
1189
|
+
widths: cols.map((col) => widthAt(widthPlan, col.id)),
|
|
1190
|
+
value
|
|
1191
|
+
}, value;
|
|
1192
|
+
}
|
|
1193
|
+
let preparedWarnings = warnings, liftedByFormatting = resolved !== initialResolved && resolved.lifted;
|
|
1194
|
+
return function(options2, sizingOnly, wantsScene, widthOnlyOnMiss = !1) {
|
|
1195
|
+
liftedByFormatting && zeroLifts.count++;
|
|
1196
|
+
for (let note of tableNotes) disclosureNote(note);
|
|
1197
|
+
let size = resolveSize(options2.size), engineNotes = options2[ENGINE_NOTES] ?? [];
|
|
1198
|
+
for (; ; ) {
|
|
1199
|
+
let sizingProbe2 = function(sizing2, marks, pad = cellPadX2) {
|
|
1200
|
+
let probe = {
|
|
1201
|
+
type: "table",
|
|
1202
|
+
size,
|
|
1203
|
+
sizing: sizing2,
|
|
1204
|
+
plot,
|
|
1205
|
+
scene: [],
|
|
1206
|
+
labels: [],
|
|
1207
|
+
axes: [],
|
|
1208
|
+
annotations: [],
|
|
1209
|
+
frame: frame.frame,
|
|
1210
|
+
marks,
|
|
1211
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
1212
|
+
a11y: { title: "", desc: "", counts: [] },
|
|
1213
|
+
warnings: warnings2,
|
|
1214
|
+
debug: { occupied: [], decisions: [] }
|
|
1215
|
+
};
|
|
1216
|
+
return cellPads.set(probe, pad), probe;
|
|
1217
|
+
};
|
|
1218
|
+
var sizingProbe = sizingProbe2;
|
|
1219
|
+
let warnings2 = [...preparedWarnings], cellPadX2 = initialCellPadX, frameInput = {
|
|
1220
|
+
size,
|
|
1221
|
+
margin: { ...canvasMargin(theme, size.width), ...options2.margin },
|
|
1222
|
+
...frameTextOptions(options2),
|
|
1223
|
+
// uniform money unit hoisted out of every cell → the frame slot
|
|
1224
|
+
// (solveFrame prepends 'in' itself)
|
|
1225
|
+
unit: tableFrameUnit(table, options2),
|
|
1226
|
+
// rows/cols, not table.rows/table.columns: this surface is static, so a
|
|
1227
|
+
// marker inside a collapsed row or a hidden column is unreachable here
|
|
1228
|
+
// and its footnote would point at nothing
|
|
1229
|
+
footnotes: [...tableNotes, ...authored, ...engineNotes],
|
|
1230
|
+
// Nothing in a table points at a note: no head or cell carries a
|
|
1231
|
+
// mark, so a "1)" before the note is a number the reader cannot follow
|
|
1232
|
+
// (the same rule as for the engine's own notes). The author's
|
|
1233
|
+
// notes stay notes and print without a number.
|
|
1234
|
+
numberedFootnotes: authored,
|
|
1235
|
+
unreferencedNotes: authored.map((_, i) => i + 1),
|
|
1236
|
+
// A table's notes read in the tertiary ink where the theme names one.
|
|
1237
|
+
footnoteInk: "inkMeta",
|
|
1238
|
+
// The notes and the source keep the cell air in from both edges, as on React, also at canvas margin 0.
|
|
1239
|
+
footerInset: cellPadX2,
|
|
1240
|
+
...keyEntries.length + arrowEntries.length > 0 ? {
|
|
1241
|
+
legend: {
|
|
1242
|
+
options: legendRequired(options2.legend, warnings2, "table", theme, keyEntries.length > 0 ? "its heat bands cut at edges no cell prints" : "its arrow shapes stand for shares no cell prints"),
|
|
1243
|
+
items: [
|
|
1244
|
+
...keyEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: entry.fill, key: "box", stroke: { token: "grid" } })),
|
|
1245
|
+
...arrowEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: { token: "ink" }, key: "glyph", glyph: entry.glyph }))
|
|
1246
|
+
]
|
|
1247
|
+
},
|
|
1248
|
+
legendFont: "footnote"
|
|
1249
|
+
} : {},
|
|
1250
|
+
theme,
|
|
1251
|
+
measure
|
|
1252
|
+
}, framePlan = sharedTableFrame(table, frameInput), frame = framePlan.frame, plot = frame.plot, groundTexts = /* @__PURE__ */ new Map(), widthView = { ...widthViewBase, available: plot.w }, widthProbe = widthOnlyOnMiss === "regular-rung" && options2[TARGET_SIZE]?.fixed.width !== !1 ? { canvasWidth: size.width, footerInset: cellPadX2 } : void 0, widthPlan = preparedWidth ? solveTableWidthRung(preparedWidth, plot.w, options2, widthProbe) : sharedWidthPlan(table, theme, measure, options2, widthView, widthProbe);
|
|
1253
|
+
if ("widthMiss" in widthPlan) {
|
|
1254
|
+
let sizing2 = tableSizing(size, plot, plot.y, widthPlan.totalW, widthPlan.minimumW);
|
|
1255
|
+
if (size.width < sizing2.minWidth) {
|
|
1256
|
+
let x = Math.round(plot.x), y2 = Math.round(plot.y);
|
|
1257
|
+
return sizingProbe2(sizing2, {
|
|
1258
|
+
table: { x, y: y2, w: widthPlan.totalW, h: 0 },
|
|
1259
|
+
columns: [],
|
|
1260
|
+
rows: [],
|
|
1261
|
+
headerBand: { x, y: y2, w: widthPlan.totalW, h: 0 }
|
|
1262
|
+
}, widthPlan.cellPadX);
|
|
1263
|
+
}
|
|
1264
|
+
widthPlan = preparedWidth ? solveTableWidthRung(preparedWidth, plot.w, options2) : sharedWidthPlan(table, theme, measure, options2, widthView);
|
|
1265
|
+
}
|
|
1266
|
+
cellPadX2 = widthPlan.cellPadX, frameInput.footerInset !== cellPadX2 && (frameInput.footerInset = cellPadX2, framePlan = sharedTableFrame(table, frameInput), frame = framePlan.frame, plot = frame.plot);
|
|
1267
|
+
let gridX = Math.round(plot.x), gridY = Math.round(plot.y), { sizingMinimums, totalW, minimumW, fonts, columnHeaderText, cellFont, indentStep, rowIndent, operatorSlot, childCount } = widthPlan, sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal);
|
|
1268
|
+
if (pushAll(warnings2, widthPlan.warnings), sizingOnly && options2[TARGET_SIZE]?.fixed.height === !1 && !heightOmitted(options2.size) || widthOnlyOnMiss && options2[TARGET_SIZE]?.fixed.width !== !1 && size.width < size.width - plot.w + minimumW)
|
|
1269
|
+
return sizingProbe2(tableSizing(size, plot, plot.y, totalW, minimumW), {
|
|
1270
|
+
table: { x: gridX, y: gridY, w: totalW, h: 0 },
|
|
1271
|
+
columns: cols.map((col) => ({ id: col.id, x: gridX, w: widthAt(widthPlan, col.id) })),
|
|
1272
|
+
rows: [],
|
|
1273
|
+
headerBand: { x: gridX, y: gridY, w: totalW, h: 0 }
|
|
1274
|
+
});
|
|
1275
|
+
let rowModel = rowsAt(options2, widthPlan, size, plot), { sectionInk, ofWhichMuted, rowHeight, sectionNatural, inlineBlock, inlineFont: inlineFont2, noteStatusCut, statusFit, hasGroups, headsDrawn, hasGroupHeads, headPadBottom, groupPad, headerFits, subFits, headerSubH, colX, groupWraps, groupLineCount, groupLineH, groupExtraH, headerGroupH, headerH, spanRule, groupAlign, tableW, rowX, rowW, wrappedLines, cutTitles, rowExtra, labelHead, affixBelow, plannedCellText, plannedCuts } = rowModel, cutNotes = rowModel.cutNotes.map(disclosureNote).filter((note) => !engineNotes.includes(note));
|
|
1276
|
+
if (!sizingOnly && cutNotes.length > 0) {
|
|
1277
|
+
engineNotes = [...engineNotes, ...cutNotes];
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
let rowY = /* @__PURE__ */ new Map(), y = gridY + headerH;
|
|
1281
|
+
for (let [index, row] of rows.entries()) {
|
|
1282
|
+
index > 0 && row.spacer !== void 0 && (y += Math.round(row.spacer));
|
|
1283
|
+
let h = rowHeight(row) + (rowExtra.get(row.id) ?? 0);
|
|
1284
|
+
rowY.set(row.id, { y, h }), y += h;
|
|
1285
|
+
}
|
|
1286
|
+
let naturalTableH = y - gridY;
|
|
1287
|
+
{
|
|
1288
|
+
let callerH = options2[COMPACT_RETRY], grow = rowDrivenHeight({
|
|
1289
|
+
options: callerH === void 0 || !heightOmitted(options2.size) ? options2 : {},
|
|
1290
|
+
width: size.width,
|
|
1291
|
+
height: size.height,
|
|
1292
|
+
chromeH: size.height - plot.h,
|
|
1293
|
+
rowsH: y - plot.y + 4,
|
|
1294
|
+
...callerH === void 0 ? {} : { ceiling: callerH }
|
|
1295
|
+
});
|
|
1296
|
+
if (grow !== void 0) {
|
|
1297
|
+
size = { width: size.width, height: grow }, options2 = { ...options2, size };
|
|
1298
|
+
continue;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
let targetSize = options2[TARGET_SIZE];
|
|
1302
|
+
if (!sizingOnly && targetSize?.fixed.height === !1 && size.width === targetSize.sizePx.width && size.height === targetSize.sizePx.height) {
|
|
1303
|
+
let height = tableSizing(size, plot, y, totalW, 0).naturalHeight;
|
|
1304
|
+
if (height !== size.height) {
|
|
1305
|
+
let nextSize = { width: size.width, height }, nextFramePlan = sharedTableFrame(table, { ...frameInput, size: nextSize }), nextFrame = nextFramePlan.frame;
|
|
1306
|
+
nextFrame.plot.x === plot.x && nextFrame.plot.y === plot.y && nextFrame.plot.w === plot.w && tableSizing(nextSize, nextFrame.plot, y, totalW, 0).naturalHeight === height && (size = nextSize, framePlan = nextFramePlan, frame = nextFrame, plot = frame.plot);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
y > plot.y + plot.h && warnings2.push({
|
|
1310
|
+
code: "table-overflow",
|
|
1311
|
+
severity: "error",
|
|
1312
|
+
message: `${rows.length} rows exceed the plot height at density '${density}' \u2014 use 'compact', fewer rows, or a taller size`
|
|
1313
|
+
});
|
|
1314
|
+
let wrapFits = !1;
|
|
1315
|
+
if (widthPlan.wouldWrap.length > 0 && size.width - plot.w + sumOf(sizingMinimums) > size.width)
|
|
1316
|
+
if (options2[VERIFY_ADVICE]) {
|
|
1317
|
+
let ids = new Set(widthPlan.wouldWrap.map((col) => col.id)), wrapped = { ...authoredData, columns: authoredData.columns.map((col) => ids.has(col.id) ? { ...col, wrap: !0 } : col) };
|
|
1318
|
+
wrapFits = !missesFrame(layoutTable(wrapped, options2), options2);
|
|
1319
|
+
} else
|
|
1320
|
+
wrapFits = widthPlan.wrapMinimumWidth === void 0 || widthPlan.wrapMinimumWidth <= plot.w;
|
|
1321
|
+
let sizing = {
|
|
1322
|
+
...tableSizing(size, plot, y, totalW, minimumW),
|
|
1323
|
+
...wrapFits ? { hint: `Or set wrap: true on text column ${widthPlan.wouldWrap.map((col) => `'${col.id}'`).join(", ")}: its cells then take as many lines as they need instead of one line's width.` } : {}
|
|
1324
|
+
};
|
|
1325
|
+
if (sizingOnly || wantsScene !== void 0) {
|
|
1326
|
+
let probe = sizingProbe2(sizing, { table: { x: gridX, y: gridY, w: tableW, h: naturalTableH }, columns: cols.map((col) => ({ id: col.id, ...colX.get(col.id) })), rows: [], headerBand: { x: gridX, y: gridY, w: tableW, h: headerH } });
|
|
1327
|
+
if (sizingOnly || !wantsScene(probe)) return probe;
|
|
1328
|
+
}
|
|
1329
|
+
let tableH = naturalTableH;
|
|
1330
|
+
if (options2.heightFill !== "none" && fixedHeightCanvas(options2) && ladder.rowHeight === void 0 && figures) {
|
|
1331
|
+
let leaves = rows.filter(isLeafRow), room = Math.min(...leaves.map((row) => 2 * (TABLE_PAD_MAX - levelPad(row.step, !1)))), extra = spareShare(plot.y + plot.h - y - 4 - STANDOFF_BELOW, leaves.length, room, !0);
|
|
1332
|
+
if (extra > 0) {
|
|
1333
|
+
let shift = 0;
|
|
1334
|
+
for (let row of rows) {
|
|
1335
|
+
let at = rowY.get(row.id), h = isLeafRow(row) ? at.h + extra : at.h;
|
|
1336
|
+
rowY.set(row.id, { y: at.y + shift, h }), isLeafRow(row) && (shift += extra);
|
|
1337
|
+
}
|
|
1338
|
+
tableH += shift;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
let geometry = {
|
|
1342
|
+
type: "table",
|
|
1343
|
+
size,
|
|
1344
|
+
sizing,
|
|
1345
|
+
plot,
|
|
1346
|
+
scene: [],
|
|
1347
|
+
labels: [],
|
|
1348
|
+
axes: [],
|
|
1349
|
+
annotations: [],
|
|
1350
|
+
frame: frame.frame,
|
|
1351
|
+
marks: {
|
|
1352
|
+
table: { x: gridX, y: gridY, w: tableW, h: tableH },
|
|
1353
|
+
headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
|
|
1354
|
+
columns: cols.map((col) => ({ id: col.id, ...colX.get(col.id) })),
|
|
1355
|
+
rows: rows.map((row) => ({ id: row.id, ...rowY.get(row.id) }))
|
|
1356
|
+
},
|
|
1357
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
1358
|
+
a11y: tableA11y(options2, dataRows.length, cols.length),
|
|
1359
|
+
warnings: warnings2,
|
|
1360
|
+
paintWarningRules: void 0,
|
|
1361
|
+
debug: { occupied: [], decisions: [] }
|
|
1362
|
+
}, plannedWarnings = [...warnings2];
|
|
1363
|
+
return cellPads.set(geometry, cellPadX2), deferLayout(geometry, () => {
|
|
1364
|
+
warnings2 = [...plannedWarnings];
|
|
1365
|
+
let nodes = [...frame.nodes];
|
|
1366
|
+
plannedCuts();
|
|
1367
|
+
let numericStats = /* @__PURE__ */ new Map();
|
|
1368
|
+
for (let col of cols) {
|
|
1369
|
+
if (col.kind !== "value" && col.kind !== "computed") continue;
|
|
1370
|
+
let values = [], textReserve = 0;
|
|
1371
|
+
for (let row of rows) {
|
|
1372
|
+
let cell = row.cells[col.id];
|
|
1373
|
+
cell && (cell.state === "value" && typeof cell.raw == "number" && values.push(cell.raw), textReserve = Math.max(textReserve, measure(cell.displayed, figureFont(cellFont(cell), cellDrawsTabular(theme, col.kind, cell.displayed))).width));
|
|
1374
|
+
}
|
|
1375
|
+
let signed = col.kind === "computed" && !!col.polarity || (col.format ? parseFormatExample(col.format).signed : !1);
|
|
1376
|
+
numericStats.set(col.id, {
|
|
1377
|
+
min: values.length > 0 ? minOf(values) : 0,
|
|
1378
|
+
max: values.length > 0 ? maxOf(values) : 0,
|
|
1379
|
+
maxAbs: values.length > 0 ? maxOf(values.map((value) => Math.abs(value))) : 0,
|
|
1380
|
+
textReserve,
|
|
1381
|
+
signed
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
let sparkDomains = sparklineDomains(cols, rows);
|
|
1385
|
+
if (hasGroupHeads) {
|
|
1386
|
+
let headingFrom = -1 / 0, headingEnd = -1 / 0;
|
|
1387
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
1388
|
+
if (spans[groupIndex].span === 0 || g.heading === !1) continue;
|
|
1389
|
+
let tracks = g.columnIds.filter((columnId) => colX.has(columnId)).map((columnId) => colX.get(columnId)), first = tracks.reduce((a, b) => b.x < a.x ? b : a), last = tracks.reduce((a, b) => b.x + b.w > a.x + a.w ? b : a), cx = Math.round(first.x + (last.x + last.w - first.x) / 2), bracketY = groupPad === void 0 ? gridY + headerGroupH - 3 + CRISP : gridY + groupPad.top + groupExtraH + ladder.headBox(fonts.group.size) + CRISP, label = groupHeadingLabel(g.label), lineCount = groupLineCount(g.id), labelY = groupPad === void 0 ? bracketY - 4 - fonts.group.size * 1.2 - (lineCount - 1) * groupLineH : gridY + groupPad.top + groupExtraH - (lineCount - 1) * groupLineH + (ladder.headBox(fonts.group.size) - fonts.group.size * 1.2) / 2, spacedNote = groupHeadingNote(g.note), faces = groupHeadingFaces(fonts.group), noteFont = faces.note, measured = groupHeadingWidth(g, faces, measure), note = spacedNote?.trimStart(), noteOffset = measured.label + (note === void 0 ? 0 : measured.note - measure(note, noteFont).width), labelW = measured.label + measured.note, spanStart = Math.round(first.x + cellPadX2), spanEnd = Math.round(last.x + last.w - cellPadX2), wrap = groupWraps.get(g.id);
|
|
1390
|
+
if (wrap !== void 0) {
|
|
1391
|
+
let align = groupAlign === "left" ? "start" : groupAlign === "right" ? "end" : "middle", anchorX = align === "start" ? spanStart : align === "end" ? spanEnd : cx;
|
|
1392
|
+
nodes.push({
|
|
1393
|
+
t: "text",
|
|
1394
|
+
typeRole: "axis",
|
|
1395
|
+
id: `group:${g.id}`,
|
|
1396
|
+
x: anchorX,
|
|
1397
|
+
y: labelY,
|
|
1398
|
+
lines: wrap.label,
|
|
1399
|
+
align,
|
|
1400
|
+
font: fonts.group,
|
|
1401
|
+
ink: tableInk("head"),
|
|
1402
|
+
owner: {},
|
|
1403
|
+
part: "tableGroupHeader"
|
|
1404
|
+
}), wrap.note !== void 0 && nodes.push({
|
|
1405
|
+
t: "text",
|
|
1406
|
+
typeRole: "footnote",
|
|
1407
|
+
id: `group-note:${g.id}`,
|
|
1408
|
+
x: anchorX,
|
|
1409
|
+
y: labelY + wrap.label.length * groupLineH,
|
|
1410
|
+
lines: [wrap.note],
|
|
1411
|
+
align,
|
|
1412
|
+
font: noteFont,
|
|
1413
|
+
ink: tableInk("secondary"),
|
|
1414
|
+
owner: {},
|
|
1415
|
+
part: "tableGroupHeader"
|
|
1416
|
+
});
|
|
1417
|
+
let textW = Math.max(
|
|
1418
|
+
...wrap.label.map((line) => measure(line, fonts.group).width),
|
|
1419
|
+
wrap.note === void 0 ? 0 : measure(wrap.note, noteFont).width
|
|
1420
|
+
), textStart = align === "start" ? spanStart : Math.round(align === "end" ? spanEnd - textW : cx - textW / 2);
|
|
1421
|
+
nodes.push({
|
|
1422
|
+
t: "line",
|
|
1423
|
+
id: `group-rule:${g.id}`,
|
|
1424
|
+
x1: spanRule ? spanStart : textStart,
|
|
1425
|
+
y1: bracketY,
|
|
1426
|
+
x2: spanRule ? spanEnd : Math.round(textStart + textW),
|
|
1427
|
+
y2: bracketY,
|
|
1428
|
+
stroke: tableRuleInk(),
|
|
1429
|
+
width: rowRuleWidth,
|
|
1430
|
+
owner: {},
|
|
1431
|
+
part: "tableGroupRule"
|
|
1432
|
+
}), headingFrom = first.x, headingEnd = spanEnd;
|
|
1433
|
+
continue;
|
|
1434
|
+
}
|
|
1435
|
+
let overflows = labelW > spanEnd - spanStart, centred = groupAlign === "center" && !overflows, clear = first.x > headingFrom ? Math.round(headingEnd + fonts.group.size) : -1 / 0, startX = overflows || groupAlign === "left" ? Math.max(spanStart, clear) : Math.round(groupAlign === "right" ? spanEnd - labelW : cx - labelW / 2);
|
|
1436
|
+
headingFrom = first.x, headingEnd = centred ? cx + labelW / 2 : startX + labelW, centred ? note === void 0 ? nodes.push({
|
|
1437
|
+
t: "text",
|
|
1438
|
+
typeRole: "axis",
|
|
1439
|
+
id: `group:${g.id}`,
|
|
1440
|
+
x: cx,
|
|
1441
|
+
y: labelY,
|
|
1442
|
+
lines: [label],
|
|
1443
|
+
align: "middle",
|
|
1444
|
+
font: fonts.group,
|
|
1445
|
+
ink: tableInk("head"),
|
|
1446
|
+
owner: {},
|
|
1447
|
+
part: "tableGroupHeader"
|
|
1448
|
+
}) : (nodes.push({
|
|
1449
|
+
t: "text",
|
|
1450
|
+
typeRole: "axis",
|
|
1451
|
+
id: `group:${g.id}`,
|
|
1452
|
+
x: startX,
|
|
1453
|
+
y: labelY,
|
|
1454
|
+
lines: [label],
|
|
1455
|
+
align: "start",
|
|
1456
|
+
font: fonts.group,
|
|
1457
|
+
ink: tableInk("head"),
|
|
1458
|
+
owner: {},
|
|
1459
|
+
part: "tableGroupHeader"
|
|
1460
|
+
}), nodes.push({
|
|
1461
|
+
t: "text",
|
|
1462
|
+
typeRole: "footnote",
|
|
1463
|
+
id: `group-note:${g.id}`,
|
|
1464
|
+
x: startX + noteOffset,
|
|
1465
|
+
y: labelY,
|
|
1466
|
+
lines: [note],
|
|
1467
|
+
align: "start",
|
|
1468
|
+
font: noteFont,
|
|
1469
|
+
ink: tableInk("secondary"),
|
|
1470
|
+
owner: {},
|
|
1471
|
+
part: "tableGroupHeader"
|
|
1472
|
+
})) : (nodes.push({
|
|
1473
|
+
t: "text",
|
|
1474
|
+
typeRole: "axis",
|
|
1475
|
+
id: `group:${g.id}`,
|
|
1476
|
+
x: startX,
|
|
1477
|
+
y: labelY,
|
|
1478
|
+
lines: [label],
|
|
1479
|
+
align: "start",
|
|
1480
|
+
font: fonts.group,
|
|
1481
|
+
ink: tableInk("head"),
|
|
1482
|
+
owner: {},
|
|
1483
|
+
part: "tableGroupHeader"
|
|
1484
|
+
}), note !== void 0 && nodes.push({
|
|
1485
|
+
t: "text",
|
|
1486
|
+
typeRole: "footnote",
|
|
1487
|
+
id: `group-note:${g.id}`,
|
|
1488
|
+
x: startX + noteOffset,
|
|
1489
|
+
y: labelY,
|
|
1490
|
+
lines: [note],
|
|
1491
|
+
align: "start",
|
|
1492
|
+
font: noteFont,
|
|
1493
|
+
ink: tableInk("secondary"),
|
|
1494
|
+
owner: {},
|
|
1495
|
+
part: "tableGroupHeader"
|
|
1496
|
+
})), nodes.push({
|
|
1497
|
+
t: "line",
|
|
1498
|
+
id: `group-rule:${g.id}`,
|
|
1499
|
+
x1: spanRule ? spanStart : centred ? Math.round(cx - labelW / 2) : startX,
|
|
1500
|
+
y1: bracketY,
|
|
1501
|
+
// A heading wider than its block runs on, but the rule stops at the block's last column.
|
|
1502
|
+
x2: spanRule ? spanEnd : Math.round(centred ? cx + labelW / 2 : startX + labelW),
|
|
1503
|
+
y2: bracketY,
|
|
1504
|
+
stroke: tableRuleInk(),
|
|
1505
|
+
width: rowRuleWidth,
|
|
1506
|
+
owner: {},
|
|
1507
|
+
part: "tableGroupRule"
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
let headerRuleY = gridY + headerH - 1 + CRISP, headerSubY = headerRuleY - headPadBottom - headerSubH - fonts.header.size * 1.2 + fonts.header.size * 1.2;
|
|
1512
|
+
for (let col of headsDrawn ? cols : []) {
|
|
1513
|
+
if (!col.label && col.kind === "rowLabel") continue;
|
|
1514
|
+
let { x: cx, w } = colX.get(col.id), headAlign = col.headAlign ?? col.align, align = headAlign === "right" ? "end" : headAlign === "center" ? "middle" : "start", headerIndent = col.kind === "rowLabel" ? rowIndent(0) : 0, tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : cx + cellPadX2 + headerIndent, label = columnHeaderText(col).replace(/\u00a0/g, " ");
|
|
1515
|
+
nodes.push({
|
|
1516
|
+
t: "text",
|
|
1517
|
+
typeRole: "axis",
|
|
1518
|
+
id: `header:${col.id}`,
|
|
1519
|
+
x: tx,
|
|
1520
|
+
y: headerSubY - headerFits.get(col.id).h,
|
|
1521
|
+
lines: headerFits.get(col.id).lines,
|
|
1522
|
+
...headerFits.get(col.id).title ? { title: label } : {},
|
|
1523
|
+
align,
|
|
1524
|
+
font: fonts.header,
|
|
1525
|
+
ink: tableInk("head"),
|
|
1526
|
+
owner: { colId: col.id },
|
|
1527
|
+
part: "tableHeader"
|
|
1528
|
+
}), col.subLabel !== void 0 && nodes.push({
|
|
1529
|
+
t: "text",
|
|
1530
|
+
typeRole: "axis",
|
|
1531
|
+
id: `header-sub:${col.id}`,
|
|
1532
|
+
x: tx,
|
|
1533
|
+
y: headerSubY,
|
|
1534
|
+
lines: subFits.get(col.id).lines,
|
|
1535
|
+
...subFits.get(col.id).title ? { title: col.subLabel } : {},
|
|
1536
|
+
align,
|
|
1537
|
+
font: fonts.sub,
|
|
1538
|
+
ink: tableInk("subLabel"),
|
|
1539
|
+
owner: { colId: col.id },
|
|
1540
|
+
part: "tableHeaderSub"
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
headsDrawn && nodes.push({
|
|
1544
|
+
t: "line",
|
|
1545
|
+
id: "rule:header",
|
|
1546
|
+
x1: rowX,
|
|
1547
|
+
y1: headerRuleY,
|
|
1548
|
+
x2: rowX + rowW,
|
|
1549
|
+
y2: headerRuleY,
|
|
1550
|
+
// `table.headRule: 'ink'` closes the head on the text ink.
|
|
1551
|
+
stroke: { token: theme.table?.headRule === "ink" ? "ink" : "rule" },
|
|
1552
|
+
width: theme.table?.ruleWidths?.head ?? strokeToken(theme, "hair"),
|
|
1553
|
+
owner: {},
|
|
1554
|
+
part: "tableHeaderRule"
|
|
1555
|
+
});
|
|
1556
|
+
let bodyBottom = rowY.size > 0 ? maxOf([...rowY.values()].map((r) => r.y + r.h)) : gridY + headerH, spacerGaps = [];
|
|
1557
|
+
rows.forEach((row, index) => {
|
|
1558
|
+
if (index === 0 || row.spacer === void 0) return;
|
|
1559
|
+
let previous = rowY.get(rows[index - 1].id);
|
|
1560
|
+
spacerGaps.push({ from: previous.y + previous.h, to: rowY.get(row.id).y });
|
|
1561
|
+
});
|
|
1562
|
+
let blockDivider = (id, columnId, fromY = gridY) => {
|
|
1563
|
+
let edge = colX.get(columnId)?.x;
|
|
1564
|
+
edge === void 0 || edge <= gridX || dividerAt(id, Math.round(edge) + CRISP, fromY);
|
|
1565
|
+
};
|
|
1566
|
+
function dividerAt(id, x, fromY) {
|
|
1567
|
+
if (nodes.some((node) => node.t === "line" && node.x1 === x && node.part === "tableGroupDivider")) return;
|
|
1568
|
+
let segments = [], start = fromY;
|
|
1569
|
+
for (let gap of spacerGaps)
|
|
1570
|
+
gap.from <= start || (segments.push([start, Math.round(gap.from) + CRISP]), start = Math.round(gap.to));
|
|
1571
|
+
segments.push([start, Math.round(bodyBottom) + CRISP]), segments.forEach(([y1, y2], index) => nodes.push({
|
|
1572
|
+
t: "line",
|
|
1573
|
+
id: index === 0 ? id : `${id}:${index}`,
|
|
1574
|
+
x1: x,
|
|
1575
|
+
y1,
|
|
1576
|
+
x2: x,
|
|
1577
|
+
y2,
|
|
1578
|
+
stroke: tableRuleInk(),
|
|
1579
|
+
width: rowRuleWidth,
|
|
1580
|
+
owner: {},
|
|
1581
|
+
part: "tableGroupDivider"
|
|
1582
|
+
}));
|
|
1583
|
+
}
|
|
1584
|
+
if (hasGroups)
|
|
1585
|
+
for (let [groupIndex, g] of table.columnGroups.entries()) {
|
|
1586
|
+
if (groupIndex === 0 || spans[groupIndex].span === 0 || g.spacer !== void 0 && g.spacer > 0) continue;
|
|
1587
|
+
let firstVisible = g.columnIds.find((columnId) => colX.has(columnId));
|
|
1588
|
+
firstVisible !== void 0 && blockDivider(`rule:group-divider:${g.id}`, firstVisible);
|
|
1589
|
+
}
|
|
1590
|
+
for (let run of bandedColumnRuns)
|
|
1591
|
+
blockDivider(`rule:band-divider:${run.columnIds[0]}`, run.columnIds[0], gridY + headerGroupH);
|
|
1592
|
+
let closeBlock = (id, lastId, fromY) => {
|
|
1593
|
+
let index = cols.findIndex((col) => col.id === lastId), next = cols[index + 1];
|
|
1594
|
+
if (next !== void 0) {
|
|
1595
|
+
let nextGroup = table.columnGroups.find((group) => group.columnIds.includes(next.id));
|
|
1596
|
+
nextGroup !== void 0 && (nextGroup.spacer ?? 0) > 0 && nextGroup.columnIds.find((columnId) => colX.has(columnId)) === next.id || blockDivider(id, next.id, fromY);
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
if (options2.rowExtent !== "frame") return;
|
|
1600
|
+
let last = colX.get(lastId);
|
|
1601
|
+
dividerAt(id, Math.round(last.x + last.w) - 1 + CRISP, fromY);
|
|
1602
|
+
};
|
|
1603
|
+
for (let group of table.columnGroups) {
|
|
1604
|
+
if (group.band !== !0) continue;
|
|
1605
|
+
let visible = group.columnIds.filter((columnId) => colX.has(columnId));
|
|
1606
|
+
visible.length > 0 && closeBlock(`rule:band-close:${group.id}`, visible[visible.length - 1], gridY);
|
|
1607
|
+
}
|
|
1608
|
+
for (let run of bandedColumnRuns)
|
|
1609
|
+
closeBlock(`rule:band-close:${run.columnIds[run.columnIds.length - 1]}`, run.columnIds[run.columnIds.length - 1], gridY + headerGroupH);
|
|
1610
|
+
let bandPaint = semanticPalettePaint(theme, options2.palette, "neutral", 1 - surface.bandTint), totalGroundPaint = semanticPalettePaint(
|
|
1611
|
+
theme,
|
|
1612
|
+
options2.palette,
|
|
1613
|
+
"neutral",
|
|
1614
|
+
1 - Math.min(1, surface.bandTint * 2)
|
|
1615
|
+
), strongColumnBandPaint = {
|
|
1616
|
+
token: "neutral",
|
|
1617
|
+
theme: { kind: "mix", from: { token: "ink" }, to: totalGroundPaint, weight: surface.bandTint }
|
|
1618
|
+
}, grounds = rowGrounds(table), columnBandFills = /* @__PURE__ */ new Map(), rowWashes = /* @__PURE__ */ new Map(), bandedGroups = table.columnGroups.filter((g) => g.band === !0), dividerXs = new Set(nodes.flatMap((node) => node.t === "line" && node.part === "tableGroupDivider" && node.width > 0 ? [node.x1] : [])), bandRect = (g) => {
|
|
1619
|
+
let visible = g.columnIds.filter((columnId) => colX.has(columnId));
|
|
1620
|
+
if (visible.length === 0) return;
|
|
1621
|
+
let first = colX.get(visible[0]), last = colX.get(visible[visible.length - 1]), x = dividerXs.has(Math.round(first.x) + CRISP) ? Math.round(first.x) + 1 : first.x;
|
|
1622
|
+
return { x, w: last.x + last.w - x };
|
|
1623
|
+
}, groundMode = options2.groupGround ?? theme.table?.groupGround ?? "expanded", groundShown = (open) => groundMode === "always" || groundMode === "expanded" && open, closers = finalClosers(rows), totalGroundless = theme.table?.grounds?.total !== void 0 && transparentCss(theme.table.grounds.total), rowById = new Map(rows.map((row) => [row.id, row])), topOf = (row) => {
|
|
1624
|
+
let top = row;
|
|
1625
|
+
for (; top.parentId !== void 0 && rowById.has(top.parentId); ) top = rowById.get(top.parentId);
|
|
1626
|
+
return top;
|
|
1627
|
+
}, blockRuled = /* @__PURE__ */ new Set(), opensBlock = (row) => row.parentId === void 0 && row.role !== "section" && expandedIds.has(row.id), blockRuleAbove = (row, next) => theme.table?.blockRule === "rule" && next.parentId === void 0 && (opensBlock(next) || next.id !== topOf(row).id && opensBlock(topOf(row))), lastRow = rows[rows.length - 1];
|
|
1628
|
+
rows.forEach((row, ri) => {
|
|
1629
|
+
let { y: ry, h: rh } = rowY.get(row.id), isTotal = isTotalRow(row), isSection = row.role === "section", ground = row.kind === "member" ? expandedIds.has(row.id) && groundMode !== "none" ? "band" : void 0 : row.kind === "measure" || row.kind === "detail" || row.kind === "split" || row.kind === "subtotal" || row.kind === "result" || row.kind === "driver" ? void 0 : isTotal ? "emphasis" : language.groupBand && groundShown(expandedIds.has(row.id)) ? grounds.get(row.id) : void 0;
|
|
1630
|
+
ri > 0 && row.kind === "member" ? nodes.push(rule(`rule:member:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableMemberRule")) : ri > 0 && row.divider && nodes.push(rule(`rule:divider:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableDividerRule"));
|
|
1631
|
+
let customGround = authoredGround(row, isTotal);
|
|
1632
|
+
if (customGround !== void 0 && nodes.push({ t: "rect", id: `statementground:${row.id}`, rect: { x: rowX, y: ry, w: rowW, h: rh }, fill: { css: customGround }, owner: { rowId: row.id }, part: "tableStatementGround" }), row.kind === "result" && theme.table?.resultRule !== "none" && nodes.push(rule(`rule:result:${row.id}`, ry, { token: theme.table?.resultRule === "rule" ? "rule" : "ink" }, strokeToken(theme, "hair"), "tableResultRule")), ground !== void 0 && customGround === void 0 && !(isTotal && totalGroundless)) {
|
|
1633
|
+
let part = isTotal ? "tableTotalGround" : ground === "emphasis" ? "tableGroupGround" : "tableGroupBand";
|
|
1634
|
+
nodes.push({
|
|
1635
|
+
t: "rect",
|
|
1636
|
+
id: `${isTotal ? "totalground" : ground === "emphasis" ? "groupground" : "groupband"}:${row.id}`,
|
|
1637
|
+
rect: blockRuled.has(row.id) ? { x: rowX, y: ry + 1, w: rowW, h: rh - 1 } : { x: rowX, y: ry, w: rowW, h: rh },
|
|
1638
|
+
fill: isTotal ? totalGroundPaint : bandPaint,
|
|
1639
|
+
owner: { rowId: row.id },
|
|
1640
|
+
part
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
for (let g of [...bandedGroups, ...bandedColumnRuns]) {
|
|
1644
|
+
let band = bandRect(g);
|
|
1645
|
+
if (band !== void 0) {
|
|
1646
|
+
for (let id of g.columnIds) columnBandFills.set(`${row.id}\0${id}`, ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint);
|
|
1647
|
+
nodes.push({
|
|
1648
|
+
t: "rect",
|
|
1649
|
+
id: `columnband:${"id" in g ? g.id : g.columnIds[0]}:${row.id}`,
|
|
1650
|
+
rect: { x: band.x, y: ry, w: band.w, h: rh },
|
|
1651
|
+
fill: ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint,
|
|
1652
|
+
owner: { rowId: row.id },
|
|
1653
|
+
part: "tableColumnBand"
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
let rowWash;
|
|
1658
|
+
if (options2.anchorWash && row.step === 0 && row.hasChildren && row.defaultExpanded && (rowWash = semanticPalettePaint(theme, options2.palette, "neutral", surface.anchorTint), nodes.push({
|
|
1659
|
+
t: "rect",
|
|
1660
|
+
id: `anchorwash:${row.id}`,
|
|
1661
|
+
rect: { x: rowX, y: ry, w: rowW, h: rh },
|
|
1662
|
+
fill: rowWash,
|
|
1663
|
+
owner: { rowId: row.id },
|
|
1664
|
+
part: "tableAnchorTint"
|
|
1665
|
+
})), row.highlightTone) {
|
|
1666
|
+
let tone = row.highlightTone, edgePaint = tone === "highlight" ? semanticPalettePaint(theme, options2.palette, "focus") : { token: tone };
|
|
1667
|
+
rowWash = tone === "highlight" ? semanticPalettePaint(theme, options2.palette, "focus", surface.rowTint) : { ...markRolePaint(tone, !0), tint: surface.rowTint }, nodes.push({
|
|
1668
|
+
t: "rect",
|
|
1669
|
+
id: `rowtint:${row.id}`,
|
|
1670
|
+
rect: { x: rowX, y: ry, w: rowW, h: rh },
|
|
1671
|
+
fill: rowWash,
|
|
1672
|
+
owner: { rowId: row.id },
|
|
1673
|
+
part: "tableRowTint"
|
|
1674
|
+
}), nodes.push({
|
|
1675
|
+
t: "rect",
|
|
1676
|
+
id: `rowedge:${row.id}`,
|
|
1677
|
+
rect: { x: rowX, y: ry, w: 3, h: rh },
|
|
1678
|
+
fill: edgePaint,
|
|
1679
|
+
owner: { rowId: row.id },
|
|
1680
|
+
part: "tableRowEdge"
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
rowWash !== void 0 && rowWashes.set(row.id, rowWash);
|
|
1684
|
+
for (let col of cols) {
|
|
1685
|
+
let cell = row.cells[col.id];
|
|
1686
|
+
if (!cell) continue;
|
|
1687
|
+
let { x: cx, w } = colX.get(col.id);
|
|
1688
|
+
if (col.kind === "encoding") {
|
|
1689
|
+
pushAll(
|
|
1690
|
+
nodes,
|
|
1691
|
+
encodingSparklineNodes(col, row, { x: cx, y: ry, w, h: rh }, theme, options2.palette, measure, sparkDomains.get(col.id), options2.locale?.language)
|
|
1692
|
+
);
|
|
1693
|
+
continue;
|
|
1694
|
+
}
|
|
1695
|
+
if (labelOnlyRow(row, expandedIds) && col.kind !== "rowLabel") continue;
|
|
1696
|
+
let drop = isSection ? Math.max(0, rh - sectionNatural() - (rowExtra.get(row.id) ?? 0)) : 0;
|
|
1697
|
+
emitCell(cell, row, col.id, cx, w, ry + drop, rh - drop, isTotal, isSection);
|
|
1698
|
+
}
|
|
1699
|
+
let isLast = row.id === lastRow?.id, next = rows[ri + 1], spacedNext = next?.spacer !== void 0;
|
|
1700
|
+
if (closers.has(row.id)) {
|
|
1701
|
+
let finalRule = theme.table?.finalRule ?? "double";
|
|
1702
|
+
finalRule === "double" ? (nodes.push(rule(`rule:final:${row.id}:1`, ry + rh - 2, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule")), nodes.push(rule(`rule:final:${row.id}:2`, ry + rh, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule"))) : finalRule === "rule" && nodes.push(rule(`rule:final:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "hair"), "tableFinalRule"));
|
|
1703
|
+
} else if (next?.kind !== "result") {
|
|
1704
|
+
if (spacedNext && next.role === "total")
|
|
1705
|
+
nodes.push(rule(`rule:pre-total:${next.id}`, rowY.get(next.id).y, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")), isTotal && nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
|
|
1706
|
+
else if (!(spacedNext && !isTotal))
|
|
1707
|
+
if (isTotal && next)
|
|
1708
|
+
nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
|
|
1709
|
+
else if (isLast) {
|
|
1710
|
+
let close = isTotal ? "rule" : theme.table?.closeRule ?? "rule";
|
|
1711
|
+
close !== "none" && nodes.push(rule("rule:close", ry + rh, close === "grid" ? tableRuleInk() : { token: close }, close === "grid" ? rowRuleWidth : strokeToken(theme, "rule"), "tableCloseRule"));
|
|
1712
|
+
} else next?.role === "total" ? nodes.push(rule(`rule:pre-total:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")) : isSection && heavySectionRule || (isSection ? nodes.push(rule(`rule:section:${row.id}`, ry + rh, theme.table?.headRule === "ink" ? { token: "ink" } : tableRuleInk(), rowRuleWidth, "tableSectionRule")) : next !== void 0 && blockRuleAbove(row, next) ? (nodes.push(rule(`rule:block:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableBlockRule")), blockRuled.add(next.id)) : nodes.push(rule(`rule:row:${row.id}`, ry + rh, rowRule.paint, rowRule.width, "tableRowRule")));
|
|
1713
|
+
}
|
|
1714
|
+
let ruleRefused = isLast && theme.table?.closeRule === "none" || next?.kind === "result" && theme.table?.resultRule === "none";
|
|
1715
|
+
if (isSection && heavySectionRule && !ruleRefused) {
|
|
1716
|
+
let atY = Math.round(ry + rh) + ruleSpace - sectionRuleSpace / 2;
|
|
1717
|
+
nodes.push({ t: "line", id: `rule:section:${row.id}`, x1: rowX, y1: atY, x2: rowX + rowW, y2: atY, stroke: { token: "ink" }, width: sectionRuleWidth, owner: {}, part: "tableSectionRule" });
|
|
1718
|
+
}
|
|
1719
|
+
});
|
|
1720
|
+
function rule(id, atY, stroke, width, part) {
|
|
1721
|
+
let yCrisp = Math.round(atY) + CRISP;
|
|
1722
|
+
return { t: "line", id, x1: rowX, y1: yCrisp, x2: rowX + rowW, y2: yCrisp, stroke, width, owner: {}, part };
|
|
1723
|
+
}
|
|
1724
|
+
function usesTotalFace(kind) {
|
|
1725
|
+
return kind === void 0 ? !0 : kind === "subtotal" || kind === "result" || kind === "driver" ? !1 : kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0;
|
|
1726
|
+
}
|
|
1727
|
+
function emitStatusMark(cell, row, col, cx, w, ry, rh) {
|
|
1728
|
+
let owner = { rowId: row.id, colId: col.id }, square = statusSquare(fonts.body.size), side = Math.min(square.side, Math.max(0, w - 2));
|
|
1729
|
+
nodes.push({
|
|
1730
|
+
t: "rect",
|
|
1731
|
+
id: tableCellNodeId("chip", row.id, col.id),
|
|
1732
|
+
rect: { x: Math.round(cx + (w - side) / 2), y: Math.round(ry + (rh - side) / 2), w: side, h: side },
|
|
1733
|
+
fill: statusSquarePaint(cell.tone),
|
|
1734
|
+
owner,
|
|
1735
|
+
part: "tableChip",
|
|
1736
|
+
title: cell.displayed,
|
|
1737
|
+
display: { state: cell.displayed }
|
|
1738
|
+
}), noteStatusCut(col, row, "", cell.displayed);
|
|
1739
|
+
}
|
|
1740
|
+
function authoredGround(row, isTotal) {
|
|
1741
|
+
let css = row.kind === "subtotal" ? theme.table?.grounds?.subtotal : isTotal ? theme.table?.grounds?.total : void 0;
|
|
1742
|
+
return css === void 0 || transparentCss(css) ? void 0 : css;
|
|
1743
|
+
}
|
|
1744
|
+
function groundInk(ground, ink, tone) {
|
|
1745
|
+
if (ground === void 0 || "theme" in ink && ink.theme?.kind === "ground-text") return ink;
|
|
1746
|
+
let paint = onTableGround(ink, ground, tone), key = JSON.stringify(paint), known = groundTexts.get(key);
|
|
1747
|
+
return known !== void 0 ? known : (groundTexts.set(key, paint), paint);
|
|
1748
|
+
}
|
|
1749
|
+
function toneInk(ground, tone) {
|
|
1750
|
+
return groundInk(ground, toneTextPaint(theme, tone, options2.palette), tone);
|
|
1751
|
+
}
|
|
1752
|
+
function emitCell(cell, row, colId, cx, w, ry, rh, isTotal, isSection) {
|
|
1753
|
+
let rowId = row.id, col = cols.find((c) => c.id === colId), font = cellFont(cell), owner = { rowId, colId };
|
|
1754
|
+
cell.state === "open" && nodes.push({ t: "rect", id: tableCellNodeId("openground", rowId, colId), rect: { x: cx, y: ry, w, h: rh }, fill: bandPaint, owner, part: "tableOpenGround" });
|
|
1755
|
+
let inline = inlineBlock(row), valueBox = lineBox(font.size), head = inline.extra > 0 || affixBelow.has(rowId) ? labelHead.get(rowId) ?? 0 : 0, blockTop = ry + Math.max(0, (rh - ruleSpace - (valueBox + head + inline.extra)) / 2), figureCell = isFigureCell(cell, col), tintBox = { x: cx + 1, y: ry + ruleSpace + 1, w: Math.max(0, w - 2), h: Math.max(0, rh - ruleSpace - 2) }, toneFill = figureCell && cell.tone !== "neutral" && theme.table?.tones === "fill" && !isTotal ? tableGround(cell.tone === "good" && cell.strong ? "goodStrong" : cell.tone) : void 0;
|
|
1756
|
+
toneFill !== void 0 && nodes.push({ t: "rect", id: tableCellNodeId("toneground", rowId, colId), rect: tintBox, fill: toneFill, owner, part: "tableToneGround" });
|
|
1757
|
+
let rowGround = authoredGround(row, isTotal), columnBand = columnBandFills.get(`${rowId}\0${colId}`), textGround = toneFill ?? (rowGround === void 0 ? columnBand === strongColumnBandPaint && !rowWashes.has(rowId) ? columnBand : void 0 : rowWashes.get(rowId) ?? columnBand ?? { css: rowGround });
|
|
1758
|
+
if (figureCell && cell.bar !== void 0 && cell.bar > 0) {
|
|
1759
|
+
let top = (inline.extra + head > 0 ? blockTop : ry + (rh - ruleSpace - valueBox) / 2) + 2;
|
|
1760
|
+
nodes.push({ t: "rect", id: tableCellNodeId("sizebar", rowId, colId), rect: { x: cx + 1, y: top, w: (w - 1) * cell.bar, h: valueBox - 4 }, fill: { token: "background", theme: { kind: "table-ground", ground: col.emphasis === "muted" ? "barMuted" : "bar" } }, owner, part: "tableSizeBar" });
|
|
1761
|
+
}
|
|
1762
|
+
let stacked = inline.extra + head > 0, textY = stacked ? blockTop + (valueBox - font.size * 1.2) / 2 : ry + (rh - font.size * 1.2) / 2, contentX = cx + cellPadX2, contentW = (isSection ? tableW - (cx - gridX) : w) - 2 * cellPadX2;
|
|
1763
|
+
if (cell.kind === "status" && cell.state === "value" && col.statusMark === "square") {
|
|
1764
|
+
let square = statusSquare(fonts.body.size), fit = statusFit(col, cell.displayed, fonts.body, w - 2 * cellPadX2 - square.side - square.gap, w - square.side - square.gap);
|
|
1765
|
+
if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
|
|
1766
|
+
let { text: label, title } = fit;
|
|
1767
|
+
title !== void 0 && noteStatusCut(col, row, label, title);
|
|
1768
|
+
let groupW = square.side + square.gap + measure(label, fonts.body).width, markX = Math.round(cx + (w - groupW) / 2);
|
|
1769
|
+
nodes.push({
|
|
1770
|
+
t: "rect",
|
|
1771
|
+
id: tableCellNodeId("chip", rowId, colId),
|
|
1772
|
+
rect: { x: markX, y: Math.round(ry + (rh - square.side) / 2), w: square.side, h: square.side },
|
|
1773
|
+
fill: statusSquarePaint(cell.tone),
|
|
1774
|
+
owner,
|
|
1775
|
+
part: "tableChip"
|
|
1776
|
+
}), nodes.push({
|
|
1777
|
+
t: "text",
|
|
1778
|
+
typeRole: "label",
|
|
1779
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1780
|
+
x: markX + square.side + square.gap,
|
|
1781
|
+
y: ry + (rh - fonts.body.size * 1.2) / 2,
|
|
1782
|
+
lines: [label],
|
|
1783
|
+
align: "start",
|
|
1784
|
+
font: fonts.body,
|
|
1785
|
+
ink: groundInk(textGround, { token: "ink" }),
|
|
1786
|
+
owner,
|
|
1787
|
+
part: "tableCell",
|
|
1788
|
+
role: "category",
|
|
1789
|
+
display: { state: cell.displayed },
|
|
1790
|
+
...title === void 0 ? {} : { title }
|
|
1791
|
+
});
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
if (cell.kind === "status" && cell.state === "value") {
|
|
1795
|
+
let fit = statusFit(col, cell.displayed, fonts.chip, w - 2 * cellPadX2 - 2 * CHIP_PAD_X, w - 2 * CHIP_PAD_X);
|
|
1796
|
+
if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
|
|
1797
|
+
let { text: label, title } = fit;
|
|
1798
|
+
title !== void 0 && noteStatusCut(col, row, label, title);
|
|
1799
|
+
let tw = measure(label, fonts.chip).width, chipW = Math.round(tw + 2 * CHIP_PAD_X), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(cx + (w - chipW) / 2), chipY = Math.round(ry + (rh - chipH) / 2), chip = chipPaints(theme, cell.tone, options2.palette);
|
|
1800
|
+
nodes.push({
|
|
1801
|
+
t: "rect",
|
|
1802
|
+
id: tableCellNodeId("chip", rowId, colId),
|
|
1803
|
+
rect: { x: chipX, y: chipY, w: chipW, h: chipH },
|
|
1804
|
+
fill: chip.fill,
|
|
1805
|
+
// A status preset's chips are square; everywhere else they keep the
|
|
1806
|
+
// theme's chip radius.
|
|
1807
|
+
radius: language.squareChips ? 0 : surface.chipRadius,
|
|
1808
|
+
owner,
|
|
1809
|
+
part: "tableChip"
|
|
1810
|
+
}), nodes.push({
|
|
1811
|
+
t: "text",
|
|
1812
|
+
typeRole: "label",
|
|
1813
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1814
|
+
x: chipX + chipW / 2,
|
|
1815
|
+
y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
|
|
1816
|
+
lines: [label],
|
|
1817
|
+
align: "middle",
|
|
1818
|
+
font: fonts.chip,
|
|
1819
|
+
ink: chip.ink,
|
|
1820
|
+
owner,
|
|
1821
|
+
part: "tableCell",
|
|
1822
|
+
role: "category",
|
|
1823
|
+
display: { state: cell.displayed },
|
|
1824
|
+
...title === void 0 ? {} : { title }
|
|
1825
|
+
});
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
let indent = cell.kind === "rowLabel" ? rowIndent(indentStep(cell)) : 0, align = col.align === "right" ? "end" : col.align === "center" ? "middle" : "start", tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent, parentRow = cell.kind === "rowLabel" && row.hasChildren, expanded = parentRow && expandedIds.has(rowId);
|
|
1829
|
+
if (parentRow && options2.outlineMarks === !0 && row.foldable !== !1) {
|
|
1830
|
+
let boxed = (theme.table?.mark ?? (options2.variant === "steering" ? "boxed" : "bare")) === "boxed", mx = Math.round(Math.max(cx + 2, contentX + indent - operatorSlot - (theme.table?.toggle?.gap ?? (boxed ? 17 : 16)))), my = Math.round(stacked ? blockTop + (valueBox - MARK_SIZE) / 2 : ry + (rh - MARK_SIZE) / 2), toggleSize = theme.table?.toggle?.size ?? 11, boxY = my + (MARK_SIZE - toggleSize) / 2;
|
|
1831
|
+
boxed && nodes.push({ t: "path", id: `markbox:${rowId}`, d: `M${mx} ${boxY}h${toggleSize}v${toggleSize}h-${toggleSize}Z`, stroke: tableInk("toggle"), width: strokeToken(theme, "mark"), owner, part: "tableOutlineBox" }), nodes.push({
|
|
1832
|
+
t: "path",
|
|
1833
|
+
id: `mark:${rowId}`,
|
|
1834
|
+
d: boxed ? `M${mx + (toggleSize - 5) / 2} ${my + 4}h5${expanded ? "" : `M${mx + toggleSize / 2} ${my + 1.5}v5`}` : expanded ? `M${mx + 1} ${my + 4}h6` : `M${mx + 1} ${my + 4}h6M${mx + 4} ${my + 1}v6`,
|
|
1835
|
+
stroke: boxed ? { token: "ink" } : tableInk("toggle"),
|
|
1836
|
+
width: strokeToken(theme, "mark"),
|
|
1837
|
+
lineCap: "round",
|
|
1838
|
+
owner,
|
|
1839
|
+
part: "tableOutlineMark"
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
let badge = isSection && col.kind === "rowLabel" ? row.badge : void 0, badgeW = badge === void 0 ? 0 : Math.round(measure(badge.text, fonts.chip).width + 2 * CHIP_PAD_X), badgeReserve = badgeW === 0 ? 0 : badgeW + SECTION_CHIP_GAP, affixFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), weight: theme.type.label.weight, ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme), affixWidth = col.kind === "rowLabel" && row.unitAffix !== void 0 && !(row.kind === "member" && expandedIds.has(row.id)) ? theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, affixFont).width : measure(row.unitAffix, affixFont).width + (theme.table.qualifier.gap ?? 4) : 0, lineAffix = affixBelow.has(rowId) ? 0 : affixWidth, maxW = contentW - indent - badgeReserve - lineAffix - (cell.note && col.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), wrappedCell = wrappedLines.get(tableCellKey(rowId, colId)), { text, title: cutTitle } = plannedCellText.get(tableCellKey(rowId, colId)) ?? cellText(
|
|
1843
|
+
cell,
|
|
1844
|
+
col.kind,
|
|
1845
|
+
isSection,
|
|
1846
|
+
font,
|
|
1847
|
+
maxW,
|
|
1848
|
+
wrappedCell,
|
|
1849
|
+
cutTitles.get(tableCellKey(rowId, colId)),
|
|
1850
|
+
measure,
|
|
1851
|
+
theme.table?.section?.case
|
|
1852
|
+
), lines = wrappedCell ?? [text], sectionLabel = isSection && col.kind === "rowLabel";
|
|
1853
|
+
if (sectionLabel && align !== "start") {
|
|
1854
|
+
let groupW = measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + badgeReserve, start = contentX + indent;
|
|
1855
|
+
tx = align === "end" ? contentX + contentW - groupW : start + (contentX + contentW - start - groupW) / 2;
|
|
1856
|
+
}
|
|
1857
|
+
let drawnAlign = sectionLabel ? "start" : align, textTop = lines.length > 1 ? stacked ? blockTop : ry + (rh - lines.length * font.size * 1.2) / 2 : textY, drawnFont = cell.state !== "value" ? row.kind === "driver" ? kindFont(fonts.body, "driver", !1, theme) : fonts.body : isTotal && cell.kind !== "rowLabel" && usesTotalFace(row.kind) ? fonts.totalValue : col.emphasis === "strong" ? strongColumnFont(font, col, cell, row.kind, theme) : col.emphasis === "muted" && isCohortDensity(density) ? { ...font, weight: fonts.body.weight } : font, enc = col.cellEncoding, context = {
|
|
1858
|
+
cell,
|
|
1859
|
+
box: { x: cx, y: ry, w, h: rh },
|
|
1860
|
+
theme,
|
|
1861
|
+
...options2.palette === void 0 ? {} : { palette: options2.palette },
|
|
1862
|
+
...cell.tone === "neutral" || enc?.type !== "arrow" ? {} : { toneInk: toneInk(textGround, cell.tone) },
|
|
1863
|
+
measure,
|
|
1864
|
+
nodeId: (suffix) => tableCellNodeId(suffix, rowId, colId),
|
|
1865
|
+
owner
|
|
1866
|
+
}, stats = numericStats.get(colId), encodingInk, ownGround = hasPolarityBadge(cell, col), lane = heatLanes.get(colId);
|
|
1867
|
+
if ((col.kind === "value" || col.kind === "computed") && enc?.type === "heat" && lane) {
|
|
1868
|
+
let heat = emitHeat({ ...context, box: tintBox }, lane, enc), heatGround = heat.nodes.find((node) => node.t === "rect")?.fill;
|
|
1869
|
+
heatGround !== void 0 && (textGround = heatGround), nodes.push(...heat.nodes), !cell.deEmphasized && !(cell.relation === "ofWhich" && ofWhichMuted) && (encodingInk = heat.ink), heat.weight !== void 0 && !isTotal && (drawnFont = { ...drawnFont, weight: heat.weight });
|
|
1870
|
+
} else (col.kind === "value" || col.kind === "computed") && enc?.type === "inCellBar" && stats ? nodes.push(
|
|
1871
|
+
...emitInCellBar(context, {
|
|
1872
|
+
contentBox: { x: contentX, y: ry, w: contentW, h: rh },
|
|
1873
|
+
maxAbs: stats.maxAbs,
|
|
1874
|
+
textReserve: stats.textReserve
|
|
1875
|
+
})
|
|
1876
|
+
) : col.kind === "computed" && col.polarity && enc?.type === "arrow" && stats && nodes.push(...emitArrow(context, { scale: enc.scale, target: options2.target, textScale: textScaleOf(options2), font, maxAbs: stats.maxAbs, valueX: cx + w - cellPadX2 }));
|
|
1877
|
+
if (ownGround) {
|
|
1878
|
+
let badgeH = chipHeight(rh, font.size), tw = measure(text, figureFont(font, cellDrawsTabular(theme, col.kind, text))).width;
|
|
1879
|
+
nodes.push({
|
|
1880
|
+
t: "rect",
|
|
1881
|
+
id: tableCellNodeId("badge", rowId, colId),
|
|
1882
|
+
rect: {
|
|
1883
|
+
x: Math.round(cx + w - cellPadX2 - tw - 6),
|
|
1884
|
+
y: Math.round(textTop + (font.size * 1.2 - badgeH) / 2),
|
|
1885
|
+
w: Math.round(tw + 12),
|
|
1886
|
+
h: badgeH
|
|
1887
|
+
},
|
|
1888
|
+
fill: chipPaints(theme, cell.tone, options2.palette).fill,
|
|
1889
|
+
radius: surface.chipRadius,
|
|
1890
|
+
owner,
|
|
1891
|
+
part: "tableBadge"
|
|
1892
|
+
}), tx = cx + w - cellPadX2;
|
|
1893
|
+
}
|
|
1894
|
+
let isGlyph = cell.state !== "value", quiet = col.emphasis === "muted", driverToned = row.driverTone === !0 && cell.kind !== "rowLabel" && cell.state === "value" && cell.tone !== "neutral", plainInk = row.kind === "driver" && !driverToned ? tableInk("driver") : cell.kind === "rowLabel" && (row.kind === "detail" || row.kind === "split") ? tableInk("child") : isGlyph ? tableInk("secondary") : quiet ? tableInk("secondary") : isSection && sectionInk !== void 0 ? { token: sectionInk } : encodingInk ?? (cell.deEmphasized || cell.relation === "ofWhich" && ofWhichMuted ? tableInk("secondary") : cell.tone === "neutral" ? cell.zero ? tableInk("secondary") : tableInk(cell.kind === "rowLabel" ? "label" : "figure") : theme.table?.tones === "fill" && (col.kind === "value" || col.kind === "computed") && !isTotal ? tableInk("figure") : enc?.type === "polarityBadge" ? toneTextPaint(theme, cell.tone, options2.palette) : toneInk(textGround, cell.tone)), ink = ownGround ? polarityBadgeInk(theme, cell, col, row, options2.palette) : groundInk(textGround, plainInk), printsFigure = figures || !heatColumn(col) || isTotal;
|
|
1895
|
+
if (cell.kind === "rowLabel" && row.operator !== void 0 && operatorSlot > 0 && nodes.push({
|
|
1896
|
+
t: "text",
|
|
1897
|
+
id: `operator:${rowId}`,
|
|
1898
|
+
x: tx - operatorSlot,
|
|
1899
|
+
y: textTop,
|
|
1900
|
+
lines: [row.operator],
|
|
1901
|
+
align: "start",
|
|
1902
|
+
font,
|
|
1903
|
+
ink: groundInk(textGround, tableInk("operator")),
|
|
1904
|
+
owner,
|
|
1905
|
+
part: "tableOperator",
|
|
1906
|
+
typeRole: "label",
|
|
1907
|
+
role: "category"
|
|
1908
|
+
}), printsFigure && nodes.push({
|
|
1909
|
+
t: "text",
|
|
1910
|
+
typeRole: "label",
|
|
1911
|
+
id: tableCellNodeId("cell", rowId, colId),
|
|
1912
|
+
x: tx,
|
|
1913
|
+
y: textTop,
|
|
1914
|
+
lines,
|
|
1915
|
+
...cutTitle !== void 0 ? { title: cutTitle } : {},
|
|
1916
|
+
align: drawnAlign,
|
|
1917
|
+
font: drawnFont,
|
|
1918
|
+
ink,
|
|
1919
|
+
owner,
|
|
1920
|
+
part: "tableCell",
|
|
1921
|
+
...cellRole(col.kind, lines.join(" ")),
|
|
1922
|
+
...cell.displayed === "" ? {} : {
|
|
1923
|
+
display: cell.state === "value" ? { value: cell.displayed } : { state: cell.displayed }
|
|
1924
|
+
}
|
|
1925
|
+
}), inline.lines.length > 0 && (col.kind === "rowLabel" || col.kind === "value" || col.kind === "computed")) {
|
|
1926
|
+
let base = inline.note === void 0 ? 0 : 1, lineY = blockTop + valueBox + head + ladder.inlineGap + base * inline.box;
|
|
1927
|
+
for (let [index, line] of inline.lines.entries()) {
|
|
1928
|
+
let baseLineFont = changeLineFont(theme, ladder, row.step), driverLine = row.kind === "driver" || line.kind === "driver", lineFont = driverLine && theme.table?.driver?.italic !== !1 ? { ...baseLineFont, style: "italic" } : baseLineFont, lineCell = line.cells[colId], printed = col.kind === "rowLabel" ? ellipsize(line.label, lineFont, contentW - indent - INLINE_LABEL_INDENT, measure).text : lineCell?.displayed ?? "", y2 = lineY + (inline.box - lineFont.size * 1.2) / 2;
|
|
1929
|
+
if (lineY += inline.box, inline.noteSlots.get(colId) === base + index || !printed) continue;
|
|
1930
|
+
let toned = col.kind !== "rowLabel" && lineCell?.state === "value" && lineCell.tone !== "neutral";
|
|
1931
|
+
nodes.push({
|
|
1932
|
+
t: "text",
|
|
1933
|
+
typeRole: "label",
|
|
1934
|
+
id: tableCellNodeId("cellline", rowId, colId, line.id),
|
|
1935
|
+
// A line sits under its figure: a column's alignment seats both.
|
|
1936
|
+
x: col.kind === "rowLabel" && align === "start" ? contentX + indent + INLINE_LABEL_INDENT : align === "middle" ? cx + w / 2 : align === "start" ? contentX + indent : cx + w - cellPadX2,
|
|
1937
|
+
y: y2,
|
|
1938
|
+
lines: [printed],
|
|
1939
|
+
align,
|
|
1940
|
+
font: lineFont,
|
|
1941
|
+
ink: groundInk(textGround, driverLine && !(toned && (row.driverTone === !0 || line.driverTone === !0)) ? tableInk("driver") : toned && !(theme.table?.tones === "fill" && lineCell.tone === "warn") ? toneInk(textGround, lineCell.tone) : tableInk("secondary")),
|
|
1942
|
+
owner,
|
|
1943
|
+
part: "tableCellLine",
|
|
1944
|
+
...col.kind === "rowLabel" ? { role: "category" } : cellRole(col.kind, printed),
|
|
1945
|
+
...lineCell === void 0 || lineCell.displayed === "" || col.kind === "rowLabel" ? {} : { display: lineCell.state === "value" ? { value: lineCell.displayed } : { state: lineCell.displayed } }
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
if (affixWidth > 0 && nodes.push({
|
|
1950
|
+
t: "text",
|
|
1951
|
+
typeRole: "label",
|
|
1952
|
+
id: `unit:${rowId}`,
|
|
1953
|
+
// Measured in the face the label is drawn in: a bolder label measured in the body face ran
|
|
1954
|
+
// into its unit ("marginof product sales"). Under the label, the unit starts its own line.
|
|
1955
|
+
x: affixBelow.has(rowId) ? tx : tx + measure(lines[lines.length - 1] ?? text, drawnFont).width + Math.max(theme.table?.qualifier?.gap ?? 4, measure(" ", affixFont).width),
|
|
1956
|
+
// baseline lock: the affix shares the label's baseline exactly
|
|
1957
|
+
y: affixBelow.has(rowId) ? textTop + lines.length * font.size * 1.2 : textTop + (lines.length - 1) * font.size * 1.2 + (font.size - affixFont.size) * NOTE_BASELINE_LOCK,
|
|
1958
|
+
lines: [row.unitAffix],
|
|
1959
|
+
align: "start",
|
|
1960
|
+
font: affixFont,
|
|
1961
|
+
ink: groundInk(textGround, tableInk(row.kind === "driver" ? "driver" : "qualifier")),
|
|
1962
|
+
owner,
|
|
1963
|
+
part: "tableRowUnit",
|
|
1964
|
+
// A hoisted scale letter is a number's tail and takes the figures;
|
|
1965
|
+
// an authored unit is a phrase ("$ per order") and reads as prose,
|
|
1966
|
+
// which is the composed-role rule.
|
|
1967
|
+
role: composedTextRole(row.unitAffix, "caption")
|
|
1968
|
+
}), badge !== void 0) {
|
|
1969
|
+
let chip = chipPaints(theme, badge.tone, options2.palette), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(tx + measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + SECTION_CHIP_GAP), clearAbove = lines.length > 1 ? Math.ceil(textTop + (lines.length - 2) * font.size * 1.2 + font.size) : -1 / 0, chipY = Math.max(clearAbove, Math.round(textTop + (lines.length - 1) * font.size * 1.2 + (font.size * 1.2 - chipH) / 2));
|
|
1970
|
+
nodes.push({
|
|
1971
|
+
t: "rect",
|
|
1972
|
+
id: `sectionbadge:${rowId}`,
|
|
1973
|
+
rect: { x: chipX, y: chipY, w: badgeW, h: chipH },
|
|
1974
|
+
fill: chip.fill,
|
|
1975
|
+
radius: language.squareChips ? 0 : surface.chipRadius,
|
|
1976
|
+
owner,
|
|
1977
|
+
part: "tableSectionBadge"
|
|
1978
|
+
}), nodes.push({
|
|
1979
|
+
t: "text",
|
|
1980
|
+
typeRole: "label",
|
|
1981
|
+
id: `sectionbadge-text:${rowId}`,
|
|
1982
|
+
x: chipX + badgeW / 2,
|
|
1983
|
+
y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
|
|
1984
|
+
lines: [badge.text],
|
|
1985
|
+
align: "middle",
|
|
1986
|
+
font: fonts.chip,
|
|
1987
|
+
ink: chip.ink,
|
|
1988
|
+
owner,
|
|
1989
|
+
part: "tableSectionBadge",
|
|
1990
|
+
role: "category",
|
|
1991
|
+
display: { state: badge.text }
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
if (parentRow && !expanded && align === "start") {
|
|
1995
|
+
let noun = table.levelNouns?.[cell.level + 1], count = childCount.get(rowId) ?? 0;
|
|
1996
|
+
if (noun !== void 0 && count > 0) {
|
|
1997
|
+
let word = count === 1 ? noun.one : noun.other, hintX = tx + measure(lines[lines.length - 1] ?? text, font).width + lineAffix + badgeReserve + HINT_GAP, full = `\xB7 ${count} ${word}`, room = contentX + contentW - hintX, short = `\xB7 ${count}\u2026`, hint = measure(full, fonts.hint).width <= room ? { text: full } : measure(short, fonts.hint).width <= room ? { text: short, title: full } : void 0;
|
|
1998
|
+
hint !== void 0 && nodes.push({
|
|
1999
|
+
t: "text",
|
|
2000
|
+
typeRole: "label",
|
|
2001
|
+
id: `hint:${rowId}`,
|
|
2002
|
+
x: hintX,
|
|
2003
|
+
y: textTop + (lines.length - 1) * font.size * 1.2 + (font.size - fonts.hint.size) * NOTE_BASELINE_LOCK,
|
|
2004
|
+
lines: [hint.text],
|
|
2005
|
+
...hint.title === void 0 ? {} : { title: hint.title },
|
|
2006
|
+
align: "start",
|
|
2007
|
+
font: fonts.hint,
|
|
2008
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
2009
|
+
owner,
|
|
2010
|
+
part: "tableCollapsedHint",
|
|
2011
|
+
role: "category"
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
let noteSlot = inline.noteSlots.get(colId);
|
|
2016
|
+
if (cell.note && noteSlot !== void 0) {
|
|
2017
|
+
let noteFont = inlineFont2(row.step, !1);
|
|
2018
|
+
nodes.push({
|
|
2019
|
+
t: "text",
|
|
2020
|
+
typeRole: "footnote",
|
|
2021
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
2022
|
+
x: align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent,
|
|
2023
|
+
y: blockTop + valueBox + head + ladder.inlineGap + noteSlot * inline.box + (inline.box - noteFont.size * 1.2) / 2,
|
|
2024
|
+
lines: [cell.note],
|
|
2025
|
+
align,
|
|
2026
|
+
font: noteFont,
|
|
2027
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
2028
|
+
owner,
|
|
2029
|
+
part: "tableCellNote"
|
|
2030
|
+
});
|
|
2031
|
+
} else if (cell.note && col.kind === "rowLabel" && inline.note !== void 0) {
|
|
2032
|
+
let noteFont = inlineFont2(row.step, !1);
|
|
2033
|
+
nodes.push({
|
|
2034
|
+
t: "text",
|
|
2035
|
+
typeRole: "footnote",
|
|
2036
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
2037
|
+
x: contentX + indent,
|
|
2038
|
+
y: blockTop + valueBox + head + ladder.inlineGap + (inline.box - noteFont.size * 1.2) / 2,
|
|
2039
|
+
lines: [cell.note],
|
|
2040
|
+
align: "start",
|
|
2041
|
+
font: noteFont,
|
|
2042
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
2043
|
+
owner,
|
|
2044
|
+
part: "tableCellNote"
|
|
2045
|
+
});
|
|
2046
|
+
} else if (cell.note) {
|
|
2047
|
+
let lastLine = lines[lines.length - 1] ?? text, noteX = align === "end" ? tx - measure(lastLine, font).width - 4 : tx + measure(lastLine, font).width + 4, hostFont = drawnFont, noteY = textTop + (lines.length - 1) * font.size * 1.2 + (hostFont.size - fonts.note.size) * NOTE_BASELINE_LOCK;
|
|
2048
|
+
nodes.push({
|
|
2049
|
+
t: "text",
|
|
2050
|
+
typeRole: "footnote",
|
|
2051
|
+
id: tableCellNodeId("note", rowId, colId),
|
|
2052
|
+
x: noteX,
|
|
2053
|
+
y: noteY,
|
|
2054
|
+
lines: [cell.note],
|
|
2055
|
+
align: align === "end" ? "end" : "start",
|
|
2056
|
+
font: fonts.note,
|
|
2057
|
+
ink: groundInk(textGround, tableInk("secondary")),
|
|
2058
|
+
owner,
|
|
2059
|
+
part: "tableCellNote"
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
let occupied = [...framePlan.claims];
|
|
2064
|
+
headsDrawn && occupied.push({ rect: { x: rowX, y: gridY, w: rowW, h: headerH }, kind: "mark", owner: {}, part: "tableHeader" });
|
|
2065
|
+
for (let row of rows) {
|
|
2066
|
+
let { y: ry, h: rh } = rowY.get(row.id);
|
|
2067
|
+
occupied.push({ rect: { x: rowX, y: ry, w: rowW, h: rh }, kind: "mark", owner: { rowId: row.id }, part: "tableRow" });
|
|
2068
|
+
}
|
|
2069
|
+
for (let col of cols) {
|
|
2070
|
+
let { x: cx, w } = colX.get(col.id);
|
|
2071
|
+
occupied.push({ rect: { x: cx, y: gridY, w, h: tableH }, kind: "mark", owner: { colId: col.id }, part: "tableColumn" });
|
|
2072
|
+
}
|
|
2073
|
+
let marks = {
|
|
2074
|
+
table: { x: gridX, y: gridY, w: tableW, h: tableH },
|
|
2075
|
+
headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
|
|
2076
|
+
columns: cols.map((c) => ({ id: c.id, ...colX.get(c.id) })),
|
|
2077
|
+
rows: rows.map((r) => ({ id: r.id, ...rowY.get(r.id) }))
|
|
2078
|
+
}, paintWarningRules = [];
|
|
2079
|
+
if (groundTexts.size > 0) {
|
|
2080
|
+
let texts = options2.colorblindSafe === !0 ? colorblindRoles([...groundTexts.values()]).value : [...groundTexts.values()];
|
|
2081
|
+
paintWarningRules.push({ kind: "table-ground-text", texts, before: warnings2.length }), pushAll(warnings2, groundTextWarnings(theme, texts));
|
|
2082
|
+
}
|
|
2083
|
+
let scene = options2.colorblindSafe === !0 ? colorblindRoles(nodes).value : nodes;
|
|
2084
|
+
return {
|
|
2085
|
+
type: "table",
|
|
2086
|
+
size,
|
|
2087
|
+
sizing,
|
|
2088
|
+
plot,
|
|
2089
|
+
scene,
|
|
2090
|
+
labels: [],
|
|
2091
|
+
axes: [],
|
|
2092
|
+
annotations: [],
|
|
2093
|
+
frame: frame.frame,
|
|
2094
|
+
marks,
|
|
2095
|
+
derived: { table, computedCells: resolved.computedCells },
|
|
2096
|
+
a11y: tableA11y(options2, dataRows.length, cols.length),
|
|
2097
|
+
warnings: warnings2,
|
|
2098
|
+
...paintWarningRules.length > 0 ? { paintWarningRules } : {},
|
|
2099
|
+
debug: { occupied, decisions: [] }
|
|
2100
|
+
};
|
|
2101
|
+
}, plannedCuts);
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
function widthAt(plan, id) {
|
|
2106
|
+
return "columnIndex" in plan ? plan.widths[plan.columnIndex.get(id)] : plan.widths.get(id);
|
|
2107
|
+
}
|
|
2108
|
+
function tableSizing(size, plot, bottom, totalW, minimumW) {
|
|
2109
|
+
return rowSizing("table", size, {
|
|
2110
|
+
chromeH: size.height - plot.h,
|
|
2111
|
+
minimumRowsH: bottom - plot.y + 4,
|
|
2112
|
+
naturalRowsH: bottom - plot.y + 4,
|
|
2113
|
+
minWidth: size.width - plot.w + minimumW,
|
|
2114
|
+
naturalWidth: size.width - plot.w + totalW
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
function fitStatusLabel(label, font, room, trackRoom, measure) {
|
|
2118
|
+
let width = measure(label, font).width;
|
|
2119
|
+
if (width <= room) return { text: label };
|
|
2120
|
+
if (room < HEADING_CUT_MIN) return width <= trackRoom ? { text: label } : null;
|
|
2121
|
+
let cut = cutWithTitle(label, font, room, measure);
|
|
2122
|
+
return cut.text === "\u2026" || cut.text === "" ? null : cut;
|
|
2123
|
+
}
|
|
2124
|
+
function cellText(cell, kind, isSection, font, maxW, wrapped, wrappedTitle, measure, sectionCase) {
|
|
2125
|
+
let text = isSection && sectionCase !== "asis" ? sectionText(cell.displayed) : cell.displayed;
|
|
2126
|
+
return wrapped ? { text: wrapped[0] ?? text, ...wrappedTitle !== void 0 ? { title: wrappedTitle } : {} } : (kind === "rowLabel" || kind === "text") && measure(text, font).width > maxW ? cutWithTitle(text, font, Math.max(maxW, HEADING_CUT_MIN), measure) : { text };
|
|
2127
|
+
}
|
|
2128
|
+
function sectionText(s) {
|
|
2129
|
+
return s.toUpperCase();
|
|
2130
|
+
}
|
|
2131
|
+
function encodingSparklineNodes(col, row, box, theme, palette, measure, domain, language) {
|
|
2132
|
+
if (row.role === "section" || col.encoding?.type !== "sparkline") return [];
|
|
2133
|
+
let values = sparklineSourceValues(row, col.encoding.sourceColumns), last = lastObservedIndex(values), lastSource = last === void 0 ? void 0 : col.encoding.sourceColumns[last];
|
|
2134
|
+
return emitSparkline(
|
|
2135
|
+
{
|
|
2136
|
+
cell: row.cells[col.id],
|
|
2137
|
+
box,
|
|
2138
|
+
theme,
|
|
2139
|
+
...palette === void 0 ? {} : { palette },
|
|
2140
|
+
measure,
|
|
2141
|
+
nodeId: (suffix) => tableCellNodeId(suffix, row.id, col.id),
|
|
2142
|
+
owner: { rowId: row.id, colId: col.id }
|
|
2143
|
+
},
|
|
2144
|
+
values,
|
|
2145
|
+
{
|
|
2146
|
+
kind: col.encoding.kind ?? "line",
|
|
2147
|
+
domain: domain ?? tableSparklineDomain([row], col.encoding.sourceColumns, col.encoding.kind ?? "line"),
|
|
2148
|
+
lastText: lastSource === void 0 ? void 0 : row.cells[lastSource]?.displayed,
|
|
2149
|
+
language
|
|
2150
|
+
}
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
function transparentCss(css) {
|
|
2154
|
+
return css.trim().toLowerCase() === "transparent";
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
export {
|
|
2158
|
+
REGULAR_SPACING,
|
|
2159
|
+
tableScrollRung,
|
|
2160
|
+
sparklineSourceValues,
|
|
2161
|
+
sparklineDomains,
|
|
2162
|
+
emitSparkline,
|
|
2163
|
+
fitTableFormats,
|
|
2164
|
+
formatsFittedWarning,
|
|
2165
|
+
prepareTableExecutor,
|
|
2166
|
+
prepareTableCardExecutor,
|
|
2167
|
+
layoutTableCard,
|
|
2168
|
+
memoLayout,
|
|
2169
|
+
classFloor
|
|
2170
|
+
};
|