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