boardplot 0.55.0 → 0.57.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 (479) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +3 -3
  3. package/dist/{ReaderBox-3FFPHWSI.js → ReaderBox-GCIITQCX.js} +5 -5
  4. package/dist/{annotateEngine-ET4DM2OK.js → annotateEngine-JMZI6QEG.js} +1 -1
  5. package/dist/build-identity.json +3 -3
  6. package/dist/{chunk-RO2PSSAI.js → chunk-26WNBTWB.js} +21 -5
  7. package/dist/{chunk-3AJY353W.js → chunk-2AJWRVZ2.js} +4 -3
  8. package/dist/{chunk-NVGAEQ6M.js → chunk-2BHLRHF2.js} +2 -2
  9. package/dist/{chunk-CZ3WCG55.js → chunk-2HD5RY2U.js} +11 -3
  10. package/dist/{chunk-HR2BKLS3.js → chunk-2I76VFMZ.js} +186 -241
  11. package/dist/{chunk-3B3CFJ2H.js → chunk-2KCK63DD.js} +2 -2
  12. package/dist/{chunk-GDZI5ZJ7.js → chunk-2WTD3GCR.js} +11 -3
  13. package/dist/{chunk-EBC5TMI2.js → chunk-2X6XY4K4.js} +27 -10
  14. package/dist/{chunk-MJMOKPTF.js → chunk-3DUGZ7ML.js} +196 -138
  15. package/dist/{chunk-N5TZL74Y.js → chunk-3LNVEE5Z.js} +1 -1
  16. package/dist/{chunk-DB2JKPOX.js → chunk-43PCSBVQ.js} +567 -14
  17. package/dist/{chunk-WEMUCDPK.js → chunk-4JGBCBDZ.js} +1 -1
  18. package/dist/{chunk-7UPZPFHQ.js → chunk-4JNHF6JW.js} +12 -12
  19. package/dist/{chunk-4X3HNETE.js → chunk-4RN4OM6I.js} +3 -3
  20. package/dist/{chunk-Z7NHFNH3.js → chunk-4U2WSW6F.js} +107 -26
  21. package/dist/{chunk-6D4EO3S7.js → chunk-53OEKS4L.js} +5 -3
  22. package/dist/{chunk-E44W4EEG.js → chunk-54HEIM2A.js} +2 -2
  23. package/dist/{chunk-CLGUFVHM.js → chunk-5H4HFRDO.js} +6 -6
  24. package/dist/{chunk-SFG7NG23.js → chunk-5HTGSB6Y.js} +3 -3
  25. package/dist/{chunk-WXJ5MHLH.js → chunk-5JTRCSBN.js} +1 -1
  26. package/dist/{chunk-4Y7BA2NW.js → chunk-5P4MXWKP.js} +4 -4
  27. package/dist/{chunk-MLW72KWN.js → chunk-5RHP7YTL.js} +5 -5
  28. package/dist/{chunk-AB35GVPG.js → chunk-5TUDYKNL.js} +41 -31
  29. package/dist/{chunk-HZUAEMN5.js → chunk-5WSIH4SR.js} +1 -1
  30. package/dist/{chunk-YTCIGJUU.js → chunk-62JZL6FW.js} +45 -37
  31. package/dist/{chunk-S7NRL66K.js → chunk-6EE6XEMA.js} +4 -4
  32. package/dist/chunk-6JXBLQJ2.js +32 -0
  33. package/dist/{chunk-BGJRCG7N.js → chunk-6KHRMK3I.js} +46 -26
  34. package/dist/{chunk-3OZRODC4.js → chunk-6LQKU6YN.js} +4 -4
  35. package/dist/chunk-6VU2XI3W.js +89 -0
  36. package/dist/{chunk-E6HDUEGK.js → chunk-6WJOHZPW.js} +5 -5
  37. package/dist/{chunk-XJQXFVXY.js → chunk-6XU5XGYV.js} +7 -8
  38. package/dist/{chunk-QOWE55RR.js → chunk-6ZN2XJFI.js} +11 -6
  39. package/dist/{chunk-4WT3T5SH.js → chunk-72OJBDRB.js} +205 -60
  40. package/dist/{chunk-GFIT3FRE.js → chunk-73O6AOAA.js} +63 -47
  41. package/dist/{chunk-DEYAI662.js → chunk-76UL4CT4.js} +60 -24
  42. package/dist/chunk-7BQK2UDV.js +13 -0
  43. package/dist/{chunk-NHYKSPL4.js → chunk-7EQU2TUN.js} +304 -119
  44. package/dist/{chunk-FS6ZE5TG.js → chunk-7FAO4ICF.js} +2 -2
  45. package/dist/{chunk-LSF76AS3.js → chunk-7MYJUJZV.js} +6 -2
  46. package/dist/{chunk-D2QMNHCC.js → chunk-7P7D6WXR.js} +11 -2
  47. package/dist/{chunk-GCSCHK5Y.js → chunk-A33MFWHW.js} +3 -3
  48. package/dist/{chunk-3C24WWUQ.js → chunk-A6XCVOC5.js} +1 -1
  49. package/dist/{chunk-O7DVW3IE.js → chunk-AFA32LHN.js} +134 -37
  50. package/dist/{chunk-WALYNKBN.js → chunk-AFGQXMKT.js} +264 -88
  51. package/dist/{chunk-ZTMZOKVC.js → chunk-AKJO6N4K.js} +3 -3
  52. package/dist/{chunk-P6TA7M3G.js → chunk-ANNQJWDX.js} +11 -11
  53. package/dist/{chunk-KFGZMHIB.js → chunk-AOIZJ7GR.js} +7 -7
  54. package/dist/chunk-B5A7X2BA.js +44 -0
  55. package/dist/{chunk-HGT3UKDW.js → chunk-BDCKHLUB.js} +16 -16
  56. package/dist/{chunk-NUCYUKVH.js → chunk-BFDPY7JM.js} +10 -3
  57. package/dist/{chunk-BK6P6KMW.js → chunk-BM2A3IGQ.js} +1 -1
  58. package/dist/{chunk-H3AEYPRP.js → chunk-BO5EJBLH.js} +249 -129
  59. package/dist/chunk-BQIADGJB.js +23 -0
  60. package/dist/{chunk-F6CVYNDY.js → chunk-BY5JGQFZ.js} +24 -7
  61. package/dist/{chunk-WDIVAU5U.js → chunk-C5SQEYTQ.js} +78 -57
  62. package/dist/{chunk-NCZWLV7T.js → chunk-CEMXGMQN.js} +2 -2
  63. package/dist/{chunk-6H3OSHEY.js → chunk-CIDOL4FO.js} +5 -5
  64. package/dist/{chunk-WAPCCJUB.js → chunk-CT4RFZO4.js} +6 -6
  65. package/dist/{chunk-7Q37C6GZ.js → chunk-CV3NC75L.js} +1 -1
  66. package/dist/{chunk-GDVR3XHT.js → chunk-D3PQAVFW.js} +23 -13
  67. package/dist/{chunk-GMJFCBR6.js → chunk-D5G67OER.js} +1 -1
  68. package/dist/{chunk-BFFPYT3Y.js → chunk-D5RAVZ5C.js} +6 -7
  69. package/dist/{chunk-FQF7GSJK.js → chunk-DJBMA4FW.js} +4 -4
  70. package/dist/{chunk-4DZFR52I.js → chunk-DPUCT567.js} +2 -2
  71. package/dist/{chunk-ZHFUMVW7.js → chunk-DYSEZVIJ.js} +18 -2
  72. package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
  73. package/dist/{chunk-YXM4W3TN.js → chunk-EDBUVDRI.js} +118 -68
  74. package/dist/{chunk-JBMWRXDS.js → chunk-EEBMK6T6.js} +6 -6
  75. package/dist/{chunk-CYKIX3IQ.js → chunk-EEL2N4Y6.js} +7 -8
  76. package/dist/{chunk-PYV6ZIR6.js → chunk-EFKFZNQC.js} +24 -18
  77. package/dist/{chunk-IOKWBUQP.js → chunk-EHNGPUTO.js} +6 -6
  78. package/dist/{chunk-ZBSNF5F7.js → chunk-EHQLLZCQ.js} +49 -22
  79. package/dist/{chunk-ONKSGT2M.js → chunk-EWR6WVOV.js} +6 -6
  80. package/dist/{chunk-MTRV3BJL.js → chunk-EY4OA4OF.js} +1005 -666
  81. package/dist/{chunk-Y3L655X6.js → chunk-F4JAGDPD.js} +6 -6
  82. package/dist/{chunk-LRCO4G7C.js → chunk-FAFUMSPR.js} +35 -26
  83. package/dist/{chunk-63L35UCI.js → chunk-FERP4WS3.js} +19 -9
  84. package/dist/{chunk-N5HN5QGH.js → chunk-FF7MV4D4.js} +1 -1
  85. package/dist/{chunk-G63WXSQP.js → chunk-FJKFYQ5I.js} +23 -18
  86. package/dist/chunk-FL3FQ2YA.js +27 -0
  87. package/dist/{chunk-YOOHNQ3L.js → chunk-FX5VZK5F.js} +4 -0
  88. package/dist/{chunk-37A6CLR5.js → chunk-G5BUGYIL.js} +70 -18
  89. package/dist/{chunk-JU7S52HI.js → chunk-G5CELEUR.js} +6 -6
  90. package/dist/{chunk-EW47LNWH.js → chunk-GADI2DU7.js} +11 -10
  91. package/dist/{chunk-F6OLHND5.js → chunk-GAFEN3H7.js} +2 -2
  92. package/dist/{chunk-EXDMYV5W.js → chunk-GC4WOLV3.js} +1 -1
  93. package/dist/{chunk-WFSOKGGA.js → chunk-GHFTKVJN.js} +1 -1
  94. package/dist/chunk-GKDUIDU6.js +138 -0
  95. package/dist/{chunk-LA5OYJ5P.js → chunk-GKQLKUMF.js} +188 -84
  96. package/dist/{chunk-LLDKKEUD.js → chunk-GS5UG6QD.js} +1 -1
  97. package/dist/{chunk-BWVNCLUS.js → chunk-H2POQ4LB.js} +5 -5
  98. package/dist/{chunk-WSJDLZSZ.js → chunk-H3EWFSWI.js} +97 -53
  99. package/dist/{chunk-XPOMQWXY.js → chunk-H6EJ63QN.js} +20 -18
  100. package/dist/{chunk-Q3E74U2W.js → chunk-HB3TH7GY.js} +3 -3
  101. package/dist/{chunk-MLGEBFEX.js → chunk-HC6WHTBX.js} +2 -2
  102. package/dist/{chunk-X7XTIM6U.js → chunk-HDSHS2QZ.js} +47 -32
  103. package/dist/{chunk-QBJDHFJJ.js → chunk-HFFKN7PA.js} +11 -6
  104. package/dist/{chunk-K5S3K6QK.js → chunk-HGPFEG2L.js} +7 -8
  105. package/dist/{chunk-7Z73MM35.js → chunk-HVX2E26J.js} +46 -26
  106. package/dist/{chunk-KAYBRD4F.js → chunk-I3DLERI7.js} +2 -2
  107. package/dist/{chunk-SPSGUFTI.js → chunk-I4NUYVP5.js} +1 -1
  108. package/dist/{chunk-OHGEDG46.js → chunk-I5ZADE2U.js} +1 -1
  109. package/dist/{chunk-CPGASWNN.js → chunk-I65OLJ2X.js} +1 -1
  110. package/dist/{chunk-LAVVML3X.js → chunk-I6QGYRY4.js} +3 -3
  111. package/dist/{chunk-N7N5NIAU.js → chunk-I7KDPCC7.js} +3 -3
  112. package/dist/{chunk-UF3HSFAE.js → chunk-IFURKTOL.js} +3 -3
  113. package/dist/{chunk-Y54LU4CU.js → chunk-IPWUBZ4P.js} +1 -1
  114. package/dist/{chunk-IQDMZ33D.js → chunk-IRXTNSZL.js} +10 -10
  115. package/dist/{chunk-GD5TYS5R.js → chunk-IUVJVMKS.js} +13 -13
  116. package/dist/{chunk-E5OEWMNX.js → chunk-IVQT2E3Y.js} +66 -36
  117. package/dist/{chunk-7DAH2E4T.js → chunk-IW3YUMPI.js} +2 -2
  118. package/dist/chunk-IXM6BAM4.js +53 -0
  119. package/dist/{chunk-XVUQMZWV.js → chunk-IZRTNCJQ.js} +5 -5
  120. package/dist/{chunk-KZH2QI6S.js → chunk-J22ETKDJ.js} +2 -2
  121. package/dist/{chunk-HJRNBKIT.js → chunk-JARJP576.js} +3 -3
  122. package/dist/{chunk-4YHZSPAJ.js → chunk-JHWDTV4K.js} +5 -1
  123. package/dist/{chunk-PQYJZMCR.js → chunk-JIH52I36.js} +79 -79
  124. package/dist/{chunk-LFUJTEJO.js → chunk-JKXJWCJ5.js} +71 -36
  125. package/dist/{chunk-2BP6X5GX.js → chunk-JMOBA5ES.js} +2 -2
  126. package/dist/{chunk-2TAK2ELB.js → chunk-JMXNXLAC.js} +5 -1
  127. package/dist/{chunk-Z5V6ZM76.js → chunk-JRRSKCGG.js} +3 -3
  128. package/dist/{chunk-IVRYF7QA.js → chunk-JSA3ESEJ.js} +1 -1
  129. package/dist/{chunk-NOCIN2EM.js → chunk-K6Y4HBK7.js} +32 -32
  130. package/dist/{chunk-WQT6HIIY.js → chunk-KAAB2DIV.js} +23 -13
  131. package/dist/{chunk-GM2HIU6C.js → chunk-KF3ZHLHQ.js} +7 -8
  132. package/dist/{chunk-3XOWXLLQ.js → chunk-KGS5Z7SL.js} +3 -3
  133. package/dist/{chunk-AIU4GZV5.js → chunk-KIXNHDXS.js} +7 -8
  134. package/dist/{chunk-ILFQ75N4.js → chunk-KJLH5EHD.js} +29 -29
  135. package/dist/{chunk-UIYXMPDW.js → chunk-KLQKHA3T.js} +6 -6
  136. package/dist/chunk-KQ2WZ6BY.js +11 -0
  137. package/dist/{chunk-5SLJGRUO.js → chunk-KUMJI5B6.js} +32 -18
  138. package/dist/{chunk-XYYRHGQI.js → chunk-L2XRUG4P.js} +7 -8
  139. package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
  140. package/dist/{chunk-RTXRIZYU.js → chunk-LFX5BERN.js} +167 -70
  141. package/dist/{chunk-D7G27EYZ.js → chunk-LGMV7ZV4.js} +4 -4
  142. package/dist/{chunk-H4VDQ7OE.js → chunk-LO3AGGE3.js} +7 -8
  143. package/dist/{chunk-UNMIUILK.js → chunk-LSKCKGCF.js} +5 -1
  144. package/dist/{chunk-CVIW2MV4.js → chunk-LSR3SBJ4.js} +78 -37
  145. package/dist/{chunk-V634AXDM.js → chunk-LUZ7HXBT.js} +1 -1
  146. package/dist/{chunk-B3AXM3MT.js → chunk-LW4ZQGVL.js} +2 -2
  147. package/dist/{chunk-H3IBJQ5A.js → chunk-M2OQK2FO.js} +1 -1
  148. package/dist/{chunk-AZM4YNRE.js → chunk-M74H7QYD.js} +2 -2
  149. package/dist/{chunk-M427S3G7.js → chunk-MOQFYJ3F.js} +6 -6
  150. package/dist/{chunk-QRVIS2QB.js → chunk-MQ5EKWIG.js} +51 -9
  151. package/dist/{chunk-LHKDZAWN.js → chunk-MSYTF3DZ.js} +10 -3
  152. package/dist/{chunk-LD4LML5P.js → chunk-MTCDGSYW.js} +9 -1
  153. package/dist/{chunk-KHRAJDBM.js → chunk-NCCDEUHD.js} +1 -1
  154. package/dist/{chunk-IGVAWAOK.js → chunk-NIDH22DI.js} +31 -7
  155. package/dist/{chunk-IF2ZABAM.js → chunk-NINK4G7U.js} +2 -2
  156. package/dist/{chunk-F5V7YFKS.js → chunk-NO7GRVUU.js} +10 -8
  157. package/dist/{chunk-EBVJCVXL.js → chunk-NRYERHEI.js} +6 -6
  158. package/dist/{chunk-OJ2BPQGQ.js → chunk-O4D27FKH.js} +1 -1
  159. package/dist/{chunk-RYPJB3RO.js → chunk-O7Y6RJ4D.js} +23 -11
  160. package/dist/{chunk-2C4SYWZ3.js → chunk-OAT6FWKL.js} +7 -8
  161. package/dist/{chunk-VL7WLE4H.js → chunk-OF7FMGH5.js} +6 -6
  162. package/dist/{chunk-V3MSLNSD.js → chunk-OKM5LYYP.js} +7 -8
  163. package/dist/{chunk-YV5KYGE5.js → chunk-OQQMDSCC.js} +1 -1
  164. package/dist/{chunk-QKWBDH2L.js → chunk-OTGNVAI4.js} +2 -2
  165. package/dist/{chunk-HFRQLMKK.js → chunk-PSYPB22T.js} +3 -3
  166. package/dist/{chunk-JXBZIJCG.js → chunk-PYGEIPPH.js} +1 -1
  167. package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
  168. package/dist/{chunk-MQYIBGZE.js → chunk-Q7VPTN5X.js} +4 -4
  169. package/dist/{chunk-XZLU3G23.js → chunk-QFIRPOXR.js} +6 -2
  170. package/dist/{chunk-QBRRJ5OR.js → chunk-QHPJ5ZKS.js} +6 -6
  171. package/dist/{chunk-R27IDIJI.js → chunk-QLWUFEKR.js} +6 -6
  172. package/dist/{chunk-COQEHO7B.js → chunk-QNLESRH6.js} +3 -1
  173. package/dist/{chunk-5UVJKB7L.js → chunk-QRZESG66.js} +40 -29
  174. package/dist/{chunk-KND4OM4B.js → chunk-QYOZ46ZQ.js} +70 -23
  175. package/dist/{chunk-HLOXWM2O.js → chunk-QZMLSK43.js} +244 -74
  176. package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
  177. package/dist/{chunk-AF7EB6N6.js → chunk-RHBQ2Q5H.js} +104 -47
  178. package/dist/{chunk-Y2CAIAUI.js → chunk-RHVP62HI.js} +6 -6
  179. package/dist/{chunk-EAR43REB.js → chunk-RMVCKO6N.js} +16 -14
  180. package/dist/chunk-RRPTQGRU.js +47 -0
  181. package/dist/{chunk-IF76JRXT.js → chunk-S2TSXUYP.js} +6 -6
  182. package/dist/{chunk-O2KKQNGW.js → chunk-SD6ENKTO.js} +7 -2
  183. package/dist/{chunk-J5PL6JLL.js → chunk-SGDWLXUC.js} +1 -1
  184. package/dist/{chunk-75TWO5B2.js → chunk-SHAAMKN7.js} +45 -24
  185. package/dist/{chunk-NB7M4KX4.js → chunk-SHCW2TCA.js} +11 -11
  186. package/dist/{chunk-3ZAH24P6.js → chunk-SSZB3VXG.js} +19 -19
  187. package/dist/chunk-SXAZDIGM.js +84 -0
  188. package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
  189. package/dist/{chunk-ODZJ4LW7.js → chunk-T3WCDDIL.js} +7 -2
  190. package/dist/{chunk-OOFSQ5AS.js → chunk-T5MBORBK.js} +1 -1
  191. package/dist/{chunk-OY2UJ4XK.js → chunk-TDDSWNGD.js} +25 -17
  192. package/dist/{chunk-5DMHMQFP.js → chunk-TGR6PRKG.js} +3 -3
  193. package/dist/{chunk-EGPXEY2K.js → chunk-TKERVBJ3.js} +7 -8
  194. package/dist/{chunk-6C64IBOG.js → chunk-TMXRTYGT.js} +10 -4
  195. package/dist/{chunk-RNIYG6PI.js → chunk-TQ5HHNM3.js} +2 -2
  196. package/dist/{chunk-LF6RTFNK.js → chunk-TWRFVW3J.js} +5 -3
  197. package/dist/{chunk-7FKY6YWU.js → chunk-TXMS7QUJ.js} +3 -3
  198. package/dist/{chunk-H5L2P2GO.js → chunk-UBXIGE2P.js} +3 -2
  199. package/dist/{chunk-7Q2WV6D2.js → chunk-UCIAHSJK.js} +2 -2
  200. package/dist/{chunk-BVYIKLQ5.js → chunk-UD6U4EF5.js} +1 -1
  201. package/dist/{chunk-4CJ6UCX4.js → chunk-UFZXZJJG.js} +5 -5
  202. package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
  203. package/dist/{chunk-CKNOLGRR.js → chunk-UP4JSNDR.js} +1 -1
  204. package/dist/{chunk-3B3K7TD5.js → chunk-USFIDSTO.js} +8 -6
  205. package/dist/{chunk-PZ46S2SY.js → chunk-V3UE3TB7.js} +2 -2
  206. package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
  207. package/dist/{chunk-BSATR6ZO.js → chunk-V62B23VC.js} +13 -1
  208. package/dist/{chunk-NA6WLZ66.js → chunk-VFLMBA2M.js} +68 -18
  209. package/dist/chunk-VJ7VBB6S.js +58 -0
  210. package/dist/{chunk-32IKJMUF.js → chunk-VM5CQ7CG.js} +3 -3
  211. package/dist/{chunk-6WZZADRL.js → chunk-VMGTNB6H.js} +6 -6
  212. package/dist/{chunk-WWIY6BBY.js → chunk-VT7PBGL2.js} +8 -8
  213. package/dist/{chunk-3L2VXXM4.js → chunk-VY2NPB2Q.js} +2 -2
  214. package/dist/{chunk-QEP3X3OV.js → chunk-VY67Q6CJ.js} +20 -20
  215. package/dist/{chunk-W45AR6EW.js → chunk-W5SVS4B6.js} +2 -2
  216. package/dist/{chunk-U7W7GYXP.js → chunk-W7Q6PLT4.js} +37 -37
  217. package/dist/{chunk-7GVYMGLK.js → chunk-WDAZ2MT4.js} +8 -4
  218. package/dist/{chunk-T5Y4HXYO.js → chunk-WE5WVQE4.js} +13 -1
  219. package/dist/chunk-WJQX7HBH.js +54 -0
  220. package/dist/{chunk-EC2PGJ64.js → chunk-WKWCNS6K.js} +6 -6
  221. package/dist/{chunk-2ALFFOKB.js → chunk-WSKZZ2ZB.js} +14 -14
  222. package/dist/{chunk-5SHI57XD.js → chunk-WZB6R2ZX.js} +7 -5
  223. package/dist/{chunk-MEMPP7VZ.js → chunk-X5OVVMZX.js} +1 -1
  224. package/dist/{chunk-UDKYY27B.js → chunk-XCROSJ2Z.js} +1 -1
  225. package/dist/{chunk-ROLR7HRB.js → chunk-XFCBH3TI.js} +3 -3
  226. package/dist/{chunk-XMN3Z43K.js → chunk-XJUZC53Y.js} +1 -1
  227. package/dist/chunk-XN7JDII2.js +2047 -0
  228. package/dist/{chunk-RUWNG2JC.js → chunk-XNV7VOIT.js} +4 -4
  229. package/dist/{chunk-KC52E5G4.js → chunk-XR7VOF2V.js} +10 -8
  230. package/dist/{chunk-Z2X4JQNY.js → chunk-XYUXB5VK.js} +8 -3
  231. package/dist/{chunk-SC42DPNV.js → chunk-Y5IKCXQR.js} +7 -8
  232. package/dist/{chunk-YLC42C3M.js → chunk-Y5WHM2Q5.js} +1 -1
  233. package/dist/{chunk-IGNBQT23.js → chunk-Y7Q3VEYC.js} +96 -5
  234. package/dist/{chunk-O6NJDRXE.js → chunk-YB6QGOCO.js} +2 -2
  235. package/dist/{chunk-AM2CG7VX.js → chunk-YBYV56FS.js} +3 -3
  236. package/dist/{chunk-O4WJWHCH.js → chunk-YCUNFAEE.js} +90 -42
  237. package/dist/{chunk-V7F4F6JA.js → chunk-YFI5PN5O.js} +5 -7
  238. package/dist/{chunk-SBR2RLEQ.js → chunk-YGPLUENN.js} +89 -59
  239. package/dist/chunk-YGZEG3JV.js +123 -0
  240. package/dist/{chunk-WG5CJGLU.js → chunk-YJGFT63R.js} +8 -3
  241. package/dist/{chunk-KEDNHCGB.js → chunk-YNHPPZ7S.js} +1 -1
  242. package/dist/{chunk-EZZ533MH.js → chunk-YO5UKKCQ.js} +1 -1
  243. package/dist/{chunk-SZXKV3BX.js → chunk-YTEJYLU7.js} +5 -1
  244. package/dist/{chunk-33FCWTGT.js → chunk-Z257SH5U.js} +1 -1
  245. package/dist/{chunk-O7W35PT3.js → chunk-Z2BDTZDT.js} +14 -12
  246. package/dist/{chunk-EQRFSVDD.js → chunk-ZDD3MJ2H.js} +1 -1
  247. package/dist/{chunk-APQPYM2Z.js → chunk-ZNX5J7D7.js} +3 -3
  248. package/dist/{chunk-VBVG6NEL.js → chunk-ZSYU6LIH.js} +5 -5
  249. package/dist/{chunk-2YNF6AHH.js → chunk-ZTSJ7NY6.js} +6 -2
  250. package/dist/chunk-ZV3SNRJI.js +122 -0
  251. package/dist/cli/index.js +1 -1
  252. package/dist/{core-6HMJHFRR.js → core-4M4RY7MX.js} +4 -1
  253. package/dist/{core-RPQBIOU4.js → core-4PW4MXWR.js} +4 -1
  254. package/dist/{core-MV6KGAUV.js → core-5S5CJHBG.js} +5 -1
  255. package/dist/{core-XMTKUXLO.js → core-7TTM4KRP.js} +6 -1
  256. package/dist/{core-EYJ3WJK4.js → core-7XKNJM7Y.js} +4 -1
  257. package/dist/{core-3IJPBNGC.js → core-A7HXVSKB.js} +5 -1
  258. package/dist/{core-CLLIG7ZU.js → core-AMWCZTOT.js} +2 -1
  259. package/dist/{core-2YTKFBNZ.js → core-AVA4XLQ2.js} +4 -1
  260. package/dist/{core-UAY2G7LN.js → core-BJZEJ63L.js} +5 -1
  261. package/dist/{core-PTRQPQTO.js → core-CCB3IXGD.js} +4 -1
  262. package/dist/{core-HJUGHAX7.js → core-D2OIGYC7.js} +2 -1
  263. package/dist/{core-NTWHFDM4.js → core-DMDAXVMY.js} +3 -1
  264. package/dist/{core-2SICIP63.js → core-EMSJRGSE.js} +3 -4
  265. package/dist/{core-MEC6A5DD.js → core-FCSA74RT.js} +2 -1
  266. package/dist/{core-CBEGB2NO.js → core-FTQBESDS.js} +3 -1
  267. package/dist/{core-GRWI22NS.js → core-GS4DXDDG.js} +4 -1
  268. package/dist/{core-CAL7YNFC.js → core-JDZDBTID.js} +2 -1
  269. package/dist/{core-H7KMWYP5.js → core-L3UR75IJ.js} +2 -1
  270. package/dist/{core-JMYMIH6Z.js → core-MAW4S3KA.js} +4 -1
  271. package/dist/{core-T4ZH3FAU.js → core-N2JEWJ7D.js} +3 -1
  272. package/dist/{core-T2KHX5LG.js → core-OBPTBKX6.js} +4 -1
  273. package/dist/{core-CTZLHGXE.js → core-OFPPRHYY.js} +5 -1
  274. package/dist/{core-QABTVASG.js → core-QFAVWFI3.js} +5 -1
  275. package/dist/{core-FX7HRKTF.js → core-QM34237W.js} +9 -1
  276. package/dist/{core-GQC6VDW5.js → core-SKMHEA4Y.js} +5 -1
  277. package/dist/{core-VBR253SM.js → core-T3OSZOVV.js} +2 -1
  278. package/dist/{core-7JKE7H32.js → core-UNX4ZV4M.js} +4 -1
  279. package/dist/core-VRVL6LIM.js +49 -0
  280. package/dist/{core-OIC5KJSD.js → core-VT35VDVS.js} +4 -1
  281. package/dist/{core-3647Z25D.js → core-VWYXK2R3.js} +4 -1
  282. package/dist/{core-YEFGEW3Z.js → core-WNT6ZMRO.js} +5 -1
  283. package/dist/{core-VMIBBHXI.js → core-WP73P4CW.js} +4 -1
  284. package/dist/{core-ULZ7XUQP.js → core-WPEYRK6Y.js} +2 -1
  285. package/dist/{core-PMYCLXT7.js → core-WXZJ7V7S.js} +2 -1
  286. package/dist/{core-KEB5PBCO.js → core-XKXDXALI.js} +3 -1
  287. package/dist/{core-OWCTIPHD.js → core-ZACFV6XR.js} +2 -1
  288. package/dist/{core-BMY7OL76.js → core-ZSERZGK6.js} +5 -1
  289. package/dist/{dataTable-2ZXK54TP.js → dataTable-7IO546LM.js} +11 -2
  290. package/dist/{engine-HGXSWGOI.js → engine-US3N6UCH.js} +51 -15
  291. package/dist/fixtures.js +3 -1
  292. package/dist/fonts.js +1 -1
  293. package/dist/geo/dach.js +1 -1
  294. package/dist/geo/de-states.js +1 -1
  295. package/dist/geo/eu27.js +1 -1
  296. package/dist/geo/europe.js +1 -1
  297. package/dist/geo/index.js +2 -2
  298. package/dist/geo/us-states.js +1 -1
  299. package/dist/geo/world.js +1 -1
  300. package/dist/index.js +32 -19
  301. package/dist/{main-PVT6FMGC.js → main-2UWKGUHR.js} +28 -13
  302. package/dist/mcp/server.js +24 -13
  303. package/dist/react/bar.js +6 -1
  304. package/dist/react/bartable.js +8 -1
  305. package/dist/react/box.js +6 -1
  306. package/dist/react/bullet.js +7 -1
  307. package/dist/react/butterfly.js +6 -1
  308. package/dist/react/choropleth.js +8 -1
  309. package/dist/react/cohort.js +9 -1
  310. package/dist/react/column.js +6 -1
  311. package/dist/react/combo.js +6 -1
  312. package/dist/react/creative.js +8 -1
  313. package/dist/react/diagram.js +8 -1
  314. package/dist/react/dimswitch.js +6 -1
  315. package/dist/react/dot.js +6 -1
  316. package/dist/react/export.js +27 -19
  317. package/dist/react/funnel.js +6 -1
  318. package/dist/react/gantt.js +8 -1
  319. package/dist/react/grid.js +5 -1
  320. package/dist/react/heatmap.js +7 -1
  321. package/dist/react/histogram.js +6 -1
  322. package/dist/react/index.js +94 -84
  323. package/dist/react/kpi.js +7 -1
  324. package/dist/react/likert.js +6 -1
  325. package/dist/react/line.js +6 -1
  326. package/dist/react/mekko.js +6 -1
  327. package/dist/react/pareto.js +6 -1
  328. package/dist/react/pie.js +6 -1
  329. package/dist/react/prepare.js +36 -20
  330. package/dist/react/pvm.js +7 -1
  331. package/dist/react/pyramid.js +6 -1
  332. package/dist/react/sankey.js +8 -1
  333. package/dist/react/scatter.js +6 -1
  334. package/dist/react/slope.js +7 -1
  335. package/dist/react/sparkline.js +7 -1
  336. package/dist/react/spec.js +17 -11
  337. package/dist/react/status.js +12 -1
  338. package/dist/react/story.js +5 -3
  339. package/dist/react/table.js +6 -1
  340. package/dist/react/theme.js +8 -3
  341. package/dist/react/tilemap.js +7 -1
  342. package/dist/react/treemap.js +7 -1
  343. package/dist/react/variance.js +6 -1
  344. package/dist/react/waffle.js +7 -1
  345. package/dist/react/waterfall.js +7 -1
  346. package/dist/rows.js +3 -2
  347. package/dist/{rowsModule-JTDPTWXG.js → rowsModule-DYDVHBAX.js} +2 -1
  348. package/dist/{schema-GLN7IHSH.js → schema-3KMU5737.js} +1 -1
  349. package/dist/{schema-NVMEOHAW.js → schema-4JRNXEZF.js} +3 -1
  350. package/dist/{schema-7CPGNCOL.js → schema-626QXX4G.js} +3 -1
  351. package/dist/{schema-BMD5JR3Y.js → schema-6PL46VXZ.js} +3 -1
  352. package/dist/{schema-2Q7IJ22V.js → schema-6V5K3J2V.js} +4 -1
  353. package/dist/{schema-3XLO43SX.js → schema-A2XUZUCV.js} +3 -1
  354. package/dist/{schema-XKY2EQFH.js → schema-CNJ4Y6CT.js} +3 -1
  355. package/dist/{schema-BKHQ3ZUH.js → schema-DHMMGDTI.js} +3 -1
  356. package/dist/{schema-XHKSGMUH.js → schema-F2Q6MH7W.js} +3 -1
  357. package/dist/{schema-GGG2VOY7.js → schema-FC6J6KZC.js} +5 -1
  358. package/dist/{schema-ZE7WUNFS.js → schema-FGE5YK3S.js} +3 -1
  359. package/dist/{schema-WZLWHOMY.js → schema-FSYDLMGD.js} +1 -1
  360. package/dist/{schema-FYULDJFB.js → schema-G5KSSI5W.js} +1 -1
  361. package/dist/{schema-V3BPW4LA.js → schema-GXOG4MXL.js} +1 -1
  362. package/dist/{schema-76XRTBCJ.js → schema-HEB6ZDI5.js} +3 -1
  363. package/dist/{schema-HIDW4BA4.js → schema-I44IDRGD.js} +1 -1
  364. package/dist/{schema-BOGTPL7F.js → schema-IFTIMTS3.js} +1 -1
  365. package/dist/{schema-KIJA53MB.js → schema-IUY7VYHJ.js} +3 -1
  366. package/dist/{schema-C7NVOQNV.js → schema-J4HCSD5C.js} +5 -2
  367. package/dist/{schema-WIZ2TZAT.js → schema-JCU6LTYD.js} +1 -1
  368. package/dist/{schema-5KHDHTIX.js → schema-JJWORI7D.js} +3 -1
  369. package/dist/{schema-BUTNGYTT.js → schema-K4V4PYBO.js} +3 -1
  370. package/dist/{schema-LHMEXFLY.js → schema-LGLQBRC4.js} +3 -1
  371. package/dist/{schema-5753NOAL.js → schema-MD22QYZU.js} +1 -1
  372. package/dist/{schema-2M3LXR35.js → schema-MGETMQYC.js} +3 -1
  373. package/dist/{schema-FZKNIAIH.js → schema-MQB6CE5V.js} +3 -1
  374. package/dist/{schema-U26KG42U.js → schema-NMIYKGHE.js} +3 -1
  375. package/dist/{schema-MT6NA5AL.js → schema-NOBNFD2F.js} +3 -1
  376. package/dist/{schema-3OLBUVMZ.js → schema-OXO2XY4Y.js} +1 -1
  377. package/dist/{schema-G2PLJCYL.js → schema-PHIHMDVB.js} +1 -1
  378. package/dist/{schema-UHHFTVGS.js → schema-UXWKA3PI.js} +3 -1
  379. package/dist/{schema-J53LCIY3.js → schema-WBOPCTPC.js} +1 -1
  380. package/dist/{schema-TA3MSAPQ.js → schema-WFGDVBJK.js} +1 -1
  381. package/dist/{schema-MUTAVQMI.js → schema-WX2RS4OU.js} +3 -1
  382. package/dist/{schema-XATDKZPW.js → schema-XIHAKX3B.js} +18 -1
  383. package/dist/{schema-LEQNLBNG.js → schema-XRSORYBI.js} +3 -1
  384. package/dist/{schema-FNTAAXQ3.js → schema-YDZCGL56.js} +3 -1
  385. package/dist/{specValidation-X5XJBPTP.js → specValidation-XGELWQUU.js} +2 -1
  386. package/dist/theme.js +5 -1
  387. package/dist/types/core/charts/bartable/types.d.ts +14 -1
  388. package/dist/types/core/charts/box/types.d.ts +5 -1
  389. package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
  390. package/dist/types/core/charts/choropleth/types.d.ts +19 -0
  391. package/dist/types/core/charts/cohort/types.d.ts +16 -3
  392. package/dist/types/core/charts/creative/types.d.ts +21 -0
  393. package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
  394. package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
  395. package/dist/types/core/charts/gantt/calendar.d.ts +20 -0
  396. package/dist/types/core/charts/gantt/columns.d.ts +56 -0
  397. package/dist/types/core/charts/gantt/layout.d.ts +8 -2
  398. package/dist/types/core/charts/gantt/model.d.ts +296 -0
  399. package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
  400. package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
  401. package/dist/types/core/charts/histogram/types.d.ts +8 -0
  402. package/dist/types/core/charts/likert/layout.d.ts +10 -8
  403. package/dist/types/core/charts/pvm/types.d.ts +9 -1
  404. package/dist/types/core/charts/pyramid/types.d.ts +3 -1
  405. package/dist/types/core/charts/sankey/types.d.ts +5 -1
  406. package/dist/types/core/charts/status/layout.d.ts +3 -0
  407. package/dist/types/core/charts/table/resolve.d.ts +14 -0
  408. package/dist/types/core/footer.d.ts +2 -0
  409. package/dist/types/core/format.d.ts +4 -0
  410. package/dist/types/core/formatSpec.d.ts +10 -0
  411. package/dist/types/core/frame.d.ts +1 -1
  412. package/dist/types/core/geo/types.d.ts +2 -0
  413. package/dist/types/core/geometry.d.ts +1 -1
  414. package/dist/types/core/label/categoryRow.d.ts +1 -1
  415. package/dist/types/core/normalize/shared.d.ts +2 -0
  416. package/dist/types/core/registry.d.ts +4 -5
  417. package/dist/types/core/request.d.ts +6 -0
  418. package/dist/types/core/schema/capability.d.ts +20 -7
  419. package/dist/types/core/schema/generatedColumns.d.ts +168 -0
  420. package/dist/types/core/text.d.ts +16 -0
  421. package/dist/types/core/themeGeometry.d.ts +9 -0
  422. package/dist/types/core/timeAxis.d.ts +6 -1
  423. package/dist/types/core/types/diagram.d.ts +7 -0
  424. package/dist/types/core/types/options.d.ts +83 -12
  425. package/dist/types/core/types/table.d.ts +23 -3
  426. package/dist/types/index.d.ts +2 -0
  427. package/dist/types/react/barrelCharts.d.ts +16 -5
  428. package/dist/types/react/charts/butterfly.d.ts +2 -2
  429. package/dist/types/react/charts/dot.d.ts +7 -1
  430. package/dist/types/react/charts/pareto.d.ts +4 -1
  431. package/dist/types/react/charts/variance.d.ts +3 -1
  432. package/dist/types/react/hover/labelCard.d.ts +18 -3
  433. package/dist/types/react/prepare.d.ts +7 -1
  434. package/dist/types/theme.d.ts +2 -0
  435. package/dist/validate.js +16 -5
  436. package/docs/manual.md +31 -3
  437. package/docs/reference/bar.md +3 -0
  438. package/docs/reference/bartable.md +16 -1
  439. package/docs/reference/box.md +8 -1
  440. package/docs/reference/bullet.md +12 -1
  441. package/docs/reference/butterfly.md +7 -1
  442. package/docs/reference/choropleth.md +15 -2
  443. package/docs/reference/cohort.md +25 -5
  444. package/docs/reference/column.md +1 -0
  445. package/docs/reference/combo.md +1 -0
  446. package/docs/reference/creative.md +13 -0
  447. package/docs/reference/diagram.md +5 -0
  448. package/docs/reference/dimswitch.md +50 -32
  449. package/docs/reference/dot.md +7 -2
  450. package/docs/reference/fixtures.md +57 -0
  451. package/docs/reference/funnel.md +5 -0
  452. package/docs/reference/gantt.md +10 -2
  453. package/docs/reference/grid.md +9 -2
  454. package/docs/reference/heatmap.md +6 -0
  455. package/docs/reference/histogram.md +2 -2
  456. package/docs/reference/kpi.md +5 -1
  457. package/docs/reference/likert.md +8 -0
  458. package/docs/reference/line.md +1 -1
  459. package/docs/reference/options.md +4 -3
  460. package/docs/reference/pareto.md +1 -1
  461. package/docs/reference/pvm.md +7 -1
  462. package/docs/reference/pyramid.md +6 -0
  463. package/docs/reference/react.md +1 -2
  464. package/docs/reference/sankey.md +6 -2
  465. package/docs/reference/slope.md +6 -0
  466. package/docs/reference/sparkline.md +1 -1
  467. package/docs/reference/status.md +7 -1
  468. package/docs/reference/table.md +16 -4
  469. package/docs/reference/tilemap.md +2 -2
  470. package/docs/reference/treemap.md +1 -1
  471. package/docs/reference/waffle.md +1 -1
  472. package/docs/reference/waterfall.md +4 -1
  473. package/package.json +1 -1
  474. package/dist/chunk-FI5EXISD.js +0 -27
  475. package/dist/chunk-O36WX56O.js +0 -13
  476. package/dist/chunk-YGTNVZJE.js +0 -89
  477. package/dist/chunk-ZGHBDMYF.js +0 -24
  478. package/dist/chunk-ZLYQWUNR.js +0 -1794
  479. package/dist/core-SKRADU7T.js +0 -41
