boardplot 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +491 -0
- package/README.md +4 -4
- package/dist/{ReaderBox-YXC5XK7D.js → ReaderBox-GLCKYXBU.js} +14 -10
- package/dist/{annotateEngine-5O3IRSQL.js → annotateEngine-QVNAE3EH.js} +3 -1
- package/dist/build-identity.json +3 -3
- package/dist/{chunk-MT4MP3UZ.js → chunk-27OIGDRK.js} +1 -1
- package/dist/{chunk-OD3IH6FG.js → chunk-2DOEZ5QY.js} +39 -21
- package/dist/{chunk-WUKSZNHL.js → chunk-2FKEF2AC.js} +32 -21
- package/dist/{chunk-GYNZ72GO.js → chunk-2HTYGMMG.js} +2 -2
- package/dist/chunk-2NN676RI.js +25 -0
- package/dist/{chunk-4MREJWRM.js → chunk-2NRHD2G7.js} +5 -4
- package/dist/{chunk-3UBTO342.js → chunk-2NSQIPAA.js} +77 -38
- package/dist/{chunk-T7ZCYYQZ.js → chunk-2YO4WRJN.js} +25 -7
- package/dist/{chunk-SHH2AHIU.js → chunk-32LLDRPI.js} +64 -42
- package/dist/{chunk-WEPAE4KG.js → chunk-3465633G.js} +4 -4
- package/dist/{chunk-WGIO6AHP.js → chunk-37PKNVLS.js} +3 -3
- package/dist/chunk-3V62N3Z7.js +24 -0
- package/dist/{chunk-S6CRZKPO.js → chunk-43GGVT7W.js} +5 -5
- package/dist/{chunk-VDAZPGR2.js → chunk-4DZFR52I.js} +2 -2
- package/dist/{chunk-WDONXBQE.js → chunk-4JC3SE4G.js} +1 -1
- package/dist/{chunk-EHVESNLV.js → chunk-4JGBCBDZ.js} +1 -1
- package/dist/{chunk-G6XCUX3I.js → chunk-4JHMCXOB.js} +60 -13
- package/dist/{chunk-GGO43PHB.js → chunk-4KMZAK6J.js} +6 -5
- package/dist/{chunk-GVKFFJ23.js → chunk-4KQHKPB3.js} +462 -149
- package/dist/{chunk-AHQ4L3BE.js → chunk-4LTN7SND.js} +2 -2
- package/dist/{chunk-MZJBPDIL.js → chunk-52WNCUIN.js} +1 -1
- package/dist/{chunk-JAKRPSWP.js → chunk-54ROMBU7.js} +164 -51
- package/dist/{chunk-OZUTYDV4.js → chunk-5DTCOOLU.js} +2 -2
- package/dist/{chunk-DDI2W4TR.js → chunk-5P2TTHBZ.js} +3 -3
- package/dist/{chunk-U2HQELXL.js → chunk-5PPQIF4D.js} +2 -2
- package/dist/{chunk-K4K6KGEF.js → chunk-5S3JQ5AT.js} +241 -195
- package/dist/chunk-5TWY3ZIC.js +19 -0
- package/dist/{chunk-BXEM2CVW.js → chunk-6364WO5D.js} +3 -3
- package/dist/{chunk-ZNHF2XCP.js → chunk-63Y3ROZ7.js} +50 -36
- package/dist/{chunk-VAEC53B3.js → chunk-64LJDGJH.js} +3 -3
- package/dist/{chunk-WZBMTZBM.js → chunk-67QSW5RW.js} +4 -4
- package/dist/{chunk-HGGLJYPZ.js → chunk-6AMN7IKJ.js} +89 -57
- package/dist/{chunk-24BHMKDD.js → chunk-6EYTD777.js} +25 -2
- package/dist/{chunk-HZG5NB7Q.js → chunk-6MJUW5R5.js} +159 -86
- package/dist/{chunk-NGRIT3CY.js → chunk-6QDMRPXI.js} +113 -128
- package/dist/{chunk-HZZH3MQI.js → chunk-6WHWXCHJ.js} +7 -3
- package/dist/{chunk-T3PNYRDM.js → chunk-75WIUG2W.js} +394 -141
- package/dist/{chunk-ZTH6YSVA.js → chunk-76Q7E3TM.js} +117 -102
- package/dist/chunk-7ADUVRG5.js +14 -0
- package/dist/{chunk-U4P6TQRW.js → chunk-7DAH2E4T.js} +2 -2
- package/dist/{chunk-43OQ26TL.js → chunk-7FKY6YWU.js} +8 -8
- package/dist/{chunk-CPKHL7FK.js → chunk-7KSUMFBK.js} +1 -1
- package/dist/{chunk-KL2XJQAA.js → chunk-7M2GK7XQ.js} +1729 -196
- package/dist/{chunk-RZB4RPPD.js → chunk-7PPMT5EJ.js} +155 -151
- package/dist/{chunk-JFBEAUJ6.js → chunk-7Q37C6GZ.js} +1 -1
- package/dist/chunk-7STMIK2X.js +94 -0
- package/dist/{chunk-KFWEO4UA.js → chunk-7VMEM3LN.js} +254 -142
- package/dist/{chunk-GSMWHKOW.js → chunk-7VVHTOE7.js} +7 -7
- package/dist/{chunk-KBFPMESI.js → chunk-A2GAWGVJ.js} +246 -79
- package/dist/{chunk-23RWLBZF.js → chunk-AGDDH6XY.js} +3 -3
- package/dist/chunk-AMR4SUAN.js +25 -0
- package/dist/{chunk-6I7YZTY7.js → chunk-BDGLMWPO.js} +12 -4
- package/dist/{chunk-JJJ2KAHR.js → chunk-BIGQKCU7.js} +20 -9
- package/dist/{chunk-LTMF75MR.js → chunk-BISJK67O.js} +208 -62
- package/dist/{chunk-FILDYFT4.js → chunk-BIVL764T.js} +2 -2
- package/dist/{chunk-RNOJSEES.js → chunk-BK6P6KMW.js} +1 -1
- package/dist/{chunk-XB4KZ6WO.js → chunk-BSATR6ZO.js} +40 -13
- package/dist/{chunk-MYCLO35J.js → chunk-BTDGWHGJ.js} +50 -12
- package/dist/{chunk-PDG4IM3L.js → chunk-BVYIKLQ5.js} +1 -1
- package/dist/{chunk-TNHD4UTC.js → chunk-BYCJ6TKI.js} +13 -3
- package/dist/{chunk-NQSDIDRO.js → chunk-CAJ54IEP.js} +5 -5
- package/dist/{chunk-E42JZ2DA.js → chunk-CB4CERXZ.js} +4 -5
- package/dist/{chunk-ENOCOA3F.js → chunk-CCDXK5NA.js} +5 -5
- package/dist/{chunk-7X3UZM7F.js → chunk-CCJP6QZO.js} +1 -1
- package/dist/{chunk-ELPQZIGR.js → chunk-CF4NMRN7.js} +37 -13
- package/dist/{chunk-32X7JGH3.js → chunk-CHAS5A5B.js} +89 -69
- package/dist/{chunk-AVMKRVNP.js → chunk-CKGSGRP7.js} +14 -24
- package/dist/{chunk-3EZRM4YM.js → chunk-CPGASWNN.js} +25 -1
- package/dist/{chunk-BWTX7LUG.js → chunk-CXETOLPX.js} +9 -4
- package/dist/{chunk-D3D7XHBI.js → chunk-CYKXROFG.js} +6 -6
- package/dist/{chunk-DRTA6JG5.js → chunk-D2B3KP35.js} +26 -15
- package/dist/{chunk-TSPWXAAI.js → chunk-DD6RVD3S.js} +6 -7
- package/dist/{chunk-A5TY7H5T.js → chunk-DF3XEFQ7.js} +159 -53
- package/dist/{chunk-P52JHUUM.js → chunk-DLDDRXAI.js} +198 -88
- package/dist/{chunk-XNA6DATU.js → chunk-DLUNQHFO.js} +99 -56
- package/dist/{chunk-2THWIKRB.js → chunk-DMAMWUYY.js} +33 -16
- package/dist/chunk-DQ7YMQVX.js +26 -0
- package/dist/{chunk-4WK3CNW5.js → chunk-DRHQG44U.js} +11 -0
- package/dist/{chunk-WZGJSQKN.js → chunk-DZ3S4RPI.js} +15 -1
- package/dist/chunk-E2ZUBP4Q.js +24 -0
- package/dist/{chunk-G63ROSY5.js → chunk-E555EDOQ.js} +139 -72
- package/dist/{chunk-A7IEVBYI.js → chunk-E76U5H52.js} +1 -5
- package/dist/{chunk-J2ROMB7J.js → chunk-E7V3OHQQ.js} +64 -26
- package/dist/chunk-EBB4PYBN.js +24 -0
- package/dist/{chunk-FPPN5NAR.js → chunk-ECBUFKCP.js} +3 -3
- package/dist/{chunk-5PCCSSII.js → chunk-EGGDPDYJ.js} +1 -1
- package/dist/{chunk-F7X53SZM.js → chunk-EIL3KHAL.js} +12 -7
- package/dist/{chunk-MBVXROCI.js → chunk-EMFUZKYK.js} +20 -3
- package/dist/{chunk-TNNK4IIY.js → chunk-ETMHDCEH.js} +13 -12
- package/dist/{chunk-WMZCOGD6.js → chunk-EZZ533MH.js} +1 -1
- package/dist/{chunk-GEBGBJBD.js → chunk-F2EVCJ4U.js} +41 -34
- package/dist/{chunk-2IXDYW6O.js → chunk-F5BYLT3M.js} +195 -57
- package/dist/{chunk-NRHTC2SQ.js → chunk-F6OLHND5.js} +2 -2
- package/dist/{chunk-3FNY7ZCG.js → chunk-F77TMAUY.js} +141 -79
- package/dist/{chunk-QQNPU27R.js → chunk-FCECYJVA.js} +1 -1
- package/dist/{chunk-RGZGLKFB.js → chunk-FFJGC2DX.js} +418 -62
- package/dist/chunk-FG5L2LUK.js +89 -0
- package/dist/chunk-FMDNJ6PC.js +47 -0
- package/dist/{chunk-4WQ2MBE7.js → chunk-FNMH5WEY.js} +1 -1
- package/dist/{chunk-F35DA442.js → chunk-FNRPQIQE.js} +46 -27
- package/dist/{chunk-7EVIIADO.js → chunk-GC4WOLV3.js} +3 -1
- package/dist/{chunk-JB4YPOMT.js → chunk-GELSK76Y.js} +6 -7
- package/dist/{chunk-5SJQOPL7.js → chunk-GIHH6VC2.js} +4 -4
- package/dist/chunk-GLQ3KCTY.js +24 -0
- package/dist/{chunk-HHS6333D.js → chunk-GM3EGUYW.js} +2 -2
- package/dist/{chunk-PBYUJSEY.js → chunk-GQT2SY2S.js} +66 -43
- package/dist/{chunk-BUPLB3EX.js → chunk-H3IBJQ5A.js} +6 -2
- package/dist/{chunk-K4RCWNLC.js → chunk-HHXIVFAU.js} +11 -8
- package/dist/{chunk-B3F4TS3V.js → chunk-HJRNBKIT.js} +768 -69
- package/dist/chunk-HOU2MZHC.js +61 -0
- package/dist/{chunk-S4QSJAGY.js → chunk-HZUAEMN5.js} +1 -1
- package/dist/chunk-I7H5DU34.js +132 -0
- package/dist/{chunk-YS56RSTZ.js → chunk-IFQN4GKK.js} +161 -69
- package/dist/chunk-IGJ2G5C6.js +24 -0
- package/dist/{chunk-4ZGN4ZUN.js → chunk-IGNBQT23.js} +87 -3
- package/dist/{chunk-B6LHZLLK.js → chunk-IGVAWAOK.js} +31 -101
- package/dist/chunk-INHDHZNP.js +8 -0
- package/dist/chunk-IRXVV65V.js +24 -0
- package/dist/{chunk-IDDA5INB.js → chunk-IVRYF7QA.js} +7 -4
- package/dist/{chunk-3RMTPAEJ.js → chunk-JCAGVAB3.js} +810 -73
- package/dist/{chunk-OMVYFSOM.js → chunk-JCIXYOND.js} +2 -2
- package/dist/{chunk-6TJDWMZV.js → chunk-JEUL777U.js} +83 -9
- package/dist/{chunk-J33RA3YO.js → chunk-JFFREZGT.js} +5 -5
- package/dist/{chunk-AJHYXD5U.js → chunk-JGFHNAHS.js} +2 -2
- package/dist/chunk-JHWYG7V5.js +24 -0
- package/dist/{chunk-EP54VZI5.js → chunk-JIEVDGAF.js} +1 -1
- package/dist/{chunk-IDT7DJ7F.js → chunk-JKOEHRGV.js} +1 -1
- package/dist/chunk-JMGB444D.js +26 -0
- package/dist/{chunk-DSZUV3TM.js → chunk-JTC5SEAQ.js} +3 -3
- package/dist/chunk-JTFKRDDA.js +53 -0
- package/dist/{chunk-RKITD2UJ.js → chunk-JVZTKQFS.js} +6 -3
- package/dist/{chunk-BBL3R5YZ.js → chunk-JXBZIJCG.js} +1 -1
- package/dist/{chunk-WLZ54FWG.js → chunk-JYAZPMSA.js} +70 -1
- package/dist/chunk-K3VZ5QJK.js +19 -0
- package/dist/{chunk-EYLWVI26.js → chunk-KBJMLXNW.js} +165 -124
- package/dist/{chunk-KAQH75T6.js → chunk-KD5GOR2K.js} +82 -48
- package/dist/{chunk-LNKY5Z2X.js → chunk-KDSYZLF6.js} +2 -3
- package/dist/{chunk-7NWFKHSG.js → chunk-KF7HD3EH.js} +116 -42
- package/dist/{chunk-V7RAPZHX.js → chunk-KLB2QC24.js} +3 -3
- package/dist/chunk-KLIZXSBK.js +24 -0
- package/dist/{chunk-HDZGZJKR.js → chunk-KQCKK3LD.js} +100 -36
- package/dist/{chunk-4TPHMIE5.js → chunk-KTHFHD6C.js} +4 -2
- package/dist/{chunk-IYEFEBRN.js → chunk-KZJ5VM6E.js} +14 -3
- package/dist/{chunk-MEG4NMSI.js → chunk-L6YVK6VC.js} +2 -2
- package/dist/chunk-LGNJCPFP.js +28 -0
- package/dist/{chunk-7JQAUJOL.js → chunk-LKMFMNQX.js} +1 -1
- package/dist/{chunk-QY5ZKUWY.js → chunk-MAFPVR4G.js} +9 -3
- package/dist/{chunk-QR35TD2B.js → chunk-MD6DCQMA.js} +37 -37
- package/dist/{chunk-AA4U62G6.js → chunk-MJPXHCBW.js} +4 -4
- package/dist/{chunk-LYVOL4TQ.js → chunk-MOK3ZS6P.js} +2 -1
- package/dist/{chunk-MKVV7GVJ.js → chunk-MOS6WFWM.js} +13 -7
- package/dist/{chunk-2DR5MMDY.js → chunk-MPO5TVGF.js} +12 -6
- package/dist/{chunk-OU5K2JPF.js → chunk-MRAP2UVV.js} +102 -32
- package/dist/chunk-MS7O3KDJ.js +24 -0
- package/dist/{chunk-53OYF4ZT.js → chunk-MSYTF3DZ.js} +26 -11
- package/dist/{chunk-5A6MO4AR.js → chunk-MZACASZY.js} +7 -4
- package/dist/{chunk-H4H4O62O.js → chunk-N5HN5QGH.js} +1 -1
- package/dist/chunk-NCLRZQR6.js +211 -0
- package/dist/{chunk-C54QLNE4.js → chunk-NGA7ICG4.js} +1 -1
- package/dist/{chunk-SFQ5ADIG.js → chunk-NHC2ADGI.js} +315 -151
- package/dist/chunk-NMTWUYUF.js +30 -0
- package/dist/chunk-O36WX56O.js +13 -0
- package/dist/{chunk-FV32N6AF.js → chunk-O6ZTIDWB.js} +6 -4
- package/dist/{chunk-6BJQULXR.js → chunk-O7REHICC.js} +85 -39
- package/dist/{chunk-4FFCIQDG.js → chunk-OG2YUVBW.js} +4 -1
- package/dist/{chunk-CICWSCLC.js → chunk-OJ5CQV7H.js} +146 -69
- package/dist/{chunk-ULTSSIOU.js → chunk-OQQMDSCC.js} +1 -1
- package/dist/{chunk-PJWLKCFX.js → chunk-P4SMC4BY.js} +98 -90
- package/dist/{chunk-JEYJRJ7M.js → chunk-PJBEJR2U.js} +5 -4
- package/dist/{chunk-AZIRTSVP.js → chunk-PQLAZEQV.js} +122 -52
- package/dist/chunk-PZ46S2SY.js +69 -0
- package/dist/chunk-QB5HV4IY.js +24 -0
- package/dist/{chunk-IM4WUIR7.js → chunk-QGFKSDQO.js} +2 -2
- package/dist/chunk-QJWLNP64.js +24 -0
- package/dist/chunk-QLANK3VN.js +24 -0
- package/dist/chunk-QSMGZOT5.js +24 -0
- package/dist/{chunk-UYNAL3Y3.js → chunk-QWCLWFKC.js} +142 -68
- package/dist/chunk-QZIHKQRH.js +26 -0
- package/dist/{chunk-SZCPKGYG.js → chunk-R2IKOLBK.js} +3 -3
- package/dist/{chunk-BRPOSOK5.js → chunk-R5MEBBAA.js} +144 -71
- package/dist/{chunk-47BO6MYI.js → chunk-RJGCYGC3.js} +137 -70
- package/dist/chunk-RLMC5CUP.js +24 -0
- package/dist/{chunk-6NLH6TEP.js → chunk-RMC4OONA.js} +331 -143
- package/dist/{chunk-26P4WRQC.js → chunk-RPIKNMZA.js} +6 -3
- package/dist/{chunk-YF2PYLC4.js → chunk-RSCRIWAH.js} +1 -1
- package/dist/{chunk-DHWCFQNO.js → chunk-RT66UTLJ.js} +4 -18
- package/dist/{chunk-DAVHGK27.js → chunk-S7NRL66K.js} +46 -23
- package/dist/{chunk-VABRPZVC.js → chunk-SA46CNMS.js} +5 -1
- package/dist/chunk-SE7MJ2LQ.js +24 -0
- package/dist/{chunk-L7RHB734.js → chunk-SGDWLXUC.js} +1 -1
- package/dist/{chunk-E64MTTBC.js → chunk-SMHZXHHD.js} +45 -14
- package/dist/{chunk-AG2CJ4JY.js → chunk-SNQ7D5R7.js} +18 -1
- package/dist/{chunk-3V7AA3IZ.js → chunk-SPSGUFTI.js} +11 -3
- package/dist/{chunk-I2E3YDNZ.js → chunk-SRAV6FPB.js} +33 -9
- package/dist/chunk-SRUV7AT6.js +51 -0
- package/dist/{chunk-KJEZFOO6.js → chunk-SS4YGK3E.js} +91 -48
- package/dist/{chunk-WQ55QPEB.js → chunk-SXD3OYAR.js} +241 -118
- package/dist/{chunk-U7LLQ7XM.js → chunk-T2CYNDYU.js} +473 -109
- package/dist/{chunk-FMFCGYCE.js → chunk-T2YDWT54.js} +289 -300
- package/dist/{chunk-KORHKDJW.js → chunk-TE4M52AA.js} +2 -1
- package/dist/chunk-TUW5IYGA.js +24 -0
- package/dist/chunk-TXBO2LWM.js +25 -0
- package/dist/chunk-U3A6FMSI.js +28 -0
- package/dist/{chunk-EHDWWFNV.js → chunk-UBCVBBJJ.js} +3 -3
- package/dist/chunk-UPTXFTKH.js +25 -0
- package/dist/chunk-UREXN6WG.js +25 -0
- package/dist/chunk-UZLR25BW.js +24 -0
- package/dist/{chunk-JEL6665C.js → chunk-UZTQUPTB.js} +6 -6
- package/dist/{chunk-ISWU5YB3.js → chunk-V5JQQMFQ.js} +11 -5
- package/dist/chunk-V634AXDM.js +31 -0
- package/dist/{chunk-57ZGVAU3.js → chunk-V7F4F6JA.js} +39 -6
- package/dist/chunk-VJ7VBB6S.js +58 -0
- package/dist/{chunk-LVXOY5WL.js → chunk-VPL3JYC6.js} +6 -5
- package/dist/{chunk-VWYUUBBP.js → chunk-VVXKFU72.js} +83 -32
- package/dist/{chunk-XTGWCYAR.js → chunk-WBETBGSC.js} +430 -256
- package/dist/chunk-WI5VOSQX.js +125 -0
- package/dist/chunk-WIVFIVFZ.js +27 -0
- package/dist/{chunk-OURX73UJ.js → chunk-WN3HEU3P.js} +13 -11
- package/dist/{chunk-7EOLHBI6.js → chunk-WTQAG2OT.js} +81 -21
- package/dist/{chunk-G57ZO7DB.js → chunk-WWGPTEQB.js} +66 -26
- package/dist/{chunk-33PLBIMA.js → chunk-WXJ5MHLH.js} +3 -2
- package/dist/chunk-X23SZHV5.js +25 -0
- package/dist/{chunk-TKQKXBGC.js → chunk-X3KCQEYZ.js} +10 -8
- package/dist/chunk-X3YP4DUV.js +76 -0
- package/dist/chunk-XC5IRUEL.js +48 -0
- package/dist/{chunk-LFX7W4B7.js → chunk-XCROSJ2Z.js} +1 -1
- package/dist/{chunk-RK4S3VPS.js → chunk-XHRUXZD7.js} +3 -3
- package/dist/{chunk-S32YYDIB.js → chunk-XMP2DNLI.js} +4 -3
- package/dist/{chunk-C3O45JWU.js → chunk-XQMYQ4TN.js} +4 -4
- package/dist/{chunk-QKL7IY42.js → chunk-Y54LU4CU.js} +1 -1
- package/dist/chunk-YHD2FZFP.js +24 -0
- package/dist/{chunk-OMNQXHFF.js → chunk-YK2KWNTU.js} +31 -20
- package/dist/chunk-YMTXTQCN.js +24 -0
- package/dist/{chunk-SGD3ZHID.js → chunk-YOOHNQ3L.js} +15 -4
- package/dist/{chunk-JTJNQKPM.js → chunk-YPYD6OJ3.js} +2 -2
- package/dist/{chunk-3P4PJJND.js → chunk-YYJORENB.js} +6 -6
- package/dist/{chunk-NRF223FR.js → chunk-YZZLIYPA.js} +1 -1
- package/dist/{chunk-WJKVNRCR.js → chunk-Z55DXFWS.js} +18 -17
- package/dist/{chunk-UTQGZF37.js → chunk-ZEYBI47P.js} +1 -1
- package/dist/{chunk-WKWMOZNE.js → chunk-ZJFJ2IKQ.js} +226 -61
- package/dist/{chunk-QJ4WGAC6.js → chunk-ZKJ5L35C.js} +94 -21
- package/dist/{chunk-ZXOD37BE.js → chunk-ZL6IHMOW.js} +73 -39
- package/dist/chunk-ZMPH2OC4.js +24 -0
- package/dist/{chunk-EYZ6SLF3.js → chunk-ZVM5TFGR.js} +7 -7
- package/dist/chunk-ZWNRLIFT.js +24 -0
- package/dist/{chunk-VNLSTZES.js → chunk-ZY72LSQK.js} +314 -92
- package/dist/chunk-ZYQYX66L.js +24 -0
- package/dist/cli/index.js +3 -3
- package/dist/{core-MN45UFF4.js → core-3KLQSYWB.js} +3 -1
- package/dist/{core-DAFZ7YJW.js → core-4HFVG4CP.js} +2 -1
- package/dist/{core-34KIMTK6.js → core-4RR6VSXM.js} +2 -1
- package/dist/{core-7R3ARYNI.js → core-5UF44NDI.js} +5 -1
- package/dist/{core-3CWPIFAL.js → core-7S3XMW5O.js} +3 -1
- package/dist/{core-ONNGSKWQ.js → core-7Y5BZZON.js} +5 -1
- package/dist/{core-AEYGGH7X.js → core-A5AKUB7H.js} +4 -1
- package/dist/{core-YPH723Z7.js → core-AR2T32Y3.js} +8 -1
- package/dist/{core-CJZXX2V3.js → core-BBNY2BX4.js} +2 -1
- package/dist/{core-CJ7FFPDU.js → core-BLHEJ5OK.js} +5 -1
- package/dist/{core-KII4CH3W.js → core-BOG33BFD.js} +3 -1
- package/dist/{core-O2K4BDYH.js → core-DD62MWEW.js} +4 -1
- package/dist/{core-WJSKT5XM.js → core-DFZMOO7E.js} +5 -1
- package/dist/{core-QXIAQFHM.js → core-E2XOSHPR.js} +3 -1
- package/dist/{core-R27R6J5M.js → core-G3LXHW73.js} +3 -1
- package/dist/{core-V7I4F6JW.js → core-GLOZY6Z7.js} +5 -1
- package/dist/{core-KZK3WCUG.js → core-GSILPKUR.js} +3 -1
- package/dist/{core-GEUPUZUY.js → core-H5HO2CED.js} +3 -1
- package/dist/{core-W7AZNHOX.js → core-HDNWVLJW.js} +3 -1
- package/dist/{core-L7Y7YXWR.js → core-HTD5RHE7.js} +1 -1
- package/dist/{core-WHI4ABF2.js → core-ILPXXC2Z.js} +1 -1
- package/dist/{core-RGLOYY73.js → core-J2JD5ODO.js} +6 -1
- package/dist/{core-ASBJZZTP.js → core-JDFUZFRH.js} +2 -1
- package/dist/{core-XKV7GMPG.js → core-K3JX5WPM.js} +2 -1
- package/dist/{core-L5KTPXHC.js → core-LB5M7XL4.js} +3 -1
- package/dist/{core-KCORN7F7.js → core-LGJZUP6H.js} +3 -1
- package/dist/{core-DJPGSTXB.js → core-MU4ALRR7.js} +8 -1
- package/dist/{core-MNUVP5IJ.js → core-QPSAYRFT.js} +5 -1
- package/dist/{core-YVNOHIQ4.js → core-RR2CAZC5.js} +3 -1
- package/dist/{core-KF6GJOGW.js → core-TCSW24N6.js} +7 -1
- package/dist/{core-JLXFDYHX.js → core-TKZZZ6UW.js} +4 -1
- package/dist/{core-7YKLT7KY.js → core-VKZSQFRG.js} +4 -1
- package/dist/{core-EAIFSTDE.js → core-WJNK7F2J.js} +3 -1
- package/dist/{core-JLJTP7P6.js → core-WZ4CHVYL.js} +3 -1
- package/dist/{core-PFXIBWLD.js → core-XW7UJFJZ.js} +4 -1
- package/dist/{core-RCFFJANI.js → core-YMXYUGF5.js} +5 -1
- package/dist/{core-DKJUX7Q4.js → core-ZLSQHZ3I.js} +3 -1
- package/dist/{dataTable-VKEHFLJM.js → dataTable-CNDRVGA5.js} +4 -2
- package/dist/{engine-PPXKJJFI.js → engine-FVEIM3WV.js} +59 -32
- package/dist/fixtures.js +6 -1
- package/dist/{fontTables-WYCZNRE7.js → fontTables-ZPZQ6IR3.js} +1 -1
- package/dist/fonts.js +2 -1
- package/dist/geo/dach.js +3 -1
- package/dist/geo/de-states.js +3 -1
- package/dist/geo/eu27.js +3 -1
- package/dist/geo/europe.js +3 -1
- package/dist/geo/index.js +4 -2
- package/dist/geo/us-states.js +3 -1
- package/dist/geo/world.js +3 -1
- package/dist/index.js +31 -26
- package/dist/{main-53MXACOU.js → main-THU6VIVU.js} +55 -24
- package/dist/mcp/server.js +50 -22
- package/dist/{module-SVEW5ZUE.js → module-ZSR7KTAS.js} +1 -1
- package/dist/react/bar.js +6 -1
- package/dist/react/bartable.js +6 -1
- package/dist/react/box.js +6 -1
- package/dist/react/bullet.js +4 -1
- package/dist/react/butterfly.js +5 -1
- package/dist/react/choropleth.js +4 -1
- package/dist/react/cohort.js +4 -1
- package/dist/react/column.js +9 -1
- package/dist/react/combo.js +3 -1
- package/dist/react/creative.js +2 -1
- package/dist/react/diagram.js +3 -1
- package/dist/react/dimswitch.js +4 -1
- package/dist/react/dot.js +9 -1
- package/dist/react/export.js +33 -30
- package/dist/react/funnel.js +4 -1
- package/dist/react/gantt.js +4 -1
- package/dist/react/grid.js +4 -1
- package/dist/react/heatmap.js +4 -1
- package/dist/react/histogram.js +6 -1
- package/dist/react/index.js +95 -90
- package/dist/react/kpi.js +2 -1
- package/dist/react/likert.js +7 -1
- package/dist/react/line.js +4 -1
- package/dist/react/mekko.js +5 -1
- package/dist/react/pareto.js +3 -1
- package/dist/react/pie.js +5 -1
- package/dist/react/prepare.js +33 -27
- package/dist/react/pvm.js +4 -1
- package/dist/react/pyramid.js +5 -1
- package/dist/react/sankey.js +4 -1
- package/dist/react/scatter.js +4 -1
- package/dist/react/slope.js +6 -1
- package/dist/react/sparkline.js +4 -1
- package/dist/react/spec.js +25 -32
- package/dist/react/status.js +8 -1
- package/dist/react/story.js +6 -4
- package/dist/react/table.js +4 -1
- package/dist/react/theme.js +6 -3
- package/dist/react/tilemap.js +4 -1
- package/dist/react/treemap.js +3 -1
- package/dist/react/variance.js +5 -1
- package/dist/react/waffle.js +3 -1
- package/dist/react/waterfall.js +4 -1
- package/dist/{resvg-ZOVDIZTV.js → resvg-VB7S5HRF.js} +1 -1
- package/dist/rows.js +2 -3
- package/dist/{rowsModule-L3MBGPBH.js → rowsModule-LI6KOS46.js} +2 -1
- package/dist/{schema-GVHM2HEF.js → schema-25INXAMY.js} +1 -1
- package/dist/{schema-ZCZCY34J.js → schema-5DUTAVO7.js} +1 -1
- package/dist/{schema-26YUL3MG.js → schema-5KDEQBBT.js} +1 -1
- package/dist/{schema-FT37ZEYY.js → schema-5ZTGVQAJ.js} +1 -3
- package/dist/{schema-CMXL5F5L.js → schema-72EEMYS3.js} +1 -1
- package/dist/{schema-6ZV532RM.js → schema-7NSV542V.js} +1 -1
- package/dist/{schema-HWU55RJL.js → schema-AMT7P7KB.js} +1 -1
- package/dist/{schema-AQD3H5VV.js → schema-AXRDF6ND.js} +1 -1
- package/dist/{schema-SY3MKF5S.js → schema-B2GCEYXD.js} +1 -1
- package/dist/{schema-QLH2DZFI.js → schema-BBTXTWYI.js} +1 -1
- package/dist/{schema-SLQPM32G.js → schema-BKUFZLLI.js} +1 -1
- package/dist/{schema-LYBOPAGQ.js → schema-CGQID64D.js} +1 -1
- package/dist/{schema-QNI6MNQ2.js → schema-FDFQKIO5.js} +1 -1
- package/dist/{schema-KH62LDYK.js → schema-GN6GAIU5.js} +1 -1
- package/dist/{schema-733PO52K.js → schema-GNTKL5DN.js} +1 -1
- package/dist/{schema-ZSYX76MO.js → schema-H2EC4GAQ.js} +1 -1
- package/dist/{schema-H7RKVTVO.js → schema-HH5HOORE.js} +1 -1
- package/dist/{schema-NOPOI5G2.js → schema-J7TNCZIP.js} +1 -1
- package/dist/{schema-WAKLKLBB.js → schema-JH57NFXJ.js} +1 -1
- package/dist/{schema-KFXLS67Q.js → schema-KPEPBGAX.js} +1 -1
- package/dist/{schema-GK6MD4EG.js → schema-L5U4OROI.js} +1 -1
- package/dist/{schema-IOWE3RQO.js → schema-LOQ3AFC7.js} +1 -1
- package/dist/{schema-GSE3QXUK.js → schema-M5JBHQIV.js} +5 -3
- package/dist/{schema-IOKAZVL7.js → schema-MMVPMJEF.js} +1 -1
- package/dist/{schema-B4GFRYIP.js → schema-OU35XA3Z.js} +1 -1
- package/dist/{schema-HRHNGOFC.js → schema-PL3EU6EQ.js} +2 -2
- package/dist/{schema-MNG24WU2.js → schema-PQZWO3BP.js} +1 -1
- package/dist/{schema-5E5J43CF.js → schema-QCIE6M2P.js} +2 -1
- package/dist/{schema-Q4IPIR6W.js → schema-QORUB6EK.js} +1 -1
- package/dist/{schema-33ZF6WKL.js → schema-QPOBZUAR.js} +1 -1
- package/dist/{schema-3W7IFXVN.js → schema-R5Y6NVBH.js} +1 -1
- package/dist/{schema-KHCLVE2V.js → schema-THXXFY6I.js} +1 -1
- package/dist/{schema-HGUBNXUY.js → schema-VYECMPON.js} +1 -1
- package/dist/{schema-PNUC54GC.js → schema-YLE4XXQQ.js} +1 -1
- package/dist/{schema-KORNUIC6.js → schema-ZEVJMFLV.js} +1 -1
- package/dist/{schema-4ZXJCRZR.js → schema-ZG6ZKFRZ.js} +1 -1
- package/dist/{schema-WCDYWS4K.js → schema-ZQSIR5UC.js} +1 -1
- package/dist/{specValidation-H5B4MQST.js → specValidation-VHLGDEME.js} +3 -1
- package/dist/theme.js +4 -2
- package/dist/{themeShapeRules-54U5EIZR.js → themeShapeRules-PW4BQHKL.js} +1 -1
- package/dist/types/core/a11y/recordsShared.d.ts +4 -0
- package/dist/types/core/annotate.d.ts +39 -0
- package/dist/types/core/annotateArms.d.ts +1 -1
- package/dist/types/core/axis.d.ts +2 -0
- package/dist/types/core/calendarLabels.d.ts +15 -0
- package/dist/types/core/charts/band/stacks.d.ts +71 -2
- package/dist/types/core/charts/bartable/types.d.ts +10 -0
- package/dist/types/core/charts/box/types.d.ts +2 -0
- package/dist/types/core/charts/choropleth/index.d.ts +7 -0
- package/dist/types/core/charts/choropleth/layout.d.ts +7 -0
- package/dist/types/core/charts/choropleth/schema.d.ts +36 -0
- package/dist/types/core/charts/cohort/types.d.ts +8 -1
- package/dist/types/core/charts/column/layout.d.ts +1 -1
- package/dist/types/core/charts/column/model.d.ts +4 -0
- package/dist/types/core/charts/combo/endpoints.d.ts +1 -1
- package/dist/types/core/charts/creative/types.d.ts +1 -1
- package/dist/types/core/charts/dimswitch/compile.d.ts +2 -0
- package/dist/types/core/charts/dimswitch/types.d.ts +8 -0
- package/dist/types/core/charts/grid/normalize.d.ts +18 -1
- package/dist/types/core/charts/heatmap/fixtures.d.ts +2 -2
- package/dist/types/core/charts/histogram/types.d.ts +14 -2
- package/dist/types/core/charts/likert/layout.d.ts +14 -9
- package/dist/types/core/charts/logAxis.d.ts +55 -0
- package/dist/types/core/charts/pvm/types.d.ts +6 -0
- package/dist/types/core/charts/pyramid/types.d.ts +7 -4
- package/dist/types/core/charts/sankey/types.d.ts +3 -1
- package/dist/types/core/charts/scatter/clamp.d.ts +155 -0
- package/dist/types/core/charts/scatter/frontier.d.ts +21 -0
- package/dist/types/core/charts/scatter/index.d.ts +9 -0
- package/dist/types/core/charts/scatter/layout.d.ts +26 -0
- package/dist/types/core/charts/scatter/logAxis.d.ts +14 -0
- package/dist/types/core/charts/scatter/model.d.ts +258 -0
- package/dist/types/core/charts/scatter/schema.d.ts +57 -0
- package/dist/types/core/charts/scatter/trend.d.ts +54 -0
- package/dist/types/core/charts/scatter/valueLines.d.ts +47 -0
- package/dist/types/core/charts/sparkline/fixtures.d.ts +1 -1
- package/dist/types/core/charts/status/layout.d.ts +5 -3
- package/dist/types/core/charts/table/resolve.d.ts +0 -7
- package/dist/types/core/charts/tilemap/index.d.ts +6 -0
- package/dist/types/core/charts/tilemap/layout.d.ts +5 -0
- package/dist/types/core/charts/tilemap/schema.d.ts +4 -0
- package/dist/types/core/charts/treemap/types.d.ts +2 -2
- package/dist/types/core/charts/variance/fixtures.d.ts +2 -1
- package/dist/types/core/charts/waffle/types.d.ts +2 -0
- package/dist/types/core/dateFormat.d.ts +1 -1
- package/dist/types/core/doc/diagnostics.d.ts +8 -0
- package/dist/types/core/doc/document.d.ts +9 -1
- package/dist/types/core/doc/ownedDocumentCopy.d.ts +2 -1
- package/dist/types/core/fontMetrics/index.d.ts +1 -1
- package/dist/types/core/footer.d.ts +9 -1
- package/dist/types/core/format.d.ts +8 -1
- package/dist/types/core/formatSpec.d.ts +84 -6
- package/dist/types/core/frame.d.ts +41 -8
- package/dist/types/core/geo/packs/registry.d.ts +3 -2
- package/dist/types/core/geometry.d.ts +19 -0
- package/dist/types/core/icons.d.ts +11 -0
- package/dist/types/core/inputError.d.ts +3 -0
- package/dist/types/core/isoDate.d.ts +2 -0
- package/dist/types/core/label/categoryRow.d.ts +9 -1
- package/dist/types/core/label/occupied.d.ts +5 -0
- package/dist/types/core/label/solver.d.ts +31 -2
- package/dist/types/core/notes.d.ts +13 -1
- package/dist/types/core/ols.d.ts +38 -0
- package/dist/types/core/periodYears.d.ts +5 -1
- package/dist/types/core/registry.d.ts +12 -0
- package/dist/types/core/request.d.ts +3 -2
- package/dist/types/core/scale.d.ts +7 -0
- package/dist/types/core/schema/capability.d.ts +17 -20
- package/dist/types/core/schema/namedColumns.d.ts +6 -0
- package/dist/types/core/schema/refusals.d.ts +1 -4
- package/dist/types/core/shareRounding.d.ts +8 -0
- package/dist/types/core/sizing.d.ts +17 -12
- package/dist/types/core/story.d.ts +3 -0
- package/dist/types/core/target.d.ts +6 -0
- package/dist/types/core/text.d.ts +8 -0
- package/dist/types/core/theme.d.ts +52 -1
- package/dist/types/core/types/annotations.d.ts +15 -3
- package/dist/types/core/types/data.d.ts +4 -1
- package/dist/types/core/types/diagram.d.ts +81 -2
- package/dist/types/core/types/optionInput.d.ts +13 -0
- package/dist/types/core/types/options.d.ts +65 -24
- package/dist/types/core/types/scene.d.ts +79 -2
- package/dist/types/core/types/table.d.ts +11 -0
- package/dist/types/core/types/theme.d.ts +48 -3
- package/dist/types/index.d.ts +28 -27
- package/dist/types/optionTypes.d.ts +44 -0
- package/dist/types/react/DimSwitchChart.d.ts +2 -1
- package/dist/types/react/RefusalBoundary.d.ts +25 -0
- package/dist/types/react/SceneRenderer.d.ts +3 -1
- package/dist/types/react/SizePlaceholder.d.ts +2 -1
- package/dist/types/react/TableChart.d.ts +8 -4
- package/dist/types/react/barrelCharts.d.ts +1521 -1012
- package/dist/types/react/charts/bar.d.ts +36 -25
- package/dist/types/react/charts/bartable.d.ts +36 -25
- package/dist/types/react/charts/box.d.ts +36 -25
- package/dist/types/react/charts/bullet.d.ts +36 -25
- package/dist/types/react/charts/butterfly.d.ts +36 -25
- package/dist/types/react/charts/choropleth.d.ts +36 -25
- package/dist/types/react/charts/cohort.d.ts +76 -50
- package/dist/types/react/charts/column.d.ts +36 -25
- package/dist/types/react/charts/combo.d.ts +2 -1
- package/dist/types/react/charts/creative.d.ts +31 -25
- package/dist/types/react/charts/diagram.d.ts +302 -160
- package/dist/types/react/charts/dot.d.ts +36 -25
- package/dist/types/react/charts/funnel.d.ts +36 -25
- package/dist/types/react/charts/gantt.d.ts +36 -25
- package/dist/types/react/charts/grid.d.ts +38 -27
- package/dist/types/react/charts/heatmap.d.ts +36 -25
- package/dist/types/react/charts/histogram.d.ts +36 -25
- package/dist/types/react/charts/kpi.d.ts +36 -25
- package/dist/types/react/charts/likert.d.ts +36 -25
- package/dist/types/react/charts/line.d.ts +36 -25
- package/dist/types/react/charts/mekko.d.ts +36 -25
- package/dist/types/react/charts/pareto.d.ts +33 -25
- package/dist/types/react/charts/pie.d.ts +36 -25
- package/dist/types/react/charts/pvm.d.ts +36 -25
- package/dist/types/react/charts/pyramid.d.ts +33 -25
- package/dist/types/react/charts/sankey.d.ts +36 -25
- package/dist/types/react/charts/scatter.d.ts +36 -25
- package/dist/types/react/charts/slope.d.ts +36 -25
- package/dist/types/react/charts/sparkline.d.ts +36 -25
- package/dist/types/react/charts/status.d.ts +36 -25
- package/dist/types/react/charts/tilemap.d.ts +36 -25
- package/dist/types/react/charts/treemap.d.ts +36 -25
- package/dist/types/react/charts/variance.d.ts +36 -25
- package/dist/types/react/charts/waffle.d.ts +36 -25
- package/dist/types/react/charts/waterfall.d.ts +36 -25
- package/dist/types/react/createChartComponent.d.ts +11 -9
- package/dist/types/react/footerFrame.d.ts +1 -1
- package/dist/types/react/hover/engine.d.ts +2 -1
- package/dist/types/react/hover/labelCard.d.ts +20 -2
- package/dist/types/react/prepare.d.ts +2 -2
- package/dist/types/react/prepared.d.ts +5 -1
- package/dist/types/react/useContainerSize.d.ts +2 -0
- package/dist/types/rows.d.ts +1 -1
- package/dist/validate.js +13 -8
- package/docs/manual.md +139 -35
- package/docs/reference/bar.md +10 -7
- package/docs/reference/bartable.md +7 -3
- package/docs/reference/box.md +5 -2
- package/docs/reference/bullet.md +7 -5
- package/docs/reference/butterfly.md +12 -5
- package/docs/reference/choropleth.md +10 -8
- package/docs/reference/cohort.md +3 -2
- package/docs/reference/column.md +14 -7
- package/docs/reference/combo.md +8 -6
- package/docs/reference/creative.md +1 -1
- package/docs/reference/diagram.md +94 -18
- package/docs/reference/dimswitch.md +16 -13
- package/docs/reference/dot.md +7 -4
- package/docs/reference/fixtures.md +49 -5
- package/docs/reference/funnel.md +4 -3
- package/docs/reference/gantt.md +1 -1
- package/docs/reference/grid.md +1 -1
- package/docs/reference/heatmap.md +6 -4
- package/docs/reference/histogram.md +7 -4
- package/docs/reference/kpi.md +11 -8
- package/docs/reference/likert.md +7 -3
- package/docs/reference/line.md +9 -8
- package/docs/reference/mekko.md +4 -4
- package/docs/reference/options.md +34 -32
- package/docs/reference/pareto.md +4 -4
- package/docs/reference/pie.md +8 -7
- package/docs/reference/pvm.md +4 -2
- package/docs/reference/pyramid.md +4 -4
- package/docs/reference/react.md +20 -11
- package/docs/reference/sankey.md +5 -3
- package/docs/reference/scatter.md +3 -3
- package/docs/reference/slope.md +7 -6
- package/docs/reference/sparkline.md +6 -5
- package/docs/reference/status.md +6 -4
- package/docs/reference/table.md +28 -26
- package/docs/reference/theme.md +93 -85
- package/docs/reference/tilemap.md +8 -7
- package/docs/reference/treemap.md +6 -5
- package/docs/reference/variance.md +8 -5
- package/docs/reference/waffle.md +2 -1
- package/docs/reference/waterfall.md +12 -9
- package/docs/use-cases.md +25 -2
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/dist/chunk-2HXKW6U6.js +0 -24
- package/dist/chunk-35ZTANEK.js +0 -24
- package/dist/chunk-3CLLHMFF.js +0 -24
- package/dist/chunk-46ZPFJAM.js +0 -24
- package/dist/chunk-6BWSF5PS.js +0 -24
- package/dist/chunk-6K2TMVPF.js +0 -42
- package/dist/chunk-6KWIQ5KF.js +0 -18
- package/dist/chunk-6ZXMA4TY.js +0 -24
- package/dist/chunk-7HFUG25L.js +0 -24
- package/dist/chunk-7R5EV5MS.js +0 -24
- package/dist/chunk-7X65ZQN4.js +0 -38
- package/dist/chunk-ATUZTGZI.js +0 -25
- package/dist/chunk-BW5VLBSZ.js +0 -15
- package/dist/chunk-BYD7VLAI.js +0 -24
- package/dist/chunk-CEY646NZ.js +0 -28
- package/dist/chunk-D7GZPMHW.js +0 -24
- package/dist/chunk-FIANWJXX.js +0 -19
- package/dist/chunk-H4SYN3QA.js +0 -24
- package/dist/chunk-HC4NDND6.js +0 -24
- package/dist/chunk-HNVW3YDS.js +0 -25
- package/dist/chunk-HW7BPJNQ.js +0 -24
- package/dist/chunk-I5L3QTKQ.js +0 -24
- package/dist/chunk-IK4BHOPZ.js +0 -33
- package/dist/chunk-IMJXJHFW.js +0 -88
- package/dist/chunk-JDEVGTSX.js +0 -24
- package/dist/chunk-K2KU4HHT.js +0 -25
- package/dist/chunk-KDMKHR5A.js +0 -32
- package/dist/chunk-KNZD53L4.js +0 -24
- package/dist/chunk-KOJ5QETJ.js +0 -8
- package/dist/chunk-KSQEG6DX.js +0 -24
- package/dist/chunk-KVSJ2O4Q.js +0 -24
- package/dist/chunk-L3JWM7FR.js +0 -50
- package/dist/chunk-L7FSCT4M.js +0 -28
- package/dist/chunk-LMPZKCDM.js +0 -24
- package/dist/chunk-MONVTUHR.js +0 -24
- package/dist/chunk-NWQTSZYC.js +0 -24
- package/dist/chunk-OM67S6S4.js +0 -19
- package/dist/chunk-OTW5SEFS.js +0 -21
- package/dist/chunk-PGV25HTX.js +0 -25
- package/dist/chunk-QGCEHR6S.js +0 -13
- package/dist/chunk-T3IGJARD.js +0 -22
- package/dist/chunk-U2ES66IN.js +0 -26
- package/dist/chunk-U6CJPTOB.js +0 -19
- package/dist/chunk-VDVXGAIP.js +0 -24
- package/dist/chunk-VGWWUCAB.js +0 -24
- package/dist/chunk-X4U6PT3Z.js +0 -33
- package/dist/chunk-XXNLNZ7E.js +0 -24
- package/dist/chunk-ZBJNEJSL.js +0 -24
- package/dist/chunk-ZWJTHFWB.js +0 -27
- /package/dist/{DiagnosticDetails-UNYNYCAH.js → DiagnosticDetails-JFBBXOT2.js} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMPACT_OMITTED_NOTES,
|
|
3
3
|
LIVE_NOTE_SHOW,
|
|
4
|
+
allQuiet,
|
|
4
5
|
chartNotes,
|
|
5
6
|
copyNote,
|
|
6
7
|
defaultNoteLines,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
footerParts,
|
|
13
14
|
footerPlans,
|
|
14
15
|
footerType,
|
|
16
|
+
isQuiet,
|
|
15
17
|
keepNoteMeta,
|
|
16
18
|
liveFooterExtra,
|
|
17
19
|
notesPointer,
|
|
@@ -21,25 +23,26 @@ import {
|
|
|
21
23
|
staticFrame,
|
|
22
24
|
valueNote,
|
|
23
25
|
wrapFootnote
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SMHZXHHD.js";
|
|
25
27
|
import {
|
|
26
28
|
ENGINE_REV
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-QGFKSDQO.js";
|
|
28
30
|
import {
|
|
29
31
|
dateNames
|
|
30
32
|
} from "./chunk-QBR6IKIX.js";
|
|
31
33
|
import {
|
|
32
34
|
parseFormatExample,
|
|
33
35
|
parseISODate,
|
|
34
|
-
unitOfSpec
|
|
35
|
-
|
|
36
|
+
unitOfSpec,
|
|
37
|
+
utcDate
|
|
38
|
+
} from "./chunk-FFJGC2DX.js";
|
|
36
39
|
import {
|
|
37
40
|
chartString,
|
|
38
41
|
chartStrings,
|
|
39
42
|
currencySign,
|
|
40
43
|
localeStrings,
|
|
41
44
|
withLocaleStrings
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-MSYTF3DZ.js";
|
|
43
46
|
import {
|
|
44
47
|
cellValue
|
|
45
48
|
} from "./chunk-O3VN6BTL.js";
|
|
@@ -89,7 +92,7 @@ import {
|
|
|
89
92
|
textScaleOf,
|
|
90
93
|
textSizeOf,
|
|
91
94
|
visibleTintAmount
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-HJRNBKIT.js";
|
|
93
96
|
import {
|
|
94
97
|
COLOR_FIX,
|
|
95
98
|
FILL_SEPARATION_FLOOR,
|
|
@@ -103,7 +106,7 @@ import {
|
|
|
103
106
|
parseColor,
|
|
104
107
|
pickInk,
|
|
105
108
|
readsAsLoss
|
|
106
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-DRHQG44U.js";
|
|
107
110
|
import {
|
|
108
111
|
DEFAULT_TARGET,
|
|
109
112
|
NormalizeError,
|
|
@@ -113,7 +116,7 @@ import {
|
|
|
113
116
|
scaleTextAtFloor,
|
|
114
117
|
targetFloorsPx,
|
|
115
118
|
targetTypeSizesPx
|
|
116
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-YOOHNQ3L.js";
|
|
117
120
|
import {
|
|
118
121
|
maxOf,
|
|
119
122
|
minOf,
|
|
@@ -123,7 +126,15 @@ import {
|
|
|
123
126
|
ellipsize,
|
|
124
127
|
hasAuthoredTypeSize,
|
|
125
128
|
wrapText
|
|
126
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-SNQ7D5R7.js";
|
|
130
|
+
import {
|
|
131
|
+
boldMeasurer,
|
|
132
|
+
boldRuns,
|
|
133
|
+
hasBold,
|
|
134
|
+
markBold,
|
|
135
|
+
plainText,
|
|
136
|
+
splitBoldLines
|
|
137
|
+
} from "./chunk-SRUV7AT6.js";
|
|
127
138
|
|
|
128
139
|
// src/core/geometry.ts
|
|
129
140
|
function rectsOverlap(a, b, pad = 0) {
|
|
@@ -143,26 +154,36 @@ function polylineYAt(line, x) {
|
|
|
143
154
|
function pointRectDistance(p, rect) {
|
|
144
155
|
return Math.hypot(Math.max(rect.x - p.x, 0, p.x - rect.x - rect.w), Math.max(rect.y - p.y, 0, p.y - rect.y - rect.h));
|
|
145
156
|
}
|
|
146
|
-
function pointSegmentDistance(x, y, a,
|
|
147
|
-
let
|
|
157
|
+
function pointSegmentDistance(x, y, a, dx, dy, squared) {
|
|
158
|
+
let t = dx === 0 && dy === 0 ? 0 : Math.max(0, Math.min(1, ((x - a.x) * dx + (y - a.y) * dy) / squared));
|
|
148
159
|
return Math.hypot(x - a.x - t * dx, y - a.y - t * dy);
|
|
149
160
|
}
|
|
150
161
|
function rectLineDistance(rect, line) {
|
|
151
162
|
if (line.length === 1) return pointRectDistance(line[0], rect);
|
|
152
163
|
let right = rect.x + rect.w, bottom = rect.y + rect.h, best = 1 / 0, previousDistance = 1 / 0;
|
|
153
164
|
for (let i = 1; i < line.length; i++) {
|
|
154
|
-
let a = line[i - 1], b = line[i]
|
|
155
|
-
|
|
165
|
+
let a = line[i - 1], b = line[i], dx = b.x - a.x, dy = b.y - a.y, squared = dx * dx + dy * dy, minX = Math.min(a.x, b.x), maxX = Math.max(a.x, b.x), minY = Math.min(a.y, b.y), maxY = Math.max(a.y, b.y), scale = Math.max(
|
|
166
|
+
1,
|
|
167
|
+
Math.abs(rect.x),
|
|
168
|
+
Math.abs(rect.y),
|
|
169
|
+
Math.abs(right),
|
|
170
|
+
Math.abs(bottom),
|
|
171
|
+
Math.abs(a.x),
|
|
172
|
+
Math.abs(a.y),
|
|
173
|
+
Math.abs(b.x),
|
|
174
|
+
Math.abs(b.y)
|
|
175
|
+
), error = scale <= 2 ** 40 && (dx === 0 || Math.abs(dx) >= 2 ** -256) && (dy === 0 || Math.abs(dy) >= 2 ** -256) ? 64 * Number.EPSILON * scale : 1 / 0;
|
|
176
|
+
if (!(rect.w >= 0 && rect.h >= 0 && (maxX < rect.x - error || minX > right + error || maxY < rect.y - error || minY > bottom + error)) && segmentHitsRect(a, b, rect)) return 0;
|
|
156
177
|
i === 1 && (previousDistance = pointRectDistance(a, rect));
|
|
157
178
|
let nextDistance = pointRectDistance(b, rect);
|
|
179
|
+
best = Math.min(best, previousDistance, nextDistance);
|
|
180
|
+
let limit = best + error, leftGap = Math.max(0, minX - rect.x, rect.x - maxX), rightGap = Math.max(0, minX - right, right - maxX), topGap = Math.max(0, minY - rect.y, rect.y - maxY), bottomGap = Math.max(0, minY - bottom, bottom - maxY);
|
|
158
181
|
best = Math.min(
|
|
159
182
|
best,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
pointSegmentDistance(rect.x,
|
|
163
|
-
pointSegmentDistance(right,
|
|
164
|
-
pointSegmentDistance(rect.x, bottom, a, b),
|
|
165
|
-
pointSegmentDistance(right, bottom, a, b)
|
|
183
|
+
leftGap > limit || topGap > limit ? 1 / 0 : pointSegmentDistance(rect.x, rect.y, a, dx, dy, squared),
|
|
184
|
+
rightGap > limit || topGap > limit ? 1 / 0 : pointSegmentDistance(right, rect.y, a, dx, dy, squared),
|
|
185
|
+
leftGap > limit || bottomGap > limit ? 1 / 0 : pointSegmentDistance(rect.x, bottom, a, dx, dy, squared),
|
|
186
|
+
rightGap > limit || bottomGap > limit ? 1 / 0 : pointSegmentDistance(right, bottom, a, dx, dy, squared)
|
|
166
187
|
), previousDistance = nextDistance;
|
|
167
188
|
}
|
|
168
189
|
return best;
|
|
@@ -201,13 +222,19 @@ function rectHitsConvexPolygon(rect, polygon, pad = 0) {
|
|
|
201
222
|
});
|
|
202
223
|
}
|
|
203
224
|
function prepareConvexPolygon(polygon) {
|
|
204
|
-
let
|
|
225
|
+
let axes = [[1, 0], [0, 1], ...polygon.map((p, i) => {
|
|
205
226
|
let q = polygon[(i + 1) % polygon.length];
|
|
206
227
|
return [q.y - p.y, p.x - q.x];
|
|
207
|
-
})]
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
228
|
+
})], projected = [];
|
|
229
|
+
for (let [x, y] of axes) {
|
|
230
|
+
if (!x && !y) continue;
|
|
231
|
+
let min = 1 / 0, max = -1 / 0;
|
|
232
|
+
for (let point of polygon) {
|
|
233
|
+
let value = point.x * x + point.y * y;
|
|
234
|
+
min = Math.min(min, value), max = Math.max(max, value);
|
|
235
|
+
}
|
|
236
|
+
projected.push([x, y, min, max]);
|
|
237
|
+
}
|
|
211
238
|
return (rect, pad) => {
|
|
212
239
|
let x0 = rect.x - pad, y0 = rect.y - pad, x1 = rect.x + rect.w + pad, y1 = rect.y + rect.h + pad;
|
|
213
240
|
return projected.every(([x, y, min, max]) => {
|
|
@@ -248,6 +275,20 @@ function clamp(v, lo, hi) {
|
|
|
248
275
|
function round2(v) {
|
|
249
276
|
return Math.round(v * 100) / 100;
|
|
250
277
|
}
|
|
278
|
+
function cleanFloat(v, scale = v) {
|
|
279
|
+
let decimals = 14 - Math.floor(Math.log10(Math.abs(scale)));
|
|
280
|
+
if (decimals < 0 || decimals > 100) return v;
|
|
281
|
+
let cleaned = Number(v.toFixed(decimals)) + 0;
|
|
282
|
+
return Math.abs(cleaned - v) > 4 * Number.EPSILON * Math.abs(scale) ? v : cleaned;
|
|
283
|
+
}
|
|
284
|
+
function cleanSum(terms) {
|
|
285
|
+
let scale = 0;
|
|
286
|
+
for (let t of terms) scale += Math.abs(t);
|
|
287
|
+
return cleanFloat(terms.reduce((a, b) => a + b, 0), scale);
|
|
288
|
+
}
|
|
289
|
+
function cleanDiff(a, b) {
|
|
290
|
+
return cleanFloat(a - b, Math.max(Math.abs(a), Math.abs(b)));
|
|
291
|
+
}
|
|
251
292
|
function strokeBoxPad(width, dx, dy) {
|
|
252
293
|
let r = width / 2, length = Math.hypot(dx, dy);
|
|
253
294
|
return length === 0 ? { x: r, y: r } : { x: r * Math.abs(dy) / length, y: r * Math.abs(dx) / length };
|
|
@@ -263,6 +304,7 @@ function defaultAnnotationId(annotation, index) {
|
|
|
263
304
|
var ANNOTATION_KIND_PURPOSES = {
|
|
264
305
|
diff: "Draws a level-difference arrow between two anchors and computes either percent change or their signed value difference.",
|
|
265
306
|
cagr: "Draws a growth arrow between two anchored points and computes the compound annual growth rate from their values and ISO-date span.",
|
|
307
|
+
bracket: "Draws a bracket over an inclusive span of steps and prints the sum of their values, after an optional label.",
|
|
266
308
|
delta: "Computes the signed difference between an anchored value and another anchor or literal, then places a collision-managed label at the first anchor.",
|
|
267
309
|
abs: "Reads the anchored data value and places its formatted absolute value in a collision-managed label.",
|
|
268
310
|
note: "Places authored text at an anchored data element through collision avoidance, with an optional icon or status chip.",
|
|
@@ -276,7 +318,7 @@ var ANNOTATION_KIND_PURPOSES = {
|
|
|
276
318
|
// src/core/adjacentSeries.ts
|
|
277
319
|
var ORDERED_STEP_FLOOR = 3, orderedRung = (sample, theme) => {
|
|
278
320
|
let kind = sample.paint !== void 0 && "theme" in sample.paint ? sample.paint.theme?.kind : void 0;
|
|
279
|
-
return kind === "ordered-ramp" || kind === "stack-ramp" && (theme.color.stack?.length ?? 0) >= 2;
|
|
321
|
+
return kind === "ordered-ramp" || kind === "group-ramp" || kind === "neutral-ramp" || kind === "stack-ramp" && (theme.color.stack?.length ?? 0) >= 2;
|
|
280
322
|
}, sideOf = (paint) => paint && "theme" in paint && paint.theme?.kind === "visible-tint" && paint.theme.apart !== void 0 ? paint.theme.base : paint, sameSide = (first, second) => {
|
|
281
323
|
let a = sideOf(first.paint), b = sideOf(second.paint);
|
|
282
324
|
return a !== void 0 && (a !== first.paint || b !== second.paint) && JSON.stringify(a) === JSON.stringify(b);
|
|
@@ -558,13 +600,13 @@ function numericVariant(role, theme) {
|
|
|
558
600
|
|
|
559
601
|
// src/core/label/occupied.ts
|
|
560
602
|
var CELL = 16;
|
|
561
|
-
function cellRange(rect, pad) {
|
|
603
|
+
function cellRange(rect, pad, range) {
|
|
562
604
|
let x0 = Math.floor((rect.x - pad) / CELL), x1 = Math.floor((rect.x + rect.w + pad) / CELL), y0 = Math.floor((rect.y - pad) / CELL), y1 = Math.floor((rect.y + rect.h + pad) / CELL);
|
|
563
605
|
if (x0 <= x1 && y0 <= y1 && (x1 - x0 + 1) * (y1 - y0 + 1) <= 256 && Math.max(-x0, x1, -y0, y1) < 32768)
|
|
564
|
-
return [x0, x1, y0, y1
|
|
606
|
+
return range[0] = x0, range[1] = x1, range[2] = y0, range[3] = y1, range;
|
|
565
607
|
}
|
|
566
608
|
function createOccupiedIndex(_plot) {
|
|
567
|
-
let rects = [], cells = /* @__PURE__ */ new Map(), wide = [], polygonTests = [], hit = (index, rect, pad) => {
|
|
609
|
+
let rects = [], scratchRange = [0, 0, 0, 0], released = /* @__PURE__ */ new Set(), cells = /* @__PURE__ */ new Map(), wide = [], polygonTests = [], hit = (index, rect, pad) => {
|
|
568
610
|
let claim = rects[index];
|
|
569
611
|
return rectsOverlap(claim.rect, rect, pad) && (claim.polygon === void 0 || (polygonTests[index] ??= prepareConvexPolygon(claim.polygon))(rect, pad));
|
|
570
612
|
}, seen = [], stamp = 0, visiting = !1, visitNear = (rect, pad, visit) => {
|
|
@@ -576,14 +618,14 @@ function createOccupiedIndex(_plot) {
|
|
|
576
618
|
visiting = !1;
|
|
577
619
|
}
|
|
578
620
|
}, visitClaims = (rect, pad, visit) => {
|
|
579
|
-
let range = cellRange(rect, pad);
|
|
621
|
+
let range = cellRange(rect, pad, scratchRange);
|
|
580
622
|
if (range === void 0) {
|
|
581
623
|
for (let i = 0; i < rects.length; i++) if (visit(i)) return !0;
|
|
582
624
|
return !1;
|
|
583
625
|
}
|
|
626
|
+
let [x0, x1, y0, y1] = range;
|
|
584
627
|
stamp++;
|
|
585
628
|
for (let w = 0; w < wide.length; w++) if (visit(wide[w])) return !0;
|
|
586
|
-
let [x0, x1, y0, y1] = range;
|
|
587
629
|
for (let x = x0; x <= x1; x++)
|
|
588
630
|
for (let y = y0; y <= y1; y++) {
|
|
589
631
|
let cell = cells.get(x * 65536 + y);
|
|
@@ -600,7 +642,7 @@ function createOccupiedIndex(_plot) {
|
|
|
600
642
|
claim(rect, kind, owner, part, polygon) {
|
|
601
643
|
let claimed = part === void 0 ? { rect: { ...rect }, kind, owner } : { rect: { ...rect }, kind, owner, part };
|
|
602
644
|
polygon !== void 0 && (claimed.polygon = polygon.map((point) => ({ ...point })));
|
|
603
|
-
let index = rects.push(claimed) - 1, range = cellRange(rect, 0);
|
|
645
|
+
let index = rects.push(claimed) - 1, range = cellRange(rect, 0, scratchRange);
|
|
604
646
|
if (range === void 0) wide.push(index);
|
|
605
647
|
else {
|
|
606
648
|
let [x0, x1, y0, y1] = range;
|
|
@@ -621,7 +663,16 @@ function createOccupiedIndex(_plot) {
|
|
|
621
663
|
return visitNear(rect, pad, (i) => (!skip?.(rects[i]) && hit(i, rect, pad) && found.push(i), !1)), found.sort((a, b) => a - b).map((i) => rects[i]);
|
|
622
664
|
},
|
|
623
665
|
snapshot() {
|
|
624
|
-
|
|
666
|
+
let copy = (entry) => ({ ...entry, rect: { ...entry.rect } });
|
|
667
|
+
if (released.size === 0) return rects.map(copy);
|
|
668
|
+
let kept = [];
|
|
669
|
+
return rects.forEach((entry, index) => {
|
|
670
|
+
released.has(index) || kept.push(copy(entry));
|
|
671
|
+
}), kept;
|
|
672
|
+
},
|
|
673
|
+
release(claim) {
|
|
674
|
+
let index = rects.indexOf(claim);
|
|
675
|
+
index < 0 || (released.add(index), claim.rect = { x: -1e9, y: -1e9, w: 0, h: 0 }, claim.polygon = void 0);
|
|
625
676
|
}
|
|
626
677
|
};
|
|
627
678
|
}
|
|
@@ -750,6 +801,10 @@ function labelCtx(theme, size, options, rest) {
|
|
|
750
801
|
};
|
|
751
802
|
}
|
|
752
803
|
var DENSITY_MIN_PRIORITY = PRIORITY.endpoint, REQUIRED_VALUE_PRIORITY = PRIORITY.valueLine;
|
|
804
|
+
function dropsFromRow(row, index) {
|
|
805
|
+
let last = row.eligible.length - 1;
|
|
806
|
+
return row.mode === "none" ? !(row.keepEnds && (index === 0 || index === last)) : (last - index) % 2 !== 0;
|
|
807
|
+
}
|
|
753
808
|
function solveLabels(requests, occupied, ctx) {
|
|
754
809
|
if (!ctx.valueRows?.length) return solveLabelPass(requests, occupied, ctx);
|
|
755
810
|
let initial = occupied.snapshot(), pinned = new Set(requests.filter((req) => req.pinnedSlot ?? ctx.pins[req.id]).map((req) => req.id)), rows = ctx.valueRows.map((row) => ({ ...row, eligible: [], mode: "all", reason: "" })), dropped = /* @__PURE__ */ new Set();
|
|
@@ -764,7 +819,7 @@ function solveLabels(requests, occupied, ctx) {
|
|
|
764
819
|
if (unseated === void 0) break;
|
|
765
820
|
let skipped = row.mode;
|
|
766
821
|
row.mode = row.mode === "all" && row.alternate ? "alternate" : "none", row.reason = `computed row ${row.mode === "alternate" ? "uses alternate values from the end" : "omitted"}; skipped ${skipped}: no candidate for '${unseated}'`, row.eligible.forEach((id, index) => {
|
|
767
|
-
(row
|
|
822
|
+
dropsFromRow(row, index) ? dropped.add(id) : dropped.delete(id);
|
|
768
823
|
});
|
|
769
824
|
}
|
|
770
825
|
}
|
|
@@ -781,7 +836,7 @@ function solveLabels(requests, occupied, ctx) {
|
|
|
781
836
|
}));
|
|
782
837
|
let failed = row.eligible.filter((id) => !dropped.has(id) && byId.get(id)?.hidden);
|
|
783
838
|
row.eligible.length < 2 || failed.length === 0 || (row.mode = row.mode === "all" && row.alternate ? "alternate" : "none", row.reason = `computed row ${row.mode === "alternate" ? "uses alternate values from the end" : "omitted"}; unplaced: ${failed.join(", ")}`, row.eligible.forEach((id, index) => {
|
|
784
|
-
|
|
839
|
+
pinned.has(id) || (dropsFromRow(row, index) ? dropped.add(id) : dropped.delete(id));
|
|
785
840
|
}), retry = !0);
|
|
786
841
|
}
|
|
787
842
|
if (retry) continue;
|
|
@@ -823,7 +878,7 @@ function solveLabelPass(requests, occupied, ctx) {
|
|
|
823
878
|
value = "hard";
|
|
824
879
|
else {
|
|
825
880
|
let sawLabel = !1;
|
|
826
|
-
anyHit(occupied, rect, padding, (o) => o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn || overRules && (o.part === "referenceLine" || o.part === CROSSABLE_RULE_PART) || overLegend && o.kind === "legend" || o.kind === "mark" && (isOwnMark(o.owner, req.owner, req.kind, o.part) || overColumns && isColumnPart(o.part) && rectContains(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && req.candidates[index].onFill?.seriesId === o.owner.seriesId || req.ownStrokeClear && o.kind === "mark" && (o.part === void 0 || o.part === AREA_FILL_PART) && !o.polygon && o.owner.seriesId === req.owner.seriesId && !rectsOverlap(o.rect, rect) || o.kind === "mark" && req.owner.seriesId !== void 0 && o.owner.seriesId === req.owner.seriesId && req.candidates[index].slot.startsWith("inside") && (req.candidates[index].slot.startsWith("insideBand") || !rectsOverlap(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && (req.candidates[index].slot.startsWith("insideBand") || req.candidates[index].insideFill !== void 0) ? !1 : o.kind === "label" ? (sawLabel = !0, !1) : !0) ? value = "hard" : sawLabel && (value = "label"), value !== "hard" && inTickColumn(rect, req.candidates[index].tickAir) && (value = "hard");
|
|
881
|
+
anyHit(occupied, rect, padding, (o) => o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn || overRules && (o.part === "referenceLine" || o.part === CROSSABLE_RULE_PART) || req.candidates[index].overValueLines && isValueLine(o) || overLegend && o.kind === "legend" || o.kind === "mark" && (isOwnMark(o.owner, req.owner, req.kind, o.part) || overColumns && isColumnPart(o.part) && rectContains(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && req.candidates[index].onFill?.seriesId === o.owner.seriesId || req.ownStrokeClear && o.kind === "mark" && (o.part === void 0 || o.part === AREA_FILL_PART) && !o.polygon && o.owner.seriesId === req.owner.seriesId && !rectsOverlap(o.rect, rect) || o.kind === "mark" && req.owner.seriesId !== void 0 && o.owner.seriesId === req.owner.seriesId && req.candidates[index].slot.startsWith("inside") && (req.candidates[index].slot.startsWith("insideBand") || !rectsOverlap(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && (req.candidates[index].slot.startsWith("insideBand") || req.candidates[index].insideFill !== void 0) ? !1 : o.kind === "label" ? (sawLabel = !0, !1) : !0) ? value = "hard" : sawLabel && (value = "label"), value !== "hard" && inTickColumn(rect, req.candidates[index].tickAir) && (value = "hard");
|
|
827
882
|
let tickAir = req.candidates[index].tickAir;
|
|
828
883
|
value !== "hard" && tickAir && anyHit(occupied, rect, tickAir, (o) => o.kind === "axis" && o.rect.w > 2 && o.rect.h > 2) && (value = "hard"), value === "free" && onLeader(rect, padding) && (value = "label"), value === "free" && pinOf(req) !== req.candidates[index].slot && crowdsSeriesValue(req.candidates[index]) && (value = "label");
|
|
829
884
|
}
|
|
@@ -934,7 +989,7 @@ function solveLabelPass(requests, occupied, ctx) {
|
|
|
934
989
|
keepOffLeader(label, req);
|
|
935
990
|
}, crowds = (cand) => req.labelGap !== void 0 && anyHit(occupied, cand.rect, req.labelGap, (o) => o.kind === "label" && !sameOwner(o.owner, req.owner)), indices = req.candidates.map((_, i) => i), crowded = indices.map((i) => crowds(req.candidates[i])), order2 = req.labelGap === void 0 ? indices : [...indices].sort((a, b) => req.candidates[a].penalty - req.candidates[b].penalty || Number(crowded[a]) - Number(crowded[b]) || a - b), ambiguous = [], place = (cand, reason, leader) => {
|
|
936
991
|
let label = finalize(base, req, cand, !1, darkInk, lightInk);
|
|
937
|
-
leader && (label.leader = leader), cand.overRules && anyHit(occupied, cand.rect, req.pad ?? pad, (o) => o.part === "referenceLine") && (label.halo = !0), placed.push(label), occupied.claim(cand.rect, "label", req.owner, TOTAL_KINDS.has(req.kind) ? TOTAL_PART : void 0), claimLeader(label), decisions.push({ labelId: req.id, strategy: "candidatesOccupied", tried, chose: cand.slot, reason: note(reason) });
|
|
992
|
+
leader && (label.leader = leader), cand.overRules && anyHit(occupied, cand.rect, req.pad ?? pad, (o) => o.part === "referenceLine") && (label.halo = !0), cand.overValueLines && anyHit(occupied, cand.rect, req.pad ?? pad, isValueLine) && (label.halo = !0), placed.push(label), occupied.claim(cand.rect, "label", req.owner, TOTAL_KINDS.has(req.kind) ? TOTAL_PART : void 0), claimLeader(label), decisions.push({ labelId: req.id, strategy: "candidatesOccupied", tried, chose: cand.slot, reason: note(reason) });
|
|
938
993
|
}, crossing;
|
|
939
994
|
for (let i of order2) {
|
|
940
995
|
let cand = req.candidates[i];
|
|
@@ -1016,6 +1071,12 @@ function solveLabelPass(requests, occupied, ctx) {
|
|
|
1016
1071
|
let rank = new Map([...owned].sort(labelOrder(pinOf, ctx.focus, !1)).map((req, i) => [req.id, i])), byRank = (a, b) => (rank.get(a) ?? 0) - (rank.get(b) ?? 0);
|
|
1017
1072
|
placed.sort((a, b) => byRank(a.id, b.id)), decisions.sort((a, b) => byRank(a.labelId, b.labelId));
|
|
1018
1073
|
}
|
|
1074
|
+
for (let label of placed) {
|
|
1075
|
+
let req = label.hidden || label.rotate !== -45 ? void 0 : requests.find((r) => r.id === label.id);
|
|
1076
|
+
if (!req) continue;
|
|
1077
|
+
let lineH = req.font.size * (req.font.lineHeight ?? 1.2), length = Math.max(...req.lines.map((line) => ctx.measure(line, req.font).width)), end = { x: label.rect.x + label.rect.w, y: label.rect.y + lineH * Math.SQRT1_2 / 2 }, reach = { x: -length * Math.SQRT1_2, y: length * Math.SQRT1_2 }, half = lineH * Math.SQRT1_2 / 2, polygon = [{ x: end.x - half, y: end.y - half }, { x: end.x + half, y: end.y + half }, { x: end.x + reach.x + half, y: end.y + reach.y + half }, { x: end.x + reach.x - half, y: end.y + reach.y - half }], xs = polygon.map((p) => p.x), ys = polygon.map((p) => p.y);
|
|
1078
|
+
occupied.claim({ x: Math.min(...xs), y: Math.min(...ys), w: Math.max(...xs) - Math.min(...xs), h: Math.max(...ys) - Math.min(...ys) }, "label", label.owner, "rotatedName", polygon);
|
|
1079
|
+
}
|
|
1019
1080
|
return { placed, decisions, warnings, ...ownershipLimited.size > 0 ? { ownershipLimited } : {} };
|
|
1020
1081
|
}
|
|
1021
1082
|
function isOtherOwners(mark, label, kind, part) {
|
|
@@ -1075,7 +1136,7 @@ function withLiftLeaders(req, ownedPoint, runClear) {
|
|
|
1075
1136
|
});
|
|
1076
1137
|
return changed ? { ...req, candidates, ...req.leaderClear ? {} : { leaderClear: !0 } } : req;
|
|
1077
1138
|
}
|
|
1078
|
-
var LED_PENALTY = 100, CROSSABLE_RULE_PART = "crossableRule", LAST_RESORT_PENALTY = 200;
|
|
1139
|
+
var isValueLine = (claim) => claim.kind === "annotation" && claim.part === "referenceLine", LED_PENALTY = 100, CROSSABLE_RULE_PART = "crossableRule", LAST_RESORT_PENALTY = 200;
|
|
1079
1140
|
function withOwnedSeats(requests, model, pinOf) {
|
|
1080
1141
|
return requests.map((req) => {
|
|
1081
1142
|
if (req.kind !== "point" || req.owner.annotationId !== void 0 || req.rotate !== void 0) return req;
|
|
@@ -1134,8 +1195,8 @@ function isOwnMark(mark, label, kind, part) {
|
|
|
1134
1195
|
return shared > 0;
|
|
1135
1196
|
}
|
|
1136
1197
|
var LEADER_GUTTER_RATIO = 0.4, LEADER_MIN_DRAWN_RATIO = 0.6;
|
|
1137
|
-
function leaderTerminus(rect, from) {
|
|
1138
|
-
let gutter = LEADER_GUTTER_RATIO *
|
|
1198
|
+
function leaderTerminus(rect, from, lineHeight = rect.h) {
|
|
1199
|
+
let gutter = LEADER_GUTTER_RATIO * lineHeight, approachesFromLeft = from.x <= rect.x, edgeX = approachesFromLeft ? rect.x : rect.x + rect.w;
|
|
1139
1200
|
return {
|
|
1140
1201
|
x: approachesFromLeft ? edgeX - gutter : edgeX + gutter,
|
|
1141
1202
|
y: rect.y + rect.h / 2
|
|
@@ -1147,13 +1208,19 @@ function leaderExceedsLimit(req, cand) {
|
|
|
1147
1208
|
if (!cand.leaderFrom || !leaderFor(cand)) return !1;
|
|
1148
1209
|
let { rect, leaderFrom: from } = cand;
|
|
1149
1210
|
if (from.x > rect.x && from.x < rect.x + rect.w) return Math.max(rect.y - from.y, from.y - rect.y - rect.h) > req.maxLeaderLength;
|
|
1150
|
-
let end = leaderTerminus(cand.rect, cand.leaderFrom), dx = Math.abs(end.x - cand.leaderFrom.x), dy = Math.abs(end.y - cand.leaderFrom.y);
|
|
1211
|
+
let end = leaderTerminus(cand.rect, cand.leaderFrom, leaderHeightOf(cand)), dx = Math.abs(end.x - cand.leaderFrom.x), dy = Math.abs(end.y - cand.leaderFrom.y);
|
|
1151
1212
|
return (dx <= 8 || dy <= 8 ? Math.hypot(dx, dy) : dx + dy) > req.maxLeaderLength;
|
|
1152
1213
|
}
|
|
1153
1214
|
function leaderFor(cand) {
|
|
1215
|
+
return leaderAt(cand, cand.rect.h) ?? (cand.leaderLineHeight === void 0 ? void 0 : leaderAt(cand, cand.leaderLineHeight));
|
|
1216
|
+
}
|
|
1217
|
+
function leaderHeightOf(cand) {
|
|
1218
|
+
return cand.leaderLineHeight !== void 0 && !leaderAt(cand, cand.rect.h) ? cand.leaderLineHeight : cand.rect.h;
|
|
1219
|
+
}
|
|
1220
|
+
function leaderAt(cand, lineHeight) {
|
|
1154
1221
|
let from = cand.leaderFrom;
|
|
1155
1222
|
if (!from) return;
|
|
1156
|
-
let minimum = LEADER_MIN_DRAWN_RATIO *
|
|
1223
|
+
let minimum = LEADER_MIN_DRAWN_RATIO * lineHeight, approachesFromLeft = from.x <= cand.rect.x, toEdge = leaderTerminus(cand.rect, from, lineHeight), dx = toEdge.x - from.x, dy = toEdge.y - from.y;
|
|
1157
1224
|
if (approachesFromLeft ? dx <= 0 : dx >= 0) return cand.leaderVertical ? verticalLeader(cand.rect, from) : void 0;
|
|
1158
1225
|
if (Math.hypot(dx, dy) < minimum) return;
|
|
1159
1226
|
let d = leaderPath(from, toEdge);
|
|
@@ -1192,7 +1259,8 @@ function finalize(base, _req, cand, pinned, darkInk, lightInk) {
|
|
|
1192
1259
|
theme: {
|
|
1193
1260
|
kind: "contrast-ink",
|
|
1194
1261
|
fill: paint,
|
|
1195
|
-
...pattern ? { pattern } : {}
|
|
1262
|
+
...pattern ? { pattern } : {},
|
|
1263
|
+
...cand.insideMatrix ? { matrix: cand.insideMatrix } : {}
|
|
1196
1264
|
}
|
|
1197
1265
|
}), cand.needsBacking && (cand.contrast === "box" ? label.backing = inflate(cand.rect, 2) : label.halo = !0), cand.leaderFrom) {
|
|
1198
1266
|
let leader = leaderFor(cand);
|
|
@@ -1250,16 +1318,27 @@ function leaderBox(pieces) {
|
|
|
1250
1318
|
let xs = pieces.flatMap(([a, b]) => [a.x, b.x]), ys = pieces.flatMap(([a, b]) => [a.y, b.y]), x = Math.min(...xs), y = Math.min(...ys);
|
|
1251
1319
|
return { x, y, w: Math.max(...xs) - x, h: Math.max(...ys) - y };
|
|
1252
1320
|
}
|
|
1321
|
+
function anchorValueBox(occupied, near, anchor, reach) {
|
|
1322
|
+
let own = occupied.hitsWhich({ x: near.x - reach, y: near.y - reach, w: near.w + reach * 2, h: near.h + reach * 2 }, 0).filter((claim) => printsAnchor(claim, anchor));
|
|
1323
|
+
return own.length === 0 ? void 0 : own.slice(1).reduce((u, { rect }) => unionRect(u, rect), own[0].rect);
|
|
1324
|
+
}
|
|
1325
|
+
function valueEdgeToward(value, text) {
|
|
1326
|
+
let c = LEADER_LABEL_CLEARANCE;
|
|
1327
|
+
return {
|
|
1328
|
+
x: Math.min(Math.max(text.x + text.w / 2, value.x - c), value.x + value.w + c),
|
|
1329
|
+
y: Math.min(Math.max(text.y + text.h / 2, value.y - c), value.y + value.h + c)
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
function leaderCrossesLabel(d, occupied) {
|
|
1333
|
+
return leaderPieces(d, 32).some(([a, b]) => occupied.hitsWhich(leaderBox([[a, b]]), 0).some((claim) => claim.kind === "label" && segmentHitsRect(a, b, claim.rect)));
|
|
1334
|
+
}
|
|
1253
1335
|
function leadersOffAnchorValues(labels, anchors, occupied) {
|
|
1254
1336
|
for (let label of labels) {
|
|
1255
1337
|
let anchor = anchors.get(label.id);
|
|
1256
1338
|
if (label.hidden || !label.leader || !anchor) continue;
|
|
1257
1339
|
let pieces = leaderPieces(label.leader.d, 32), own = occupied.hitsWhich(leaderBox(pieces), 0).filter((claim) => printsAnchor(claim, anchor) && pieces.some(([a, b]) => segmentHitsRect(a, b, claim.rect)));
|
|
1258
1340
|
if (own.length === 0) continue;
|
|
1259
|
-
let box = own.slice(1).reduce((u, { rect }) => unionRect(u, rect), own[0].rect),
|
|
1260
|
-
x: Math.min(Math.max(label.rect.x + label.rect.w / 2, box.x - c), box.x + box.w + c),
|
|
1261
|
-
y: Math.min(Math.max(label.rect.y + label.rect.h / 2, box.y - c), box.y + box.h + c)
|
|
1262
|
-
}, leader = seatLeader(label.rect, from);
|
|
1341
|
+
let box = own.slice(1).reduce((u, { rect }) => unionRect(u, rect), own[0].rect), from = valueEdgeToward(box, label.rect), leader = seatLeader(label.rect, from);
|
|
1263
1342
|
if (!leader) continue;
|
|
1264
1343
|
let next = leaderPieces(leader.d, 32);
|
|
1265
1344
|
occupied.hitsWhich(leaderBox(next), 0).some((claim) => claim.kind === "label" && claim.owner.annotationId !== label.owner.annotationId && next.some(([a, b]) => segmentHitsRect(a, b, claim.rect))) || (label.leader = leader);
|
|
@@ -1368,7 +1447,8 @@ function labelsToNodes(theme, labels, fontOf, marks) {
|
|
|
1368
1447
|
nodes.push({
|
|
1369
1448
|
t: "text",
|
|
1370
1449
|
id: nodeId,
|
|
1371
|
-
|
|
1450
|
+
// A vertical name's further lines stack rightward from the first one's baseline (verticalNameRect).
|
|
1451
|
+
x: label.rotate === -90 ? label.rect.x + lineH : rotated || flushRight.has(label) ? label.rect.x + label.rect.w : label.align === "middle" ? label.rect.x + label.rect.w / 2 : label.align === "end" ? label.rect.x + label.rect.w : label.rect.x + (label.swatch ? SWATCH_RESERVE : 0),
|
|
1372
1452
|
y: rotated ? label.rect.y + lineH * Math.SQRT1_2 / 2 - font.size * TEXT_ASCENT : label.lines.length === 1 && label.capHeight !== void 0 ? label.rect.y + label.rect.h / 2 + label.capHeight / 2 - font.size * TEXT_ASCENT : label.rect.y,
|
|
1373
1453
|
lines: head > 0 ? label.lines.slice(0, head) : label.lines,
|
|
1374
1454
|
...label.runs && label.lines.length === 1 && !rotated ? { runs: label.runs } : {},
|
|
@@ -1581,6 +1661,12 @@ function colorAttr(value) {
|
|
|
1581
1661
|
let color = checkedColor(value);
|
|
1582
1662
|
return esc(color);
|
|
1583
1663
|
}
|
|
1664
|
+
function fillAttr(fill) {
|
|
1665
|
+
let m = /^#(?:([0-9a-f]{6})([0-9a-f]{2})|([0-9a-f]{3})([0-9a-f]))$/i.exec(fill);
|
|
1666
|
+
if (!m) return `fill="${fill}"`;
|
|
1667
|
+
let rgb = m[1] ?? m[3], alpha = parseInt(m[2] ?? m[4].repeat(2), 16);
|
|
1668
|
+
return alpha === 255 ? `fill="#${rgb}"` : `fill="#${rgb}" fill-opacity="${Number((alpha / 255).toFixed(3))}"`;
|
|
1669
|
+
}
|
|
1584
1670
|
function validateNumber(label, value, minimum) {
|
|
1585
1671
|
if (value !== void 0 && (!Number.isFinite(value) || minimum !== void 0 && value < minimum))
|
|
1586
1672
|
throw new Error(`invalid SVG numeric ${label} '${String(value)}'`);
|
|
@@ -1621,23 +1707,27 @@ function validateGeometryNumbers(geometry) {
|
|
|
1621
1707
|
validateNumber(`${node.id}.cx`, node.cx), validateNumber(`${node.id}.cy`, node.cy), validateNumber(`${node.id}.r`, node.r, 0);
|
|
1622
1708
|
else {
|
|
1623
1709
|
if (validateNumber(`${node.id}.x`, node.x), validateNumber(`${node.id}.y`, node.y), validateNumber(`${node.id}.font.size`, node.font.size, 0), validateNumber(`${node.id}.font.weight`, node.font.weight, 0), node.font.style !== void 0 && node.font.style !== "normal" && node.font.style !== "italic") throw new Error(`invalid SVG font style ${node.id}`);
|
|
1624
|
-
if (validateNumber(`${node.id}.font.lineHeight`, node.font.lineHeight, 0), validateNumber(`${node.id}.font.letterSpacing`, node.font.letterSpacing), node.runs !== void 0) {
|
|
1625
|
-
if (!Array.isArray(node.
|
|
1626
|
-
throw new Error(`invalid SVG text
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1710
|
+
if (validateNumber(`${node.id}.font.lineHeight`, node.font.lineHeight, 0), validateNumber(`${node.id}.font.letterSpacing`, node.font.letterSpacing), node.runs !== void 0 || node.lineRuns !== void 0) {
|
|
1711
|
+
if (node.lineRuns !== void 0 && (node.runs !== void 0 || !Array.isArray(node.lineRuns) || node.lineRuns.length !== node.lines.length))
|
|
1712
|
+
throw new Error(`invalid SVG text lineRuns ${node.id} \u2014 one run list per line, without runs`);
|
|
1713
|
+
let lists = node.lineRuns ?? [node.runs];
|
|
1714
|
+
for (let line = 0; line < lists.length; line++) {
|
|
1715
|
+
let runs = lists[line], field = node.lineRuns ? `lineRuns[${line}]` : "runs";
|
|
1716
|
+
if (!Array.isArray(runs) || runs.length === 0)
|
|
1717
|
+
throw new Error(`invalid SVG text ${field} ${node.id} \u2014 expected a non-empty array`);
|
|
1718
|
+
for (let index = 0; index < runs.length; index++) {
|
|
1719
|
+
let run = runs[index];
|
|
1720
|
+
if (typeof run != "object" || run === null)
|
|
1721
|
+
throw new Error(`invalid SVG text run ${node.id}.${field}[${index}] \u2014 expected an object`);
|
|
1722
|
+
let { text, weight } = run;
|
|
1723
|
+
if (typeof text != "string")
|
|
1724
|
+
throw new Error(`invalid SVG text run ${node.id}.${field}[${index}].text \u2014 expected a string`);
|
|
1725
|
+
if (validateNumber(`${node.id}.${field}[${index}].weight`, weight, 1), typeof weight == "number" && weight > 1e3)
|
|
1726
|
+
throw new Error(`invalid SVG numeric ${node.id}.${field}[${index}].weight '${weight}' \u2014 above 1000`);
|
|
1727
|
+
}
|
|
1728
|
+
if (!node.lineRuns && node.lines.length !== 1 || node.lines[line] !== runs.map((run) => run.text).join(""))
|
|
1729
|
+
throw new Error(`invalid SVG text ${field} ${node.id} \u2014 lines must equal the concatenated run texts`);
|
|
1636
1730
|
}
|
|
1637
|
-
if (node.lines.length !== 1 || node.lines[0] !== node.runs.map((run) => run.text).join(""))
|
|
1638
|
-
throw new Error(
|
|
1639
|
-
`invalid SVG text runs ${node.id} \u2014 runs are single-line and lines[0] must equal the concatenated run texts`
|
|
1640
|
-
);
|
|
1641
1731
|
}
|
|
1642
1732
|
node.backing && validateRectNumbers(`${node.id}.backing`, node.backing);
|
|
1643
1733
|
}
|
|
@@ -1748,8 +1838,8 @@ function renderSvgInternal(geometry, theme, opts) {
|
|
|
1748
1838
|
);
|
|
1749
1839
|
let { size } = geometry, natural = geometry.presentation?.naturalSize, dims = natural?.unit === "pt" ? `width="${n2(natural.width)}pt" height="${n2(natural.height)}pt"` : `width="${n2(size.width)}" height="${n2(size.height)}"`, out = [], titleId = scopedId("bp-title", idScope), descId = scopedId("bp-desc", idScope), xlink = geometry.scene.some((node) => node.t === "image") ? ` xmlns:xlink="${XLINK_NS}"` : "";
|
|
1750
1840
|
out.push(
|
|
1751
|
-
`<svg xmlns="http://www.w3.org/2000/svg"${xlink} data-bp-engine="${ENGINE_REV}" viewBox="0 0 ${n2(size.width)} ${n2(size.height)}" ${dims} direction="ltr" style="${ROOT_STYLE}" preserveAspectRatio="xMidYMid meet" role="${interactive ? "graphics-document document" : "img"}" aria-label="${esc(geometry.a11y.title, "a11y.title")}" aria-describedby="${descId}" ${geometry.sizing ? `data-bp-sizing="${esc(JSON.stringify(geometry.sizing), "sizing")}" ` : ""}${geometry.mode ? `data-bp-mode="${geometry.mode}" ` : ""}font-family="${esc(theme.type.family, "theme.type.family")}"${interactive ? ` data-bp-interactive="" data-bp-chart="${esc(geometry.type, "geometry.type")}"` : ""}>`
|
|
1752
|
-
), geometry.a11y.includeTitle === !0 && out.push(`<title id="${titleId}">${esc(geometry.a11y.title, "a11y.title")}</title>`), out.push(`<desc id="${descId}">${esc(geometry.a11y.desc, "a11y.desc")}</desc>`);
|
|
1841
|
+
`<svg xmlns="http://www.w3.org/2000/svg"${xlink} data-bp-engine="${ENGINE_REV}" viewBox="0 0 ${n2(size.width)} ${n2(size.height)}" ${dims} direction="ltr" style="${ROOT_STYLE}" preserveAspectRatio="xMidYMid meet" role="${interactive ? "graphics-document document" : "img"}" aria-label="${esc(plainText(geometry.a11y.title), "a11y.title")}" aria-describedby="${descId}" ${geometry.sizing ? `data-bp-sizing="${esc(JSON.stringify(geometry.sizing), "sizing")}" ` : ""}${geometry.mode ? `data-bp-mode="${geometry.mode}" ` : ""}font-family="${esc(theme.type.family, "theme.type.family")}"${interactive ? ` data-bp-interactive="" data-bp-chart="${esc(geometry.type, "geometry.type")}"` : ""}>`
|
|
1842
|
+
), geometry.a11y.includeTitle === !0 && out.push(`<title id="${titleId}">${esc(plainText(geometry.a11y.title), "a11y.title")}</title>`), out.push(`<desc id="${descId}">${esc(plainText(geometry.a11y.desc), "a11y.desc")}</desc>`);
|
|
1753
1843
|
let patternDefs = /* @__PURE__ */ new Map();
|
|
1754
1844
|
for (let node of geometry.scene)
|
|
1755
1845
|
if ((node.t === "rect" || node.t === "path") && isHatchPattern(node.pattern) && node.fill) {
|
|
@@ -1773,6 +1863,7 @@ function renderSvgInternal(geometry, theme, opts) {
|
|
|
1773
1863
|
`);
|
|
1774
1864
|
}
|
|
1775
1865
|
function renderSvg(geometry, theme, opts = {}) {
|
|
1866
|
+
if (!theme) throw new TypeError("renderSvg: theme is required; pass the theme the geometry was laid out with, such as request.theme");
|
|
1776
1867
|
return renderSvgInternal(geometry, theme, opts);
|
|
1777
1868
|
}
|
|
1778
1869
|
function scopedId(id, scope) {
|
|
@@ -1827,7 +1918,7 @@ function renderNodeInner(node, theme, formatter, tf, interaction, idScope, rootF
|
|
|
1827
1918
|
let stroke = formatter.attr(node.fill);
|
|
1828
1919
|
fill = `url(#${resolvedHatchPattern(node.fill, theme, formatter, idScope, node.hatchGround, node.hatch, node.pattern).id})`, extra = node.hatchEdge === !1 ? "" : ` stroke="${stroke}" stroke-width="${strokeToken(theme, "hair")}"`;
|
|
1829
1920
|
} else node.pattern === "outline" && solidMutedPlan(theme) ? fill = formatter.attr(PLAN_MUTED_PAINT) : node.pattern === "outline" || node.pattern === "hollow" ? (fill = formatter.background(), extra = ` stroke="${formatter.attr(node.fill)}" stroke-width="${theme.pattern.outlineStrokeWidth}"`) : (fill = formatter.attr(node.fill), node.stroke && (extra = ` stroke="${formatter.attr(node.stroke)}" stroke-width="${node.strokeWidth ?? strokeToken(theme, "mark")}"`));
|
|
1830
|
-
let radius = node.radius ? ` rx="${n2(node.radius)}"` : "", open = `<rect${tf} data-id="${esc(node.id, "node.id")}" data-part="${esc(node.part, "node.part")}"${rc} x="${n2(rect.x)}" y="${n2(rect.y)}" width="${n2(rect.w)}" height="${n2(rect.h)}"${radius}
|
|
1921
|
+
let radius = node.radius ? ` rx="${n2(node.radius)}"` : "", open = `<rect${tf} data-id="${esc(node.id, "node.id")}" data-part="${esc(node.part, "node.part")}"${rc} x="${n2(rect.x)}" y="${n2(rect.y)}" width="${n2(rect.w)}" height="${n2(rect.h)}"${radius} ${fillAttr(fill)}${extra}`;
|
|
1831
1922
|
return node.title === void 0 ? `${open}/>` : `${open} role="img" aria-label="${esc(node.title, "node.title")}"><title>${esc(node.title, "node.title")}</title></rect>`;
|
|
1832
1923
|
}
|
|
1833
1924
|
case "line": {
|
|
@@ -1836,18 +1927,25 @@ function renderNodeInner(node, theme, formatter, tf, interaction, idScope, rootF
|
|
|
1836
1927
|
}
|
|
1837
1928
|
case "path": {
|
|
1838
1929
|
let fill = renderedPathFill(node, theme, formatter, idScope), stroke = node.stroke ? ` stroke="${formatter.attr(node.stroke)}" stroke-width="${node.width ?? strokeToken(theme, "rule")}"` : "", dash = node.dash ? ` stroke-dasharray="${node.dash.join(" ")}"` : "", lineCap = node.lineCap ? ` stroke-linecap="${esc(node.lineCap, "path.lineCap")}"` : "";
|
|
1839
|
-
return `<path${tf} data-id="${esc(node.id)}" data-part="${esc(node.part)}"${rc} d="${esc(node.d)}"
|
|
1930
|
+
return `<path${tf} data-id="${esc(node.id)}" data-part="${esc(node.part)}"${rc} d="${esc(node.d)}" ${fillAttr(fill)}${stroke}${dash}${lineCap} stroke-linejoin="round"/>`;
|
|
1840
1931
|
}
|
|
1841
1932
|
case "circle": {
|
|
1842
1933
|
let stroke = node.stroke ? ` stroke="${formatter.attr(node.stroke)}" stroke-width="${node.strokeWidth ?? strokeToken(theme, "mark")}"` : "";
|
|
1843
|
-
return `<circle${tf} data-id="${esc(node.id, "node.id")}" data-part="${esc(node.part, "node.part")}"${rc} cx="${n2(node.cx)}" cy="${n2(node.cy)}" r="${n2(node.r)}"
|
|
1934
|
+
return `<circle${tf} data-id="${esc(node.id, "node.id")}" data-part="${esc(node.part, "node.part")}"${rc} cx="${n2(node.cx)}" cy="${n2(node.cy)}" r="${n2(node.r)}" ${fillAttr(formatter.attr(node.fill))}${stroke}${node.title === void 0 ? "/>" : `><title>${esc(node.title, "node.title")}</title></circle>`}`;
|
|
1844
1935
|
}
|
|
1845
1936
|
case "text": {
|
|
1846
1937
|
let anchor = node.align === "start" ? "start" : node.align === "end" ? "end" : "middle", font = node.font, lineH = font.size * (font.lineHeight ?? 1.2), ink = formatter.attr(node.ink), backing = node.backing ? `<rect x="${n2(node.backing.x)}" y="${n2(node.backing.y)}" width="${n2(node.backing.w)}" height="${n2(node.backing.h)}" fill="${formatter.background()}" opacity="0.92"/>` : "", ls = font.letterSpacing ?? 0, lsAttr = ls ? ` letter-spacing="${n2(ls)}"` : "", lsShift = ls ? node.align === "end" ? ls : node.align === "middle" ? ls / 2 : 0 : 0, tx0 = node.x + lsShift, spans = node.runs ? node.runs.map(
|
|
1847
1938
|
(run, i) => `<tspan${run.weight !== void 0 && run.weight !== font.weight ? ` font-weight="${n2(run.weight)}"` : ""}>${esc(run.text, `text run ${i}`)}</tspan>`
|
|
1848
|
-
).join("") : node.lines.map(
|
|
1849
|
-
|
|
1850
|
-
|
|
1939
|
+
).join("") : node.lines.map((line, i) => {
|
|
1940
|
+
let content = node.lineRuns ? node.lineRuns[i].map(
|
|
1941
|
+
(run, j) => `<tspan${run.weight !== void 0 && run.weight !== font.weight ? ` font-weight="${n2(run.weight)}"` : ""}>${esc(run.text, `text run ${i}.${j}`)}</tspan>`
|
|
1942
|
+
).join("") : esc(line, `text line ${i}`);
|
|
1943
|
+
return `${i === 0 || /\S-$/.test(node.lines[i - 1]) ? "" : `<tspan x="${n2(tx0)}" dy="0"> </tspan>`}<tspan x="${n2(tx0)}" dy="${i === 0 ? "0" : n2(lineH)}">${content}</tspan>`;
|
|
1944
|
+
}).join(""), family = font.family && font.family !== rootFontFamily ? ` font-family="${esc(font.family, "font.family")}"` : "", baselineY = node.y + font.size * TEXT_ASCENT2, rotateAttr = node.rotate ? ` transform="rotate(${n2(node.rotate)} ${n2(tx0)} ${n2(baselineY)})"` : "", role = textRole(node), figures = numericVariant(role, theme), numeric = figures ? ` style="font-variant-numeric: ${figures}"` : "", placed = ` x="${n2(tx0)}" y="${n2(baselineY)}" text-anchor="${anchor}"${rotateAttr}${family} font-size="${font.size}" font-weight="${font.weight}"${font.style === void 0 ? "" : ` font-style="${font.style}"`}${lsAttr}`, halo = node.halo ? formatter.halo(node.ink) : "", haloText = halo ? `<text aria-hidden="true"${node.opacity === void 0 ? "" : ` opacity="${node.opacity}"`}${placed} fill="${halo}" stroke="${halo}" stroke-width="2.5" stroke-linejoin="round"${numeric}>${spans}</text>` : "", text = `<text data-id="${esc(node.id, "node.id")}" data-part="${esc(node.part, "node.part")}" data-bp-role="${role}"${rc}${placed} fill="${ink}"${numeric}>${spans}</text>`;
|
|
1945
|
+
if (node.title) {
|
|
1946
|
+
let full = esc(node.title, "node.title");
|
|
1947
|
+
return `<g${tf} role="img" aria-label="${full}"><title>${full}</title>${backing}${haloText}${text}</g>`;
|
|
1948
|
+
}
|
|
1851
1949
|
return tf ? `<g${tf}>${backing}${haloText}${text}</g>` : backing + haloText + text;
|
|
1852
1950
|
}
|
|
1853
1951
|
}
|
|
@@ -2004,6 +2102,7 @@ function needsSeriesKey(type, data, options, geometry) {
|
|
|
2004
2102
|
if (type === "bar" && options?.variant === "tornado") return !1;
|
|
2005
2103
|
if (type === "scatter" || type === "bubble") return scatterGroupIdentities(data, geometry).length > 1;
|
|
2006
2104
|
if (["butterfly", "pyramid", "heatmap", "status"].includes(type) || !["column", "bar", "combo", "dot", "cleveland", "dumbbell"].includes(type) && options?.labels !== !1) return !1;
|
|
2105
|
+
if (type === "pie") return !0;
|
|
2007
2106
|
let series = data?.series;
|
|
2008
2107
|
return Array.isArray(series) && series.filter((s) => s.role !== "reference" && s.values?.some((entry) => {
|
|
2009
2108
|
let cell = entry !== null && typeof entry == "object" && "categoryId" in entry && "value" in entry ? entry.value : entry;
|
|
@@ -2113,20 +2212,25 @@ function shrinkFont(font, options) {
|
|
|
2113
2212
|
}
|
|
2114
2213
|
function fitText(text, font, maxWidth, maxLines, measure, options = {}) {
|
|
2115
2214
|
let widths = options.wider !== void 0 && options.wider > maxWidth ? [maxWidth, options.wider] : [maxWidth], joined = text.includes(`
|
|
2116
|
-
`) ? text.replace(/\s*\n\s*/g, " ") : text, texts = joined === text ? [text] : [text, joined]
|
|
2117
|
-
for (let width2 of widths)
|
|
2118
|
-
for (let candidate of texts) {
|
|
2119
|
-
let tried = attempt(candidate, font, width2, maxLines, measure, options.typeRole, options.breakAfter);
|
|
2120
|
-
if (!tried.cut) return tried.fitted;
|
|
2121
|
-
}
|
|
2122
|
-
let step = shrinkFont(font, options);
|
|
2123
|
-
if (step)
|
|
2215
|
+
`) ? text.replace(/\s*\n\s*/g, " ") : text, texts = joined === text ? [text] : [text, joined], fits = (candidateFont, lines) => {
|
|
2124
2216
|
for (let width2 of widths)
|
|
2125
2217
|
for (let candidate of texts) {
|
|
2126
|
-
let tried = attempt(candidate,
|
|
2127
|
-
if (!
|
|
2218
|
+
let tried = attempt(candidate, candidateFont, width2, lines, measure, options.typeRole, options.breakAfter), breakFlag = options.breakAfter, ok = tried;
|
|
2219
|
+
if (ok.cut && options.hyphenRetry && !options.breakAfter && (ok = attempt(candidate, candidateFont, width2, lines, measure, options.typeRole, !0), breakFlag = !0), ok.cut) continue;
|
|
2220
|
+
if (width2 === maxWidth) return ok.fitted;
|
|
2221
|
+
let narrow = Math.ceil(maxWidth), fitted = ok.fitted;
|
|
2222
|
+
for (let wide = width2; wide - narrow >= 2; ) {
|
|
2223
|
+
let mid = Math.floor((narrow + wide) / 2), fewer = attempt(candidate, candidateFont, mid, lines, measure, options.typeRole, breakFlag);
|
|
2224
|
+
fewer.cut ? narrow = mid : (wide = mid, fitted = fewer.fitted);
|
|
2225
|
+
}
|
|
2226
|
+
return fitted;
|
|
2128
2227
|
}
|
|
2129
|
-
|
|
2228
|
+
}, step = shrinkFont(font, options), limits = options.tightLines !== void 0 && options.tightLines > maxLines ? [maxLines, maxLines + 1] : [maxLines];
|
|
2229
|
+
for (let lines of limits) {
|
|
2230
|
+
let fitted = fits(font, lines) ?? (step && fits(step, lines));
|
|
2231
|
+
if (fitted) return fitted;
|
|
2232
|
+
}
|
|
2233
|
+
let width = widths[widths.length - 1], last = attempt(joined, step ?? font, width, limits[limits.length - 1], measure, options.typeRole, options.breakAfter).fitted, end = last.lines.length - 1;
|
|
2130
2234
|
if (end >= 0 && !last.lines.some((line) => line.endsWith("\u2026"))) {
|
|
2131
2235
|
let lines = [...last.lines];
|
|
2132
2236
|
return lines[end] = ellipsize(`${lines[end].trimEnd()}\u2026`, last.font, width, measure).text, { ...last, lines, w: Math.max(1, ...lines.map((line) => measure(line, last.font).width)), title: text };
|
|
@@ -2157,7 +2261,7 @@ function cutWithTitle(text, font, maxWidth, measure) {
|
|
|
2157
2261
|
}
|
|
2158
2262
|
|
|
2159
2263
|
// src/core/label/omissions.ts
|
|
2160
|
-
var words = (text) => text.replace(/\s+/g, " ").trim(), ownerKey = (owner) => JSON.stringify([owner.seriesId, owner.categoryId, owner.segmentId, owner.pointId, owner.valueLineId, owner.annotationId, owner.rowId, owner.colId]);
|
|
2264
|
+
var words = (text) => plainText(text).replace(/\s+/g, " ").trim(), ownerKey = (owner) => JSON.stringify([owner.seriesId, owner.categoryId, owner.segmentId, owner.pointId, owner.valueLineId, owner.annotationId, owner.rowId, owner.colId]);
|
|
2161
2265
|
function containsText(hay, needle) {
|
|
2162
2266
|
for (let at = needle ? hay.indexOf(needle) : -1; at >= 0; at = hay.indexOf(needle, at + 1))
|
|
2163
2267
|
if (!/[\p{L}\p{N}.,+\-−]$/u.test(hay.slice(0, at)) && !/^([\p{L}\p{N}]|[.,]\p{N})/u.test(hay.slice(at + needle.length))) return !0;
|
|
@@ -2428,7 +2532,7 @@ function normalizeLegendOption(option, defaultOptions) {
|
|
|
2428
2532
|
if (option !== "none")
|
|
2429
2533
|
return option === void 0 || option === "auto" ? defaultOptions : typeof option == "string" ? { position: option } : option;
|
|
2430
2534
|
}
|
|
2431
|
-
var COMPACT_SOURCE_LINES = /* @__PURE__ */ Symbol("compactSourceLines"), LEGEND_HEIGHT = /* @__PURE__ */ Symbol("legendHeight"), CUT_LABEL_NOTES = /* @__PURE__ */ Symbol("cutLabelNotes"), CUT_LABEL_LIST = /* @__PURE__ */ Symbol("cutLabelList");
|
|
2535
|
+
var SIDE_KEY_PLOT_SHARE = 0.68, COMPACT_SOURCE_LINES = /* @__PURE__ */ Symbol("compactSourceLines"), LEGEND_HEIGHT = /* @__PURE__ */ Symbol("legendHeight"), CUT_LABEL_NOTES = /* @__PURE__ */ Symbol("cutLabelNotes"), CUT_LABEL_LIST = /* @__PURE__ */ Symbol("cutLabelList");
|
|
2432
2536
|
function authoredNotes(options) {
|
|
2433
2537
|
return options.footnotes === !1 ? [] : options.footnotes ?? [];
|
|
2434
2538
|
}
|
|
@@ -2487,11 +2591,11 @@ function frameTextOptions(options) {
|
|
|
2487
2591
|
}
|
|
2488
2592
|
var NOTE_HIT_PX = 24;
|
|
2489
2593
|
function htmlFooterHeight(input, parts, sourceText, font, width, lineH, measure) {
|
|
2490
|
-
let height = (text) => wrapFootnote(text, font, width, measure).length * lineH, total = 0;
|
|
2594
|
+
let height = (text) => wrapFootnote(markBold(text), font, width, measure).length * lineH, total = 0;
|
|
2491
2595
|
for (let note of parts.shown)
|
|
2492
2596
|
total += height(`${note.ref ? `${footnoteMark(note.ref)} ` : ""}${note.kind === "method" || note.kind === "disclosure" ? note.short ?? note.text : note.text}`);
|
|
2493
2597
|
let credit = parts.credit && `${chartString2(input, "mapCredit")}: ${parts.credit.text}`, label = parts.panel.length === 0 ? void 0 : parts.info ? `${chartString(input, "notesAndSources")} (${parts.panel.length})` : notesPointer(parts.panel.length, input.strings), items = [
|
|
2494
|
-
...parts.source && sourceText ? [{ w: measure(sourceText, font).width, text: sourceText }] : [],
|
|
2598
|
+
...parts.source && sourceText ? [{ w: measure(markBold(sourceText), font).width, text: sourceText }] : [],
|
|
2495
2599
|
...credit && parts.info ? [{ w: measure(credit, font).width, text: credit }] : [],
|
|
2496
2600
|
...label ? [{ w: Math.max(NOTE_HIT_PX, measure(label, font).width), h: Math.max(NOTE_HIT_PX, lineH) }] : []
|
|
2497
2601
|
], used = -1, line = 0;
|
|
@@ -2503,7 +2607,7 @@ function htmlFooterHeight(input, parts, sourceText, font, width, lineH, measure)
|
|
|
2503
2607
|
}
|
|
2504
2608
|
used >= 0 && (total += line + 2), used = Math.min(item.w, width), line = h;
|
|
2505
2609
|
}
|
|
2506
|
-
return items.length > 0 && (total += line + (parts.shown.length > 0 ? 4 : 0)), credit && !parts.info && (total +=
|
|
2610
|
+
return items.length > 0 && (total += line + (parts.shown.length > 0 ? 4 : 0)), credit && !parts.info && (total += wrapFootnote(credit, font, width, measure).length * lineH), total;
|
|
2507
2611
|
}
|
|
2508
2612
|
var frameChrome = /* @__PURE__ */ new WeakMap(), plotChromeFloor = /* @__PURE__ */ new WeakMap(), settledAutoHeight = /* @__PURE__ */ new WeakSet(), REFERENCE_SUBTITLE_PLOT_GAP = 12, REFERENCE_FOOTER_GAP = 12;
|
|
2509
2613
|
function fixedPlotChrome(result, reserve = 0) {
|
|
@@ -2720,6 +2824,7 @@ function shiftLegendKeyY(node, dy) {
|
|
|
2720
2824
|
}
|
|
2721
2825
|
}
|
|
2722
2826
|
function measureNamesUnit(unit, measure) {
|
|
2827
|
+
measure = plainText(measure);
|
|
2723
2828
|
let escaped = unit.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+");
|
|
2724
2829
|
return escaped.length > 0 && new RegExp(`(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])`, "iu").test(measure);
|
|
2725
2830
|
}
|
|
@@ -2827,7 +2932,7 @@ function withCutLabelNotes(data, options, layout) {
|
|
|
2827
2932
|
severity: "warn",
|
|
2828
2933
|
message: `${cuts.length} shortened labels have their full text in the notes list and reading.omissions.`,
|
|
2829
2934
|
detail: { labels: cuts.map((cut) => cut.labelId) }
|
|
2830
|
-
}], geo), existing = chartNotes(first).map((note) => note.text.replace(/\s+/g, " ").trim()), unlisted = cuts.filter((cut) => isNumberAlone(cut.text) || !existing.some((note) => containsText(note, cut.text.replace(/\s+/g, " ").trim())));
|
|
2935
|
+
}], geo), existing = chartNotes(first).map((note) => note.text.replace(/\s+/g, " ").trim()), unlisted = cuts.filter((cut) => isNumberAlone(cut.text) || !existing.some((note) => containsText(plainText(note), cut.text.replace(/\s+/g, " ").trim())));
|
|
2831
2936
|
if (!unlisted.length) return warn(first);
|
|
2832
2937
|
let items = [...new Set(unlisted.map((cut) => {
|
|
2833
2938
|
let owner = first.scene.find((node2) => node2.t === "text" && (node2.id === cut.labelId || node2.id === `label:${cut.labelId}`))?.owner, source = data, row = source?.rows?.find((row2) => row2.id === owner?.rowId)?.label, column = source?.columns?.find((column2) => column2.id === owner?.colId)?.label, place = [row, row ? column : void 0].filter(Boolean).join(" \u2014 ");
|
|
@@ -3071,27 +3176,56 @@ function markNotedLabels(geo, noted, from) {
|
|
|
3071
3176
|
}
|
|
3072
3177
|
function unitMissing(options, geo) {
|
|
3073
3178
|
let unit = typeof options?.unit == "string" ? options.unit.trim() : "";
|
|
3074
|
-
if (!unit || options?.unitShown === !0 || geo.warnings.some((w) => w.severity === "error") || geo.type === "variance" && options?.variant === "relative") return !1;
|
|
3179
|
+
if (!unit || options?.unitShown === !0 || geo.warnings.some((w) => w.severity === "error") || geo.type === "variance" && options?.variant === "relative" || printsOnlyShares(geo.type, options, geo.derived)) return !1;
|
|
3075
3180
|
let subtitle = resolveSubtitle(options?.subtitle);
|
|
3076
3181
|
if (subtitle && subtitleUnitClause(unit, subtitle.measure) === "" || !squeezeUnit(unit)) return !1;
|
|
3077
3182
|
let subtitleText = geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" "), carriesUnit = geo.type === "cohort" ? textCarriesCohortUnit : textCarriesUnit;
|
|
3078
3183
|
return !carriesUnit(subtitleText, unit) && !geo.scene.some((node) => node.t === "text" && carriesUnit(node.lines.join(" "), unit));
|
|
3079
3184
|
}
|
|
3080
|
-
var PERCENT_UNIT = /^(?:%|percent|per\s*cent|pct|percentage)(?!\p{L})/iu;
|
|
3185
|
+
var PERCENT_UNIT = /^(?:%|percent|per\s*cent|pct|percentage)(?!\p{L})/iu, isPercentUnit = (unit) => PERCENT_UNIT.test(unit.trim());
|
|
3186
|
+
function columnSegmentsPrintAbsolute(options) {
|
|
3187
|
+
let o = options ?? {};
|
|
3188
|
+
if (o.labels === !1) return !1;
|
|
3189
|
+
let segment = o.labels?.segment;
|
|
3190
|
+
return Array.isArray(segment) ? segment.includes("absolute") : segment !== !1 && o.shareLabels !== void 0;
|
|
3191
|
+
}
|
|
3192
|
+
function printsOnlyShares(type, options, derived) {
|
|
3193
|
+
let o = options ?? {}, groupKey = (derived?.groups?.length ?? 0) > 1 && o.legend !== "none";
|
|
3194
|
+
switch (type) {
|
|
3195
|
+
case "column":
|
|
3196
|
+
return (o.variant === "stacked100" || o.valueAxis?.percent === !0) && o.grandTotalLabels !== !0 && !columnSegmentsPrintAbsolute(options);
|
|
3197
|
+
case "bar":
|
|
3198
|
+
return o.variant === "stacked100" && o.grandTotalLabels !== !0;
|
|
3199
|
+
case "line":
|
|
3200
|
+
return o.variant === "stacked100-area" || o.valueAxis?.percent === !0;
|
|
3201
|
+
case "treemap":
|
|
3202
|
+
return o.cellValue === "share" && !o.total && !groupKey;
|
|
3203
|
+
default:
|
|
3204
|
+
return !1;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
function shareUnitOptions(type, options, derived) {
|
|
3208
|
+
let unit = options.unit?.trim();
|
|
3209
|
+
if (!unit || PERCENT_UNIT.test(unit) || !printsOnlyShares(type, options, derived)) return options;
|
|
3210
|
+
let measure = resolveSubtitle(options.subtitle)?.measure;
|
|
3211
|
+
return measure && measureNamesUnit(unit, measure) ? options : { ...options, unit: "%" };
|
|
3212
|
+
}
|
|
3081
3213
|
function shareUnitLints(options, geo) {
|
|
3082
3214
|
let unit = typeof options?.unit == "string" ? options.unit.trim() : "";
|
|
3083
|
-
if (!unit || PERCENT_UNIT.test(unit) || !
|
|
3215
|
+
if (!unit || PERCENT_UNIT.test(unit) || !printsOnlyShares(geo.type, options, geo.derived)) return [];
|
|
3084
3216
|
if (geo.warnings.some((w) => w.severity === "error")) return [];
|
|
3085
3217
|
let measure = resolveSubtitle(options?.subtitle)?.measure ?? "", subtitleText = geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" ");
|
|
3086
3218
|
if (!measure || !textCarriesUnit(subtitleText, unit)) return [];
|
|
3087
|
-
let
|
|
3088
|
-
|
|
3219
|
+
let escaped = unit.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+"), clause = new RegExp(`(?:\\bin|,|\\()\\s*${escaped}\\s*\\)?\\s*$`, "iu");
|
|
3220
|
+
if (!clause.test(measure)) return [];
|
|
3221
|
+
let kept = measure.replace(clause, "").trim(), path = typeof options?.subtitle == "string" ? "/options/subtitle" : "/options/subtitle/measure";
|
|
3222
|
+
return [{
|
|
3089
3223
|
code: "share-unit-conflict",
|
|
3090
3224
|
severity: "warn",
|
|
3091
|
-
message: `
|
|
3092
|
-
suggest:
|
|
3093
|
-
field:
|
|
3094
|
-
...
|
|
3225
|
+
message: `the chart prints shares in %, but the subtitle names the unit '${unit}' of the raw values`,
|
|
3226
|
+
suggest: `remove the unit clause from the subtitle measure '${measure}', or name the base instead ('Share of generation')`,
|
|
3227
|
+
field: ["options", "subtitle"],
|
|
3228
|
+
...kept ? { fix: [{ op: "replace", path, value: kept }] } : {}
|
|
3095
3229
|
}];
|
|
3096
3230
|
}
|
|
3097
3231
|
var UNIT_SIGNS = [
|
|
@@ -3125,20 +3259,25 @@ function measureUnitTail(measure, unit) {
|
|
|
3125
3259
|
let at = measure.lastIndexOf(", ");
|
|
3126
3260
|
if (at <= 0) return "";
|
|
3127
3261
|
let tail2 = measure.slice(at + 2);
|
|
3128
|
-
return /^(%|in\s|per\s|[$€£¥]|(?:EUR|USD|CHF|GBP|JPY|US\$)(?![\p{L}])|index\b|score\b|share of\b|# )/iu.test(tail2) || unit !== void 0 && unit.trim() !== "" && tail2.trim().toLowerCase() === unit.trim().toLowerCase() ? measure.slice(at + 1) : "";
|
|
3262
|
+
return /^(%|in\s|per\s|[$€£¥]|(?:EUR|USD|CHF|GBP|JPY|US\$)(?![\p{L}])|index\b|score\b|share of\b|# )/iu.test(plainText(tail2)) || unit !== void 0 && unit.trim() !== "" && plainText(tail2).trim().toLowerCase() === unit.trim().toLowerCase() ? measure.slice(at + 1) : "";
|
|
3129
3263
|
}
|
|
3130
3264
|
function measureSubtitle(input, x, y, id, nextId, contentW) {
|
|
3131
|
-
let
|
|
3265
|
+
let authored = input.subtitle, sub = hasBold(authored.measure) || hasBold(authored.company ?? "") || hasBold(authored.period ?? "") ? {
|
|
3266
|
+
...authored,
|
|
3267
|
+
measure: markBold(authored.measure),
|
|
3268
|
+
...authored.company ? { company: markBold(authored.company) } : {},
|
|
3269
|
+
...authored.period ? { period: markBold(authored.period) } : {}
|
|
3270
|
+
} : authored, font = { family: input.theme.type.family, ...input.theme.type.subtitle }, boldFont = { ...font, weight: emphasisWeight(input.theme) }, trailing = "";
|
|
3132
3271
|
frameRendersUnit(input) && (trailing += subtitleUnitClause(input.unit, sub.measure)), sub.period && (trailing += ` \xB7 ${sub.period}`), sub.scenarios && sub.scenarios.length > 0 && (trailing += ` \xB7 ${formatScenarios(sub.scenarios)}`);
|
|
3133
3272
|
let segments = [];
|
|
3134
3273
|
sub.company && segments.push({ text: `${sub.company} \xB7 `, bold: !1 });
|
|
3135
3274
|
let unitTail = measureUnitTail(sub.measure, input.unit), lone = !sub.company && !unitTail && !trailing;
|
|
3136
3275
|
segments.push({ text: sub.measure.slice(0, sub.measure.length - unitTail.length), bold: !lone }), (unitTail || trailing) && segments.push({ text: unitTail + trailing, bold: !1 });
|
|
3137
|
-
let lineH = font.size * (font.lineHeight ?? 1.3), runs = segments.map((seg) => ({
|
|
3276
|
+
let lineH = font.size * (font.lineHeight ?? 1.3), runs = subtitleRuns(segments.map((seg) => ({
|
|
3138
3277
|
text: seg.text.replace(/^ /, "\xA0").replace(/ $/, "\xA0"),
|
|
3139
3278
|
...seg.bold ? { weight: boldFont.weight } : {}
|
|
3140
|
-
})), width = runsWidth(runs, font, boldFont, input.measure), maxLines = 1 / 0, scenarios = sub.scenarios && sub.scenarios.length > 0 ? formatScenarios(sub.scenarios) : void 0;
|
|
3141
|
-
return width > contentW ? wrapSubtitle(segments, { x, y, id, nextId, contentW, lineH, font, boldFont, measure: input.measure, maxLines, scenarios, period: sub.period }) : { nodes: [{
|
|
3279
|
+
})), boldFont.weight, font.weight), width = runsWidth(runs, font, boldFont, input.measure), maxLines = 1 / 0, scenarios = sub.scenarios && sub.scenarios.length > 0 ? formatScenarios(sub.scenarios) : void 0;
|
|
3280
|
+
return width > contentW ? wrapSubtitle(segments, { x, y, id, nextId, contentW, lineH, font, boldFont, measure: input.measure, maxLines, scenarios, period: sub.period && plainText(sub.period) }) : { nodes: [{
|
|
3142
3281
|
t: "text",
|
|
3143
3282
|
id,
|
|
3144
3283
|
x,
|
|
@@ -3153,6 +3292,9 @@ function measureSubtitle(input, x, y, id, nextId, contentW) {
|
|
|
3153
3292
|
typeRole: "subtitle"
|
|
3154
3293
|
}], rect: { x, y, w: width, h: lineH } };
|
|
3155
3294
|
}
|
|
3295
|
+
function subtitleRuns(runs, boldWeight, baseWeight) {
|
|
3296
|
+
return runs.some((run) => run.text.includes("\uE000") || run.text.includes("\uE001")) ? runs.flatMap((run) => run.weight === boldWeight ? [{ ...run, text: plainText(run.text) }] : boldRuns(run.text, boldWeight, baseWeight)) : runs;
|
|
3297
|
+
}
|
|
3156
3298
|
function runsWidth(runs, font, boldFont, measure) {
|
|
3157
3299
|
return runs.reduce((w, run) => w + measure(run.text, run.weight ? boldFont : font).width, 0) + // measure() counts n−1 tracking gaps WITHIN each run; the renderer
|
|
3158
3300
|
// tracks the continuous line, which adds one more gap per run boundary.
|
|
@@ -3160,17 +3302,17 @@ function runsWidth(runs, font, boldFont, measure) {
|
|
|
3160
3302
|
// occupied claim honest the day a theme adds letterSpacing to it.
|
|
3161
3303
|
(font.letterSpacing ? font.letterSpacing * (runs.length - 1) : 0);
|
|
3162
3304
|
}
|
|
3163
|
-
function runsOf(words2, boldWeight) {
|
|
3305
|
+
function runsOf(words2, boldWeight, baseWeight) {
|
|
3164
3306
|
let runs = [];
|
|
3165
3307
|
return words2.forEach((word, i) => {
|
|
3166
3308
|
i > 0 && words2[i - 1].bold === word.bold ? runs[runs.length - 1].text += ` ${word.text}` : runs.push({ text: i > 0 ? `\xA0${word.text}` : word.text, ...word.bold ? { weight: boldWeight } : {} });
|
|
3167
|
-
}), runs;
|
|
3309
|
+
}), subtitleRuns(runs, boldWeight, baseWeight);
|
|
3168
3310
|
}
|
|
3169
3311
|
function balancedLines(text, font, maxWidth, lines, measure) {
|
|
3170
3312
|
let filled = filledLines(text, font, maxWidth, lines, measure);
|
|
3171
3313
|
if (text.includes(`
|
|
3172
3314
|
`) || lines.some((line) => line.endsWith("\u2026")) || lines.join(" ").split(/[^\S\u00a0\u202f]+/).filter(Boolean).join(" ") !== text.split(/[^\S\u00a0\u202f]+/).filter(Boolean).join(" ") || filled.length < 2 || filled.length > 3) return filled;
|
|
3173
|
-
let units = filled.join(" ").split(" ").reduce((out, word) => (out.length > 0 && /^p\.a\.[,;:]?$/i.test(word) ? out[out.length - 1] += ` ${word}` : out.push(word), out), []);
|
|
3315
|
+
let units = filled.join(" ").split(" ").reduce((out, word) => (out.length > 0 && /^p\.a\.[,;:]?$/i.test(plainText(word)) ? out[out.length - 1] += ` ${word}` : out.push(word), out), []);
|
|
3174
3316
|
if (units.length > 40) return filled;
|
|
3175
3317
|
let n = filled.length, best, consider = (cuts) => {
|
|
3176
3318
|
let bounds = [0, ...cuts, units.length], parts = bounds.slice(1).map((to, i) => units.slice(bounds[i], to).join(" ")), widths = parts.map((part) => measure(part, font).width);
|
|
@@ -3187,9 +3329,9 @@ function filledLines(text, font, maxWidth, lines, measure) {
|
|
|
3187
3329
|
`) || lines.some((line) => line.endsWith("\u2026")) || lines.length < 2) return [...lines];
|
|
3188
3330
|
let split = (line) => line.split(/[^\S\u00a0\u202f]+/).filter(Boolean), words2 = split(text);
|
|
3189
3331
|
if (lines.flatMap(split).join(" ") !== words2.join(" ")) return [...lines];
|
|
3190
|
-
let units = (line) => split(line).reduce((out2, word) => (out2.length > 0 && /^p\.a\.[,;:]?$/i.test(word) ? out2[out2.length - 1] += ` ${word}` : out2.push(word), out2), []), out = lines.map(units);
|
|
3332
|
+
let units = (line) => split(line).reduce((out2, word) => (out2.length > 0 && /^p\.a\.[,;:]?$/i.test(plainText(word)) ? out2[out2.length - 1] += ` ${word}` : out2.push(word), out2), []), out = lines.map(units);
|
|
3191
3333
|
for (let i = 1; i < out.length; i++)
|
|
3192
|
-
if (/^p\.a\.[,;:]?$/i.test(out[i][0] ?? "") && out[i - 1].length > 1) {
|
|
3334
|
+
if (/^p\.a\.[,;:]?$/i.test(plainText(out[i][0] ?? "")) && out[i - 1].length > 1) {
|
|
3193
3335
|
let rate = out[i - 1].pop();
|
|
3194
3336
|
out[i][0] = `${rate} ${out[i][0]}`;
|
|
3195
3337
|
}
|
|
@@ -3204,7 +3346,7 @@ function filledLines(text, font, maxWidth, lines, measure) {
|
|
|
3204
3346
|
function keepLastLineCompany(broken, words2, widthOf, maxWidth, scenarios, period) {
|
|
3205
3347
|
if (broken.length < 2 || words2.filter((word) => word.text !== "\xB7").length < 4) return;
|
|
3206
3348
|
let pairWord = scenarios !== void 0 && scenarios.split(" ").length <= 3 ? scenarios : void 0, periodWord = period !== void 0 && period.trim().split(/\s+/).length <= 3 ? period.trim().split(/\s+/).join(" ") : void 0, lone = (line) => {
|
|
3207
|
-
let text = line.filter((word) => word.text !== "\xB7").map((word) => word.text).join(" ");
|
|
3349
|
+
let text = line.filter((word) => word.text !== "\xB7").map((word) => plainText(word.text)).join(" ");
|
|
3208
3350
|
return line.filter((word) => word.text !== "\xB7").length < 2 || text === pairWord || text === periodWord;
|
|
3209
3351
|
};
|
|
3210
3352
|
if (!lone(broken[broken.length - 1])) return;
|
|
@@ -3216,7 +3358,7 @@ function keepLastLineCompany(broken, words2, widthOf, maxWidth, scenarios, perio
|
|
|
3216
3358
|
for (; from < to && line[from].text === "\xB7"; ) from++;
|
|
3217
3359
|
for (; to > from && line[to - 1].text === "\xB7"; ) to--;
|
|
3218
3360
|
return line.slice(from, to);
|
|
3219
|
-
}, boundary = (cut) => pair[cut].text === "\xB7" || pair[cut - 1].text === "\xB7" || pair[cut].bold !== pair[cut - 1].bold, binds = (cut) => /^(in|of|by|vs\.?|per|to|and|or|the|a|an|for|from|at|on|[$€£¥]|US\$|Q[1-4]|H[12])$/i.test(pair[cut - 1].text), tiers = [boundary, (cut) => !binds(cut), () => !0];
|
|
3361
|
+
}, boundary = (cut) => pair[cut].text === "\xB7" || pair[cut - 1].text === "\xB7" || pair[cut].bold !== pair[cut - 1].bold, binds = (cut) => /^(in|of|by|vs\.?|per|to|and|or|the|a|an|for|from|at|on|[$€£¥]|US\$|Q[1-4]|H[12])$/i.test(plainText(pair[cut - 1].text)), tiers = [boundary, (cut) => !binds(cut), () => !0];
|
|
3220
3362
|
for (let allowed of tiers)
|
|
3221
3363
|
for (let cut = broken[broken.length - 2].length - 1; cut >= 1; cut--) {
|
|
3222
3364
|
if (!allowed(cut)) continue;
|
|
@@ -3228,7 +3370,7 @@ function keepLastLineCompany(broken, words2, widthOf, maxWidth, scenarios, perio
|
|
|
3228
3370
|
}
|
|
3229
3371
|
}
|
|
3230
3372
|
function wrapSubtitle(segments, ctx) {
|
|
3231
|
-
let words2 = segments.flatMap((seg) => seg.text.split(" ").filter(Boolean).map((text) => ({ text, bold: seg.bold }))), widthOf = (list) => runsWidth(runsOf(list, ctx.boldFont.weight), ctx.font, ctx.boldFont, ctx.measure), broken = [], rest = words2;
|
|
3373
|
+
let words2 = segments.flatMap((seg) => seg.text.split(" ").filter(Boolean).map((text) => ({ text, bold: seg.bold }))), widthOf = (list) => runsWidth(runsOf(list, ctx.boldFont.weight, ctx.font.weight), ctx.font, ctx.boldFont, ctx.measure), broken = [], rest = words2;
|
|
3232
3374
|
for (; rest.length > 0 && broken.length < ctx.maxLines - 1 && widthOf(rest) > ctx.contentW; ) {
|
|
3233
3375
|
let split = 1;
|
|
3234
3376
|
for (; split < rest.length && widthOf(rest.slice(0, split + 1)) <= ctx.contentW; ) split++;
|
|
@@ -3242,9 +3384,9 @@ function wrapSubtitle(segments, ctx) {
|
|
|
3242
3384
|
line = kept ? [...line.slice(0, -1), { ...last, text: kept }] : line.slice(0, -1);
|
|
3243
3385
|
}
|
|
3244
3386
|
return withEllipsis(line);
|
|
3245
|
-
}, title = words2.map((word) => word.text).join(" "), lines = broken.map((line) => widthOf(line) > ctx.contentW ? { line: cutLine(line), cut: !0 } : { line, cut: !1 });
|
|
3387
|
+
}, title = words2.map((word) => plainText(word.text)).join(" "), lines = broken.map((line) => widthOf(line) > ctx.contentW ? { line: cutLine(line), cut: !0 } : { line, cut: !1 });
|
|
3246
3388
|
return { nodes: lines.map(({ line, cut }, index) => {
|
|
3247
|
-
let runs = runsOf(line, ctx.boldFont.weight);
|
|
3389
|
+
let runs = runsOf(line, ctx.boldFont.weight, ctx.font.weight);
|
|
3248
3390
|
return {
|
|
3249
3391
|
t: "text",
|
|
3250
3392
|
id: index === 0 ? ctx.id : ctx.nextId(),
|
|
@@ -3307,9 +3449,9 @@ function solveFrame(input, occupied) {
|
|
|
3307
3449
|
textScale: input.textScale,
|
|
3308
3450
|
typeRole: "title",
|
|
3309
3451
|
shrink: { ...baseFont, size: Math.max(targetFloorsPx(input.target ?? DEFAULT_TARGET, input.textScale).title, compactSize) }
|
|
3310
|
-
},
|
|
3311
|
-
wrapped.title !== void 0 && (wrapped = fitText(
|
|
3312
|
-
let font = wrapped.font, lines = wrapped.title === void 0 && wrapped.lines.length >= 2 ? balancedLines(
|
|
3452
|
+
}, title = markBold(input.title), titleMeasure = title === input.title ? measure : boldMeasurer(measure, emphasisWeight(theme)), wrapped = fitText(title, baseFont, headerW, TITLE_LINES, titleMeasure, fitOptions);
|
|
3453
|
+
wrapped.title !== void 0 && (wrapped = fitText(title, wrapped.font, headerW, Number.MAX_SAFE_INTEGER, titleMeasure, { ...fitOptions, shrink: void 0 }));
|
|
3454
|
+
let font = wrapped.font, lines = wrapped.title === void 0 && wrapped.lines.length >= 2 ? balancedLines(title, font, headerW, wrapped.lines, titleMeasure) : wrapped.lines;
|
|
3313
3455
|
wrapped.title !== void 0 && warnings.push({
|
|
3314
3456
|
code: "frame-title-truncated",
|
|
3315
3457
|
severity: "warn",
|
|
@@ -3322,9 +3464,9 @@ function solveFrame(input, occupied) {
|
|
|
3322
3464
|
id,
|
|
3323
3465
|
x: contentX,
|
|
3324
3466
|
y: topY,
|
|
3325
|
-
lines,
|
|
3467
|
+
...splitBoldLines(lines, emphasisWeight(theme), font.weight),
|
|
3326
3468
|
// A cut title keeps its full text for the reader.
|
|
3327
|
-
...wrapped.title !== void 0 ? { title: wrapped.title } : {},
|
|
3469
|
+
...wrapped.title !== void 0 ? { title: plainText(wrapped.title) } : {},
|
|
3328
3470
|
align: "start",
|
|
3329
3471
|
font,
|
|
3330
3472
|
ink: { token: "ink" },
|
|
@@ -3340,7 +3482,7 @@ function solveFrame(input, occupied) {
|
|
|
3340
3482
|
nodes.push(...subtitle.nodes), occupied.claim(subtitle.rect, "frame", {}), frame.subtitleNodeId = subtitle.nodes[0].id, topY += subtitle.rect.h + tokens.gapSubtitlePlot;
|
|
3341
3483
|
} else input.title && (topY += input.cardGaps ? 8 : tokens.gapSubtitlePlot - tokens.gapTitleSubtitle);
|
|
3342
3484
|
!input.cardGaps && (input.subtitle || input.title) && theme.space.gap?.subtitlePlot === void 0 && size.width < WIDE_CANVAS_MIN_WIDTH && recordFreedChrome(frame, "header-gap", REFERENCE_SUBTITLE_PLOT_GAP - tokens.gapSubtitlePlot);
|
|
3343
|
-
let footFont = withFamily(footerType(theme.type.footnote, input.target, input.textScale)), liveFooterH = 0, footLineH = footFont.size * (footFont.lineHeight ?? 1.3), footInset = Math.max(0, Math.min(input.footerInset ?? 0, (contentW - 1) / 2)), footX = contentX + footInset, footW = contentW - 2 * footInset, fullStatic = staticFrame.pinned, placement = fullStatic ? "frame" : input.notes?.placement ?? defaultNotePlacement(input.target), hitRoom = (y) => placement === "info" ? Math.min(y, size.height - NOTE_HIT_PX) : y, budget = fullStatic ? 1 / 0 : input.notes?.maxLines ?? defaultNoteLines(input.target, size.width), shown = new Set(input.notes?.show ?? ["note"]), pointerOn = !fullStatic && !input.footnotesOff && input.notes?.pointer !== !1, entries = [];
|
|
3485
|
+
let footFont = withFamily(footerType(theme.type.footnote, input.target, input.textScale)), footMeasure = input.source && hasBold(input.source) || input.footnotes?.some(hasBold) ? boldMeasurer(measure, emphasisWeight(theme)) : measure, liveFooterH = 0, footLineH = footFont.size * (footFont.lineHeight ?? 1.3), footInset = Math.max(0, Math.min(input.footerInset ?? 0, (contentW - 1) / 2)), footX = contentX + footInset, footW = contentW - 2 * footInset, fullStatic = staticFrame.pinned, placement = fullStatic ? "frame" : input.notes?.placement ?? defaultNotePlacement(input.target), hitRoom = (y) => placement === "info" ? Math.min(y, size.height - NOTE_HIT_PX) : y, budget = fullStatic ? 1 / 0 : input.notes?.maxLines ?? defaultNoteLines(input.target, size.width), shown = new Set(input.notes?.show ?? ["note"]), pointerOn = !fullStatic && !input.footnotesOff && input.notes?.pointer !== !1, entries = [];
|
|
3344
3486
|
{
|
|
3345
3487
|
let notes = input.footnotes ?? [], numbered = input.numberedFootnotes ?? notes, unreferencedNotes = new Set(input.unreferencedNotes ?? []), next = 0, referenced = !1, unmarked = [];
|
|
3346
3488
|
for (let f of notes) {
|
|
@@ -3348,10 +3490,10 @@ function solveFrame(input, occupied) {
|
|
|
3348
3490
|
marker && (referenced = !0), numberedHere && marker === "" && unmarked.push(next + 1), numberedHere && (next += 1);
|
|
3349
3491
|
let meta = numberedHere ? void 0 : engineNoteMeta(f);
|
|
3350
3492
|
if (fullStatic && meta?.list && (staticFrame.countable = !0), meta?.list) {
|
|
3351
|
-
let fitted = fittedNote(meta.list, (text) => wrapFootnote(text, footFont, footW,
|
|
3493
|
+
let fitted = fittedNote(meta.list, (text) => wrapFootnote(markBold(text), footFont, footW, footMeasure).length <= 2);
|
|
3352
3494
|
f = meta.short ? engineNote(f, "disclosure", fitted, meta.values, meta.list) : engineNote(fitted, "disclosure", void 0, meta.values, meta.list);
|
|
3353
3495
|
}
|
|
3354
|
-
let kind = numberedDisclosure ? "disclosure" : numberedHere ? "note" : meta?.kind ?? "method", fittedShort = engineNoteMeta(f)?.short ?? meta?.short, short = fittedShort && (kind !== "disclosure" || input.notes?.maxListed !== void 0 ||
|
|
3496
|
+
let kind = numberedDisclosure ? "disclosure" : numberedHere ? "note" : meta?.kind ?? "method", fittedShort = engineNoteMeta(f)?.short ?? meta?.short, short = fittedShort && (kind !== "disclosure" || input.notes?.maxListed !== void 0 || footMeasure(markBold(fittedShort), footFont).width < footMeasure(markBold(f), footFont).width) ? fittedShort : void 0, storedMeta = meta ? { ...meta, ...engineNoteMeta(f), ...meta.ranks ? { ranks: !0 } : {} } : void 0;
|
|
3355
3497
|
entries.push(keepNoteMeta({ kind, text: f, ...short ? { short } : {}, drawn: `${marker}${kind === "disclosure" || kind === "method" && !fullStatic ? short ?? f : f}`, ...marker ? { ref: next } : {}, ...meta?.ranks ? { ranks: !0 } : {} }, storedMeta));
|
|
3356
3498
|
}
|
|
3357
3499
|
!input.footnotesOff && unmarked.length > 0 && referenced && warnings.push({
|
|
@@ -3365,10 +3507,10 @@ function solveFrame(input, occupied) {
|
|
|
3365
3507
|
entries.sort((a, b) => rank[a.kind] - rank[b.kind]);
|
|
3366
3508
|
let credit = input.credit, creditInFrame = credit !== void 0 && (credit.required || fullStatic), sourceText = input.source ? sourceLine(input.source, input.strings?.source ?? localeStrings2().source) : void 0, sourceOff = sourceText !== void 0 && !fullStatic && input[COMPACT_SOURCE_LINES] === 0;
|
|
3367
3509
|
sourceOff && (frame.source = input.source, warnings.push({ code: "footnotes-off", severity: "info", message: `compact frame has no room for the source line: ${sourceText}` }));
|
|
3368
|
-
let pointed = new Set(input.pointedNotes ?? []), kept = entries.filter((entry) => entry.kind === "disclosure" ? shown.has("disclosure") || entry.ranks === !0 && shown.has("ranks") : !input.footnotesOff && pointed.has(entry.text)), candidates = input.footnotesOff || placement === "list" ? [] : entries.filter((entry) => !kept.includes(entry) && shown.has(entry.kind)), infoPanel = staticFrame.live && placement === "info", listed = (k2) => infoPanel ? entries.filter((entry) => !kept.includes(entry) && !candidates.slice(0, k2).includes(entry))
|
|
3510
|
+
let pointed = new Set(input.pointedNotes ?? []), kept = entries.filter((entry) => entry.kind === "disclosure" ? shown.has("disclosure") || entry.ranks === !0 && shown.has("ranks") : !input.footnotesOff && pointed.has(entry.text)), candidates = input.footnotesOff || placement === "list" ? [] : entries.filter((entry) => !kept.includes(entry) && shown.has(entry.kind) && !isQuiet(entry)), infoPanel = staticFrame.live && placement === "info", infoCount = (hidden) => allQuiet(hidden) && !(credit && !creditInFrame) ? 0 : hidden.length, listed = (k2) => infoPanel ? infoCount(entries.filter((entry) => !kept.includes(entry) && !candidates.slice(0, k2).includes(entry))) + (credit && !creditInFrame ? 1 : 0) : entries.filter((entry) => shown.has(entry.kind) && !kept.includes(entry) && !isQuiet(entry)).length - k2 + (credit && !creditInFrame ? 1 : 0), sourcePara = (k2) => {
|
|
3369
3511
|
let hidden = listed(k2), pointer = pointerOn && hidden > 0 ? notesPointer(hidden, input.strings) : void 0, source = sourceOff ? void 0 : sourceText;
|
|
3370
3512
|
return source === void 0 ? pointer : pointer === void 0 ? source : `${source}${/[.!?]$/.test(source) ? "" : "."} ${pointer}`;
|
|
3371
|
-
}, sourceFit = (text) => !fullStatic && input[COMPACT_SOURCE_LINES] === 1 ? fitText(text, footFont, footW, 1,
|
|
3513
|
+
}, sourceFit = (text) => !fullStatic && input[COMPACT_SOURCE_LINES] === 1 ? fitText(markBold(text), footFont, footW, 1, footMeasure) : void 0, sourceLines = (text) => sourceFit(text)?.lines ?? wrapFootnote(markBold(text), footFont, footW, footMeasure), noteLines = candidates.map((entry) => wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure)), k = candidates.length;
|
|
3372
3514
|
for (; k > 0; k--) {
|
|
3373
3515
|
let para = sourcePara(k);
|
|
3374
3516
|
if (noteLines.slice(0, k).reduce((sum, lines) => sum + lines.length, 0) + (para ? sourceLines(para).length : 0) <= budget) break;
|
|
@@ -3389,23 +3531,19 @@ function solveFrame(input, occupied) {
|
|
|
3389
3531
|
let footParts = [
|
|
3390
3532
|
...entries.filter((entry) => visible.has(entry)).map((entry) => {
|
|
3391
3533
|
let at = candidates.indexOf(entry);
|
|
3392
|
-
return { text: entry.drawn, kind: "footnote", lines: at >= 0 ? noteLines[at] : wrapFootnote(entry.drawn, footFont, footW,
|
|
3534
|
+
return { text: entry.drawn, kind: "footnote", lines: at >= 0 ? noteLines[at] : wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure) };
|
|
3393
3535
|
}),
|
|
3394
3536
|
...sourceBlock ? [{ text: sourceBlock, kind: "source" }] : [],
|
|
3395
3537
|
...credit && creditInFrame ? [{ text: `${chartString2(input, "mapCredit")}: ${credit.text}`, kind: "credit" }] : []
|
|
3396
|
-
], footLines = 0, omitted = Array.from({ length: input[COMPACT_OMITTED_NOTES] ?? 0 }, () => ({ n: 0, kind: "note", text: "", inFrame: !1 }));
|
|
3397
|
-
if (liveFooterH =
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
contentW,
|
|
3403
|
-
footLineH,
|
|
3404
|
-
measure
|
|
3405
|
-
) - (placement === "info" ? margin.bottom : 0)) : 0, footParts.length > 0 || liveFooterH > 0) {
|
|
3538
|
+
], footLines = 0, omitted = Array.from({ length: input[COMPACT_OMITTED_NOTES] ?? 0 }, () => ({ n: 0, kind: "note", text: "", inFrame: !1 })), liveParts = (pointer) => footerParts([...noteList, ...omitted], placement, input[LIVE_NOTE_SHOW] ?? input.notes?.show, pointer), liveHeight = (parts) => Math.max(0, htmlFooterHeight(input, parts, sourceText, footFont, contentW, footLineH, footMeasure) - (placement === "info" ? margin.bottom : 0)), withPointer = staticFrame.live && !fullStatic ? liveParts(pointerOn) : void 0;
|
|
3539
|
+
if (liveFooterH = withPointer ? liveHeight(withPointer) : 0, withPointer && liveFooterH > 0 && allQuiet(withPointer.panel)) {
|
|
3540
|
+
let without = liveHeight(liveParts(!1));
|
|
3541
|
+
without < liveFooterH && (liveFooterH = without, frame.notesButtonOff = !0);
|
|
3542
|
+
}
|
|
3543
|
+
if (footParts.length > 0 || liveFooterH > 0) {
|
|
3406
3544
|
frame.footnoteNodeIds = [];
|
|
3407
3545
|
for (let i = footParts.length - 1; i >= 0; i--) {
|
|
3408
|
-
let p = footParts[i], fitted = p.kind === "source" ? sourceFit(p.text) : void 0, lines = p.lines ?? (p.kind === "source" ? sourceLines(p.text) : wrapFootnote(p.text, footFont, footW,
|
|
3546
|
+
let p = footParts[i], fitted = p.kind === "source" ? sourceFit(p.text) : void 0, lines = p.lines ?? (p.kind === "source" ? sourceLines(p.text) : wrapFootnote(p.kind === "credit" ? p.text : markBold(p.text), footFont, footW, footMeasure));
|
|
3409
3547
|
bottomY -= footLineH * lines.length, footLines += lines.length;
|
|
3410
3548
|
let id = nid(p.kind);
|
|
3411
3549
|
nodes.push({
|
|
@@ -3413,8 +3551,8 @@ function solveFrame(input, occupied) {
|
|
|
3413
3551
|
id,
|
|
3414
3552
|
x: footX,
|
|
3415
3553
|
y: bottomY,
|
|
3416
|
-
lines,
|
|
3417
|
-
...fitted?.title ? { title: fitted.title } : {},
|
|
3554
|
+
...splitBoldLines(lines, emphasisWeight(theme), footFont.weight),
|
|
3555
|
+
...fitted?.title ? { title: plainText(fitted.title) } : {},
|
|
3418
3556
|
align: "start",
|
|
3419
3557
|
font: footFont,
|
|
3420
3558
|
ink: { token: p.kind === "footnote" ? input.footnoteInk ?? "inkMuted" : "inkMuted" },
|
|
@@ -3433,11 +3571,16 @@ function solveFrame(input, occupied) {
|
|
|
3433
3571
|
let key = input.eventKey.layout(contentX, contentW);
|
|
3434
3572
|
bottomY -= key.h, pushAll(nodes, key.draw(bottomY, nid)), frame.eventKeyRect = { x: contentX, y: bottomY, w: contentW, h: key.h }, occupied.claim(frame.eventKeyRect, "frame", {}), bottomY -= tokens.gapAxisFootnote;
|
|
3435
3573
|
}
|
|
3436
|
-
let legendGeom, legendBand = 0, rightLegendBottom = 0, plotRight = size.width - margin.right, bandKeys = input.eventKey?.legendYieldsToSeries && (input.legend?.items.length ?? 0) > 0 ? [] : input.eventKey?.legend ?? [], legendInput = bandKeys.length > 0 ? { options: input.legend?.options ?? { position: "top" }, items: [...input.legend?.items ?? [], ...bandKeys] } : input.legend;
|
|
3574
|
+
let legendGeom, legendBand = 0, rightLegendBottom = 0, plotRight = size.width - margin.right, plotLeft = margin.left, bandKeys = input.eventKey?.legendYieldsToSeries && (input.legend?.items.length ?? 0) > 0 ? [] : input.eventKey?.legend ?? [], legendInput = bandKeys.length > 0 ? { options: input.legend?.options ?? { position: "top" }, items: [...input.legend?.items ?? [], ...bandKeys] } : input.legend;
|
|
3437
3575
|
if (legendInput && legendInput.items.length > 0) {
|
|
3438
3576
|
let { options } = legendInput, { items } = dedupeLegendKeys(legendInput.items, (item) => identityAppearance(item, theme));
|
|
3439
3577
|
pushAll(warnings, identityCollisionWarnings(items, theme));
|
|
3440
|
-
let footKey = input.legendFont === "footnote" || input.legendFont === "compact" && theme.type.footnote.size <= secondaryType(theme).size, keyCap = footKey ? 1 / 0 : scaleTextAtFloor(targetTypeSizesPx(input.target ?? DEFAULT_TARGET, "S").axis, input.textScale ?? 1, targetFloorsPx(input.target ?? DEFAULT_TARGET).secondary), keyRole = footKey ? theme.type.footnote : secondaryType(theme), font = withFamily(!hasAuthoredTypeSize(keyRole) && keyRole.size > keyCap ? { ...keyRole, size: keyCap } : keyRole), lineH = Math.max(SWATCH, font.size * (font.lineHeight ?? 1.2)), typeRole = footKey ? "footnote" : "secondary",
|
|
3578
|
+
let footKey = input.legendFont === "footnote" || input.legendFont === "compact" && theme.type.footnote.size <= secondaryType(theme).size, keyCap = footKey ? 1 / 0 : scaleTextAtFloor(targetTypeSizesPx(input.target ?? DEFAULT_TARGET, "S").axis, input.textScale ?? 1, targetFloorsPx(input.target ?? DEFAULT_TARGET).secondary), keyRole = footKey ? theme.type.footnote : secondaryType(theme), font = withFamily(!hasAuthoredTypeSize(keyRole) && keyRole.size > keyCap ? { ...keyRole, size: keyCap } : keyRole), lineH = Math.max(SWATCH, font.size * (font.lineHeight ?? 1.2)), typeRole = footKey ? "footnote" : "secondary", sideWanted = options.position === "right" || options.position === "left", labelBudget = sideWanted ? contentW * 0.45 : contentW, ringH = (it) => it.key === "sizes" ? Math.max(it.ringRow ?? 0, Math.ceil(2 * Math.max(0.5, ...it.radii ?? []))) : 0, maxKeyW = maxOf(items.map((it) => keyWidth(it, Math.max(lineH, ringH(it))))), valueFont = { ...font, weight: emphasisWeight(theme) }, wrapKeys = (budget2) => new Map(items.map((it) => [it, wrapFootnote(
|
|
3579
|
+
it.label,
|
|
3580
|
+
font,
|
|
3581
|
+
Math.max(1, budget2 - maxKeyW - SWATCH_GAP2 - (it.value ? SWATCH_GAP2 + measure(it.value, valueFont).width : 0)),
|
|
3582
|
+
measure
|
|
3583
|
+
)])), wrappedKeys = wrapKeys(labelBudget), keyTextH = (it) => Math.max(1, wrappedKeys.get(it).length) * lineH, textWOf = (it) => Math.max(0, ...wrappedKeys.get(it).map((line) => measure(line, font).width)), itemTextW = (it) => textWOf(it) + (it.value ? SWATCH_GAP2 + measure(it.value, valueFont).width : 0), valueNode = (it, lbId, x, y) => ({
|
|
3441
3584
|
t: "text",
|
|
3442
3585
|
id: `${lbId}:value`,
|
|
3443
3586
|
x: x + textWOf(it) + SWATCH_GAP2,
|
|
@@ -3449,9 +3592,19 @@ function solveFrame(input, occupied) {
|
|
|
3449
3592
|
ink: { token: "ink" },
|
|
3450
3593
|
owner: { seriesId: it.id },
|
|
3451
3594
|
part: "legendValue"
|
|
3452
|
-
}), keyNodes = (it, id, x, y, height2) => legendKeyNodes(theme, it, id, x, y, height2, font).map((node) => node.t === "text" ? { ...node, typeRole } : node), capMidBelowTop = font.size * TEXT_ASCENT2 - (measure.capHeight?.(font) ?? font.size * 0.72) / 2, keyTopAt = (textTop, height2) => textTop + capMidBelowTop - height2 / 2, onLabelLine = (keys, textTop) => keys.map((node) => node.t === "text" && node.part === "swatch" ? { ...node, y: textTop } : node);
|
|
3453
|
-
if (
|
|
3454
|
-
let
|
|
3595
|
+
}), keyNodes = (it, id, x, y, height2) => legendKeyNodes(theme, it, id, x, y, height2, font).map((node) => node.t === "text" ? { ...node, typeRole } : node), capMidBelowTop = font.size * TEXT_ASCENT2 - (measure.capHeight?.(font) ?? font.size * 0.72) / 2, keyTopAt = (textTop, height2) => textTop + capMidBelowTop - height2 / 2, onLabelLine = (keys, textTop) => keys.map((node) => node.t === "text" && node.part === "swatch" ? { ...node, y: textTop } : node), sideKeyW = maxOf(items.map((it) => keyWidth(it, Math.max(lineH, ringH(it))))), sideLegendW = sideKeyW + SWATCH_GAP2 + maxOf(items.map(itemTextW));
|
|
3596
|
+
if (sideWanted && !input.sideKeyFixed) {
|
|
3597
|
+
let columnH = items.reduce((h, it) => h + Math.max(keyTextH(it), ringH(it)) + 4, -4), plotW = size.width - margin.right - margin.left - sideLegendW - 16 - Math.max(0, input.plotInset?.left ?? 0), widthShort = plotW < SIDE_KEY_PLOT_SHARE * size.width;
|
|
3598
|
+
(widthShort || columnH > bottomY - topY) && (warnings.push({
|
|
3599
|
+
code: "legend-side-fallback",
|
|
3600
|
+
severity: "warn",
|
|
3601
|
+
message: widthShort ? `the key stays in the row above the plot: a column beside it would leave the plot ${Math.round(Math.max(0, plotW))} px, under ${Math.round(SIDE_KEY_PLOT_SHARE * 100)}% of the ${Math.round(size.width)} px width` : `the key stays in the row above the plot: its ${Math.round(columnH)} px column is taller than the ${Math.round(Math.max(0, bottomY - topY))} px beside the plot`,
|
|
3602
|
+
suggest: widthShort ? "Give the chart more width, or shorten the series names, to keep the key beside the plot." : "Give the chart more height, or show fewer series, to keep the key beside the plot.",
|
|
3603
|
+
field: ["options", "legend"]
|
|
3604
|
+
}), options = { ...options, position: "top" }, wrappedKeys = wrapKeys(contentW));
|
|
3605
|
+
}
|
|
3606
|
+
if (options.position === "right" || options.position === "left") {
|
|
3607
|
+
let keyW = sideKeyW, legendW = sideLegendW, legendX = options.position === "left" ? contentX : size.width - margin.right - legendW, y = topY, legendItems = [];
|
|
3455
3608
|
for (let it of items) {
|
|
3456
3609
|
let swId = nid("swatch"), lbId = nid("legendLabel"), sideKeyH = Math.max(lineH, ringH(it));
|
|
3457
3610
|
nodes.push(...onLabelLine(keyNodes(it, swId, legendX, keyTopAt(y, sideKeyH), sideKeyH), y)), nodes.push({
|
|
@@ -3469,10 +3622,10 @@ function solveFrame(input, occupied) {
|
|
|
3469
3622
|
}), it.value && nodes.push(valueNode(it, lbId, legendX + keyW + SWATCH_GAP2, y)), it.key !== "heading" && legendItems.push({ id: it.id, swatchNodeId: swId, labelId: lbId }), y += Math.max(keyTextH(it), ringH(it)) + 4;
|
|
3470
3623
|
}
|
|
3471
3624
|
let rect = { x: legendX, y: topY, w: legendW, h: y - topY - 4 };
|
|
3472
|
-
rightLegendBottom = y - 4, occupied.claim(rect, "legend", {}), legendGeom = { rect, items: legendItems }, plotRight = legendX - 16, warnings.push({
|
|
3625
|
+
rightLegendBottom = y - 4, occupied.claim(rect, "legend", {}), legendGeom = { rect, items: legendItems }, options.position === "left" ? plotLeft = legendX + legendW + 16 : plotRight = legendX - 16, warnings.push({
|
|
3473
3626
|
code: "legend-beside-plot",
|
|
3474
3627
|
severity: "info",
|
|
3475
|
-
message: `the key stands beside the plot and takes ${Math.round(
|
|
3628
|
+
message: `the key stands beside the plot and takes ${Math.round(legendW + 16)} px of its width; 'top' keeps the plot full width`
|
|
3476
3629
|
});
|
|
3477
3630
|
} else {
|
|
3478
3631
|
let keyH = lineH, titles = /* @__PURE__ */ new Map(), plainRowH = Math.max(tokens.legendRowH, lineH, maxOf(items.map(ringH))) + (input.cardGaps ? 4 : 0), budget2 = input[LEGEND_HEIGHT], available = budget2?.height === "auto" ? size.height * furnitureBudget(size.width) - (size.height - bottomY + topY) - tokens.gapLegend : budget2?.height ?? 1 / 0, fullBlockH;
|
|
@@ -3551,9 +3704,9 @@ function solveFrame(input, occupied) {
|
|
|
3551
3704
|
}
|
|
3552
3705
|
}
|
|
3553
3706
|
let plotInsetLeft = Math.max(0, input.plotInset?.left ?? 0), plot = {
|
|
3554
|
-
x:
|
|
3707
|
+
x: plotLeft + plotInsetLeft,
|
|
3555
3708
|
y: topY,
|
|
3556
|
-
w: Math.max(10, plotRight -
|
|
3709
|
+
w: Math.max(10, plotRight - plotLeft - plotInsetLeft),
|
|
3557
3710
|
h: Math.max(MIN_PLOT_H, bottomY - topY)
|
|
3558
3711
|
}, height = bottomY - topY >= MIN_PLOT_H && rightLegendBottom === 0 && !input.eventKey ? input.autoHeight?.(plot) : void 0, dy = height === void 0 ? 0 : height - size.height, moved = /* @__PURE__ */ new Map(), legendY = legendGeom?.rect.y;
|
|
3559
3712
|
if (dy !== 0) {
|
|
@@ -3569,11 +3722,157 @@ function solveFrame(input, occupied) {
|
|
|
3569
3722
|
return frame.minHeight = size.height + deficit, warnings.length > 0 && (frame.warnings = warnings), { plot, nodes, frame, legend: legendGeom, ...deficit > 0 ? { deficit } : {}, ...legendBand > 0 ? { legendBand } : {} };
|
|
3570
3723
|
}
|
|
3571
3724
|
|
|
3725
|
+
// src/core/dateFormatRead.ts
|
|
3726
|
+
var readCache = /* @__PURE__ */ new Map(), TABLE_DEFAULT = "d MMM yyyy", DATE_TOKENS = /yyyy|YYYY|yy|YY|MMMMM|MMMM|mmmm|MMM|mmm|MM|mm|M|m|dddd|ddd|dd|DD|d|D|QQQ|QQ|Q|ww|w/g, TIME_TOKENS = /yyyy|YYYY|yy|YY|MMMM|mmmm|MMM|mmm|MM|mm|M|m|dddd|ddd|dd|DD|d|D|QQQ|QQ|Q|HH|H|hh|h|ss|SSS|a/g, SEPARATOR = /^[ ./,–-]+$/, ALIASES = { YYYY: "yyyy", YY: "yy", D: "d", DD: "dd", mmm: "MMM", mmmm: "MMMM" };
|
|
3727
|
+
function readPattern(text, context) {
|
|
3728
|
+
let parts = text.match(/'[^']*'|[A-Za-z]+|'|[^'A-Za-z]+/g) ?? [];
|
|
3729
|
+
if (!parts.length || parts.join("") !== text) return;
|
|
3730
|
+
let tokens = [];
|
|
3731
|
+
for (let part of parts) {
|
|
3732
|
+
if (part.startsWith("'")) {
|
|
3733
|
+
tokens.push(part);
|
|
3734
|
+
continue;
|
|
3735
|
+
}
|
|
3736
|
+
if (/\d/.test(part)) return;
|
|
3737
|
+
if (!/[A-Za-z]/.test(part)) {
|
|
3738
|
+
tokens.push(part);
|
|
3739
|
+
continue;
|
|
3740
|
+
}
|
|
3741
|
+
let run = part.match(context === "table" ? DATE_TOKENS : TIME_TOKENS) ?? [];
|
|
3742
|
+
if (run.join("") !== part) return;
|
|
3743
|
+
tokens.push(...run);
|
|
3744
|
+
}
|
|
3745
|
+
let clock = tokens.some((token) => /^(?:HH|H|hh|h|ss)$/.test(token)), date = tokens.some((token) => /^(?:y|Y|d|D|M|Q|w|mmm)/.test(token)), result = [];
|
|
3746
|
+
for (let token of tokens)
|
|
3747
|
+
if (token === "m" || token === "mm")
|
|
3748
|
+
if (!clock && date) result.push(token === "m" ? "M" : "MM");
|
|
3749
|
+
else if (context === "time" && token === "mm") result.push(token);
|
|
3750
|
+
else return;
|
|
3751
|
+
else
|
|
3752
|
+
result.push(ALIASES[token] ?? token);
|
|
3753
|
+
return result.join("");
|
|
3754
|
+
}
|
|
3755
|
+
var fiscalNote = () => ({
|
|
3756
|
+
kind: "fiscal",
|
|
3757
|
+
message: "The fiscal year is read as the calendar year. A fiscal year that starts in another month is not supported."
|
|
3758
|
+
}), exampleNamesCache = /* @__PURE__ */ new Map();
|
|
3759
|
+
function exampleNames(language) {
|
|
3760
|
+
let cached = exampleNamesCache.get(language);
|
|
3761
|
+
if (cached) return cached;
|
|
3762
|
+
let names = /* @__PURE__ */ new Map(), add = (word, name) => {
|
|
3763
|
+
names.get(word)?.month !== void 0 && name.month === void 0 || names.set(word, name);
|
|
3764
|
+
};
|
|
3765
|
+
for (let set of [dateNames("en"), dateNames(language)])
|
|
3766
|
+
for (let [full, short, longToken, shortToken] of [
|
|
3767
|
+
[set.months, set.monthsShort, "MMMM", "MMM"],
|
|
3768
|
+
[set.days, set.daysShort, "dddd", "ddd"]
|
|
3769
|
+
])
|
|
3770
|
+
full.forEach((name, index) => {
|
|
3771
|
+
let month = longToken === "MMMM" ? index + 1 : void 0, weekday = longToken === "dddd" ? index : void 0, abbreviation = name.slice(0, 3).toLowerCase();
|
|
3772
|
+
names.has(abbreviation) || add(abbreviation, { token: shortToken, month, weekday }), add(name.toLowerCase(), { token: longToken, month, weekday });
|
|
3773
|
+
}), short.forEach((name, index) => add(name.replace(/\.$/, "").toLowerCase(), {
|
|
3774
|
+
token: shortToken,
|
|
3775
|
+
month: longToken === "MMMM" ? index + 1 : void 0,
|
|
3776
|
+
weekday: longToken === "dddd" ? index : void 0
|
|
3777
|
+
}));
|
|
3778
|
+
return exampleNamesCache.size >= 200 && exampleNamesCache.clear(), exampleNamesCache.set(language, names), names;
|
|
3779
|
+
}
|
|
3780
|
+
function readExample(text, language) {
|
|
3781
|
+
let fiscal = /^FY([ -]?)(\d{4}|\d{2})$/i.exec(text);
|
|
3782
|
+
if (fiscal) return { pattern: `'FY'${fiscal[1]}${fiscal[2].length === 4 ? "yyyy" : "yy"}`, notes: [fiscalNote()] };
|
|
3783
|
+
let quarter = /^(Q|Quarter) *([1-4])(?:([ ./,–-]+)(\d{4}|\d{2}))?$/i.exec(text);
|
|
3784
|
+
if (quarter) return {
|
|
3785
|
+
pattern: `${quarter[1].toLowerCase() === "q" ? "QQ" : "QQQ"}${quarter[4] ? quarter[3] + (quarter[4].length === 4 ? "yyyy" : "yy") : ""}`,
|
|
3786
|
+
notes: []
|
|
3787
|
+
};
|
|
3788
|
+
let parts = text.match(/[\p{L}]+|\d+|[ ./,–-]+/gu) ?? [];
|
|
3789
|
+
if (!parts.length || parts.join("") !== text) return;
|
|
3790
|
+
let names = exampleNames(language), localized = dateNames(language), fields = [], pattern = [...parts];
|
|
3791
|
+
for (let [index, part] of parts.entries()) {
|
|
3792
|
+
if (SEPARATOR.test(part)) continue;
|
|
3793
|
+
let name = names.get(part.toLowerCase());
|
|
3794
|
+
if (!/^\d+$/.test(part) && !name) return;
|
|
3795
|
+
fields.push({ index, text: part, name }), name && (pattern[index] = name.token, (name.token === "MMM" ? localized.monthsShort[name.month - 1] : name.token === "ddd" ? localized.daysShort[name.weekday] : void 0)?.endsWith(".") && parts[index + 1]?.startsWith(".") && (pattern[index + 1] = parts[index + 1].slice(1)));
|
|
3796
|
+
}
|
|
3797
|
+
let months = fields.filter((field) => field.name?.month !== void 0), weekdays = fields.filter((field) => field.name && field.name.month === void 0), numbers = fields.filter((field) => !field.name);
|
|
3798
|
+
if (months.length > 1 || weekdays.length > 1) return;
|
|
3799
|
+
let notes = [];
|
|
3800
|
+
if (months.length) {
|
|
3801
|
+
let month = months[0], years = numbers.filter((field) => field.text.length === 4), short = numbers.filter((field) => field.text.length <= 2);
|
|
3802
|
+
if (years.length > 1 || short.length > 2 || years.length + short.length !== numbers.length) return;
|
|
3803
|
+
years[0] && (pattern[years[0].index] = "yyyy");
|
|
3804
|
+
let dayToken = (field) => field.text.startsWith("0") ? "dd" : "d", validDay = (field) => +field.text >= 1 && +field.text <= 31;
|
|
3805
|
+
if (years.length) {
|
|
3806
|
+
if (short.length > 1 || short[0] && !validDay(short[0])) return;
|
|
3807
|
+
short[0] && (pattern[short[0].index] = dayToken(short[0]));
|
|
3808
|
+
} else if (short.length === 2) {
|
|
3809
|
+
let [first, second] = short;
|
|
3810
|
+
if (first.index > month.index || second.index < month.index || !validDay(first)) return;
|
|
3811
|
+
pattern[first.index] = dayToken(first), pattern[second.index] = "yy";
|
|
3812
|
+
} else if (short[0]) {
|
|
3813
|
+
let field = short[0];
|
|
3814
|
+
if (field.index < month.index || weekdays.length) {
|
|
3815
|
+
if (!validDay(field)) return;
|
|
3816
|
+
pattern[field.index] = dayToken(field);
|
|
3817
|
+
} else {
|
|
3818
|
+
pattern[field.index] = "yy";
|
|
3819
|
+
let between = parts.slice(month.index + 1, field.index).join("");
|
|
3820
|
+
+field.text <= 31 && /[ ,]/.test(between) && notes.push({
|
|
3821
|
+
kind: "ambiguous",
|
|
3822
|
+
message: `Read '${text}' as month/year. '${field.text}' is the year.`,
|
|
3823
|
+
suggest: "Use 'MMM d' for month and day, or write a four-digit year."
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
} else if (numbers.length === 1 && numbers[0].text.length === 4)
|
|
3828
|
+
pattern[numbers[0].index] = "yyyy";
|
|
3829
|
+
else if (numbers.length === 2) {
|
|
3830
|
+
let year = numbers.find((field) => field.text.length === 4), month = numbers.find((field) => field !== year);
|
|
3831
|
+
if (!year || !month || month.text.length > 2 || +month.text < 1 || +month.text > 12) return;
|
|
3832
|
+
pattern[year.index] = "yyyy", pattern[month.index] = month.text.length === 2 ? "MM" : "M";
|
|
3833
|
+
} else if (numbers.length === 3) {
|
|
3834
|
+
let year = numbers[0].text.length === 4 ? numbers[0] : numbers[2];
|
|
3835
|
+
if (year.text.length !== 4 && year.text.length !== 2) return;
|
|
3836
|
+
let pair = numbers.filter((field) => field !== year);
|
|
3837
|
+
if (pair.some((field) => field.text.length > 2 || +field.text < 1 || +field.text > 31)) return;
|
|
3838
|
+
let first = pair[0], second = pair[1], yearFirst = year === numbers[0], monthFirst = yearFirst || +second.text > 12, day = monthFirst ? second : first, month = monthFirst ? first : second;
|
|
3839
|
+
if (+month.text > 12) return;
|
|
3840
|
+
let padded = pair.some((field) => field.text.startsWith("0")) || pair.every((field) => field.text.length === 2);
|
|
3841
|
+
pattern[year.index] = year.text.length === 4 ? "yyyy" : "yy", pattern[day.index] = padded ? "dd" : "d", pattern[month.index] = padded ? "MM" : "M", !yearFirst && pair.every((field) => +field.text <= 12) && notes.push({
|
|
3842
|
+
kind: "ambiguous",
|
|
3843
|
+
message: `Read '${text}' as day/month/year, ${+day.text} ${dateNames("en").months[+month.text - 1]} ${year.text}.`,
|
|
3844
|
+
suggest: "Write a day above 12, or use the pattern 'MM/dd/yyyy' for month/day/year."
|
|
3845
|
+
});
|
|
3846
|
+
} else if (numbers.length || !fields.length) return;
|
|
3847
|
+
return { pattern: pattern.join(""), notes };
|
|
3848
|
+
}
|
|
3849
|
+
function parseDateFormat(text, context, language) {
|
|
3850
|
+
let fallback = context === "table" ? TABLE_DEFAULT : void 0;
|
|
3851
|
+
if (text === void 0) return { pattern: fallback, notes: [] };
|
|
3852
|
+
let pattern = readPattern(text, context);
|
|
3853
|
+
if (pattern !== void 0) return { pattern, notes: /'FY'\s*(?:yyyy|yy)/i.test(pattern) ? [fiscalNote()] : [] };
|
|
3854
|
+
let example = readExample(text, language);
|
|
3855
|
+
return example || {
|
|
3856
|
+
pattern: fallback,
|
|
3857
|
+
notes: [{
|
|
3858
|
+
kind: "unknown",
|
|
3859
|
+
message: `Date format '${text}' was not read. ${context === "table" ? "The default 'd MMM yyyy' is used." : "The default ticks are used."}`,
|
|
3860
|
+
suggest: "Write an example such as '30 Sep 2026' or a pattern such as 'dd.MM.yyyy'. Quote literal words with single quotes."
|
|
3861
|
+
}]
|
|
3862
|
+
};
|
|
3863
|
+
}
|
|
3864
|
+
function readDateFormat(text, context, language) {
|
|
3865
|
+
let key = `${context}|${language ?? ""}|${text}`, cached = readCache.get(key);
|
|
3866
|
+
if (cached) return cached;
|
|
3867
|
+
let result = parseDateFormat(text, context, language);
|
|
3868
|
+
return readCache.size >= 200 && readCache.clear(), readCache.set(key, result), result;
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3572
3871
|
// src/core/dateFormat.ts
|
|
3573
3872
|
function isoWeek(date) {
|
|
3574
|
-
let d =
|
|
3873
|
+
let d = utcDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()), dayNum = d.getUTCDay() || 7;
|
|
3575
3874
|
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
|
|
3576
|
-
let yearStart =
|
|
3875
|
+
let yearStart = utcDate(d.getUTCFullYear(), 0, 1);
|
|
3577
3876
|
return Math.ceil(((d.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
|
|
3578
3877
|
}
|
|
3579
3878
|
function quarterOf(date) {
|
|
@@ -3689,8 +3988,8 @@ function dateTickKeepCalendar(dates, interval) {
|
|
|
3689
3988
|
for (let i = 1; i < parsed.length; i++) gap = Math.min(gap, (parsed[i].getTime() - parsed[i - 1].getTime()) / 864e5);
|
|
3690
3989
|
return (first.getTime() - start.getTime()) / 864e5 > gap && (keep[0] = !1), keep;
|
|
3691
3990
|
}
|
|
3692
|
-
function datePatternFromExample(example) {
|
|
3693
|
-
return
|
|
3991
|
+
function datePatternFromExample(example, language) {
|
|
3992
|
+
return readDateFormat(example, "table", language).pattern;
|
|
3694
3993
|
}
|
|
3695
3994
|
|
|
3696
3995
|
export {
|
|
@@ -3709,6 +4008,9 @@ export {
|
|
|
3709
4008
|
unionRect,
|
|
3710
4009
|
clamp,
|
|
3711
4010
|
round2,
|
|
4011
|
+
cleanFloat,
|
|
4012
|
+
cleanSum,
|
|
4013
|
+
cleanDiff,
|
|
3712
4014
|
strokeBoxPad,
|
|
3713
4015
|
rowLabelX,
|
|
3714
4016
|
chartString2 as chartString,
|
|
@@ -3730,6 +4032,7 @@ export {
|
|
|
3730
4032
|
needsSeriesKey,
|
|
3731
4033
|
scatterGroupIdentities,
|
|
3732
4034
|
scatterGroupNameIsDrawn,
|
|
4035
|
+
COLLECT_IDENTITIES,
|
|
3733
4036
|
collectSeriesIdentities,
|
|
3734
4037
|
textNames,
|
|
3735
4038
|
nameIsDrawn,
|
|
@@ -3773,6 +4076,8 @@ export {
|
|
|
3773
4076
|
LAST_RESORT_PENALTY,
|
|
3774
4077
|
isOwnMark,
|
|
3775
4078
|
leaderTerminus,
|
|
4079
|
+
leaderFor,
|
|
4080
|
+
leaderHeightOf,
|
|
3776
4081
|
seatLeader,
|
|
3777
4082
|
partialPattern,
|
|
3778
4083
|
partialFootnotes,
|
|
@@ -3797,6 +4102,9 @@ export {
|
|
|
3797
4102
|
assertEmbeddedImage,
|
|
3798
4103
|
arrowSeats,
|
|
3799
4104
|
finishCalloutHeads,
|
|
4105
|
+
anchorValueBox,
|
|
4106
|
+
valueEdgeToward,
|
|
4107
|
+
leaderCrossesLabel,
|
|
3800
4108
|
leadersOffAnchorValues,
|
|
3801
4109
|
SWATCH_RESERVE,
|
|
3802
4110
|
groundEdges,
|
|
@@ -3813,6 +4121,7 @@ export {
|
|
|
3813
4121
|
legendRequired,
|
|
3814
4122
|
legendOff,
|
|
3815
4123
|
normalizeLegendOption,
|
|
4124
|
+
SIDE_KEY_PLOT_SHARE,
|
|
3816
4125
|
COMPACT_SOURCE_LINES,
|
|
3817
4126
|
LEGEND_HEIGHT,
|
|
3818
4127
|
authoredNotes,
|
|
@@ -3860,12 +4169,16 @@ export {
|
|
|
3860
4169
|
hiddenNoteWith,
|
|
3861
4170
|
markNotedLabels,
|
|
3862
4171
|
unitMissing,
|
|
4172
|
+
isPercentUnit,
|
|
4173
|
+
columnSegmentsPrintAbsolute,
|
|
4174
|
+
shareUnitOptions,
|
|
3863
4175
|
shareUnitLints,
|
|
3864
4176
|
textCarriesUnit,
|
|
3865
4177
|
textCarriesCohortUnit,
|
|
3866
4178
|
stringsIn,
|
|
3867
4179
|
subtitleLine,
|
|
3868
4180
|
solveFrame,
|
|
4181
|
+
readDateFormat,
|
|
3869
4182
|
formatDate,
|
|
3870
4183
|
DATE_TICK_STRIDES,
|
|
3871
4184
|
dateTickOrdinals,
|