@@ -1,1794 +0,0 @@
1
- import {
2
- liftOrFallback,
3
- missesSize,
4
- tightSpacingWarning
5
- } from "./chunk-APQPYM2Z.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-MTRV3BJL.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-WWIY6BBY.js";
50
- import {
51
- structureCount
52
- } from "./chunk-UDKYY27B.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
- inlineFont,
71
- kindFont,
72
- rowFont,
73
- strongColumnFont,
74
- tableFonts
75
- } from "./chunk-7Z73MM35.js";
76
- import {
77
- chipHeight,
78
- chipPaints,
79
- hasPolarityBadge,
80
- isFigureCell,
81
- onTableGround,
82
- polarityBadgeInk,
83
- statusSquare,
84
- statusSquarePaint,
85
- tableGround,
86
- toneTextPaint
87
- } from "./chunk-BVYIKLQ5.js";
88
- import {
89
- qualifierFont,
90
- tableInk,
91
- tableRuleInk
92
- } from "./chunk-Z2MGTKDR.js";
93
- import {
94
- emptyIdRecord
95
- } from "./chunk-LINZPU5D.js";
96
- import {
97
- DEFAULT_EMPTY_MESSAGE,
98
- hasNoDataRows
99
- } from "./chunk-O6NJDRXE.js";
100
- import {
101
- CARD_CLASS_WIDTH,
102
- VERIFY_ADVICE,
103
- fixedHeightCanvas,
104
- heightOmitted,
105
- rowDrivenHeight,
106
- rowSizing,
107
- spareShare
108
- } from "./chunk-WALYNKBN.js";
109
- import {
110
- authoredNotes,
111
- composedTextRole,
112
- createOccupiedIndex,
113
- cutWithTitle,
114
- distinctCut,
115
- fitText,
116
- frameTextOptions,
117
- groundTextWarnings,
118
- legendOff,
119
- legendRequired,
120
- solveFrame
121
- } from "./chunk-2ALFFOKB.js";
122
- import {
123
- copyFrame,
124
- disclosureNote,
125
- footerPlans
126
- } from "./chunk-5SHI57XD.js";
127
- import {
128
- AUTOMATIC_FORMAT,
129
- MAGNITUDE_DIVISOR,
130
- MAGNITUDE_GROUP,
131
- MAGNITUDE_LABEL,
132
- effectiveScale,
133
- formatWithSpec,
134
- parseFormatExample,
135
- specUnitKind,
136
- unitOfSpec
137
- } from "./chunk-GDVR3XHT.js";
138
- import {
139
- currentSmallValues,
140
- formatExactNumber,
141
- nonzeroDecimals,
142
- roundHalfUp,
143
- roundsToZero,
144
- zeroLifts
145
- } from "./chunk-LHKDZAWN.js";
146
- import {
147
- canvasMargin,
148
- colorblindRoles,
149
- markRolePaint,
150
- panelTypeClass,
151
- resolveSemanticPaletteTheme,
152
- resolveSurface,
153
- semanticPalettePaint,
154
- signedFillPaint,
155
- strokeToken,
156
- textScaleOf,
157
- typeWidthClass
158
- } from "./chunk-HJRNBKIT.js";
159
- import {
160
- TARGET_SIZE,
161
- accessibleTitle,
162
- resolveSize
163
- } from "./chunk-YOOHNQ3L.js";
164
- import {
165
- maxOf,
166
- minOf,
167
- pushAll
168
- } from "./chunk-WYJEOMNY.js";
169
- import {
170
- WIDTH_SAFETY,
171
- defaultMeasurer,
172
- ellipsize
173
- } from "./chunk-SNQ7D5R7.js";
174
-
175
- // src/core/charts/table/encodings/inCellBar.ts
176
- var TEXT_GAP = 8, BAR_HEIGHT = 10;
177
- function emitInCellBar(context, metrics) {
178
- let value = context.cell.raw;
179
- if (context.cell.state !== "value" || typeof value != "number" || value === 0 || metrics.maxAbs <= 0)
180
- return [];
181
- let width = Math.max(0, metrics.contentBox.w - metrics.textReserve - TEXT_GAP) * Math.min(1, Math.abs(value) / metrics.maxAbs);
182
- if (width <= 0) return [];
183
- 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);
184
- return [
185
- {
186
- t: "rect",
187
- id: context.nodeId("bar"),
188
- rect: {
189
- x: metrics.contentBox.x,
190
- y: metrics.contentBox.y + (metrics.contentBox.h - height) / 2,
191
- w: width,
192
- h: height
193
- },
194
- fill,
195
- owner: context.owner,
196
- part: "tableBar"
197
- }
198
- ];
199
- }
200
-
201
- // src/core/charts/table/encodings/sparkline.ts
202
- function sparklineSourceValues(row, sourceColumns) {
203
- return sourceColumns.map((sourceId) => {
204
- let source = row.cells[sourceId];
205
- return source?.state === "value" && typeof source.raw == "number" ? source.raw : null;
206
- });
207
- }
208
- function tableSparklineDomain(rows, sourceColumns, shape) {
209
- return sparklineDomain(
210
- rows.filter((row) => row.role !== "section").map((row) => sparklineSourceValues(row, sourceColumns)),
211
- shape
212
- );
213
- }
214
- function sparklineDomains(columns, rows) {
215
- let domains = /* @__PURE__ */ new Map();
216
- for (let column of columns)
217
- column.kind !== "encoding" || column.encoding?.type !== "sparkline" || domains.set(column.id, tableSparklineDomain(rows, column.encoding.sourceColumns, column.encoding.kind ?? "line"));
218
- return domains;
219
- }
220
- function emitSparkline(context, values, metrics) {
221
- if (!values.some((value) => value !== null)) {
222
- let font2 = { family: context.theme.type.family, ...context.theme.type.label }, mark = context.theme.table?.glyphs?.missing ?? "\u2014";
223
- return [
224
- {
225
- t: "text",
226
- typeRole: "label",
227
- id: context.nodeId("sparkEmpty"),
228
- x: context.box.x + context.box.w / 2,
229
- y: context.box.y + (context.box.h - context.measure(mark, font2).height) / 2,
230
- lines: [mark],
231
- align: "middle",
232
- font: font2,
233
- ink: { token: "inkMuted" },
234
- owner: context.owner,
235
- part: "tableSparkEmpty"
236
- }
237
- ];
238
- }
239
- 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({
240
- box: context.box,
241
- values,
242
- shape: kind,
243
- domain: metrics.domain,
244
- style: TABLE_SPARK_STYLE,
245
- lastText,
246
- font,
247
- measure: context.measure
248
- });
249
- return emitSparklineMarks({
250
- plot,
251
- shape: kind,
252
- theme: context.theme,
253
- palette: context.palette,
254
- style: TABLE_SPARK_STYLE,
255
- nodeId: context.nodeId,
256
- owner: context.owner,
257
- partPrefix: "table"
258
- }).map((node) => node.t === "text" ? { ...node, typeRole: "label" } : node);
259
- }
260
-
261
- // src/core/charts/table/fitFormats.ts
262
- var NEXT_MAGNITUDE = {
263
- none: "k",
264
- k: "m",
265
- m: "bn",
266
- bn: "t",
267
- t: void 0
268
- }, FIT_DIGITS = 2;
269
- function keptDigits(value, magnitude, decimals) {
270
- return roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[magnitude], decimals).replace(".", "").replace(/^0+/, "").length;
271
- }
272
- var ONE_DIGIT_TOLERANCE = 0.05;
273
- function printsNear(value, magnitude, decimals) {
274
- let scaled = Math.abs(value) / MAGNITUDE_DIVISOR[magnitude];
275
- return Math.abs(Number(roundHalfUp(scaled, decimals)) / scaled - 1) <= ONE_DIGIT_TOLERANCE;
276
- }
277
- function keepsDigits(figures, spec, next) {
278
- return figures.every((value) => {
279
- let kept = keptDigits(value, next.magnitude, next.decimals);
280
- 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);
281
- });
282
- }
283
- function floorDecimals(figures, spec, magnitude, from = 0) {
284
- let decimals = from;
285
- for (; decimals < 6 && !keepsDigits(figures, spec, { magnitude, decimals }); ) decimals++;
286
- return decimals;
287
- }
288
- function shorterSpec(spec, figures) {
289
- if (spec.glyphs || spec.negative === "trailing" || spec.ordinal || spec.exponent || spec.magnitudeInAffix) return;
290
- let maxAbs = figures === void 0 ? 1 / 0 : Math.max(0, maxOf(figures));
291
- if (figures ??= [], spec.significantDigits !== void 0) return;
292
- if (spec.decimals > 0) {
293
- 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) };
294
- return keepsDigits(figures, spec, next2) ? next2 : void 0;
295
- }
296
- if (specUnitKind(spec) !== "number" || !/^(?:|\p{Sc}|[A-Z]{3})$/u.test(spec.suffix.trim())) return;
297
- let magnitude = NEXT_MAGNITUDE[spec.magnitude];
298
- if (magnitude === void 0 || maxAbs / MAGNITUDE_DIVISOR[magnitude] < 1) return;
299
- let next = { ...spec, magnitude, decimals: 1, rollMagnitude: void 0 };
300
- if (maxAbs === 1 / 0) return next;
301
- let rolled = { ...next, ...effectiveScale(maxAbs, next) };
302
- rolled.decimals = floorDecimals(figures, spec, rolled.magnitude, rolled.decimals);
303
- 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;
304
- return widest(step) >= widest(spec) ? void 0 : step;
305
- }
306
- function exampleOf(spec) {
307
- 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}`;
308
- 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;
309
- }
310
- function withRowFormats(rows, formats) {
311
- return rows.map((row) => {
312
- let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withRowFormats(row.children, formats);
313
- return next === void 0 && children === row.children ? row : {
314
- ...row,
315
- ...next === void 0 ? {} : { format: next.format },
316
- ...next?.unitAffix === void 0 ? {} : { unitAffix: next.unitAffix },
317
- ...children === void 0 ? {} : { children }
318
- };
319
- });
320
- }
321
- function withCellFormats(rows, formats) {
322
- return rows.map((row) => {
323
- let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withCellFormats(row.children, formats);
324
- if (next === void 0 && children === void 0) return row;
325
- let cells = next === void 0 ? row.cells : { ...row.cells };
326
- for (let [columnId, format] of next ?? []) {
327
- let cell = row.cells[columnId];
328
- cells[columnId] = typeof cell == "number" ? { v: cell, format } : { ...cell, format };
329
- }
330
- return { ...row, ...cells === void 0 ? {} : { cells }, ...children === void 0 ? {} : { children } };
331
- });
332
- }
333
- function rowExample(row, decimal) {
334
- if (row === void 0) return;
335
- if (row.format !== void 0) return row.format;
336
- let calc = row.calc;
337
- return calc !== void 0 && "op" in calc && (calc.op === "share" || calc.op === "percentDelta") ? `1${decimal}2%` : void 0;
338
- }
339
- function authoredRows(rows, into = /* @__PURE__ */ new Map()) {
340
- for (let row of rows)
341
- into.set(row.id, row), row.children && authoredRows(row.children, into);
342
- return into;
343
- }
344
- function fitTableFormats(data, options, resolved, columns, ctx) {
345
- 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();
346
- for (let round = 0; round < 8; round++) {
347
- 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) => {
348
- value !== 0 && map.set(id, [...map.get(id) ?? [], Math.abs(value)]);
349
- };
350
- for (let column of columns(table)) {
351
- if (column.width === void 0 || column.kind !== "value" && column.kind !== "computed") continue;
352
- let room = column.width - 2 * ctx.padX, authoredColumn = authoredColumns.get(column.id);
353
- for (let row of table.rows) {
354
- if (row.role === "section") continue;
355
- let parent = row.inline === !0 && row.parentId !== void 0 ? resolvedById.get(row.parentId) : void 0;
356
- if (row.inline === !0 && (parent === void 0 || ctx.lineFont === void 0)) continue;
357
- let cell = row.cells[column.id];
358
- if (cell === void 0 || cell.state !== "value" || typeof cell.raw != "number") continue;
359
- 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;
360
- if (cell.format !== void 0) {
361
- overflows && cellOverflow.push({ rowId: row.id, columnId: column.id, format: cell.format, max: Math.abs(cell.raw) });
362
- continue;
363
- }
364
- figure(rowFigures, row.id, cell.raw), figure(columnFigures, column.id, cell.raw);
365
- 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);
366
- rowFormatted && fits && rowPrinting.add(row.id), overflows && (rowFormatted ? fits : authoredColumn?.fitFormat !== !1) && (rowFormatted ? rowOverflow.add(row.id) : columnOverflow.add(column.id));
367
- }
368
- }
369
- let rowFormattedColumn = (columnId) => {
370
- let authoredColumn = authoredColumns.get(columnId);
371
- return authoredColumn !== void 0 && columnOwnsFormat(authoredColumn) ? !1 : table.rows.some((row) => {
372
- let authored = rowsById.get(row.id);
373
- return authored?.format !== void 0 && authored.calc === void 0 && row.inline !== !0 && typeof row.cells[columnId]?.raw == "number";
374
- });
375
- }, rowFormats = /* @__PURE__ */ new Map();
376
- for (let rowId of rowOverflow) {
377
- if (exhausted.has(`row:${rowId}`)) continue;
378
- 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) ?? []);
379
- if (next === void 0) {
380
- exhausted.add(`row:${rowId}`);
381
- continue;
382
- }
383
- let before = unitOfSpec(spec), after = unitOfSpec(next);
384
- rowFormats.set(rowId, {
385
- format: exampleOf(next),
386
- // The label names the unit the cells now read in.
387
- ...row.unitAffix !== void 0 && before !== null && after !== null && row.unitAffix === before && before !== after ? { unitAffix: after } : {}
388
- });
389
- }
390
- 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();
391
- for (let [rowId, next] of rowFormats) {
392
- let row = resolvedById.get(rowId);
393
- if (row === void 0) continue;
394
- let spec = parseFormatExample(next.format), key = unitOf(row, spec);
395
- caps.set(key, Math.min(caps.get(key) ?? 1 / 0, spec.decimals));
396
- }
397
- for (let rowId of rowPrinting) {
398
- if (exhausted.has(`row:${rowId}`)) continue;
399
- let row = resolvedById.get(rowId), shortened = rowFormats.get(rowId), example = shortened?.format ?? rowExample(rowsById.get(rowId), decimal);
400
- if (row === void 0 || example === void 0) continue;
401
- let spec = parseFormatExample(example), cap = caps.get(unitOf(row, spec));
402
- if (cap === void 0 || spec.significantDigits !== void 0 || spec.decimals <= cap || cap === 3 && spec.thousandsSep === "") continue;
403
- let decimals = floorDecimals(rowFigures.get(rowId) ?? [], spec, spec.magnitude, cap);
404
- decimals >= spec.decimals || rowFormats.set(rowId, { ...shortened, format: exampleOf({ ...spec, decimals }) });
405
- }
406
- let columnFormats = /* @__PURE__ */ new Map();
407
- for (let columnId of columnOverflow) {
408
- if (exhausted.has(`col:${columnId}`)) continue;
409
- if (rowFormattedColumn(columnId)) {
410
- exhausted.add(`col:${columnId}`);
411
- continue;
412
- }
413
- 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) ?? []);
414
- if (next === void 0) {
415
- exhausted.add(`col:${columnId}`);
416
- continue;
417
- }
418
- columnFormats.set(columnId, exampleOf(next));
419
- }
420
- let cellFormats = /* @__PURE__ */ new Map();
421
- for (let { rowId, columnId, format, max } of cellOverflow) {
422
- let key = tableCellNodeId("cell", rowId, columnId);
423
- if (exhausted.has(key)) continue;
424
- let next = shorterSpec(parseFormatExample(format), [max]);
425
- if (next === void 0) {
426
- exhausted.add(key);
427
- continue;
428
- }
429
- cellFormats.set(rowId, (cellFormats.get(rowId) ?? /* @__PURE__ */ new Map()).set(columnId, exampleOf(next)));
430
- }
431
- if (rowFormats.size === 0 && columnFormats.size === 0 && cellFormats.size === 0) break;
432
- for (let rowId of rowFormats.keys()) fittedRows.add(rowId);
433
- for (let columnId of columnFormats.keys()) fittedColumns.add(columnId);
434
- for (let [rowId, formats] of cellFormats) for (let columnId of formats.keys()) fittedCells.add(`${rowId}\0${columnId}`);
435
- let rows = rowFormats.size === 0 ? current.rows : withRowFormats(current.rows, rowFormats);
436
- current = {
437
- ...current,
438
- columns: current.columns.map((column) => columnFormats.has(column.id) ? { ...column, format: columnFormats.get(column.id) } : column),
439
- rows: cellFormats.size === 0 ? rows : withCellFormats(rows, cellFormats)
440
- }, fitted = resolveTable(current, unlifted, data), result = fitted;
441
- }
442
- if (fitted === void 0) return;
443
- {
444
- 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();
445
- for (let [id, authored] of rowsById) {
446
- let row = resolvedById.get(id), example = rowExample(authored, decimal);
447
- if (row === void 0 || example === void 0 || authored.calc !== void 0 || authored.fitFormat === !1) continue;
448
- let spec = parseFormatExample(example);
449
- if (spec.significantDigits !== void 0) continue;
450
- let key = familyKey(row, spec);
451
- families.set(key, [...families.get(key) ?? [], { id, spec }]);
452
- }
453
- let unified = /* @__PURE__ */ new Map();
454
- for (let members of families.values()) {
455
- if (!members.some((member) => fittedRows.has(member.id))) continue;
456
- let least = minOf(members.map((member) => member.spec.decimals));
457
- for (let member of members) {
458
- if (member.spec.decimals <= least || least === 3 && member.spec.thousandsSep === "") continue;
459
- 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);
460
- decimals < member.spec.decimals && unified.set(member.id, { format: exampleOf({ ...member.spec, decimals }) });
461
- }
462
- }
463
- if (unified.size > 0) {
464
- for (let id of unified.keys()) fittedRows.add(id);
465
- current = { ...current, rows: withRowFormats(current.rows, unified) }, fitted = resolveTable(current, unlifted, data);
466
- }
467
- }
468
- let lifts = zeroFigureFormats(current, fitted.table, fittedRows, fittedColumns, fittedCells, decimal, options, data);
469
- 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) };
470
- }
471
- function formatsFittedWarning(changes) {
472
- if (changes.length === 0) return;
473
- 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("; ");
474
- return {
475
- code: "table-formats-fitted",
476
- severity: "info",
477
- message: `fitFormats shortened ${changes.length} format${changes.length === 1 ? "" : "s"} to fit authored widths: ${listed}${changes.length > 6 ? `; and ${changes.length - 6} more` : ""}`,
478
- detail: { changes },
479
- suggest: "Widen the column, or set fitFormat: false on the row or column to keep its format as authored."
480
- };
481
- }
482
- function formatChanges(before, after, decimal) {
483
- let changes = [], rowsBefore = authoredRows(before.rows), rowsAfter = authoredRows(after.rows);
484
- for (let [id, row] of rowsAfter) {
485
- let from = rowExample(rowsBefore.get(id), decimal), to = rowExample(row, decimal);
486
- from !== to && to !== void 0 && changes.push({ row: id, ...from === void 0 ? {} : { from }, to });
487
- }
488
- let columnsBefore = new Map(before.columns.map((column) => [column.id, column]));
489
- for (let column of after.columns) {
490
- let from = columnsBefore.get(column.id)?.format, to = column.format;
491
- from !== to && to !== void 0 && changes.push({ column: column.id, ...from === void 0 ? {} : { from }, to });
492
- }
493
- for (let [id, row] of rowsAfter)
494
- for (let [columnId, cell] of Object.entries(row.cells ?? {})) {
495
- 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;
496
- to !== void 0 && from !== to && changes.push({ row: id, column: columnId, ...from === void 0 ? {} : { from }, to });
497
- }
498
- return changes;
499
- }
500
- function zeroFigureFormats(data, table, fittedRows, fittedColumns, fittedCells, decimal, options, source) {
501
- let lifts = /* @__PURE__ */ new Map();
502
- if (fittedRows.size === 0 && fittedColumns.size === 0 && fittedCells.size === 0) return lifts;
503
- let rowsById = authoredRows(data.rows), sourceRows = authoredRows(source.rows), automatic = options.format === void 0 && options.unit === void 0 && options.magnitude !== "million" && options.magnitude !== "thousand";
504
- for (let column of data.columns) {
505
- if (column.kind !== "value") continue;
506
- let columnFormat = column.format, automaticColumn = automatic && source.columns.find((entry) => entry.id === column.id)?.format === void 0;
507
- for (let row of table.rows) {
508
- 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;
509
- if (raw === void 0 || raw === 0 || authoredRow.calc !== void 0) continue;
510
- 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);
511
- if (example === void 0) continue;
512
- let sourceRow = sourceRows.get(row.id);
513
- if (ownFitted === void 0 && (rowFormatted ? automatic && (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) : automaticColumn)) continue;
514
- let spec = parseFormatExample(example), scaled = raw / MAGNITUDE_DIVISOR[spec.magnitude];
515
- if (roundsToZero(scaled, spec.decimals)) {
516
- if (ownFitted !== void 0 || row.inline === !0) {
517
- if (options[ZERO_LIFT] !== void 0) continue;
518
- zeroLifts.count++;
519
- }
520
- lifts.set(row.id, (lifts.get(row.id) ?? /* @__PURE__ */ new Map()).set(column.id, exampleOf({ ...spec, decimals: nonzeroDecimals(scaled, spec.decimals) })));
521
- }
522
- }
523
- }
524
- return lifts;
525
- }
526
-
527
- // src/core/charts/table/layout.ts
528
- 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;
529
- function cellRole(kind, text) {
530
- return cellHoldsNumber(kind, text) ? {} : { role: "category" };
531
- }
532
- 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"), 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;
533
- function cutCount(geometry) {
534
- return geometry.scene.filter((node) => node.t === "text" && node.id.startsWith("cell:") && node.title !== void 0).length;
535
- }
536
- function layoutTable(authoredData, options = {}, resolved = resolveTable(authoredData, options)) {
537
- return liftOrFallback(
538
- (mode) => {
539
- if (mode === "full") return layoutTableLadder(authoredData, options, resolved);
540
- let step = { ...options, [ZERO_LIFT]: mode };
541
- return layoutTableLadder(authoredData, step, resolveTable(authoredData, step));
542
- },
543
- (lifted, plain) => costsWidth(lifted, plain, options),
544
- resolved.lifted,
545
- (bound, plain) => missesFrame(bound, options) && !missesFrame(plain, options)
546
- );
547
- }
548
- function missesFrame(geometry, options) {
549
- let open = options[TARGET_SIZE]?.fixed;
550
- 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);
551
- }
552
- function costsWidth(lifted, plain, options) {
553
- let misses = (geometry) => missesFrame(geometry, options);
554
- if (misses(plain)) return !1;
555
- if (misses(lifted) || cutCount(lifted) > cutCount(plain)) return !0;
556
- 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));
557
- return lifted.warnings.some((warning) => stepped.has(warning.code) && !before.has(warning.code));
558
- }
559
- function themeGroupPad(theme) {
560
- let pad = theme.table?.groupPad;
561
- return pad?.top === void 0 && pad?.bottom === void 0 ? void 0 : { top: pad?.top ?? GROUP_PAD_TOP, bottom: pad?.bottom ?? GROUP_PAD_BOTTOM };
562
- }
563
- var groupAirAboveLeast = (pad, ruleSpace) => pad.top + ruleSpace + pad.bottom > 9;
564
- function hasHeadAir(options) {
565
- let theme = chartTheme(options), group = themeGroupPad(theme);
566
- 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")));
567
- }
568
- function layoutTableLadder(authoredData, options, resolved) {
569
- 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) => {
570
- let compact = drawn.sizing === void 0 ? void 0 : compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, !0, formatFits);
571
- return compact?.sizing && !compact.refused && (drawn.sizing = {
572
- ...drawn.sizing,
573
- minWidth: Math.min(drawn.sizing.minWidth, compact.sizing.minWidth),
574
- minHeight: fixedHeight ? Math.min(drawn.sizing.minHeight, compact.sizing.minHeight) : drawn.sizing.minHeight
575
- }), withWidthRepair(drawn);
576
- };
577
- if (options.belowMinimum === "refuse" || !full.sizing) return full;
578
- if (fits(full)) {
579
- fullSizingOnly && (full = layoutTableOnce(authoredData, base, resolved, !1, formatFits));
580
- 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;
581
- return open?.width === !1 ? drawn : withFloor(drawn);
582
- }
583
- if (widthFits(full) && fixedHeight && hasHeadAir(options)) {
584
- let lean = once({ ...base, [HEAD_AIR_MIN]: !0 });
585
- if (lean.sizing !== void 0 && fits(lean))
586
- 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;
587
- }
588
- if (widthFits(full)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 6), void 0, resolved, sizingOnly, formatFits));
589
- 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 });
590
- if (narrowest.sizing !== void 0 && !widthFits(narrowest)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
591
- let tried = new Set(gutterHelps ? [] : [`${pad}`]);
592
- for (let step of [{ pad }, { pad: Math.min(pad, 6) }, { pad: Math.min(pad, 3) }, { pad: Math.min(pad, 3), heads: 2 }]) {
593
- let key = `${step.pad}${step.heads === void 0 ? "" : `:${step.heads}`}`;
594
- if (tried.has(key)) continue;
595
- tried.add(key);
596
- let last = step.heads === void 0 ? rung(step) : narrowest;
597
- if (last.sizing === void 0 || widthFits(last) && heightFits(last))
598
- 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;
599
- }
600
- return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
601
- }
602
- var WIDTH_REPAIR_PROBE = /* @__PURE__ */ Symbol("tableWidthRepairProbe");
603
- function widthRepairHeight(data, options, geometry) {
604
- if (options[WIDTH_REPAIR_PROBE] || options[SIZING_ONLY]) return geometry;
605
- 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;
606
- if (!warning || !size || size.height === void 0) return geometry;
607
- if (!options[VERIFY_ADVICE])
608
- return geometry.warnings = geometry.warnings.map((w) => {
609
- if (w !== warning) return w;
610
- let { fix: _unverified, ...rest } = w;
611
- return { ...rest, suggest: `${w.suggest ?? ""} Call measure for a size that keeps the height and draws.`.trim() };
612
- }), geometry;
613
- let wider = layoutTableCard(data, { ...options, size, [WIDTH_REPAIR_PROBE]: !0 }), needed = wider.refused || !wider.sizing ? void 0 : Math.ceil(wider.sizing.minHeight);
614
- 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;
615
- }
616
- function layoutTableCard(data, options = {}) {
617
- return memoLayout(data, options, () => widthRepairHeight(
618
- data,
619
- options,
620
- cardHeightFloor(layoutTableCard, data, options, classFloor(layoutTable, data, options, layoutTable(data, options)))
621
- ));
622
- }
623
- var layouts = /* @__PURE__ */ new WeakMap(), functionIds = /* @__PURE__ */ new WeakMap(), nextFunctionId = 0;
624
- function memoLayout(data, options, layout) {
625
- if (typeof options.theme == "string") return layout();
626
- let key = layoutKey(data, options), byKey = layouts.get(data);
627
- return (!byKey || byKey.size >= 32) && layouts.set(data, byKey = /* @__PURE__ */ new Map()), byKey.has(key) || byKey.set(key, layout()), deepCopy(byKey.get(key));
628
- }
629
- function layoutKey(data, options) {
630
- let symbols = Object.getOwnPropertySymbols(options).map((symbol) => [symbol.description, options[symbol]]);
631
- return JSON.stringify([data, options, symbols, currentSmallValues()], (_key, value) => typeof value != "function" ? value : (functionIds.has(value) || functionIds.set(value, nextFunctionId++), `function ${functionIds.get(value)}`));
632
- }
633
- function deepCopy(value, copies = /* @__PURE__ */ new Map()) {
634
- if (value === null || typeof value != "object") return value;
635
- if (copies.has(value)) return copies.get(value);
636
- if (Array.isArray(value)) {
637
- let copy2 = [];
638
- copies.set(value, copy2);
639
- for (let entry of value) copy2.push(deepCopy(entry, copies));
640
- return copy2;
641
- }
642
- if (value instanceof Map) {
643
- let copy2 = /* @__PURE__ */ new Map();
644
- copies.set(value, copy2);
645
- for (let [key, entry] of value) copy2.set(key, deepCopy(entry, copies));
646
- return copy2;
647
- }
648
- if (value instanceof Set) {
649
- let copy2 = /* @__PURE__ */ new Set();
650
- copies.set(value, copy2);
651
- for (let entry of value) copy2.add(deepCopy(entry, copies));
652
- return copy2;
653
- }
654
- if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return value;
655
- let copy = footerPlans.has(value) ? copyFrame(value) : Object.getPrototypeOf(value) === null ? emptyIdRecord() : {};
656
- copies.set(value, copy);
657
- for (let key of Reflect.ownKeys(value)) copy[key] = deepCopy(value[key], copies);
658
- return copy;
659
- }
660
- function classFloor(layout, data, options, geometry) {
661
- if (geometry.refused || !geometry.sizing || panelTypeClass(options) !== void 0) return geometry;
662
- let sizing = geometry.sizing;
663
- if (sizing.minWidth >= geometry.size.width || typeWidthClass(sizing.minWidth) === typeWidthClass(geometry.size.width)) return geometry;
664
- let height = Math.max(geometry.size.height, sizing.minHeight), byKey = classFloors.get(data);
665
- (!byKey || byKey.size >= 32) && classFloors.set(data, byKey = /* @__PURE__ */ new Map());
666
- let key = layoutKey(data, { ...options, size: [sizing.minWidth, typeWidthClass(geometry.size.width), height] }), floor = byKey.get(key);
667
- if (floor === void 0) {
668
- floor = sizing.minWidth;
669
- for (let pass = 0; pass < 3 && typeWidthClass(floor) !== typeWidthClass(geometry.size.width); pass++) {
670
- let probe = layout(data, { ...options, size: { width: floor, height }, [SIZING_ONLY]: !0, [REGULAR_SPACING]: !0 });
671
- if (probe.refused || !probe.sizing || probe.sizing.minWidth >= floor) break;
672
- floor = probe.sizing.minWidth;
673
- }
674
- byKey.set(key, floor);
675
- }
676
- return floor !== sizing.minWidth && (geometry.sizing = { ...sizing, minWidth: floor }), geometry;
677
- }
678
- var classFloors = /* @__PURE__ */ new WeakMap(), cardHeights = /* @__PURE__ */ new WeakMap();
679
- function cardHeightFloor(layout, data, options, geometry) {
680
- let width = geometry.size.width;
681
- if (!(options[TARGET_SIZE]?.fixed?.height === !1) || geometry.refused || !geometry.sizing || width >= CARD_CLASS_WIDTH || panelTypeClass(options) !== void 0) return geometry;
682
- let step = width < 400 ? 400 : CARD_CLASS_WIDTH, byKey = cardHeights.get(data);
683
- (!byKey || byKey.size >= 32) && cardHeights.set(data, byKey = /* @__PURE__ */ new Map());
684
- let key = layoutKey(data, { ...options, size: step });
685
- if (!byKey.has(key)) {
686
- let wider = layout(data, { ...options, size: { width: step } });
687
- byKey.set(key, wider.refused || !wider.sizing ? void 0 : wider.sizing.naturalHeight);
688
- }
689
- let floor = byKey.get(key);
690
- return floor !== void 0 && floor > geometry.sizing.naturalHeight && (geometry.sizing = { ...geometry.sizing, naturalHeight: floor }), geometry;
691
- }
692
- function compactTable(authoredData, options, full, margin, cellPadX2, heads, resolved, sizingOnly, formatFits) {
693
- let compactOptions = {
694
- ...options,
695
- density: isCohortDensity(options.density ?? "regular") ? options.density : "compact",
696
- margin,
697
- // Tighter than the full table, never wider: a dense table already pads 3 or 5 px.
698
- cellPadX: cellPadX2,
699
- labelIndent: { base: 8 + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: 8 },
700
- // A fixed height never grows (docs/manual.md, "Fixed height"): only an omitted height turns automatic.
701
- size: heightOmitted(options.size) ? { width: full.size.width } : { width: full.size.width, height: full.size.height },
702
- [COMPACT_RETRY]: full.size.height,
703
- ...heads === void 0 ? {} : { [HEAD_LINES]: heads }
704
- }, 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;
705
- if (!options[REGULAR_SPACING] && compact.sizing && (missesWidth || missesHeight) && reachable) {
706
- 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);
707
- compact = layoutTableOnce(authoredData, lastOptions = {
708
- ...compactOptions,
709
- [TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight },
710
- ...missesWidth ? {
711
- cellPadX: Math.min(cellPadX2, TIGHT_PAD),
712
- labelIndent: { base: TIGHT_PAD + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: TIGHT_PAD * 2 }
713
- } : {},
714
- margin: {
715
- ...missesHeight ? { top: TIGHT_PAD * 2, bottom: TIGHT_PAD * 2 } : {},
716
- ...margin,
717
- ...missesWidth ? { left: Math.min(margin.left ?? CARD_GUTTER, TIGHT_PAD * 2), right: Math.min(margin.right ?? CARD_GUTTER, TIGHT_PAD * 2) } : {}
718
- }
719
- }, resolved, sizingOnly, formatFits), compact.warnings.push(tightWarning);
720
- }
721
- if (missesHeight && compact.sizing && compact.size.height + 0.5 < compact.sizing.minHeight && resolved.table.columns.some((col) => col.subLabel !== void 0)) {
722
- let warnings = compact.warnings;
723
- compact = layoutTableOnce(authoredData, { ...lastOptions, [SUB_LINES]: 1 }, resolved, sizingOnly, formatFits);
724
- for (let warning of warnings) warning.code === "table-tight-spacing" && !compact.warnings.includes(warning) && compact.warnings.push(warning);
725
- }
726
- 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;
727
- }
728
- function layoutTableOnce(authoredData, options, initialResolved, sizingOnly, formatFits) {
729
- 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(
730
- chartTheme(options),
731
- options.palette,
732
- warnings
733
- ), 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);
734
- if (options.fitFormats === !0) {
735
- let padX = options.cellPadX ?? cellPadX(visibleColumns(resolved.table).length), fitKey = `${options.density ?? "regular"}:${padX}`, fitted = formatFits.get(fitKey);
736
- if (!formatFits.has(fitKey)) {
737
- 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));
738
- fitted = fitTableFormats(data, options, resolved, (table2) => visibleColumns(table2), {
739
- measure,
740
- padX,
741
- cellFont: (cell) => {
742
- let row = rowById2.get(cell.rowId);
743
- 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);
744
- },
745
- figures: (col, text) => cellDrawsTabular(theme, col.kind, text),
746
- lineFont: (parent, line, text, tabular) => changeLineFitFont(theme, fitLadder, parent.step, line.polarity !== void 0, text, measure, tabular),
747
- ...options.locale?.decimal === void 0 ? {} : { decimal: options.locale.decimal }
748
- }), formatFits.set(fitKey, fitted);
749
- }
750
- if (fitted !== void 0) {
751
- let warningsAfter = warnings.splice(resolved.warnings.length);
752
- warnings.length = 0, pushAll(warnings, fitted.resolved.warnings), pushAll(warnings, warningsAfter);
753
- let fittedNote = formatsFittedWarning(fitted.changes);
754
- fittedNote !== void 0 && warnings.push(fittedNote), data = fitted.data, resolved = fitted.resolved;
755
- }
756
- }
757
- 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 = [];
758
- for (let col of cols) {
759
- if (col.band !== !0) continue;
760
- let previous = bandedColumnRuns[bandedColumnRuns.length - 1];
761
- 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] });
762
- }
763
- let spacerBefore = /* @__PURE__ */ new Map();
764
- for (let group of table.columnGroups) {
765
- if (group.spacer === void 0 || group.spacer <= 0) continue;
766
- let first = cols.find((col) => group.columnIds.includes(col.id));
767
- first === void 0 || first.id === cols[0]?.id || spacerBefore.set(first.id, tight ? Math.min(group.spacer, TIGHT_PAD * 2) : group.spacer);
768
- }
769
- 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") };
770
- options.figures === !1 && figures && warnings.push({
771
- code: "figures-need-heat",
772
- severity: "warn",
773
- message: "figures: false needs a heat column, and this table draws none, so it prints its figures",
774
- field: ["options", "figures"],
775
- suggest: "Remove figures: false, or give a column a heat lane in options.encodings."
776
- });
777
- 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);
778
- keyless && legendOff(warnings, "table", [...heatEntries, ...arrowShapes].map((entry) => entry.label));
779
- let keyEntries = keyless ? [] : heatEntries, arrowEntries = keyless ? [] : arrowShapes, authored = authoredNotes(options), frameInput = {
780
- size,
781
- margin: { ...canvasMargin(theme, size.width), ...options.margin },
782
- ...frameTextOptions(options),
783
- // uniform money unit hoisted out of every cell → the frame slot
784
- // (solveFrame prepends 'in' itself)
785
- unit: table.unit ?? options.unit,
786
- // rows/cols, not table.rows/table.columns: this surface is static, so a
787
- // marker inside a collapsed row or a hidden column is unreachable here
788
- // and its footnote would point at nothing
789
- footnotes: [...tableFootnotes(table, rows, cols), ...authored, ...options[ENGINE_NOTES] ?? []],
790
- // Nothing in a table points at a note: no head or cell carries a
791
- // mark, so a "1)" before the note is a number the reader cannot follow
792
- // (the same rule as for the engine's own notes). The author's
793
- // notes stay notes and print without a number.
794
- numberedFootnotes: authored,
795
- unreferencedNotes: authored.map((_, i) => i + 1),
796
- // A table's notes read in the tertiary ink where the theme names one.
797
- footnoteInk: "inkMeta",
798
- // The notes and the source keep the cell air in from both edges, as on React, also at canvas margin 0.
799
- footerInset: cellPadX2,
800
- ...keyEntries.length + arrowEntries.length > 0 ? {
801
- legend: {
802
- 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"),
803
- items: [
804
- ...keyEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: entry.fill, key: "box", stroke: { token: "grid" } })),
805
- ...arrowEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: { token: "ink" }, key: "glyph", glyph: entry.glyph }))
806
- ]
807
- },
808
- legendFont: "footnote"
809
- } : {},
810
- theme,
811
- measure
812
- }, 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));
813
- tightRows && (ladder.pad = () => 1, ladder.totalPad = 1, ladder.rowHeight !== void 0 && (ladder.rowHeight = ladder.lineBox(ladder.label) + 2));
814
- let { lineBox, pad: levelPad } = ladder, widthPlan = tableWidths(table, theme, measure, options, {
815
- columns: cols,
816
- rows,
817
- widthRows,
818
- fullRows,
819
- available: plot.w,
820
- spacerTotal,
821
- headLines: options[HEAD_LINES],
822
- subLines: options[SUB_LINES]
823
- });
824
- 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);
825
- let nodes = [...frame.nodes], gridX = Math.round(plot.x), gridY = Math.round(plot.y), { widths, sizingMinimums, totalW, minimumW, fonts, regularFonts, columnHeaderText, cellFont, cellStep, 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";
826
- function rowHeight(row) {
827
- if (row.role === "total" && row.kind !== "result" && row.kind !== "driver")
828
- return ladder.totalPad * 2 + lineBox(fonts.total.size) + 2 * ruleSpace;
829
- if (row.role === "section") {
830
- if (tightRows || options[COMPACT_RETRY] !== void 0) return sectionNatural();
831
- let space = theme.table?.section?.spaceBefore ?? lineBox(ladder.label);
832
- return sectionNatural() + Math.round(row.id === rows[0]?.id ? Math.min(space, lineBox(ladder.label) / 4) : space);
833
- }
834
- let pad = levelPad(row.step, row.hasChildren);
835
- 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)));
836
- }
837
- function sectionNatural() {
838
- return levelPad(1, !1) * 2 + ladder.sectionBox(fonts.section.size) + sectionRuleSpace;
839
- }
840
- function lineHoldsValue(line, colId) {
841
- let cell = line.cells[colId];
842
- return cell !== void 0 && cell.state === "value" && cell.displayed !== "";
843
- }
844
- let labelColumnId = cols.find((col) => col.kind === "rowLabel")?.id;
845
- function labelNoteOf(row) {
846
- if (!(labelColumnId === void 0 || row.role === "section"))
847
- return row.cells[labelColumnId]?.note;
848
- }
849
- let inlineBlocks = /* @__PURE__ */ new Map();
850
- function inlineBlock(row) {
851
- let cached = inlineBlocks.get(row);
852
- if (cached !== void 0) return cached;
853
- 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();
854
- for (let col of cols) {
855
- if (col.noteLine !== !0 || col.kind === "rowLabel" || row.cells[col.id]?.note === void 0) continue;
856
- let slot = base + lines.length;
857
- for (let [index, line] of lines.entries())
858
- if (!lineHoldsValue(line, col.id)) {
859
- slot = base + index;
860
- break;
861
- }
862
- noteSlots.set(col.id, slot), stacked = Math.max(stacked, slot + 1);
863
- }
864
- let block = {
865
- lines,
866
- ...note === void 0 ? {} : { note },
867
- box,
868
- noteSlots,
869
- extra: stacked === 0 ? 0 : ladder.inlineGap + stacked * box
870
- };
871
- return inlineBlocks.set(row, block), block;
872
- }
873
- let inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed), sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal);
874
- pushAll(warnings, widthPlan.warnings);
875
- function sizingProbe(sizing2, marks2) {
876
- return {
877
- type: "table",
878
- size,
879
- sizing: sizing2,
880
- plot,
881
- scene: [],
882
- labels: [],
883
- axes: [],
884
- annotations: [],
885
- frame: frame.frame,
886
- marks: marks2,
887
- derived: { table, computedCells: resolved.computedCells },
888
- a11y: { title: "", desc: "", counts: [] },
889
- warnings,
890
- debug: { occupied: [], decisions: [] }
891
- };
892
- }
893
- if (sizingOnly && options[TARGET_SIZE]?.fixed.height === !1 && !heightOmitted(options.size))
894
- return sizingProbe(tableSizing(size, plot, plot.y, totalW, minimumW), {
895
- table: { x: gridX, y: gridY, w: totalW, h: 0 },
896
- columns: cols.map((col) => ({ id: col.id, x: gridX, w: widths.get(col.id) })),
897
- rows: [],
898
- headerBand: { x: gridX, y: gridY, w: totalW, h: 0 }
899
- });
900
- 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) => [col.id, fitText(
901
- columnHeaderText(col),
902
- fonts.header,
903
- headRoom(col),
904
- 1 / 0,
905
- measure,
906
- { target: options.target, typeRole: "axis" }
907
- )])), subFits = new Map(cols.flatMap((col) => col.subLabel === void 0 ? [] : [[col.id, fitText(
908
- col.subLabel,
909
- fonts.sub,
910
- headRoom(col),
911
- !col.label && col.kind === "rowLabel" ? 1 : options[SUB_LINES] ?? 1 / 0,
912
- measure,
913
- { target: options.target, typeRole: "axis" }
914
- )]])), 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, headerGroupH = hasGroupHeads ? 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", colX = /* @__PURE__ */ new Map(), x = gridX;
915
- for (let col of cols) {
916
- x += spacerBefore.get(col.id) ?? 0;
917
- let w = Math.round(widths.get(col.id));
918
- colX.set(col.id, { x, w }), x += w;
919
- }
920
- let 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 ?? ""]);
921
- for (let row of rows) {
922
- let sectionCol = row.role === "section" ? cols.find((col) => col.kind === "rowLabel") : void 0, sectionCell = sectionCol === void 0 ? void 0 : row.cells[sectionCol.id];
923
- if (sectionCol !== void 0 && sectionCell?.displayed) {
924
- 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(cellStep(sectionCell)) - affixRoom(row, font) - badgeW;
925
- if (measure(text, font).width > room) {
926
- let wrap = fitText(text, font, Math.max(room, 20), 2, measure, { target: options.target, typeRole: "label" });
927
- 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));
928
- }
929
- }
930
- for (let col of cols) {
931
- let rowLabel = col.kind === "rowLabel" && row.role !== "section";
932
- if (col.kind !== "text" && !rowLabel) continue;
933
- let cell = row.cells[col.id];
934
- if (!cell || !cell.displayed) continue;
935
- let font = cellFont(cell), w = colX.get(col.id).w, indent = cell.kind === "rowLabel" ? rowIndent(cellStep(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(`
936
- `);
937
- if (textW <= room - affix && !authoredBreak) continue;
938
- 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) => {
939
- let head = Math.max(0, own - slack);
940
- head > 0 && labelHead.set(row.id, head), head > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, head));
941
- };
942
- if (ownLine && (affixBelow.add(row.id), textW <= maxW)) {
943
- wrappedLines.set(tableCellKey(row.id, col.id), [cell.displayed]), setHead(affixHead);
944
- continue;
945
- }
946
- 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;
947
- 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);
948
- let grow = Math.ceil((wrap.lines.length - 1) * font.size * 1.2);
949
- rowLabel ? setHead(grow + affixHead) : grow > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, grow));
950
- }
951
- }
952
- let rowY = /* @__PURE__ */ new Map(), y = gridY + headerH;
953
- for (let [index, row] of rows.entries()) {
954
- index > 0 && row.spacer !== void 0 && (y += Math.round(row.spacer));
955
- let h = rowHeight(row) + (rowExtra.get(row.id) ?? 0);
956
- rowY.set(row.id, { y, h }), y += h;
957
- }
958
- let naturalTableH = y - gridY;
959
- {
960
- let callerH = options[COMPACT_RETRY], grow = rowDrivenHeight({
961
- options: callerH === void 0 || !heightOmitted(options.size) ? options : {},
962
- width: size.width,
963
- height: size.height,
964
- chromeH: size.height - plot.h,
965
- rowsH: y - plot.y + 4,
966
- ...callerH === void 0 ? {} : { ceiling: callerH }
967
- });
968
- if (grow !== void 0) return layoutTableOnce(authoredData, { ...options, size: { width: size.width, height: grow } }, initialResolved, sizingOnly, formatFits);
969
- }
970
- let targetSize = options[TARGET_SIZE];
971
- if (!sizingOnly && targetSize?.fixed.height === !1 && size.width === targetSize.sizePx.width && size.height === targetSize.sizePx.height) {
972
- let height = tableSizing(size, plot, y, totalW, 0).naturalHeight;
973
- if (height !== size.height) {
974
- let nextSize = { width: size.width, height }, nextOccupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: height }), nextFrame = solveFrame({ ...frameInput, size: nextSize }, nextOccupied);
975
- 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));
976
- }
977
- }
978
- y > plot.y + plot.h && warnings.push({
979
- code: "table-overflow",
980
- severity: "error",
981
- message: `${rows.length} rows exceed the plot height at density '${density}' \u2014 use 'compact', fewer rows, or a taller size`
982
- });
983
- let wrapFits = !1;
984
- if (widthPlan.wouldWrap.length > 0 && size.width - plot.w + sumOf(sizingMinimums) > size.width)
985
- if (options[VERIFY_ADVICE]) {
986
- 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) };
987
- wrapFits = !missesFrame(layoutTable(wrapped, options), options);
988
- } else
989
- wrapFits = widthPlan.wrapMinimumWidth === void 0 || widthPlan.wrapMinimumWidth <= plot.w;
990
- let sizing = {
991
- ...tableSizing(size, plot, y, totalW, minimumW),
992
- ...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.` } : {}
993
- };
994
- 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 } });
995
- let tableH = naturalTableH;
996
- if (options.heightFill !== "none" && fixedHeightCanvas(options) && ladder.rowHeight === void 0 && figures) {
997
- 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);
998
- if (extra > 0) {
999
- let shift = 0;
1000
- for (let row of rows) {
1001
- let at = rowY.get(row.id), h = isLeafRow(row) ? at.h + extra : at.h;
1002
- rowY.set(row.id, { y: at.y + shift, h }), isLeafRow(row) && (shift += extra);
1003
- }
1004
- tableH += shift;
1005
- }
1006
- }
1007
- let numericStats = /* @__PURE__ */ new Map();
1008
- for (let col of cols) {
1009
- if (col.kind !== "value" && col.kind !== "computed") continue;
1010
- let values = [], textReserve = 0;
1011
- for (let row of rows) {
1012
- let cell = row.cells[col.id];
1013
- 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));
1014
- }
1015
- let signed = col.kind === "computed" && !!col.polarity || (col.format ? parseFormatExample(col.format).signed : !1);
1016
- numericStats.set(col.id, {
1017
- min: values.length > 0 ? minOf(values) : 0,
1018
- max: values.length > 0 ? maxOf(values) : 0,
1019
- maxAbs: values.length > 0 ? maxOf(values.map((value) => Math.abs(value))) : 0,
1020
- textReserve,
1021
- signed
1022
- });
1023
- }
1024
- let sparkDomains = sparklineDomains(cols, rows);
1025
- if (hasGroupHeads) {
1026
- let headingFrom = -1 / 0, headingEnd = -1 / 0;
1027
- for (let [groupIndex, g] of table.columnGroups.entries()) {
1028
- if (spans[groupIndex].span === 0 || g.heading === !1) continue;
1029
- 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 + ladder.headBox(fonts.group.size) + CRISP, label = groupHeadingLabel(g.label), labelY = groupPad === void 0 ? bracketY - 4 - fonts.group.size * 1.2 : gridY + groupPad.top + (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), 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);
1030
- headingFrom = first.x, headingEnd = centred ? cx + labelW / 2 : startX + labelW, centred ? note === void 0 ? nodes.push({
1031
- t: "text",
1032
- typeRole: "axis",
1033
- id: `group:${g.id}`,
1034
- x: cx,
1035
- y: labelY,
1036
- lines: [label],
1037
- align: "middle",
1038
- font: fonts.group,
1039
- ink: tableInk("head"),
1040
- owner: {},
1041
- part: "tableGroupHeader"
1042
- }) : (nodes.push({
1043
- t: "text",
1044
- typeRole: "axis",
1045
- id: `group:${g.id}`,
1046
- x: startX,
1047
- y: labelY,
1048
- lines: [label],
1049
- align: "start",
1050
- font: fonts.group,
1051
- ink: tableInk("head"),
1052
- owner: {},
1053
- part: "tableGroupHeader"
1054
- }), nodes.push({
1055
- t: "text",
1056
- typeRole: "footnote",
1057
- id: `group-note:${g.id}`,
1058
- x: startX + trackedW,
1059
- y: labelY,
1060
- lines: [note],
1061
- align: "start",
1062
- font: noteFont,
1063
- ink: tableInk("secondary"),
1064
- owner: {},
1065
- part: "tableGroupHeader"
1066
- })) : (nodes.push({
1067
- t: "text",
1068
- typeRole: "axis",
1069
- id: `group:${g.id}`,
1070
- x: startX,
1071
- y: labelY,
1072
- lines: [label],
1073
- align: "start",
1074
- font: fonts.group,
1075
- ink: tableInk("head"),
1076
- owner: {},
1077
- part: "tableGroupHeader"
1078
- }), note !== void 0 && nodes.push({
1079
- t: "text",
1080
- typeRole: "footnote",
1081
- id: `group-note:${g.id}`,
1082
- x: startX + trackedW,
1083
- y: labelY,
1084
- lines: [note],
1085
- align: "start",
1086
- font: noteFont,
1087
- ink: tableInk("secondary"),
1088
- owner: {},
1089
- part: "tableGroupHeader"
1090
- })), nodes.push({
1091
- t: "line",
1092
- id: `group-rule:${g.id}`,
1093
- x1: spanRule ? spanStart : centred ? Math.round(cx - labelW / 2) : startX,
1094
- y1: bracketY,
1095
- // A heading wider than its block runs on, but the rule stops at the block's last column.
1096
- x2: spanRule ? spanEnd : Math.round(centred ? cx + labelW / 2 : startX + labelW),
1097
- y2: bracketY,
1098
- stroke: tableRuleInk(),
1099
- width: rowRuleWidth,
1100
- owner: {},
1101
- part: "tableGroupRule"
1102
- });
1103
- }
1104
- }
1105
- let headerRuleY = gridY + headerH - 1 + CRISP, headerSubY = headerRuleY - headPadBottom - headerSubH - fonts.header.size * 1.2 + fonts.header.size * 1.2;
1106
- for (let col of cols) {
1107
- if (!col.label && col.kind === "rowLabel") continue;
1108
- 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);
1109
- nodes.push({
1110
- t: "text",
1111
- typeRole: "axis",
1112
- id: `header:${col.id}`,
1113
- x: tx,
1114
- y: headerSubY - headerFits.get(col.id).h,
1115
- lines: headerFits.get(col.id).lines,
1116
- ...headerFits.get(col.id).title ? { title: label } : {},
1117
- align,
1118
- font: fonts.header,
1119
- ink: tableInk("head"),
1120
- owner: { colId: col.id },
1121
- part: "tableHeader"
1122
- }), col.subLabel !== void 0 && nodes.push({
1123
- t: "text",
1124
- typeRole: "axis",
1125
- id: `header-sub:${col.id}`,
1126
- x: tx,
1127
- y: headerSubY,
1128
- lines: subFits.get(col.id).lines,
1129
- ...subFits.get(col.id).title ? { title: col.subLabel } : {},
1130
- align,
1131
- font: fonts.sub,
1132
- ink: tableInk("subLabel"),
1133
- owner: { colId: col.id },
1134
- part: "tableHeaderSub"
1135
- });
1136
- }
1137
- nodes.push({
1138
- t: "line",
1139
- id: "rule:header",
1140
- x1: rowX,
1141
- y1: headerRuleY,
1142
- x2: rowX + rowW,
1143
- y2: headerRuleY,
1144
- // `table.headRule: 'ink'` closes the head on the text ink.
1145
- stroke: { token: theme.table?.headRule === "ink" ? "ink" : "rule" },
1146
- width: theme.table?.ruleWidths?.head ?? strokeToken(theme, "hair"),
1147
- owner: {},
1148
- part: "tableHeaderRule"
1149
- });
1150
- let bodyBottom = rowY.size > 0 ? maxOf([...rowY.values()].map((r) => r.y + r.h)) : gridY + headerH, spacerGaps = [];
1151
- rows.forEach((row, index) => {
1152
- if (index === 0 || row.spacer === void 0) return;
1153
- let previous = rowY.get(rows[index - 1].id);
1154
- spacerGaps.push({ from: previous.y + previous.h, to: rowY.get(row.id).y });
1155
- });
1156
- let blockDivider = (id, columnId, fromY = gridY) => {
1157
- let edge = colX.get(columnId)?.x;
1158
- edge === void 0 || edge <= gridX || dividerAt(id, Math.round(edge) + CRISP, fromY);
1159
- };
1160
- function dividerAt(id, x2, fromY) {
1161
- if (nodes.some((node) => node.t === "line" && node.x1 === x2 && node.part === "tableGroupDivider")) return;
1162
- let segments = [], start = fromY;
1163
- for (let gap of spacerGaps)
1164
- gap.from <= start || (segments.push([start, Math.round(gap.from) + CRISP]), start = Math.round(gap.to));
1165
- segments.push([start, Math.round(bodyBottom) + CRISP]), segments.forEach(([y1, y2], index) => nodes.push({
1166
- t: "line",
1167
- id: index === 0 ? id : `${id}:${index}`,
1168
- x1: x2,
1169
- y1,
1170
- x2,
1171
- y2,
1172
- stroke: tableRuleInk(),
1173
- width: rowRuleWidth,
1174
- owner: {},
1175
- part: "tableGroupDivider"
1176
- }));
1177
- }
1178
- if (hasGroups)
1179
- for (let [groupIndex, g] of table.columnGroups.entries()) {
1180
- if (groupIndex === 0 || spans[groupIndex].span === 0 || g.spacer !== void 0 && g.spacer > 0) continue;
1181
- let firstVisible = g.columnIds.find((columnId) => colX.has(columnId));
1182
- firstVisible !== void 0 && blockDivider(`rule:group-divider:${g.id}`, firstVisible);
1183
- }
1184
- for (let run of bandedColumnRuns)
1185
- blockDivider(`rule:band-divider:${run.columnIds[0]}`, run.columnIds[0], gridY + headerGroupH);
1186
- let closeBlock = (id, lastId, fromY) => {
1187
- let index = cols.findIndex((col) => col.id === lastId), next = cols[index + 1];
1188
- if (next !== void 0) {
1189
- let nextGroup = table.columnGroups.find((group) => group.columnIds.includes(next.id));
1190
- nextGroup !== void 0 && (nextGroup.spacer ?? 0) > 0 && nextGroup.columnIds.find((columnId) => colX.has(columnId)) === next.id || blockDivider(id, next.id, fromY);
1191
- return;
1192
- }
1193
- if (options.rowExtent !== "frame") return;
1194
- let last = colX.get(lastId);
1195
- dividerAt(id, Math.round(last.x + last.w) - 1 + CRISP, fromY);
1196
- };
1197
- for (let group of table.columnGroups) {
1198
- if (group.band !== !0) continue;
1199
- let visible = group.columnIds.filter((columnId) => colX.has(columnId));
1200
- visible.length > 0 && closeBlock(`rule:band-close:${group.id}`, visible[visible.length - 1], gridY);
1201
- }
1202
- for (let run of bandedColumnRuns)
1203
- closeBlock(`rule:band-close:${run.columnIds[run.columnIds.length - 1]}`, run.columnIds[run.columnIds.length - 1], gridY + headerGroupH);
1204
- let bandPaint = semanticPalettePaint(theme, options.palette, "neutral", 1 - surface.bandTint), totalGroundPaint = semanticPalettePaint(
1205
- theme,
1206
- options.palette,
1207
- "neutral",
1208
- 1 - Math.min(1, surface.bandTint * 2)
1209
- ), strongColumnBandPaint = {
1210
- token: "neutral",
1211
- theme: { kind: "mix", from: { token: "ink" }, to: totalGroundPaint, weight: surface.bandTint }
1212
- }, grounds = rowGrounds(table), columnBandFills = /* @__PURE__ */ new Map(), rowWashes = /* @__PURE__ */ new Map(), bandedGroups = table.columnGroups.filter((g) => g.band === !0), bandRect = (g) => {
1213
- let visible = g.columnIds.filter((columnId) => colX.has(columnId));
1214
- if (visible.length === 0) return;
1215
- let first = colX.get(visible[0]), last = colX.get(visible[visible.length - 1]);
1216
- return { x: first.x, w: last.x + last.w - first.x };
1217
- }, 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) => {
1218
- let top = row;
1219
- for (; top.parentId !== void 0 && rowById.has(top.parentId); ) top = rowById.get(top.parentId);
1220
- return top;
1221
- }, 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];
1222
- rows.forEach((row, ri) => {
1223
- 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;
1224
- 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"));
1225
- let customGround = authoredGround(row, isTotal);
1226
- 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)) {
1227
- let part = isTotal ? "tableTotalGround" : ground === "emphasis" ? "tableGroupGround" : "tableGroupBand";
1228
- nodes.push({
1229
- t: "rect",
1230
- id: `${isTotal ? "totalground" : ground === "emphasis" ? "groupground" : "groupband"}:${row.id}`,
1231
- rect: blockRuled.has(row.id) ? { x: rowX, y: ry + 1, w: rowW, h: rh - 1 } : { x: rowX, y: ry, w: rowW, h: rh },
1232
- fill: isTotal ? totalGroundPaint : bandPaint,
1233
- owner: { rowId: row.id },
1234
- part
1235
- });
1236
- }
1237
- for (let g of [...bandedGroups, ...bandedColumnRuns]) {
1238
- let band = bandRect(g);
1239
- if (band !== void 0) {
1240
- for (let id of g.columnIds) columnBandFills.set(`${row.id}\0${id}`, ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint);
1241
- nodes.push({
1242
- t: "rect",
1243
- id: `columnband:${"id" in g ? g.id : g.columnIds[0]}:${row.id}`,
1244
- rect: { x: band.x, y: ry, w: band.w, h: rh },
1245
- fill: ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint,
1246
- owner: { rowId: row.id },
1247
- part: "tableColumnBand"
1248
- });
1249
- }
1250
- }
1251
- let rowWash;
1252
- if (options.anchorWash && row.step === 0 && row.hasChildren && row.defaultExpanded && (rowWash = semanticPalettePaint(theme, options.palette, "neutral", surface.anchorTint), nodes.push({
1253
- t: "rect",
1254
- id: `anchorwash:${row.id}`,
1255
- rect: { x: rowX, y: ry, w: rowW, h: rh },
1256
- fill: rowWash,
1257
- owner: { rowId: row.id },
1258
- part: "tableAnchorTint"
1259
- })), row.highlightTone) {
1260
- let tone = row.highlightTone, edgePaint = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus") : { token: tone };
1261
- rowWash = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus", surface.rowTint) : { ...markRolePaint(tone, !0), tint: surface.rowTint }, nodes.push({
1262
- t: "rect",
1263
- id: `rowtint:${row.id}`,
1264
- rect: { x: rowX, y: ry, w: rowW, h: rh },
1265
- fill: rowWash,
1266
- owner: { rowId: row.id },
1267
- part: "tableRowTint"
1268
- }), nodes.push({
1269
- t: "rect",
1270
- id: `rowedge:${row.id}`,
1271
- rect: { x: rowX, y: ry, w: 3, h: rh },
1272
- fill: edgePaint,
1273
- owner: { rowId: row.id },
1274
- part: "tableRowEdge"
1275
- });
1276
- }
1277
- rowWash !== void 0 && rowWashes.set(row.id, rowWash);
1278
- for (let col of cols) {
1279
- let cell = row.cells[col.id];
1280
- if (!cell) continue;
1281
- let { x: cx, w } = colX.get(col.id);
1282
- if (col.kind === "encoding") {
1283
- pushAll(
1284
- nodes,
1285
- encodingSparklineNodes(col, row, { x: cx, y: ry, w, h: rh }, theme, options.palette, measure, sparkDomains.get(col.id), options.locale?.language)
1286
- );
1287
- continue;
1288
- }
1289
- if ((isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
1290
- let drop = isSection ? Math.max(0, rh - sectionNatural() - (rowExtra.get(row.id) ?? 0)) : 0;
1291
- emitCell(cell, row, col.id, cx, w, ry + drop, rh - drop, isTotal, isSection);
1292
- }
1293
- let isLast = row.id === lastRow?.id, next = rows[ri + 1], spacedNext = next?.spacer !== void 0;
1294
- if (closers.has(row.id)) {
1295
- let finalRule = theme.table?.finalRule ?? "double";
1296
- 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"));
1297
- } else if (next?.kind !== "result") {
1298
- if (spacedNext && next.role === "total")
1299
- 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"));
1300
- else if (!(spacedNext && !isTotal))
1301
- if (isTotal && next)
1302
- nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
1303
- else if (isLast) {
1304
- let close = isTotal ? "rule" : theme.table?.closeRule ?? "rule";
1305
- close !== "none" && nodes.push(rule("rule:close", ry + rh, close === "grid" ? tableRuleInk() : { token: close }, close === "grid" ? rowRuleWidth : strokeToken(theme, "rule"), "tableCloseRule"));
1306
- } 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")));
1307
- }
1308
- let ruleRefused = isLast && theme.table?.closeRule === "none" || next?.kind === "result" && theme.table?.resultRule === "none";
1309
- if (isSection && heavySectionRule && !ruleRefused) {
1310
- let atY = Math.round(ry + rh) + ruleSpace - sectionRuleSpace / 2;
1311
- 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" });
1312
- }
1313
- });
1314
- function rule(id, atY, stroke, width, part) {
1315
- let yCrisp = Math.round(atY) + CRISP;
1316
- return { t: "line", id, x1: rowX, y1: yCrisp, x2: rowX + rowW, y2: yCrisp, stroke, width, owner: {}, part };
1317
- }
1318
- function usesTotalFace(kind) {
1319
- return kind === void 0 ? !0 : kind === "subtotal" || kind === "result" || kind === "driver" ? !1 : kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0;
1320
- }
1321
- function affixRoom(row, font) {
1322
- 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);
1323
- }
1324
- function noteStatusCut(col, row, shown, full) {
1325
- let cuts = statusCuts.get(col.id);
1326
- cuts || statusCuts.set(col.id, cuts = /* @__PURE__ */ new Map());
1327
- let key = `${shown}\0${full}`, cut = cuts.get(key) ?? { shown, full, rows: [] };
1328
- cuts.set(key, cut), shown === "" && !cut.rows.includes(row.label) && cut.rows.push(row.label);
1329
- }
1330
- function emitStatusMark(cell, row, col, cx, w, ry, rh) {
1331
- let owner = { rowId: row.id, colId: col.id }, square = statusSquare(fonts.body.size), side = Math.min(square.side, Math.max(0, w - 2));
1332
- nodes.push({
1333
- t: "rect",
1334
- id: tableCellNodeId("chip", row.id, col.id),
1335
- rect: { x: Math.round(cx + (w - side) / 2), y: Math.round(ry + (rh - side) / 2), w: side, h: side },
1336
- fill: statusSquarePaint(cell.tone),
1337
- owner,
1338
- part: "tableChip",
1339
- title: cell.displayed,
1340
- display: { state: cell.displayed }
1341
- }), noteStatusCut(col, row, "", cell.displayed);
1342
- }
1343
- function statusFit(col, label, font, room, trackRoom) {
1344
- let key = `${col.id}\0${room}\0${trackRoom}`, fits = statusFits.get(key);
1345
- if (fits === void 0) {
1346
- let labels = [...new Set(widthRows.flatMap((row) => {
1347
- let cell = row.cells[col.id];
1348
- return cell?.kind === "status" && cell.state === "value" ? [cell.displayed] : [];
1349
- }))];
1350
- fits = new Map(labels.map((text) => {
1351
- 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 };
1352
- return [text, cut && cut.text !== text && cut.text.slice(text.startsWith("\u2026") ? 1 : 0).startsWith("\u2026") ? null : cut];
1353
- }));
1354
- let keeper = /* @__PURE__ */ new Map();
1355
- for (let [text, fit2] of fits) {
1356
- let kept = fit2?.title === void 0 ? void 0 : keeper.get(fit2.text);
1357
- fit2?.title !== void 0 && (kept === void 0 || text.length < kept.length) && keeper.set(fit2.text, text);
1358
- }
1359
- for (let [text, fit2] of fits) fit2?.title !== void 0 && keeper.get(fit2.text) !== text && fits.set(text, null);
1360
- statusFits.set(key, fits);
1361
- }
1362
- let fit = fits.get(label);
1363
- return fit === void 0 ? fitStatusLabel(label, font, room, trackRoom, measure) : fit;
1364
- }
1365
- function authoredGround(row, isTotal) {
1366
- let css = row.kind === "subtotal" ? theme.table?.grounds?.subtotal : isTotal ? theme.table?.grounds?.total : void 0;
1367
- return css === void 0 || transparentCss(css) ? void 0 : css;
1368
- }
1369
- function groundInk(ground, ink, tone) {
1370
- if (ground === void 0 || "theme" in ink && ink.theme?.kind === "ground-text") return ink;
1371
- let paint = onTableGround(ink, ground, tone), key = JSON.stringify(paint), known = groundTexts.get(key);
1372
- return known !== void 0 ? known : (groundTexts.set(key, paint), paint);
1373
- }
1374
- function toneInk(ground, tone) {
1375
- return groundInk(ground, toneTextPaint(theme, tone, options.palette), tone);
1376
- }
1377
- function emitCell(cell, row, colId, cx, w, ry, rh, isTotal, isSection) {
1378
- let rowId = row.id, col = cols.find((c) => c.id === colId), font = cellFont(cell), owner = { rowId, colId };
1379
- 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" });
1380
- 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;
1381
- toneFill !== void 0 && nodes.push({ t: "rect", id: tableCellNodeId("toneground", rowId, colId), rect: tintBox, fill: toneFill, owner, part: "tableToneGround" });
1382
- 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 });
1383
- if (figureCell && cell.bar !== void 0 && cell.bar > 0) {
1384
- let top = (inline.extra + head > 0 ? blockTop : ry + (rh - ruleSpace - valueBox) / 2) + 2;
1385
- 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" });
1386
- }
1387
- 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;
1388
- if (cell.kind === "status" && cell.state === "value" && col.statusMark === "square") {
1389
- 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);
1390
- if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1391
- let { text: label, title } = fit;
1392
- title !== void 0 && noteStatusCut(col, row, label, title);
1393
- let groupW = square.side + square.gap + measure(label, fonts.body).width, markX = Math.round(cx + (w - groupW) / 2);
1394
- nodes.push({
1395
- t: "rect",
1396
- id: tableCellNodeId("chip", rowId, colId),
1397
- rect: { x: markX, y: Math.round(ry + (rh - square.side) / 2), w: square.side, h: square.side },
1398
- fill: statusSquarePaint(cell.tone),
1399
- owner,
1400
- part: "tableChip"
1401
- }), nodes.push({
1402
- t: "text",
1403
- typeRole: "label",
1404
- id: tableCellNodeId("cell", rowId, colId),
1405
- x: markX + square.side + square.gap,
1406
- y: ry + (rh - fonts.body.size * 1.2) / 2,
1407
- lines: [label],
1408
- align: "start",
1409
- font: fonts.body,
1410
- ink: groundInk(textGround, { token: "ink" }),
1411
- owner,
1412
- part: "tableCell",
1413
- role: "category",
1414
- display: { state: cell.displayed },
1415
- ...title === void 0 ? {} : { title }
1416
- });
1417
- return;
1418
- }
1419
- if (cell.kind === "status" && cell.state === "value") {
1420
- let fit = statusFit(col, cell.displayed, fonts.chip, w - 2 * cellPadX2 - 2 * CHIP_PAD_X, w - 2 * CHIP_PAD_X);
1421
- if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1422
- let { text: label, title } = fit;
1423
- title !== void 0 && noteStatusCut(col, row, label, title);
1424
- 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);
1425
- nodes.push({
1426
- t: "rect",
1427
- id: tableCellNodeId("chip", rowId, colId),
1428
- rect: { x: chipX, y: chipY, w: chipW, h: chipH },
1429
- fill: chip.fill,
1430
- // A status preset's chips are square; everywhere else they keep the
1431
- // theme's chip radius.
1432
- radius: language.squareChips ? 0 : surface.chipRadius,
1433
- owner,
1434
- part: "tableChip"
1435
- }), nodes.push({
1436
- t: "text",
1437
- typeRole: "label",
1438
- id: tableCellNodeId("cell", rowId, colId),
1439
- x: chipX + chipW / 2,
1440
- y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1441
- lines: [label],
1442
- align: "middle",
1443
- font: fonts.chip,
1444
- ink: chip.ink,
1445
- owner,
1446
- part: "tableCell",
1447
- role: "category",
1448
- display: { state: cell.displayed },
1449
- ...title === void 0 ? {} : { title }
1450
- });
1451
- return;
1452
- }
1453
- let indent = cell.kind === "rowLabel" ? rowIndent(cellStep(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);
1454
- if (parentRow && options.outlineMarks === !0 && row.foldable !== !1) {
1455
- 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;
1456
- 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({
1457
- t: "path",
1458
- id: `mark:${rowId}`,
1459
- 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`,
1460
- stroke: boxed ? { token: "ink" } : tableInk("toggle"),
1461
- width: strokeToken(theme, "mark"),
1462
- lineCap: "round",
1463
- owner,
1464
- part: "tableOutlineMark"
1465
- });
1466
- }
1467
- 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(
1468
- cell,
1469
- col.kind,
1470
- isSection,
1471
- font,
1472
- maxW,
1473
- wrappedCell,
1474
- cutTitles.get(tableCellKey(rowId, colId)),
1475
- measure,
1476
- theme.table?.section?.case
1477
- ), lines = wrappedCell ?? [text], sectionLabel = isSection && col.kind === "rowLabel";
1478
- if (sectionLabel && align !== "start") {
1479
- let groupW = measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + badgeReserve, start = contentX + indent;
1480
- tx = align === "end" ? contentX + contentW - groupW : start + (contentX + contentW - start - groupW) / 2;
1481
- }
1482
- 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 = {
1483
- cell,
1484
- box: { x: cx, y: ry, w, h: rh },
1485
- theme,
1486
- ...options.palette === void 0 ? {} : { palette: options.palette },
1487
- ...cell.tone === "neutral" || enc?.type !== "arrow" ? {} : { toneInk: toneInk(textGround, cell.tone) },
1488
- measure,
1489
- nodeId: (suffix) => tableCellNodeId(suffix, rowId, colId),
1490
- owner
1491
- }, stats = numericStats.get(colId), encodingInk, ownGround = hasPolarityBadge(cell, col), lane = heatLanes.get(colId);
1492
- if ((col.kind === "value" || col.kind === "computed") && enc?.type === "heat" && lane) {
1493
- let heat = emitHeat({ ...context, box: tintBox }, lane, enc), heatGround = heat.nodes.find((node) => node.t === "rect")?.fill;
1494
- 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 });
1495
- } else (col.kind === "value" || col.kind === "computed") && enc?.type === "inCellBar" && stats ? nodes.push(
1496
- ...emitInCellBar(context, {
1497
- contentBox: { x: contentX, y: ry, w: contentW, h: rh },
1498
- maxAbs: stats.maxAbs,
1499
- textReserve: stats.textReserve
1500
- })
1501
- ) : 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 }));
1502
- if (ownGround) {
1503
- let badgeH = chipHeight(rh, font.size), tw = measure(text, figureFont(font, cellDrawsTabular(theme, col.kind, text))).width;
1504
- nodes.push({
1505
- t: "rect",
1506
- id: tableCellNodeId("badge", rowId, colId),
1507
- rect: {
1508
- x: Math.round(cx + w - cellPadX2 - tw - 6),
1509
- y: Math.round(textTop + (font.size * 1.2 - badgeH) / 2),
1510
- w: Math.round(tw + 12),
1511
- h: badgeH
1512
- },
1513
- fill: chipPaints(theme, cell.tone, options.palette).fill,
1514
- radius: surface.chipRadius,
1515
- owner,
1516
- part: "tableBadge"
1517
- }), tx = cx + w - cellPadX2;
1518
- }
1519
- 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;
1520
- if (cell.kind === "rowLabel" && row.operator !== void 0 && operatorSlot > 0 && nodes.push({
1521
- t: "text",
1522
- id: `operator:${rowId}`,
1523
- x: tx - operatorSlot,
1524
- y: textTop,
1525
- lines: [row.operator],
1526
- align: "start",
1527
- font,
1528
- ink: groundInk(textGround, tableInk("operator")),
1529
- owner,
1530
- part: "tableOperator",
1531
- typeRole: "label",
1532
- role: "category"
1533
- }), printsFigure && nodes.push({
1534
- t: "text",
1535
- typeRole: "label",
1536
- id: tableCellNodeId("cell", rowId, colId),
1537
- x: tx,
1538
- y: textTop,
1539
- lines,
1540
- ...cutTitle !== void 0 ? { title: cutTitle } : {},
1541
- align: drawnAlign,
1542
- font: drawnFont,
1543
- ink,
1544
- owner,
1545
- part: "tableCell",
1546
- ...cellRole(col.kind, lines.join(" ")),
1547
- ...cell.displayed === "" ? {} : {
1548
- display: cell.state === "value" ? { value: cell.displayed } : { state: cell.displayed }
1549
- }
1550
- }), inline.lines.length > 0 && (col.kind === "rowLabel" || col.kind === "value" || col.kind === "computed")) {
1551
- let base = inline.note === void 0 ? 0 : 1, lineY = blockTop + valueBox + head + ladder.inlineGap + base * inline.box;
1552
- for (let [index, line] of inline.lines.entries()) {
1553
- 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;
1554
- if (lineY += inline.box, inline.noteSlots.get(colId) === base + index || !printed) continue;
1555
- let toned = col.kind !== "rowLabel" && lineCell?.state === "value" && lineCell.tone !== "neutral";
1556
- nodes.push({
1557
- t: "text",
1558
- typeRole: "label",
1559
- id: tableCellNodeId("cellline", rowId, colId, line.id),
1560
- x: col.kind === "rowLabel" ? contentX + indent + INLINE_LABEL_INDENT : cx + w - cellPadX2,
1561
- y: y2,
1562
- lines: [printed],
1563
- align: col.kind === "rowLabel" ? "start" : "end",
1564
- font: lineFont,
1565
- 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")),
1566
- owner,
1567
- part: "tableCellLine",
1568
- ...col.kind === "rowLabel" ? { role: "category" } : cellRole(col.kind, printed),
1569
- ...lineCell === void 0 || lineCell.displayed === "" || col.kind === "rowLabel" ? {} : { display: lineCell.state === "value" ? { value: lineCell.displayed } : { state: lineCell.displayed } }
1570
- });
1571
- }
1572
- }
1573
- if (affixWidth > 0 && nodes.push({
1574
- t: "text",
1575
- typeRole: "label",
1576
- id: `unit:${rowId}`,
1577
- // Measured in the face the label is drawn in: a bolder label measured in the body face ran
1578
- // into its unit ("marginof product sales"). Under the label, the unit starts its own line.
1579
- x: affixBelow.has(rowId) ? tx : tx + measure(lines[lines.length - 1] ?? text, drawnFont).width + Math.max(theme.table?.qualifier?.gap ?? 4, measure(" ", affixFont).width),
1580
- // baseline lock: the affix shares the label's baseline exactly
1581
- 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,
1582
- lines: [row.unitAffix],
1583
- align: "start",
1584
- font: affixFont,
1585
- ink: groundInk(textGround, tableInk(row.kind === "driver" ? "driver" : "qualifier")),
1586
- owner,
1587
- part: "tableRowUnit",
1588
- // A hoisted scale letter is a number's tail and takes the figures;
1589
- // an authored unit is a phrase ("$ per order") and reads as prose,
1590
- // which is the composed-role rule.
1591
- role: composedTextRole(row.unitAffix, "caption")
1592
- }), badge !== void 0) {
1593
- 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));
1594
- nodes.push({
1595
- t: "rect",
1596
- id: `sectionbadge:${rowId}`,
1597
- rect: { x: chipX, y: chipY, w: badgeW, h: chipH },
1598
- fill: chip.fill,
1599
- radius: language.squareChips ? 0 : surface.chipRadius,
1600
- owner,
1601
- part: "tableSectionBadge"
1602
- }), nodes.push({
1603
- t: "text",
1604
- typeRole: "label",
1605
- id: `sectionbadge-text:${rowId}`,
1606
- x: chipX + badgeW / 2,
1607
- y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1608
- lines: [badge.text],
1609
- align: "middle",
1610
- font: fonts.chip,
1611
- ink: chip.ink,
1612
- owner,
1613
- part: "tableSectionBadge",
1614
- role: "category",
1615
- display: { state: badge.text }
1616
- });
1617
- }
1618
- if (parentRow && !expanded && align === "start") {
1619
- let noun = table.levelNouns?.[cell.level + 1], count = childCount.get(rowId) ?? 0;
1620
- if (noun !== void 0 && count > 0) {
1621
- 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;
1622
- hint !== void 0 && nodes.push({
1623
- t: "text",
1624
- typeRole: "label",
1625
- id: `hint:${rowId}`,
1626
- x: hintX,
1627
- y: textTop + (lines.length - 1) * font.size * 1.2 + (font.size - fonts.hint.size) * NOTE_BASELINE_LOCK,
1628
- lines: [hint.text],
1629
- ...hint.title === void 0 ? {} : { title: hint.title },
1630
- align: "start",
1631
- font: fonts.hint,
1632
- ink: groundInk(textGround, tableInk("secondary")),
1633
- owner,
1634
- part: "tableCollapsedHint",
1635
- role: "category"
1636
- });
1637
- }
1638
- }
1639
- let noteSlot = inline.noteSlots.get(colId);
1640
- if (cell.note && noteSlot !== void 0) {
1641
- let noteFont = inlineFont2(row.step, !1);
1642
- nodes.push({
1643
- t: "text",
1644
- typeRole: "footnote",
1645
- id: tableCellNodeId("note", rowId, colId),
1646
- x: align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent,
1647
- y: blockTop + valueBox + head + ladder.inlineGap + noteSlot * inline.box + (inline.box - noteFont.size * 1.2) / 2,
1648
- lines: [cell.note],
1649
- align,
1650
- font: noteFont,
1651
- ink: groundInk(textGround, tableInk("secondary")),
1652
- owner,
1653
- part: "tableCellNote"
1654
- });
1655
- } else if (cell.note && col.kind === "rowLabel" && inline.note !== void 0) {
1656
- let noteFont = inlineFont2(row.step, !1);
1657
- nodes.push({
1658
- t: "text",
1659
- typeRole: "footnote",
1660
- id: tableCellNodeId("note", rowId, colId),
1661
- x: contentX + indent,
1662
- y: blockTop + valueBox + head + ladder.inlineGap + (inline.box - noteFont.size * 1.2) / 2,
1663
- lines: [cell.note],
1664
- align: "start",
1665
- font: noteFont,
1666
- ink: groundInk(textGround, tableInk("secondary")),
1667
- owner,
1668
- part: "tableCellNote"
1669
- });
1670
- } else if (cell.note) {
1671
- 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;
1672
- nodes.push({
1673
- t: "text",
1674
- typeRole: "footnote",
1675
- id: tableCellNodeId("note", rowId, colId),
1676
- x: noteX,
1677
- y: noteY,
1678
- lines: [cell.note],
1679
- align: align === "end" ? "end" : "start",
1680
- font: fonts.note,
1681
- ink: groundInk(textGround, tableInk("secondary")),
1682
- owner,
1683
- part: "tableCellNote"
1684
- });
1685
- }
1686
- }
1687
- occupied.claim({ x: rowX, y: gridY, w: rowW, h: headerH }, "mark", {}, "tableHeader");
1688
- for (let row of rows) {
1689
- let { y: ry, h: rh } = rowY.get(row.id);
1690
- occupied.claim({ x: rowX, y: ry, w: rowW, h: rh }, "mark", { rowId: row.id }, "tableRow");
1691
- }
1692
- for (let col of cols) {
1693
- let { x: cx, w } = colX.get(col.id);
1694
- occupied.claim({ x: cx, y: gridY, w, h: tableH }, "mark", { colId: col.id }, "tableColumn");
1695
- }
1696
- let marks = {
1697
- table: { x: gridX, y: gridY, w: tableW, h: tableH },
1698
- headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
1699
- columns: cols.map((c) => ({ id: c.id, ...colX.get(c.id) })),
1700
- rows: rows.map((r) => ({ id: r.id, ...rowY.get(r.id) }))
1701
- }, paintWarningRules = [];
1702
- if (groundTexts.size > 0) {
1703
- let texts = options.colorblindSafe === !0 ? colorblindRoles([...groundTexts.values()]).value : [...groundTexts.values()];
1704
- paintWarningRules.push({ kind: "table-ground-text", texts, before: warnings.length }), pushAll(warnings, groundTextWarnings(theme, texts));
1705
- }
1706
- let scene = options.colorblindSafe === !0 ? colorblindRoles(nodes).value : nodes, cutNotes = cols.flatMap((col) => {
1707
- let cuts = statusCuts.get(col.id), entry = ({ shown, full, rows: named }) => `${shown !== "" ? shown : named.join(", ")} = ${full}`;
1708
- return cuts ? [disclosureNote(`${col.label}: ${[...cuts.values()].map(entry).join("; ")}`)] : [];
1709
- }).filter((note) => !(options[ENGINE_NOTES] ?? []).includes(note));
1710
- return cutNotes.length > 0 ? layoutTableOnce(authoredData, { ...options, [ENGINE_NOTES]: [...options[ENGINE_NOTES] ?? [], ...cutNotes] }, initialResolved, sizingOnly, formatFits) : {
1711
- type: "table",
1712
- size,
1713
- sizing,
1714
- plot,
1715
- scene,
1716
- labels: [],
1717
- axes: [],
1718
- annotations: [],
1719
- frame: frame.frame,
1720
- marks,
1721
- derived: { table, computedCells: resolved.computedCells },
1722
- a11y: {
1723
- title: accessibleTitle(options.title, "Table"),
1724
- counts: [structureCount("rows", dataRows.length), structureCount("columns", cols.length)],
1725
- desc: `Table with ${dataRows.length} rows and ${cols.length} columns`
1726
- },
1727
- warnings,
1728
- ...paintWarningRules.length > 0 ? { paintWarningRules } : {},
1729
- debug: { occupied: occupied.snapshot(), decisions: [] }
1730
- };
1731
- }
1732
- function tableSizing(size, plot, bottom, totalW, minimumW) {
1733
- return rowSizing("table", size, {
1734
- chromeH: size.height - plot.h,
1735
- minimumRowsH: bottom - plot.y + 4,
1736
- naturalRowsH: bottom - plot.y + 4,
1737
- minWidth: size.width - plot.w + minimumW,
1738
- naturalWidth: size.width - plot.w + totalW
1739
- });
1740
- }
1741
- function fitStatusLabel(label, font, room, trackRoom, measure) {
1742
- let width = measure(label, font).width;
1743
- if (width <= room) return { text: label };
1744
- if (room < HEADING_CUT_MIN) return width <= trackRoom ? { text: label } : null;
1745
- let cut = cutWithTitle(label, font, room, measure);
1746
- return cut.text === "\u2026" || cut.text === "" ? null : cut;
1747
- }
1748
- function cellText(cell, kind, isSection, font, maxW, wrapped, wrappedTitle, measure, sectionCase) {
1749
- let text = isSection && sectionCase !== "asis" ? sectionText(cell.displayed) : cell.displayed;
1750
- 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 };
1751
- }
1752
- function sectionText(s) {
1753
- return s.toUpperCase();
1754
- }
1755
- function encodingSparklineNodes(col, row, box, theme, palette, measure, domain, language) {
1756
- if (row.role === "section" || col.encoding?.type !== "sparkline") return [];
1757
- let values = sparklineSourceValues(row, col.encoding.sourceColumns), last = lastObservedIndex(values), lastSource = last === void 0 ? void 0 : col.encoding.sourceColumns[last];
1758
- return emitSparkline(
1759
- {
1760
- cell: row.cells[col.id],
1761
- box,
1762
- theme,
1763
- ...palette === void 0 ? {} : { palette },
1764
- measure,
1765
- nodeId: (suffix) => tableCellNodeId(suffix, row.id, col.id),
1766
- owner: { rowId: row.id, colId: col.id }
1767
- },
1768
- values,
1769
- {
1770
- kind: col.encoding.kind ?? "line",
1771
- domain: domain ?? tableSparklineDomain([row], col.encoding.sourceColumns, col.encoding.kind ?? "line"),
1772
- lastText: lastSource === void 0 ? void 0 : row.cells[lastSource]?.displayed,
1773
- language
1774
- }
1775
- );
1776
- }
1777
- function transparentCss(css) {
1778
- return css.trim().toLowerCase() === "transparent";
1779
- }
1780
-
1781
- export {
1782
- sparklineSourceValues,
1783
- sparklineDomains,
1784
- emitSparkline,
1785
- fitTableFormats,
1786
- formatsFittedWarning,
1787
- REGULAR_SPACING,
1788
- layoutTable,
1789
- layoutTableCard,
1790
- memoLayout,
1791
- layoutKey,
1792
- classFloor,
1793
- cardHeightFloor
1794
- };