@diagrammo/dgmo 0.46.0 → 0.48.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/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/{src/block/parser.ts → dist/chunk-7JEGTRLD.js} +100 -189
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/{editor.cjs → chunk-DKEPS5LH.js} +14 -225
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/{src/c4/layout.ts → dist/chunk-QEBUY5NY.js} +384 -1140
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/{src/utils/time-ticks.ts → dist/chunk-YRYKTYMQ.js} +45 -112
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/{src/gantt/calculator.ts → dist/chunk-Z72XRXD4.js} +236 -428
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +19 -70
- package/dist/advanced.cjs +0 -71648
- package/dist/advanced.d.cts +0 -6571
- package/dist/auto.cjs +0 -70648
- package/dist/auto.d.cts +0 -54
- package/dist/block.cjs +0 -70208
- package/dist/block.d.cts +0 -115
- package/dist/editor.d.cts +0 -26
- package/dist/element.cjs +0 -70530
- package/dist/element.d.cts +0 -62
- package/dist/highlight.cjs +0 -852
- package/dist/highlight.d.cts +0 -49
- package/dist/index.cjs +0 -70491
- package/dist/index.d.cts +0 -626
- package/dist/pert.cjs +0 -325
- package/dist/pert.d.cts +0 -559
- package/src/advanced.ts +0 -873
- package/src/arc/parser.ts +0 -15
- package/src/arc/renderer.ts +0 -633
- package/src/auto/index.ts +0 -621
- package/src/auto/shared.ts +0 -370
- package/src/auto/styles.ts +0 -73
- package/src/block/layout.ts +0 -198
- package/src/block/renderer.ts +0 -484
- package/src/block/types.ts +0 -67
- package/src/boxes-and-lines/collapse.ts +0 -96
- package/src/boxes-and-lines/focus.ts +0 -257
- package/src/boxes-and-lines/label-placement.ts +0 -339
- package/src/boxes-and-lines/layout-grouped.ts +0 -912
- package/src/boxes-and-lines/layout-layered.ts +0 -722
- package/src/boxes-and-lines/layout-search.ts +0 -1678
- package/src/boxes-and-lines/layout.ts +0 -398
- package/src/boxes-and-lines/parser.ts +0 -1181
- package/src/boxes-and-lines/renderer.ts +0 -1465
- package/src/boxes-and-lines/types.ts +0 -66
- package/src/c4/parser.ts +0 -1158
- package/src/c4/renderer.ts +0 -2008
- package/src/c4/types.ts +0 -89
- package/src/chart-type-registry.ts +0 -529
- package/src/chart-types.ts +0 -225
- package/src/chart.ts +0 -685
- package/src/charts-d3/bar.ts +0 -338
- package/src/charts-d3/chord.ts +0 -140
- package/src/charts-d3/function.ts +0 -147
- package/src/charts-d3/funnel.ts +0 -104
- package/src/charts-d3/heatmap.ts +0 -145
- package/src/charts-d3/index.ts +0 -337
- package/src/charts-d3/interactions.ts +0 -477
- package/src/charts-d3/line.ts +0 -344
- package/src/charts-d3/mount.ts +0 -151
- package/src/charts-d3/pie.ts +0 -117
- package/src/charts-d3/polar.ts +0 -89
- package/src/charts-d3/radar.ts +0 -0
- package/src/charts-d3/sankey.ts +0 -0
- package/src/charts-d3/scatter.ts +0 -185
- package/src/charts-d3/shared.ts +0 -208
- package/src/class/layout.ts +0 -326
- package/src/class/parser.ts +0 -635
- package/src/class/renderer.ts +0 -793
- package/src/class/types.ts +0 -58
- package/src/cli-banner.ts +0 -106
- package/src/cli.ts +0 -1080
- package/src/colors-diagnostics.ts +0 -35
- package/src/colors.ts +0 -379
- package/src/completion-types.ts +0 -27
- package/src/completion.ts +0 -2668
- package/src/cycle/layout.ts +0 -1026
- package/src/cycle/parser.ts +0 -387
- package/src/cycle/renderer.ts +0 -653
- package/src/cycle/types.ts +0 -101
- package/src/d3.ts +0 -1434
- package/src/data-chart-parser.ts +0 -1007
- package/src/dgmo-router.ts +0 -296
- package/src/diagnostics-registry.ts +0 -108
- package/src/diagnostics.ts +0 -0
- package/src/dimensions.ts +0 -20
- package/src/directives-registry.ts +0 -396
- package/src/editor/dgmo.grammar +0 -76
- package/src/editor/dgmo.grammar.d.ts +0 -2
- package/src/editor/dgmo.grammar.js +0 -18
- package/src/editor/dgmo.grammar.terms.d.ts +0 -5
- package/src/editor/dgmo.grammar.terms.js +0 -35
- package/src/editor/highlight-api.ts +0 -596
- package/src/editor/highlight.ts +0 -36
- package/src/editor/index.ts +0 -27
- package/src/editor/keywords.ts +0 -128
- package/src/editor/tokens.ts +0 -30
- package/src/element/index.ts +0 -432
- package/src/embed/css.ts +0 -312
- package/src/embed/escape.ts +0 -15
- package/src/embed/index.ts +0 -280
- package/src/er/classify.ts +0 -228
- package/src/er/layout.ts +0 -530
- package/src/er/parser.ts +0 -750
- package/src/er/renderer.ts +0 -725
- package/src/er/types.ts +0 -52
- package/src/error-card.ts +0 -269
- package/src/event-line/diagnostics.ts +0 -117
- package/src/event-line/parser.ts +0 -643
- package/src/event-line/renderer.ts +0 -1742
- package/src/event-line/types.ts +0 -74
- package/src/fonts.ts +0 -3
- package/src/gantt/parser.ts +0 -1641
- package/src/gantt/renderer.ts +0 -3787
- package/src/gantt/resolver.ts +0 -172
- package/src/gantt/types.ts +0 -206
- package/src/graph/diagnostics.ts +0 -64
- package/src/graph/edge-spline.ts +0 -29
- package/src/graph/flowchart-parser.ts +0 -759
- package/src/graph/flowchart-renderer.ts +0 -817
- package/src/graph/layout.ts +0 -472
- package/src/graph/notes.ts +0 -21
- package/src/graph/state-collapse.ts +0 -78
- package/src/graph/state-parser.ts +0 -574
- package/src/graph/state-renderer.ts +0 -653
- package/src/graph/types.ts +0 -65
- package/src/index.ts +0 -261
- package/src/infra/compute.ts +0 -1385
- package/src/infra/layout.ts +0 -888
- package/src/infra/parser.ts +0 -1234
- package/src/infra/renderer.ts +0 -2534
- package/src/infra/roles.ts +0 -75
- package/src/infra/types.ts +0 -216
- package/src/infra/validation.ts +0 -201
- package/src/journey-map/layout.ts +0 -490
- package/src/journey-map/parser.ts +0 -557
- package/src/journey-map/renderer.ts +0 -1580
- package/src/journey-map/types.ts +0 -47
- package/src/kanban/mutations.ts +0 -175
- package/src/kanban/parser.ts +0 -509
- package/src/kanban/renderer.ts +0 -1449
- package/src/kanban/types.ts +0 -39
- package/src/label-layout.ts +0 -368
- package/src/map/colorize.ts +0 -54
- package/src/map/completion.ts +0 -316
- package/src/map/context-labels.ts +0 -609
- package/src/map/data/PROVENANCE.json +0 -1
- package/src/map/data/README.md +0 -40
- package/src/map/data/airport-collisions.json +0 -1
- package/src/map/data/airports.json +0 -1
- package/src/map/data/gazetteer.json +0 -1
- package/src/map/data/lakes.json +0 -1
- package/src/map/data/mountain-ranges.json +0 -1
- package/src/map/data/na-lakes.json +0 -1
- package/src/map/data/na-land.json +0 -1
- package/src/map/data/region-names.json +0 -1
- package/src/map/data/rivers.json +0 -1
- package/src/map/data/types.ts +0 -121
- package/src/map/data/us-states.json +0 -1
- package/src/map/data/water-bodies.json +0 -1
- package/src/map/data/world-coarse.json +0 -1
- package/src/map/data/world-detail.json +0 -1
- package/src/map/diagnostics.ts +0 -134
- package/src/map/dimensions.ts +0 -150
- package/src/map/geo-query.ts +0 -295
- package/src/map/geo.ts +0 -438
- package/src/map/invert.ts +0 -111
- package/src/map/layout.ts +0 -5069
- package/src/map/legend-band.ts +0 -127
- package/src/map/load-data.ts +0 -186
- package/src/map/parser.ts +0 -783
- package/src/map/renderer.ts +0 -1445
- package/src/map/resolved-types.ts +0 -160
- package/src/map/resolver.ts +0 -1146
- package/src/map/types.ts +0 -194
- package/src/mindmap/collapse.ts +0 -67
- package/src/mindmap/layout.ts +0 -649
- package/src/mindmap/parser.ts +0 -430
- package/src/mindmap/renderer.ts +0 -637
- package/src/mindmap/text-wrap.ts +0 -218
- package/src/mindmap/types.ts +0 -56
- package/src/org/collapse.ts +0 -151
- package/src/org/layout.ts +0 -1262
- package/src/org/parser.ts +0 -519
- package/src/org/renderer.ts +0 -866
- package/src/org/resolver.ts +0 -636
- package/src/palettes/atlas.ts +0 -77
- package/src/palettes/blueprint.ts +0 -73
- package/src/palettes/catppuccin.ts +0 -84
- package/src/palettes/color-utils.ts +0 -443
- package/src/palettes/index.ts +0 -67
- package/src/palettes/nord.ts +0 -67
- package/src/palettes/registry.ts +0 -114
- package/src/palettes/slate.ts +0 -73
- package/src/palettes/tidewater.ts +0 -73
- package/src/palettes/tokyo-night.ts +0 -86
- package/src/palettes/types.ts +0 -88
- package/src/pert/analyzer.ts +0 -1183
- package/src/pert/diagnostics.ts +0 -110
- package/src/pert/index.ts +0 -43
- package/src/pert/internal.ts +0 -252
- package/src/pert/layout.ts +0 -971
- package/src/pert/monte-carlo.ts +0 -446
- package/src/pert/parser.ts +0 -1606
- package/src/pert/renderer.ts +0 -4009
- package/src/pert/share-normalize.ts +0 -62
- package/src/pert/types.ts +0 -604
- package/src/pyramid/parser.ts +0 -185
- package/src/pyramid/renderer.ts +0 -768
- package/src/pyramid/types.ts +0 -28
- package/src/quadrant/parser.ts +0 -18
- package/src/quadrant/renderer.ts +0 -638
- package/src/raci/diagnostics.ts +0 -213
- package/src/raci/index.ts +0 -23
- package/src/raci/mutations.ts +0 -321
- package/src/raci/parser.ts +0 -699
- package/src/raci/renderer.ts +0 -1627
- package/src/raci/types.ts +0 -82
- package/src/raci/variants.ts +0 -320
- package/src/render.ts +0 -268
- package/src/ring/parser.ts +0 -212
- package/src/ring/renderer.ts +0 -490
- package/src/ring/types.ts +0 -27
- package/src/sequence/collapse.ts +0 -174
- package/src/sequence/parser.ts +0 -1596
- package/src/sequence/participant-inference.ts +0 -152
- package/src/sequence/renderer.ts +0 -3168
- package/src/sequence/tag-resolution.ts +0 -164
- package/src/sharing.ts +0 -211
- package/src/sitemap/collapse.ts +0 -100
- package/src/sitemap/layout.ts +0 -925
- package/src/sitemap/parser.ts +0 -755
- package/src/sitemap/renderer.ts +0 -828
- package/src/sitemap/types.ts +0 -42
- package/src/slope/parser.ts +0 -18
- package/src/slope/renderer.ts +0 -378
- package/src/swimlane/diagnostics.ts +0 -94
- package/src/swimlane/layout.ts +0 -597
- package/src/swimlane/parser.ts +0 -613
- package/src/swimlane/renderer.ts +0 -681
- package/src/swimlane/types.ts +0 -151
- package/src/tech-radar/interactive.ts +0 -1129
- package/src/tech-radar/layout.ts +0 -197
- package/src/tech-radar/parser.ts +0 -436
- package/src/tech-radar/renderer.ts +0 -1239
- package/src/tech-radar/shared.ts +0 -151
- package/src/tech-radar/types.ts +0 -86
- package/src/themes.ts +0 -22
- package/src/timeline/parser.ts +0 -472
- package/src/timeline/renderer.ts +0 -3024
- package/src/timeline/types.ts +0 -33
- package/src/timeline/viz-parser.ts +0 -21
- package/src/treemap/diagnostics.ts +0 -62
- package/src/treemap/layout-radial.ts +0 -233
- package/src/treemap/layout.ts +0 -189
- package/src/treemap/parser.ts +0 -463
- package/src/treemap/renderer-radial.ts +0 -438
- package/src/treemap/renderer.ts +0 -572
- package/src/treemap/treemap-shared.ts +0 -309
- package/src/treemap/types.ts +0 -60
- package/src/utils/arrow-markers.ts +0 -51
- package/src/utils/arrows-diagnostics.ts +0 -62
- package/src/utils/arrows.ts +0 -227
- package/src/utils/brand.ts +0 -61
- package/src/utils/card.ts +0 -183
- package/src/utils/collapse-engine/tree-edges.ts +0 -115
- package/src/utils/collapse-engine/tree.ts +0 -117
- package/src/utils/d3-helpers.ts +0 -219
- package/src/utils/d3-types.ts +0 -9
- package/src/utils/description-helpers.ts +0 -38
- package/src/utils/duration.ts +0 -312
- package/src/utils/export-container.ts +0 -41
- package/src/utils/expr-eval.ts +0 -27
- package/src/utils/fit-canvas.ts +0 -64
- package/src/utils/hover-styles.ts +0 -673
- package/src/utils/inline-markdown.ts +0 -96
- package/src/utils/legend-constants.ts +0 -48
- package/src/utils/legend-d3.ts +0 -618
- package/src/utils/legend-integration.ts +0 -107
- package/src/utils/legend-layout.ts +0 -776
- package/src/utils/legend-svg.ts +0 -214
- package/src/utils/legend-types.ts +0 -272
- package/src/utils/name-normalize.ts +0 -163
- package/src/utils/note-box/constants.ts +0 -25
- package/src/utils/note-box/index.ts +0 -11
- package/src/utils/note-box/metrics.ts +0 -90
- package/src/utils/note-box/svg.ts +0 -331
- package/src/utils/notes/bounds.ts +0 -30
- package/src/utils/notes/build.ts +0 -131
- package/src/utils/notes/index.ts +0 -18
- package/src/utils/notes/model.ts +0 -19
- package/src/utils/notes/parse.ts +0 -131
- package/src/utils/notes/place.ts +0 -177
- package/src/utils/notes/resolve.ts +0 -88
- package/src/utils/number-format.ts +0 -36
- package/src/utils/parsing.ts +0 -953
- package/src/utils/reserved-key-registry.ts +0 -239
- package/src/utils/safe-href.ts +0 -38
- package/src/utils/scaling.ts +0 -97
- package/src/utils/svg-embed.ts +0 -251
- package/src/utils/tag-groups.ts +0 -607
- package/src/utils/text-measure.ts +0 -122
- package/src/utils/title-constants.ts +0 -24
- package/src/utils/visual-conventions.ts +0 -61
- package/src/utils/wrapped-desc.ts +0 -87
- package/src/venn/parser.ts +0 -18
- package/src/venn/renderer.ts +0 -1047
- package/src/version-control/diagnostics.ts +0 -67
- package/src/version-control/parser.ts +0 -544
- package/src/version-control/renderer.ts +0 -724
- package/src/version-control/types.ts +0 -100
- package/src/visualizations/parse.ts +0 -1560
- package/src/visualizations/types.ts +0 -262
- package/src/wireframe/layout.ts +0 -479
- package/src/wireframe/parser.ts +0 -1114
- package/src/wireframe/renderer.ts +0 -1318
- package/src/wireframe/types.ts +0 -110
- package/src/wordcloud/parser.ts +0 -18
- package/src/wordcloud/renderer.ts +0 -357
|
@@ -0,0 +1,1610 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MONTH_ABBR,
|
|
3
|
+
computeTimeTicks
|
|
4
|
+
} from "./chunk-YRYKTYMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
createTooltip,
|
|
7
|
+
hideTooltip,
|
|
8
|
+
renderChartTitle,
|
|
9
|
+
showTooltip
|
|
10
|
+
} from "./chunk-U6EQI3U6.js";
|
|
11
|
+
import {
|
|
12
|
+
renderIntegratedLegend
|
|
13
|
+
} from "./chunk-PWIHZ6NJ.js";
|
|
14
|
+
import {
|
|
15
|
+
ScaleContext
|
|
16
|
+
} from "./chunk-YYVTBZZC.js";
|
|
17
|
+
import {
|
|
18
|
+
FONT_FAMILY
|
|
19
|
+
} from "./chunk-6KFWC4CO.js";
|
|
20
|
+
import {
|
|
21
|
+
LEGEND_CAPSULE_PAD,
|
|
22
|
+
LEGEND_DOT_R,
|
|
23
|
+
LEGEND_ENTRY_DOT_GAP,
|
|
24
|
+
LEGEND_ENTRY_FONT_SIZE,
|
|
25
|
+
LEGEND_ENTRY_TRAIL,
|
|
26
|
+
LEGEND_HEIGHT,
|
|
27
|
+
LEGEND_PILL_FONT_SIZE,
|
|
28
|
+
LEGEND_PILL_PAD,
|
|
29
|
+
measureLegendText,
|
|
30
|
+
truncateLegendText
|
|
31
|
+
} from "./chunk-QOOUC2J5.js";
|
|
32
|
+
import {
|
|
33
|
+
parseTimelineDate
|
|
34
|
+
} from "./chunk-GMR5MFHJ.js";
|
|
35
|
+
import {
|
|
36
|
+
getSeriesColors,
|
|
37
|
+
mix,
|
|
38
|
+
shapeFill,
|
|
39
|
+
themeBaseBg
|
|
40
|
+
} from "./chunk-P6T66CCZ.js";
|
|
41
|
+
import {
|
|
42
|
+
resolveTagColor,
|
|
43
|
+
tagAttrKey
|
|
44
|
+
} from "./chunk-QLCCJEJI.js";
|
|
45
|
+
|
|
46
|
+
// src/timeline/renderer.ts
|
|
47
|
+
import * as d3Scale from "d3-scale";
|
|
48
|
+
import * as d3Selection from "d3-selection";
|
|
49
|
+
function getEraColors(palette) {
|
|
50
|
+
return [
|
|
51
|
+
palette.colors.blue,
|
|
52
|
+
palette.colors.green,
|
|
53
|
+
palette.colors.yellow,
|
|
54
|
+
palette.colors.orange,
|
|
55
|
+
palette.colors.purple
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
function renderEras(g, eras, scale, isVertical, innerWidth, innerHeight, onEnter, onLeave, hasScale = false, _tooltip = null, palette, reservedLabelY) {
|
|
59
|
+
const eraColors = palette ? getEraColors(palette) : ["#3b6ea5", "#5b9357", "#c9a227", "#cc7a33", "#7d5ba6"];
|
|
60
|
+
eras.forEach((era, i) => {
|
|
61
|
+
const startVal = parseTimelineDate(era.startDate);
|
|
62
|
+
const endVal = parseTimelineDate(era.endDate);
|
|
63
|
+
if (!Number.isFinite(startVal) || !Number.isFinite(endVal)) return;
|
|
64
|
+
const start = scale(startVal);
|
|
65
|
+
const end = scale(endVal);
|
|
66
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) return;
|
|
67
|
+
const color = era.color || eraColors[i % eraColors.length];
|
|
68
|
+
const eraG = g.append("g").attr("class", "tl-era").attr("data-line-number", String(era.lineNumber)).attr("data-era-start", String(startVal)).attr("data-era-end", String(endVal)).style("cursor", "pointer");
|
|
69
|
+
let labelEl;
|
|
70
|
+
let displayLabel = era.label;
|
|
71
|
+
let truncated = false;
|
|
72
|
+
if (isVertical) {
|
|
73
|
+
const y = Math.min(start, end);
|
|
74
|
+
const h = Math.abs(end - start);
|
|
75
|
+
eraG.append("rect").attr("x", 0).attr("y", y).attr("width", innerWidth).attr("height", h).attr("fill", color).attr("opacity", 0.08);
|
|
76
|
+
labelEl = eraG.append("text").attr("x", 6).attr("y", y + 18).attr("text-anchor", "start").attr("fill", color).attr("font-size", "13px").attr("font-weight", "600").attr("opacity", 0.8).text(displayLabel);
|
|
77
|
+
} else {
|
|
78
|
+
const x = Math.min(start, end);
|
|
79
|
+
const w = Math.abs(end - start);
|
|
80
|
+
const useReservedRow = reservedLabelY != null;
|
|
81
|
+
const rectTop = useReservedRow ? 0 : hasScale ? -48 : 0;
|
|
82
|
+
const labelY = useReservedRow ? reservedLabelY : hasScale ? -32 : 18;
|
|
83
|
+
eraG.append("rect").attr("x", x).attr("y", rectTop).attr("width", w).attr("height", innerHeight - rectTop).attr("fill", color).attr("opacity", 0.08);
|
|
84
|
+
if (useReservedRow) {
|
|
85
|
+
const maxW = Math.max(0, w - 8);
|
|
86
|
+
displayLabel = truncateLegendText(era.label, 13, maxW);
|
|
87
|
+
truncated = displayLabel !== era.label;
|
|
88
|
+
}
|
|
89
|
+
labelEl = eraG.append("text").attr("x", x + w / 2).attr("y", labelY).attr("text-anchor", "middle").attr("fill", color).attr("font-size", "13px").attr("font-weight", "600").attr("opacity", 0.8).text(displayLabel);
|
|
90
|
+
}
|
|
91
|
+
eraG.on("mouseenter", function() {
|
|
92
|
+
onEnter(startVal, endVal);
|
|
93
|
+
if (truncated) labelEl.text(era.label);
|
|
94
|
+
}).on("mouseleave", function() {
|
|
95
|
+
onLeave();
|
|
96
|
+
if (truncated) labelEl.text(displayLabel);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function renderMarkers(g, markers, scale, isVertical, innerWidth, innerHeight, onEnter, onLeave, _hasScale = false, _tooltip = null, palette, reservedLabelY) {
|
|
101
|
+
const defaultColor = palette?.accent || "#3a9188";
|
|
102
|
+
const positions = markers.map((m) => {
|
|
103
|
+
const v = parseTimelineDate(m.date);
|
|
104
|
+
return Number.isFinite(v) ? scale(v) : NaN;
|
|
105
|
+
});
|
|
106
|
+
const useReservedRow = reservedLabelY != null && !isVertical;
|
|
107
|
+
markers.forEach((marker, i) => {
|
|
108
|
+
const dateVal = parseTimelineDate(marker.date);
|
|
109
|
+
if (!Number.isFinite(dateVal)) return;
|
|
110
|
+
const pos = positions[i];
|
|
111
|
+
if (!Number.isFinite(pos)) return;
|
|
112
|
+
const color = marker.color || defaultColor;
|
|
113
|
+
const lineOpacity = 0.5;
|
|
114
|
+
const diamondSize = 5;
|
|
115
|
+
const markerG = g.append("g").attr("class", "tl-marker").attr("data-marker-date", String(dateVal)).attr("data-line-number", String(marker.lineNumber)).style("cursor", "pointer");
|
|
116
|
+
if (isVertical) {
|
|
117
|
+
markerG.append("line").attr("x1", 0).attr("y1", pos).attr("x2", innerWidth).attr("y2", pos).attr("stroke", color).attr("stroke-width", 1.5).attr("stroke-dasharray", "6 4").attr("opacity", lineOpacity);
|
|
118
|
+
markerG.append("text").attr("x", -diamondSize - 8).attr("y", pos - diamondSize - 4).attr("text-anchor", "middle").attr("fill", color).attr("font-size", "11px").attr("font-weight", "600").text(marker.label);
|
|
119
|
+
markerG.append("path").attr(
|
|
120
|
+
"d",
|
|
121
|
+
`M${-diamondSize - 8},${pos} l${diamondSize},-${diamondSize} l${diamondSize},${diamondSize} l-${diamondSize},${diamondSize} Z`
|
|
122
|
+
).attr("fill", color).attr("opacity", 0.9);
|
|
123
|
+
markerG.on("mouseenter", function() {
|
|
124
|
+
onEnter(dateVal);
|
|
125
|
+
}).on("mouseleave", function() {
|
|
126
|
+
onLeave();
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
const labelY = useReservedRow ? reservedLabelY : 6;
|
|
130
|
+
const diamondY = useReservedRow ? -(diamondSize + 1) : labelY + 14;
|
|
131
|
+
const lineTop = diamondY + diamondSize;
|
|
132
|
+
let displayLabel = marker.label;
|
|
133
|
+
let truncated = false;
|
|
134
|
+
if (useReservedRow) {
|
|
135
|
+
let nearestDist = Math.min(pos, innerWidth - pos);
|
|
136
|
+
for (let j = 0; j < positions.length; j++) {
|
|
137
|
+
if (j === i) continue;
|
|
138
|
+
const other = positions[j];
|
|
139
|
+
if (!Number.isFinite(other)) continue;
|
|
140
|
+
const d = Math.abs(other - pos);
|
|
141
|
+
if (d < nearestDist) nearestDist = d;
|
|
142
|
+
}
|
|
143
|
+
const maxW = Math.max(0, nearestDist - 8);
|
|
144
|
+
displayLabel = truncateLegendText(marker.label, 11, maxW);
|
|
145
|
+
truncated = displayLabel !== marker.label;
|
|
146
|
+
}
|
|
147
|
+
const labelEl = markerG.append("text").attr("x", pos).attr("y", labelY).attr("text-anchor", "middle").attr("fill", color).attr("font-size", "11px").attr("font-weight", "600").text(displayLabel);
|
|
148
|
+
markerG.append("path").attr(
|
|
149
|
+
"d",
|
|
150
|
+
`M${pos},${diamondY - diamondSize} l${diamondSize},${diamondSize} l-${diamondSize},${diamondSize} l-${diamondSize},-${diamondSize} Z`
|
|
151
|
+
).attr("fill", color).attr("opacity", 0.9);
|
|
152
|
+
markerG.append("line").attr("x1", pos).attr("y1", lineTop).attr("x2", pos).attr("y2", innerHeight).attr("stroke", color).attr("stroke-width", 1.5).attr("stroke-dasharray", "6 4").attr("opacity", lineOpacity);
|
|
153
|
+
markerG.on("mouseenter", function() {
|
|
154
|
+
onEnter(dateVal);
|
|
155
|
+
if (truncated) labelEl.text(marker.label);
|
|
156
|
+
}).on("mouseleave", function() {
|
|
157
|
+
onLeave();
|
|
158
|
+
if (truncated) labelEl.text(displayLabel);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function formatDateLabel(dateStr) {
|
|
164
|
+
let bce = false;
|
|
165
|
+
if (dateStr.startsWith("-")) {
|
|
166
|
+
bce = true;
|
|
167
|
+
dateStr = dateStr.slice(1);
|
|
168
|
+
}
|
|
169
|
+
const era = bce ? " BCE" : "";
|
|
170
|
+
const spaceIdx = dateStr.indexOf(" ");
|
|
171
|
+
let datePart = dateStr;
|
|
172
|
+
let timeSuffix = "";
|
|
173
|
+
if (spaceIdx !== -1) {
|
|
174
|
+
datePart = dateStr.slice(0, spaceIdx);
|
|
175
|
+
timeSuffix = " " + dateStr.slice(spaceIdx + 1);
|
|
176
|
+
}
|
|
177
|
+
const parts = datePart.split("-");
|
|
178
|
+
const year = String(parseInt(parts[0], 10));
|
|
179
|
+
if (parts.length === 1) return `${year}${timeSuffix}${era}`;
|
|
180
|
+
const month = MONTH_ABBR[parseInt(parts[1], 10) - 1];
|
|
181
|
+
if (parts.length === 2) return `${month} ${year}${timeSuffix}${era}`;
|
|
182
|
+
const day = parseInt(parts[2], 10);
|
|
183
|
+
return `${month} ${day}, ${year}${timeSuffix}${era}`;
|
|
184
|
+
}
|
|
185
|
+
function formatBoundaryLabel(dateStr, otherDateStr) {
|
|
186
|
+
const spaceIdx = dateStr.indexOf(" ");
|
|
187
|
+
const otherSpaceIdx = otherDateStr.indexOf(" ");
|
|
188
|
+
if (spaceIdx !== -1 && otherSpaceIdx !== -1) {
|
|
189
|
+
const datePart = dateStr.slice(0, spaceIdx);
|
|
190
|
+
const otherDatePart = otherDateStr.slice(0, otherSpaceIdx);
|
|
191
|
+
if (datePart === otherDatePart) {
|
|
192
|
+
return dateStr.slice(spaceIdx + 1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return formatDateLabel(dateStr);
|
|
196
|
+
}
|
|
197
|
+
function renderTimeScale(g, scale, isVertical, innerWidth, innerHeight, textColor, boundaryStart, boundaryEnd, boundaryStartLabel, boundaryEndLabel) {
|
|
198
|
+
const [domainMin, domainMax] = scale.domain();
|
|
199
|
+
const ticks = computeTimeTicks(
|
|
200
|
+
domainMin,
|
|
201
|
+
domainMax,
|
|
202
|
+
scale,
|
|
203
|
+
boundaryStart,
|
|
204
|
+
boundaryEnd,
|
|
205
|
+
boundaryStartLabel,
|
|
206
|
+
boundaryEndLabel
|
|
207
|
+
);
|
|
208
|
+
if (ticks.length < 2) return;
|
|
209
|
+
const tickLen = 6;
|
|
210
|
+
const opacity = 0.4;
|
|
211
|
+
const guideOpacity = 0.15;
|
|
212
|
+
for (const tick of ticks) {
|
|
213
|
+
if (isVertical) {
|
|
214
|
+
g.append("line").attr("x1", 0).attr("y1", tick.pos).attr("x2", innerWidth).attr("y2", tick.pos).attr("stroke", textColor).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("opacity", guideOpacity);
|
|
215
|
+
g.append("line").attr("x1", -tickLen).attr("y1", tick.pos).attr("x2", 0).attr("y2", tick.pos).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
216
|
+
g.append("text").attr("x", -tickLen - 3).attr("y", tick.pos).attr("dy", "0.35em").attr("text-anchor", "end").attr("fill", textColor).attr("font-size", "10px").attr("opacity", opacity).text(tick.label);
|
|
217
|
+
g.append("line").attr("x1", innerWidth).attr("y1", tick.pos).attr("x2", innerWidth + tickLen).attr("y2", tick.pos).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
218
|
+
g.append("text").attr("x", innerWidth + tickLen + 3).attr("y", tick.pos).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", "10px").attr("opacity", opacity).text(tick.label);
|
|
219
|
+
} else {
|
|
220
|
+
g.append("line").attr("class", "tl-scale-tick").attr("x1", tick.pos).attr("y1", 0).attr("x2", tick.pos).attr("y2", innerHeight).attr("stroke", textColor).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("opacity", guideOpacity);
|
|
221
|
+
g.append("line").attr("class", "tl-scale-tick").attr("x1", tick.pos).attr("y1", innerHeight).attr("x2", tick.pos).attr("y2", innerHeight + tickLen).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
222
|
+
g.append("text").attr("class", "tl-scale-tick").attr("x", tick.pos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "10px").attr("opacity", opacity).text(tick.label);
|
|
223
|
+
g.append("line").attr("class", "tl-scale-tick").attr("x1", tick.pos).attr("y1", -tickLen).attr("x2", tick.pos).attr("y2", 0).attr("stroke", textColor).attr("stroke-width", 1).attr("opacity", opacity);
|
|
224
|
+
g.append("text").attr("class", "tl-scale-tick").attr("x", tick.pos).attr("y", -tickLen - 4).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", "10px").attr("opacity", opacity).text(tick.label);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function showEventDatesOnScale(g, scale, startDate, endDate, innerHeight, accentColor) {
|
|
229
|
+
g.selectAll(".tl-scale-tick").attr("opacity", 0.1);
|
|
230
|
+
const tickLen = 6;
|
|
231
|
+
const startPos = scale(parseTimelineDate(startDate));
|
|
232
|
+
const startLabel = formatDateLabel(startDate);
|
|
233
|
+
g.append("line").attr("class", "tl-event-date").attr("x1", startPos).attr("y1", -tickLen).attr("x2", startPos).attr("y2", innerHeight).attr("stroke", accentColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4").attr("opacity", 0.6);
|
|
234
|
+
g.append("text").attr("class", "tl-event-date").attr("x", startPos).attr("y", -tickLen - 4).attr("text-anchor", "middle").attr("fill", accentColor).attr("font-size", "10px").attr("font-weight", "600").text(startLabel);
|
|
235
|
+
g.append("text").attr("class", "tl-event-date").attr("x", startPos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("fill", accentColor).attr("font-size", "10px").attr("font-weight", "600").text(startLabel);
|
|
236
|
+
if (endDate) {
|
|
237
|
+
const endPos = scale(parseTimelineDate(endDate));
|
|
238
|
+
const endLabel = formatDateLabel(endDate);
|
|
239
|
+
g.append("line").attr("class", "tl-event-date").attr("x1", endPos).attr("y1", -tickLen).attr("x2", endPos).attr("y2", innerHeight).attr("stroke", accentColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4").attr("opacity", 0.6);
|
|
240
|
+
g.append("text").attr("class", "tl-event-date").attr("x", endPos).attr("y", -tickLen - 4).attr("text-anchor", "middle").attr("fill", accentColor).attr("font-size", "10px").attr("font-weight", "600").text(endLabel);
|
|
241
|
+
g.append("text").attr("class", "tl-event-date").attr("x", endPos).attr("y", innerHeight + tickLen + 12).attr("text-anchor", "middle").attr("fill", accentColor).attr("font-size", "10px").attr("font-weight", "600").text(endLabel);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function hideEventDatesOnScale(g) {
|
|
245
|
+
g.selectAll(".tl-event-date").remove();
|
|
246
|
+
g.selectAll(".tl-scale-tick").each(function() {
|
|
247
|
+
const el = d3Selection.select(this);
|
|
248
|
+
const isDashed = el.attr("stroke-dasharray");
|
|
249
|
+
el.attr("opacity", isDashed ? 0.15 : 0.4);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function buildEventTooltipHtml(ev) {
|
|
253
|
+
const datePart = ev.endDate ? `${formatDateLabel(ev.date)} \u2192 ${formatDateLabel(ev.endDate)}` : formatDateLabel(ev.date);
|
|
254
|
+
return `<strong>${ev.label}</strong><br>${datePart}`;
|
|
255
|
+
}
|
|
256
|
+
function renderTimelineGroupLegend(g, groups, groupColorMap, textColor, palette, isDark, legendY, onHover, onLeave) {
|
|
257
|
+
const PILL_H = 22;
|
|
258
|
+
const DOT_R = 4;
|
|
259
|
+
const DOT_GAP = 4;
|
|
260
|
+
const PAD_X = 10;
|
|
261
|
+
const FONT_SIZE = 11;
|
|
262
|
+
const GAP = 8;
|
|
263
|
+
const pillBg = isDark ? mix(palette.surface, palette.bg, 50) : mix(palette.surface, palette.bg, 30);
|
|
264
|
+
let legendX = 0;
|
|
265
|
+
for (const grp of groups) {
|
|
266
|
+
const color = groupColorMap.get(grp.name) ?? textColor;
|
|
267
|
+
const textW = measureLegendText(grp.name, FONT_SIZE);
|
|
268
|
+
const pillW = PAD_X + DOT_R * 2 + DOT_GAP + textW + PAD_X;
|
|
269
|
+
const itemG = g.append("g").attr("class", "tl-legend-item").attr("data-group", grp.name).style("cursor", "pointer").on("mouseenter", () => onHover(grp.name)).on("mouseleave", () => onLeave());
|
|
270
|
+
itemG.append("rect").attr("x", legendX).attr("y", legendY - PILL_H / 2).attr("width", pillW).attr("height", PILL_H).attr("rx", PILL_H / 2).attr("fill", pillBg);
|
|
271
|
+
itemG.append("circle").attr("cx", legendX + PAD_X + DOT_R).attr("cy", legendY).attr("r", DOT_R).attr("fill", color);
|
|
272
|
+
itemG.append("text").attr("x", legendX + PAD_X + DOT_R * 2 + DOT_GAP).attr("y", legendY).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${FONT_SIZE}px`).attr("font-family", FONT_FAMILY).text(grp.name);
|
|
273
|
+
legendX += pillW + GAP;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function setupTimeline(container, parsed, palette, isDark, exportDims, activeTagGroup, swimlaneTagGroup) {
|
|
277
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
278
|
+
const solid = parsed.solidFill === true;
|
|
279
|
+
const {
|
|
280
|
+
timelineEvents,
|
|
281
|
+
timelineGroups,
|
|
282
|
+
timelineEras,
|
|
283
|
+
timelineMarkers,
|
|
284
|
+
timelineSort,
|
|
285
|
+
orientation
|
|
286
|
+
} = parsed;
|
|
287
|
+
if (timelineEvents.length === 0) return null;
|
|
288
|
+
let resolvedSwimlaneTG = swimlaneTagGroup ?? null;
|
|
289
|
+
if (resolvedSwimlaneTG == null && timelineSort === "tag" && parsed.timelineDefaultSwimlaneTG) {
|
|
290
|
+
resolvedSwimlaneTG = parsed.timelineDefaultSwimlaneTG;
|
|
291
|
+
}
|
|
292
|
+
const tooltip = createTooltip(container, palette, isDark);
|
|
293
|
+
const width = exportDims?.width ?? container.clientWidth;
|
|
294
|
+
const height = exportDims?.height ?? container.clientHeight;
|
|
295
|
+
if (width <= 0 || height <= 0) return null;
|
|
296
|
+
const isVertical = orientation === "vertical";
|
|
297
|
+
const textColor = palette.text;
|
|
298
|
+
const mutedColor = palette.border;
|
|
299
|
+
const bgColor = palette.bg;
|
|
300
|
+
const bg = themeBaseBg(palette, isDark);
|
|
301
|
+
const colors = getSeriesColors(palette);
|
|
302
|
+
const groupColorMap = /* @__PURE__ */ new Map();
|
|
303
|
+
timelineGroups.forEach((grp, i) => {
|
|
304
|
+
groupColorMap.set(grp.name, grp.color ?? colors[i % colors.length]);
|
|
305
|
+
});
|
|
306
|
+
let tagLanes = null;
|
|
307
|
+
if (resolvedSwimlaneTG) {
|
|
308
|
+
const tagKey = tagAttrKey(resolvedSwimlaneTG);
|
|
309
|
+
const tagGroup = parsed.timelineTagGroups.find(
|
|
310
|
+
(g) => g.name.toLowerCase() === tagKey
|
|
311
|
+
);
|
|
312
|
+
if (tagGroup) {
|
|
313
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
314
|
+
const otherEvents = [];
|
|
315
|
+
for (const ev of timelineEvents) {
|
|
316
|
+
const val = ev.metadata[tagKey];
|
|
317
|
+
if (val) {
|
|
318
|
+
const list = buckets.get(val) ?? [];
|
|
319
|
+
list.push(ev);
|
|
320
|
+
buckets.set(val, list);
|
|
321
|
+
} else {
|
|
322
|
+
otherEvents.push(ev);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const laneEntries = [...buckets.entries()].sort((a, b) => {
|
|
326
|
+
const aMin = Math.min(...a[1].map((e) => parseTimelineDate(e.date)));
|
|
327
|
+
const bMin = Math.min(...b[1].map((e) => parseTimelineDate(e.date)));
|
|
328
|
+
return aMin - bMin;
|
|
329
|
+
});
|
|
330
|
+
tagLanes = laneEntries.map(([name, events]) => ({ name, events }));
|
|
331
|
+
if (otherEvents.length > 0) {
|
|
332
|
+
tagLanes.push({ name: "(Other)", events: otherEvents });
|
|
333
|
+
}
|
|
334
|
+
for (const entry of tagGroup.entries) {
|
|
335
|
+
groupColorMap.set(entry.value, entry.color);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const effectiveColorTG = activeTagGroup ?? resolvedSwimlaneTG ?? null;
|
|
340
|
+
function eventColor(ev) {
|
|
341
|
+
if (effectiveColorTG) {
|
|
342
|
+
const tagColor = resolveTagColor(
|
|
343
|
+
ev.metadata,
|
|
344
|
+
parsed.timelineTagGroups,
|
|
345
|
+
effectiveColorTG
|
|
346
|
+
);
|
|
347
|
+
if (tagColor) return tagColor;
|
|
348
|
+
}
|
|
349
|
+
if (ev.group && groupColorMap.has(ev.group)) {
|
|
350
|
+
return groupColorMap.get(ev.group);
|
|
351
|
+
}
|
|
352
|
+
return textColor;
|
|
353
|
+
}
|
|
354
|
+
let minDate = Infinity;
|
|
355
|
+
let maxDate = -Infinity;
|
|
356
|
+
let earliestStartDateStr = "";
|
|
357
|
+
let latestEndDateStr = "";
|
|
358
|
+
for (const ev of timelineEvents) {
|
|
359
|
+
const startNum = parseTimelineDate(ev.date);
|
|
360
|
+
const endNum = ev.endDate ? parseTimelineDate(ev.endDate) : startNum;
|
|
361
|
+
if (startNum < minDate) {
|
|
362
|
+
minDate = startNum;
|
|
363
|
+
earliestStartDateStr = ev.date;
|
|
364
|
+
}
|
|
365
|
+
if (endNum > maxDate) {
|
|
366
|
+
maxDate = endNum;
|
|
367
|
+
latestEndDateStr = ev.endDate ?? ev.date;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
for (const era of timelineEras) {
|
|
371
|
+
const eraStartNum = parseTimelineDate(era.startDate);
|
|
372
|
+
const eraEndNum = parseTimelineDate(era.endDate);
|
|
373
|
+
if (Number.isFinite(eraStartNum) && eraStartNum < minDate) {
|
|
374
|
+
minDate = eraStartNum;
|
|
375
|
+
earliestStartDateStr = era.startDate;
|
|
376
|
+
}
|
|
377
|
+
if (Number.isFinite(eraEndNum) && eraEndNum > maxDate) {
|
|
378
|
+
maxDate = eraEndNum;
|
|
379
|
+
latestEndDateStr = era.endDate;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
for (const marker of timelineMarkers) {
|
|
383
|
+
const markerNum = parseTimelineDate(marker.date);
|
|
384
|
+
if (!Number.isFinite(markerNum)) continue;
|
|
385
|
+
if (markerNum < minDate) {
|
|
386
|
+
minDate = markerNum;
|
|
387
|
+
earliestStartDateStr = marker.date;
|
|
388
|
+
}
|
|
389
|
+
if (markerNum > maxDate) {
|
|
390
|
+
maxDate = markerNum;
|
|
391
|
+
latestEndDateStr = marker.date;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const datePadding = (maxDate - minDate) * 0.05 || 0.5;
|
|
395
|
+
const tagLegendReserve = parsed.timelineTagGroups.length > 0 ? 36 : 0;
|
|
396
|
+
const idealWidth = isVertical ? 500 : Math.max(600, timelineEvents.length * 40 + 200);
|
|
397
|
+
const ctx = exportDims ? ScaleContext.identity() : ScaleContext.from(width, idealWidth);
|
|
398
|
+
return {
|
|
399
|
+
width,
|
|
400
|
+
height,
|
|
401
|
+
isVertical,
|
|
402
|
+
tooltip,
|
|
403
|
+
solid,
|
|
404
|
+
textColor,
|
|
405
|
+
mutedColor,
|
|
406
|
+
bgColor,
|
|
407
|
+
bg,
|
|
408
|
+
swimlaneTagGroup: resolvedSwimlaneTG,
|
|
409
|
+
groupColorMap,
|
|
410
|
+
tagLanes,
|
|
411
|
+
eventColor,
|
|
412
|
+
minDate,
|
|
413
|
+
maxDate,
|
|
414
|
+
datePadding,
|
|
415
|
+
earliestStartDateStr,
|
|
416
|
+
latestEndDateStr,
|
|
417
|
+
tagLegendReserve,
|
|
418
|
+
ctx
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function makeTimelineHoverHelpers() {
|
|
422
|
+
const FADE_OPACITY = 0.1;
|
|
423
|
+
function fadeToGroup(g, groupName) {
|
|
424
|
+
g.selectAll(".tl-event").each(function() {
|
|
425
|
+
const el = d3Selection.select(this);
|
|
426
|
+
const evGroup = el.attr("data-group");
|
|
427
|
+
el.attr("opacity", evGroup === groupName ? 1 : FADE_OPACITY);
|
|
428
|
+
});
|
|
429
|
+
g.selectAll(".tl-legend-item, .tl-lane-header").each(
|
|
430
|
+
function() {
|
|
431
|
+
const el = d3Selection.select(this);
|
|
432
|
+
const name = el.attr("data-group");
|
|
433
|
+
el.attr("opacity", name === groupName ? 1 : FADE_OPACITY);
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
g.selectAll(".tl-marker").attr(
|
|
437
|
+
"opacity",
|
|
438
|
+
FADE_OPACITY
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
function fadeToEra(g, eraStart, eraEnd) {
|
|
442
|
+
g.selectAll(".tl-event").each(function() {
|
|
443
|
+
const el = d3Selection.select(this);
|
|
444
|
+
const date = parseFloat(el.attr("data-date"));
|
|
445
|
+
const endDate = el.attr("data-end-date");
|
|
446
|
+
const evEnd = endDate ? parseFloat(endDate) : date;
|
|
447
|
+
const inside = evEnd >= eraStart && date <= eraEnd;
|
|
448
|
+
el.attr("opacity", inside ? 1 : FADE_OPACITY);
|
|
449
|
+
});
|
|
450
|
+
g.selectAll(".tl-legend-item, .tl-lane-header").attr(
|
|
451
|
+
"opacity",
|
|
452
|
+
FADE_OPACITY
|
|
453
|
+
);
|
|
454
|
+
g.selectAll(".tl-era").each(function() {
|
|
455
|
+
const el = d3Selection.select(this);
|
|
456
|
+
const s = parseFloat(el.attr("data-era-start"));
|
|
457
|
+
const e = parseFloat(el.attr("data-era-end"));
|
|
458
|
+
const isSelf = s === eraStart && e === eraEnd;
|
|
459
|
+
el.attr("opacity", isSelf ? 1 : FADE_OPACITY);
|
|
460
|
+
});
|
|
461
|
+
g.selectAll(".tl-marker").each(function() {
|
|
462
|
+
const el = d3Selection.select(this);
|
|
463
|
+
const date = parseFloat(el.attr("data-marker-date"));
|
|
464
|
+
const inside = date >= eraStart && date <= eraEnd;
|
|
465
|
+
el.attr("opacity", inside ? 1 : FADE_OPACITY);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
function fadeToMarker(g, markerDate) {
|
|
469
|
+
g.selectAll(".tl-event").attr(
|
|
470
|
+
"opacity",
|
|
471
|
+
FADE_OPACITY
|
|
472
|
+
);
|
|
473
|
+
g.selectAll(".tl-era").attr("opacity", FADE_OPACITY);
|
|
474
|
+
g.selectAll(".tl-legend-item, .tl-lane-header").attr(
|
|
475
|
+
"opacity",
|
|
476
|
+
FADE_OPACITY
|
|
477
|
+
);
|
|
478
|
+
g.selectAll(".tl-marker").each(function() {
|
|
479
|
+
const el = d3Selection.select(this);
|
|
480
|
+
const date = parseFloat(el.attr("data-marker-date"));
|
|
481
|
+
el.attr("opacity", date === markerDate ? 1 : FADE_OPACITY);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function fadeReset(g) {
|
|
485
|
+
g.selectAll(
|
|
486
|
+
".tl-event, .tl-legend-item, .tl-lane-header, .tl-marker, .tl-tag-legend-entry"
|
|
487
|
+
).attr("opacity", 1);
|
|
488
|
+
g.selectAll(".tl-era").attr("opacity", 1);
|
|
489
|
+
}
|
|
490
|
+
function fadeToTagValue(g, tagKey, tagValue) {
|
|
491
|
+
const attrName = `data-tag-${tagKey}`;
|
|
492
|
+
g.selectAll(".tl-event").each(function() {
|
|
493
|
+
const el = d3Selection.select(this);
|
|
494
|
+
const val = el.attr(attrName);
|
|
495
|
+
el.attr("opacity", val === tagValue ? 1 : FADE_OPACITY);
|
|
496
|
+
});
|
|
497
|
+
g.selectAll(".tl-legend-item, .tl-lane-header").attr(
|
|
498
|
+
"opacity",
|
|
499
|
+
FADE_OPACITY
|
|
500
|
+
);
|
|
501
|
+
g.selectAll(".tl-marker").attr(
|
|
502
|
+
"opacity",
|
|
503
|
+
FADE_OPACITY
|
|
504
|
+
);
|
|
505
|
+
g.selectAll(".tl-tag-legend-entry").each(function() {
|
|
506
|
+
const el = d3Selection.select(this);
|
|
507
|
+
const entryValue = el.attr("data-legend-entry");
|
|
508
|
+
if (entryValue === "__group__") return;
|
|
509
|
+
const entryGroup = el.attr("data-tag-group");
|
|
510
|
+
el.attr(
|
|
511
|
+
"opacity",
|
|
512
|
+
entryGroup === tagKey && entryValue === tagValue ? 1 : FADE_OPACITY
|
|
513
|
+
);
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function setTagAttrs(evG, ev) {
|
|
517
|
+
for (const [key, value] of Object.entries(ev.metadata)) {
|
|
518
|
+
evG.attr(`data-tag-${key}`, value.toLowerCase());
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return {
|
|
522
|
+
FADE_OPACITY,
|
|
523
|
+
fadeToGroup,
|
|
524
|
+
fadeToEra,
|
|
525
|
+
fadeToMarker,
|
|
526
|
+
fadeReset,
|
|
527
|
+
fadeToTagValue,
|
|
528
|
+
setTagAttrs
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, swimlaneTagGroup, activeTagGroup, onTagStateChange, viewMode, exportMode) {
|
|
532
|
+
if (parsed.timelineTagGroups.length === 0) return;
|
|
533
|
+
const { width, textColor, groupColorMap, solid } = setup;
|
|
534
|
+
const { FADE_OPACITY, fadeReset, fadeToTagValue } = hovers;
|
|
535
|
+
const title = parsed.noTitle ? null : parsed.title;
|
|
536
|
+
const { timelineEvents } = parsed;
|
|
537
|
+
const LG_HEIGHT = LEGEND_HEIGHT;
|
|
538
|
+
const LG_PILL_PAD = LEGEND_PILL_PAD;
|
|
539
|
+
const LG_PILL_FONT_SIZE = LEGEND_PILL_FONT_SIZE;
|
|
540
|
+
const LG_CAPSULE_PAD = LEGEND_CAPSULE_PAD;
|
|
541
|
+
const LG_DOT_R = LEGEND_DOT_R;
|
|
542
|
+
const LG_ENTRY_FONT_SIZE = LEGEND_ENTRY_FONT_SIZE;
|
|
543
|
+
const LG_ENTRY_DOT_GAP = LEGEND_ENTRY_DOT_GAP;
|
|
544
|
+
const LG_ENTRY_TRAIL = LEGEND_ENTRY_TRAIL;
|
|
545
|
+
const LG_ICON_W = 20;
|
|
546
|
+
const mainSvg = d3Selection.select(container).select("svg");
|
|
547
|
+
const mainG = mainSvg.select("g");
|
|
548
|
+
if (!mainSvg.empty() && !mainG.empty()) {
|
|
549
|
+
let drawSwimlaneIcon2 = function(parent, x, y, isSwimActive) {
|
|
550
|
+
const iconG = parent.append("g").attr("class", "tl-swimlane-icon").attr("transform", `translate(${x}, ${y})`).style("cursor", "pointer");
|
|
551
|
+
iconG.append("rect").attr("x", -5).attr("y", -5).attr("width", 22).attr("height", 20).attr("fill", "transparent");
|
|
552
|
+
const barColor = isSwimActive ? palette.primary : palette.textMuted;
|
|
553
|
+
const barOpacity = isSwimActive ? 1 : 0.35;
|
|
554
|
+
const bars = [
|
|
555
|
+
{ y: 0, w: 8 },
|
|
556
|
+
{ y: 4, w: 12 },
|
|
557
|
+
{ y: 8, w: 6 }
|
|
558
|
+
];
|
|
559
|
+
for (const bar of bars) {
|
|
560
|
+
iconG.append("rect").attr("x", 0).attr("y", bar.y).attr("width", bar.w).attr("height", 2).attr("rx", 1).attr("fill", barColor).attr("opacity", barOpacity);
|
|
561
|
+
}
|
|
562
|
+
return iconG;
|
|
563
|
+
}, relayout2 = function() {
|
|
564
|
+
renderTimeline(
|
|
565
|
+
container,
|
|
566
|
+
parsed,
|
|
567
|
+
palette,
|
|
568
|
+
isDark,
|
|
569
|
+
onClickItem,
|
|
570
|
+
exportDims,
|
|
571
|
+
currentActiveGroup,
|
|
572
|
+
currentSwimlaneGroup,
|
|
573
|
+
onTagStateChange,
|
|
574
|
+
viewMode
|
|
575
|
+
);
|
|
576
|
+
}, drawLegend2 = function() {
|
|
577
|
+
mainSvg.selectAll(".tl-tag-legend-group").remove();
|
|
578
|
+
mainSvg.selectAll(".tl-tag-legend-container").remove();
|
|
579
|
+
const effectiveColorKey = (currentActiveGroup ?? currentSwimlaneGroup)?.toLowerCase() ?? null;
|
|
580
|
+
const visibleGroups = viewMode ? legendGroups.filter(
|
|
581
|
+
(lg) => effectiveColorKey != null && lg.group.name.toLowerCase() === effectiveColorKey
|
|
582
|
+
) : legendGroups;
|
|
583
|
+
if (visibleGroups.length === 0) return;
|
|
584
|
+
const legendContainer = mainSvg.append("g").attr("class", "tl-tag-legend-container");
|
|
585
|
+
if (currentActiveGroup) {
|
|
586
|
+
legendContainer.attr(
|
|
587
|
+
"data-legend-active",
|
|
588
|
+
tagAttrKey(currentActiveGroup)
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
const iconAddon = viewMode ? 0 : LG_ICON_W;
|
|
592
|
+
const centralGroups = visibleGroups.map((lg) => ({
|
|
593
|
+
name: lg.group.name,
|
|
594
|
+
entries: lg.group.entries.map((e) => ({
|
|
595
|
+
value: e.value,
|
|
596
|
+
color: e.color
|
|
597
|
+
}))
|
|
598
|
+
}));
|
|
599
|
+
const centralActive = viewMode ? effectiveColorKey : currentActiveGroup;
|
|
600
|
+
const centralConfig = {
|
|
601
|
+
groups: centralGroups,
|
|
602
|
+
position: { placement: "top-center", titleRelation: "below-title" },
|
|
603
|
+
mode: exportMode ? "export" : "preview",
|
|
604
|
+
capsulePillAddonWidth: iconAddon
|
|
605
|
+
};
|
|
606
|
+
const centralCallbacks = viewMode ? {} : {
|
|
607
|
+
onGroupToggle: (groupName) => {
|
|
608
|
+
currentActiveGroup = currentActiveGroup === groupName.toLowerCase() ? null : groupName.toLowerCase();
|
|
609
|
+
drawLegend2();
|
|
610
|
+
recolorEvents2();
|
|
611
|
+
onTagStateChange?.(currentActiveGroup, currentSwimlaneGroup);
|
|
612
|
+
},
|
|
613
|
+
onEntryHover: (groupName, entryValue) => {
|
|
614
|
+
const tagKey = tagAttrKey(groupName);
|
|
615
|
+
if (entryValue) {
|
|
616
|
+
const tagVal = entryValue.toLowerCase();
|
|
617
|
+
fadeToTagValue(mainG, tagKey, tagVal);
|
|
618
|
+
mainSvg.selectAll("[data-legend-entry]").each(function() {
|
|
619
|
+
const el = d3Selection.select(this);
|
|
620
|
+
const ev = el.attr("data-legend-entry");
|
|
621
|
+
const eg = el.attr("data-tag-group") ?? el.node()?.closest?.("[data-tag-group]")?.getAttribute("data-tag-group");
|
|
622
|
+
el.attr(
|
|
623
|
+
"opacity",
|
|
624
|
+
eg === tagKey && ev === tagVal ? 1 : FADE_OPACITY
|
|
625
|
+
);
|
|
626
|
+
});
|
|
627
|
+
} else {
|
|
628
|
+
fadeReset(mainG);
|
|
629
|
+
mainSvg.selectAll("[data-legend-entry]").attr("opacity", 1);
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
onGroupRendered: (groupName, groupEl, isActive) => {
|
|
633
|
+
const groupKey = tagAttrKey(groupName);
|
|
634
|
+
groupEl.attr("data-tag-group", groupKey);
|
|
635
|
+
if (isActive && !viewMode) {
|
|
636
|
+
const isSwimActive = currentSwimlaneGroup?.toLowerCase() === groupKey;
|
|
637
|
+
const pillWidth = measureLegendText(groupName, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
|
|
638
|
+
const pillXOff = LG_CAPSULE_PAD;
|
|
639
|
+
const iconX = pillXOff + pillWidth + 5;
|
|
640
|
+
const iconY = (LG_HEIGHT - 10) / 2;
|
|
641
|
+
const iconEl = drawSwimlaneIcon2(
|
|
642
|
+
groupEl,
|
|
643
|
+
iconX,
|
|
644
|
+
iconY,
|
|
645
|
+
isSwimActive
|
|
646
|
+
);
|
|
647
|
+
iconEl.attr("data-swimlane-toggle", groupKey).on("click", (event) => {
|
|
648
|
+
event.stopPropagation();
|
|
649
|
+
currentSwimlaneGroup = currentSwimlaneGroup === groupKey ? null : groupKey;
|
|
650
|
+
onTagStateChange?.(
|
|
651
|
+
currentActiveGroup,
|
|
652
|
+
currentSwimlaneGroup
|
|
653
|
+
);
|
|
654
|
+
relayout2();
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const legendInnerG = legendContainer.append("g").attr("transform", `translate(0, ${legendY})`);
|
|
660
|
+
renderIntegratedLegend(legendInnerG, {
|
|
661
|
+
...centralConfig,
|
|
662
|
+
palette,
|
|
663
|
+
isDark,
|
|
664
|
+
width,
|
|
665
|
+
activeGroup: centralActive,
|
|
666
|
+
callbacks: centralCallbacks
|
|
667
|
+
});
|
|
668
|
+
}, recolorEvents2 = function() {
|
|
669
|
+
const colorTG = currentActiveGroup ?? swimlaneTagGroup ?? null;
|
|
670
|
+
mainG.selectAll(".tl-event").each(function() {
|
|
671
|
+
const el = d3Selection.select(this);
|
|
672
|
+
const lineNum = el.attr("data-line-number");
|
|
673
|
+
const ev = lineNum ? eventByLine.get(lineNum) : void 0;
|
|
674
|
+
if (!ev) return;
|
|
675
|
+
let color;
|
|
676
|
+
if (colorTG) {
|
|
677
|
+
const tagColor = resolveTagColor(
|
|
678
|
+
ev.metadata,
|
|
679
|
+
parsed.timelineTagGroups,
|
|
680
|
+
colorTG
|
|
681
|
+
);
|
|
682
|
+
color = tagColor ?? (ev.group && groupColorMap.has(ev.group) ? groupColorMap.get(ev.group) : textColor);
|
|
683
|
+
} else {
|
|
684
|
+
color = ev.group && groupColorMap.has(ev.group) ? groupColorMap.get(ev.group) : textColor;
|
|
685
|
+
}
|
|
686
|
+
el.selectAll("rect").attr("fill", shapeFill(palette, color, isDark, { solid })).attr("stroke", color);
|
|
687
|
+
el.selectAll("circle:not(.tl-event-point-outline)").attr("fill", shapeFill(palette, color, isDark, { solid })).attr("stroke", color);
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
var drawSwimlaneIcon = drawSwimlaneIcon2, relayout = relayout2, drawLegend = drawLegend2, recolorEvents = recolorEvents2;
|
|
691
|
+
const legendY = title ? 50 : 10;
|
|
692
|
+
const legendGroups = parsed.timelineTagGroups.map((g) => {
|
|
693
|
+
const pillW = measureLegendText(g.name, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
|
|
694
|
+
const iconSpace = viewMode ? 8 : LG_ICON_W + 4;
|
|
695
|
+
let entryX = LG_CAPSULE_PAD + pillW + iconSpace;
|
|
696
|
+
for (const entry of g.entries) {
|
|
697
|
+
const textX = entryX + LG_DOT_R * 2 + LG_ENTRY_DOT_GAP;
|
|
698
|
+
entryX = textX + measureLegendText(entry.value, LG_ENTRY_FONT_SIZE) + LG_ENTRY_TRAIL;
|
|
699
|
+
}
|
|
700
|
+
return {
|
|
701
|
+
group: g,
|
|
702
|
+
minifiedWidth: pillW,
|
|
703
|
+
expandedWidth: entryX + LG_CAPSULE_PAD
|
|
704
|
+
};
|
|
705
|
+
});
|
|
706
|
+
let currentActiveGroup = activeTagGroup ?? null;
|
|
707
|
+
let currentSwimlaneGroup = swimlaneTagGroup ?? null;
|
|
708
|
+
const eventByLine = /* @__PURE__ */ new Map();
|
|
709
|
+
for (const ev of timelineEvents) {
|
|
710
|
+
eventByLine.set(String(ev.lineNumber), ev);
|
|
711
|
+
}
|
|
712
|
+
drawLegend2();
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
function renderTimelineHorizontalTimeSort(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, _swimlaneTagGroup, _activeTagGroup, _onTagStateChange, _viewMode) {
|
|
716
|
+
const {
|
|
717
|
+
width,
|
|
718
|
+
height,
|
|
719
|
+
tooltip,
|
|
720
|
+
solid,
|
|
721
|
+
textColor,
|
|
722
|
+
bgColor,
|
|
723
|
+
bg,
|
|
724
|
+
groupColorMap,
|
|
725
|
+
eventColor,
|
|
726
|
+
minDate,
|
|
727
|
+
maxDate,
|
|
728
|
+
datePadding,
|
|
729
|
+
earliestStartDateStr,
|
|
730
|
+
latestEndDateStr,
|
|
731
|
+
tagLegendReserve,
|
|
732
|
+
ctx
|
|
733
|
+
} = setup;
|
|
734
|
+
const { fadeToGroup, fadeToEra, fadeToMarker, fadeReset, setTagAttrs } = hovers;
|
|
735
|
+
const {
|
|
736
|
+
timelineEvents,
|
|
737
|
+
timelineGroups,
|
|
738
|
+
timelineEras,
|
|
739
|
+
timelineMarkers,
|
|
740
|
+
timelineScale
|
|
741
|
+
} = parsed;
|
|
742
|
+
const title = parsed.noTitle ? null : parsed.title;
|
|
743
|
+
const sBarH = ctx.structural(22);
|
|
744
|
+
const sPointR = ctx.structural(5);
|
|
745
|
+
const sPointStroke = ctx.structural(2);
|
|
746
|
+
const sBarRx = ctx.structural(4);
|
|
747
|
+
const sBarStroke = ctx.structural(2);
|
|
748
|
+
const sEventFont = ctx.text(13);
|
|
749
|
+
const sEventFontSm = ctx.text(12);
|
|
750
|
+
const sCharW = ctx.structural(7);
|
|
751
|
+
const sorted = timelineEvents.slice().sort((a, b) => parseTimelineDate(a.date) - parseTimelineDate(b.date));
|
|
752
|
+
const scaleMargin = timelineScale ? ctx.aesthetic(24) : 0;
|
|
753
|
+
const ERA_ROW_H = ctx.structural(22);
|
|
754
|
+
const MARKER_ROW_H = ctx.structural(22);
|
|
755
|
+
const eraReserve = timelineEras.length > 0 ? ERA_ROW_H : 0;
|
|
756
|
+
const markerReserve = timelineMarkers.length > 0 ? MARKER_ROW_H : 0;
|
|
757
|
+
const topScaleH = timelineScale ? ctx.structural(40) : 0;
|
|
758
|
+
const margin = {
|
|
759
|
+
top: ctx.aesthetic(104) + topScaleH + eraReserve + markerReserve + tagLegendReserve,
|
|
760
|
+
right: ctx.aesthetic(40),
|
|
761
|
+
bottom: ctx.aesthetic(40) + scaleMargin,
|
|
762
|
+
left: ctx.aesthetic(60)
|
|
763
|
+
};
|
|
764
|
+
const markerLabelY = markerReserve ? -(topScaleH + MARKER_ROW_H / 2) : 0;
|
|
765
|
+
const eraLabelY = eraReserve ? -(topScaleH + markerReserve + ERA_ROW_H / 2) : 0;
|
|
766
|
+
const innerWidth = width - margin.left - margin.right;
|
|
767
|
+
const rowH = ctx.structural(28);
|
|
768
|
+
const innerHeight = rowH * sorted.length;
|
|
769
|
+
const usedHeight = margin.top + innerHeight + margin.bottom;
|
|
770
|
+
const fitToContainer = !exportDims && height > 0 && usedHeight > height;
|
|
771
|
+
const svgHeight = fitToContainer ? height : usedHeight;
|
|
772
|
+
const xScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerWidth]);
|
|
773
|
+
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", svgHeight).attr("viewBox", `0 0 ${width} ${usedHeight}`).attr("preserveAspectRatio", "xMidYMin meet").style("background", bgColor);
|
|
774
|
+
if (ctx.isBelowFloor && !fitToContainer) {
|
|
775
|
+
svg.attr("width", "100%");
|
|
776
|
+
}
|
|
777
|
+
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
778
|
+
renderChartTitle(
|
|
779
|
+
svg,
|
|
780
|
+
title,
|
|
781
|
+
parsed.titleLineNumber,
|
|
782
|
+
width,
|
|
783
|
+
textColor,
|
|
784
|
+
onClickItem
|
|
785
|
+
);
|
|
786
|
+
renderEras(
|
|
787
|
+
g,
|
|
788
|
+
timelineEras,
|
|
789
|
+
xScale,
|
|
790
|
+
false,
|
|
791
|
+
innerWidth,
|
|
792
|
+
innerHeight,
|
|
793
|
+
(s, e) => fadeToEra(g, s, e),
|
|
794
|
+
() => fadeReset(g),
|
|
795
|
+
timelineScale,
|
|
796
|
+
tooltip,
|
|
797
|
+
palette,
|
|
798
|
+
eraReserve ? eraLabelY : void 0
|
|
799
|
+
);
|
|
800
|
+
renderMarkers(
|
|
801
|
+
g,
|
|
802
|
+
timelineMarkers,
|
|
803
|
+
xScale,
|
|
804
|
+
false,
|
|
805
|
+
innerWidth,
|
|
806
|
+
innerHeight,
|
|
807
|
+
(d) => fadeToMarker(g, d),
|
|
808
|
+
() => fadeReset(g),
|
|
809
|
+
timelineScale,
|
|
810
|
+
tooltip,
|
|
811
|
+
palette,
|
|
812
|
+
markerReserve ? markerLabelY : void 0
|
|
813
|
+
);
|
|
814
|
+
if (timelineScale) {
|
|
815
|
+
renderTimeScale(
|
|
816
|
+
g,
|
|
817
|
+
xScale,
|
|
818
|
+
false,
|
|
819
|
+
innerWidth,
|
|
820
|
+
innerHeight,
|
|
821
|
+
textColor,
|
|
822
|
+
minDate,
|
|
823
|
+
maxDate,
|
|
824
|
+
formatBoundaryLabel(earliestStartDateStr, latestEndDateStr),
|
|
825
|
+
formatBoundaryLabel(latestEndDateStr, earliestStartDateStr)
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
if (timelineGroups.length > 0) {
|
|
829
|
+
const legendY = timelineScale ? -ctx.aesthetic(75) : -ctx.aesthetic(55);
|
|
830
|
+
renderTimelineGroupLegend(
|
|
831
|
+
g,
|
|
832
|
+
timelineGroups,
|
|
833
|
+
groupColorMap,
|
|
834
|
+
textColor,
|
|
835
|
+
palette,
|
|
836
|
+
isDark,
|
|
837
|
+
legendY,
|
|
838
|
+
(name) => fadeToGroup(g, name),
|
|
839
|
+
() => fadeReset(g)
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
sorted.forEach((ev, i) => {
|
|
843
|
+
const y = i * rowH + rowH / 2;
|
|
844
|
+
const x = xScale(parseTimelineDate(ev.date));
|
|
845
|
+
const color = eventColor(ev);
|
|
846
|
+
const evG = g.append("g").attr("class", "tl-event").attr("data-group", ev.group || "").attr("data-line-number", String(ev.lineNumber)).attr("data-date", String(parseTimelineDate(ev.date))).attr(
|
|
847
|
+
"data-end-date",
|
|
848
|
+
ev.endDate ? String(parseTimelineDate(ev.endDate)) : null
|
|
849
|
+
).style("cursor", "pointer").on("mouseenter", function(event) {
|
|
850
|
+
if (ev.group && timelineGroups.length > 0) fadeToGroup(g, ev.group);
|
|
851
|
+
if (timelineScale) {
|
|
852
|
+
showEventDatesOnScale(
|
|
853
|
+
g,
|
|
854
|
+
xScale,
|
|
855
|
+
ev.date,
|
|
856
|
+
ev.endDate,
|
|
857
|
+
innerHeight,
|
|
858
|
+
color
|
|
859
|
+
);
|
|
860
|
+
} else {
|
|
861
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
862
|
+
}
|
|
863
|
+
}).on("mouseleave", function() {
|
|
864
|
+
fadeReset(g);
|
|
865
|
+
if (timelineScale) {
|
|
866
|
+
hideEventDatesOnScale(g);
|
|
867
|
+
} else {
|
|
868
|
+
hideTooltip(tooltip);
|
|
869
|
+
}
|
|
870
|
+
}).on("mousemove", function(event) {
|
|
871
|
+
if (!timelineScale) {
|
|
872
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
873
|
+
}
|
|
874
|
+
}).on("click", () => {
|
|
875
|
+
if (onClickItem && ev.lineNumber) onClickItem(ev.lineNumber);
|
|
876
|
+
});
|
|
877
|
+
setTagAttrs(evG, ev);
|
|
878
|
+
if (ev.endDate) {
|
|
879
|
+
const x2 = xScale(parseTimelineDate(ev.endDate));
|
|
880
|
+
const rectW = Math.max(x2 - x, 4);
|
|
881
|
+
const estLabelWidth = ev.label.length * sCharW + ctx.aesthetic(16);
|
|
882
|
+
const labelFitsInside = rectW >= estLabelWidth;
|
|
883
|
+
let fill = shapeFill(palette, color, isDark, { solid });
|
|
884
|
+
let stroke = color;
|
|
885
|
+
if (ev.uncertain) {
|
|
886
|
+
const gradientId = `uncertain-ts-${ev.lineNumber}`;
|
|
887
|
+
const strokeGradientId = `uncertain-ts-s-${ev.lineNumber}`;
|
|
888
|
+
const defs = svg.select("defs").node() || svg.append("defs").node();
|
|
889
|
+
const defsEl = d3Selection.select(defs);
|
|
890
|
+
defsEl.append("linearGradient").attr("id", gradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%").selectAll("stop").data([
|
|
891
|
+
{ offset: "0%", opacity: 1 },
|
|
892
|
+
{ offset: "80%", opacity: 1 },
|
|
893
|
+
{ offset: "100%", opacity: 0 }
|
|
894
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", mix(color, bg, 30)).attr("stop-opacity", (d) => d.opacity);
|
|
895
|
+
defsEl.append("linearGradient").attr("id", strokeGradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%").selectAll("stop").data([
|
|
896
|
+
{ offset: "0%", opacity: 1 },
|
|
897
|
+
{ offset: "80%", opacity: 1 },
|
|
898
|
+
{ offset: "100%", opacity: 0 }
|
|
899
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", color).attr("stop-opacity", (d) => d.opacity);
|
|
900
|
+
fill = `url(#${gradientId})`;
|
|
901
|
+
stroke = `url(#${strokeGradientId})`;
|
|
902
|
+
}
|
|
903
|
+
evG.append("rect").attr("x", x).attr("y", y - sBarH / 2).attr("width", rectW).attr("height", sBarH).attr("rx", sBarRx).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sBarStroke);
|
|
904
|
+
if (labelFitsInside) {
|
|
905
|
+
evG.append("text").attr("x", x + ctx.aesthetic(8)).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", `${sEventFont}px`).text(ev.label);
|
|
906
|
+
} else {
|
|
907
|
+
const sLabelGap = ctx.aesthetic(6);
|
|
908
|
+
const wouldFlipLeft = x + rectW > innerWidth * 0.6;
|
|
909
|
+
const labelFitsLeft = x - sLabelGap - estLabelWidth > 0;
|
|
910
|
+
const flipLeft = wouldFlipLeft && labelFitsLeft;
|
|
911
|
+
evG.append("text").attr("x", flipLeft ? x - sLabelGap : x + rectW + sLabelGap).attr("y", y).attr("dy", "0.35em").attr("text-anchor", flipLeft ? "end" : "start").attr("fill", textColor).attr("font-size", `${sEventFont}px`).text(ev.label);
|
|
912
|
+
}
|
|
913
|
+
} else {
|
|
914
|
+
const estLabelWidth = ev.label.length * sCharW;
|
|
915
|
+
const sPointGap = ctx.aesthetic(10);
|
|
916
|
+
const wouldFlipLeft = x > innerWidth * 0.6;
|
|
917
|
+
const labelFitsLeft = x - sPointGap - estLabelWidth > 0;
|
|
918
|
+
const flipLeft = wouldFlipLeft && labelFitsLeft;
|
|
919
|
+
evG.append("circle").attr("cx", x).attr("cy", y).attr("r", sPointR).attr("fill", shapeFill(palette, color, isDark, { solid })).attr("stroke", color).attr("stroke-width", sPointStroke);
|
|
920
|
+
evG.append("text").attr("x", flipLeft ? x - sPointGap : x + sPointGap).attr("y", y).attr("dy", "0.35em").attr("text-anchor", flipLeft ? "end" : "start").attr("fill", textColor).attr("font-size", `${sEventFontSm}px`).text(ev.label);
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function renderTimelineHorizontalGrouped(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, _swimlaneTagGroup, _activeTagGroup, _onTagStateChange, _viewMode, collapsedGroups, toggleGroup) {
|
|
925
|
+
const {
|
|
926
|
+
width,
|
|
927
|
+
height,
|
|
928
|
+
tooltip,
|
|
929
|
+
solid,
|
|
930
|
+
textColor,
|
|
931
|
+
bgColor,
|
|
932
|
+
bg,
|
|
933
|
+
groupColorMap,
|
|
934
|
+
tagLanes,
|
|
935
|
+
eventColor,
|
|
936
|
+
minDate,
|
|
937
|
+
maxDate,
|
|
938
|
+
datePadding,
|
|
939
|
+
earliestStartDateStr,
|
|
940
|
+
latestEndDateStr,
|
|
941
|
+
tagLegendReserve,
|
|
942
|
+
ctx
|
|
943
|
+
} = setup;
|
|
944
|
+
const { fadeToGroup, fadeToEra, fadeToMarker, fadeReset, setTagAttrs } = hovers;
|
|
945
|
+
const {
|
|
946
|
+
timelineEvents,
|
|
947
|
+
timelineGroups,
|
|
948
|
+
timelineEras,
|
|
949
|
+
timelineMarkers,
|
|
950
|
+
timelineScale
|
|
951
|
+
} = parsed;
|
|
952
|
+
const title = parsed.noTitle ? null : parsed.title;
|
|
953
|
+
const sBarH = ctx.structural(22);
|
|
954
|
+
const sGroupGap = ctx.aesthetic(12);
|
|
955
|
+
const sPointR = ctx.structural(5);
|
|
956
|
+
const sPointStroke = ctx.structural(2);
|
|
957
|
+
const sBarRx = ctx.structural(4);
|
|
958
|
+
const sBarStroke = ctx.structural(2);
|
|
959
|
+
const sEventFont = ctx.text(13);
|
|
960
|
+
const sCharW = ctx.structural(7);
|
|
961
|
+
const sLaneHeaderFont = ctx.text(12);
|
|
962
|
+
let lanes;
|
|
963
|
+
if (tagLanes) {
|
|
964
|
+
lanes = tagLanes;
|
|
965
|
+
} else {
|
|
966
|
+
const groupNames = timelineGroups.map((gr) => gr.name);
|
|
967
|
+
const ungroupedEvents = timelineEvents.filter(
|
|
968
|
+
(ev) => ev.group === null || !groupNames.includes(ev.group)
|
|
969
|
+
);
|
|
970
|
+
const laneNames = ungroupedEvents.length > 0 ? [...groupNames, "(Other)"] : groupNames;
|
|
971
|
+
lanes = laneNames.map((name) => ({
|
|
972
|
+
name,
|
|
973
|
+
events: timelineEvents.filter(
|
|
974
|
+
(ev) => name === "(Other)" ? ev.group === null || !groupNames.includes(ev.group) : ev.group === name
|
|
975
|
+
)
|
|
976
|
+
}));
|
|
977
|
+
}
|
|
978
|
+
const totalRows = lanes.reduce((s, l) => {
|
|
979
|
+
if (collapsedGroups.has(l.name)) return s + 1;
|
|
980
|
+
return s + l.events.length + 1;
|
|
981
|
+
}, 0);
|
|
982
|
+
const scaleMargin = timelineScale ? ctx.aesthetic(24) : 0;
|
|
983
|
+
const ERA_ROW_H = ctx.structural(22);
|
|
984
|
+
const MARKER_ROW_H = ctx.structural(22);
|
|
985
|
+
const eraReserve = timelineEras.length > 0 ? ERA_ROW_H : 0;
|
|
986
|
+
const markerReserve = timelineMarkers.length > 0 ? MARKER_ROW_H : 0;
|
|
987
|
+
const topScaleH = timelineScale ? ctx.structural(40) : 0;
|
|
988
|
+
const maxGroupNameLen = Math.max(...lanes.map((l) => l.name.length)) + 2;
|
|
989
|
+
const maxEventLabelLen = Math.max(
|
|
990
|
+
0,
|
|
991
|
+
...lanes.flatMap((l) => l.events.map((ev) => ev.label.length + 2))
|
|
992
|
+
);
|
|
993
|
+
const maxLeftLabelLen = Math.max(maxGroupNameLen, maxEventLabelLen);
|
|
994
|
+
const dynamicLeftMargin = Math.max(
|
|
995
|
+
ctx.aesthetic(140),
|
|
996
|
+
maxLeftLabelLen * sCharW + ctx.aesthetic(30)
|
|
997
|
+
);
|
|
998
|
+
const baseTopMargin = title ? ctx.aesthetic(50) : ctx.aesthetic(20);
|
|
999
|
+
const margin = {
|
|
1000
|
+
top: baseTopMargin + topScaleH + eraReserve + markerReserve + tagLegendReserve,
|
|
1001
|
+
right: ctx.aesthetic(40),
|
|
1002
|
+
bottom: ctx.aesthetic(40) + scaleMargin,
|
|
1003
|
+
left: dynamicLeftMargin
|
|
1004
|
+
};
|
|
1005
|
+
const markerLabelY = markerReserve ? -(topScaleH + MARKER_ROW_H / 2) : 0;
|
|
1006
|
+
const eraLabelY = eraReserve ? -(topScaleH + markerReserve + ERA_ROW_H / 2) : 0;
|
|
1007
|
+
const innerWidth = width - margin.left - margin.right;
|
|
1008
|
+
const totalGaps = (lanes.length - 1) * sGroupGap;
|
|
1009
|
+
const rowH = ctx.structural(28);
|
|
1010
|
+
const innerHeight = rowH * totalRows + totalGaps;
|
|
1011
|
+
const usedHeight = margin.top + innerHeight + margin.bottom;
|
|
1012
|
+
const fitToContainer = !exportDims && height > 0 && usedHeight > height;
|
|
1013
|
+
const svgHeight = fitToContainer ? height : usedHeight;
|
|
1014
|
+
const xScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerWidth]);
|
|
1015
|
+
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", svgHeight).attr("viewBox", `0 0 ${width} ${usedHeight}`).attr("preserveAspectRatio", "xMidYMin meet").style("background", bgColor);
|
|
1016
|
+
if (ctx.isBelowFloor && !fitToContainer) {
|
|
1017
|
+
svg.attr("width", "100%");
|
|
1018
|
+
}
|
|
1019
|
+
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
1020
|
+
renderChartTitle(
|
|
1021
|
+
svg,
|
|
1022
|
+
title,
|
|
1023
|
+
parsed.titleLineNumber,
|
|
1024
|
+
width,
|
|
1025
|
+
textColor,
|
|
1026
|
+
onClickItem
|
|
1027
|
+
);
|
|
1028
|
+
renderEras(
|
|
1029
|
+
g,
|
|
1030
|
+
timelineEras,
|
|
1031
|
+
xScale,
|
|
1032
|
+
false,
|
|
1033
|
+
innerWidth,
|
|
1034
|
+
innerHeight,
|
|
1035
|
+
(s, e) => fadeToEra(g, s, e),
|
|
1036
|
+
() => fadeReset(g),
|
|
1037
|
+
timelineScale,
|
|
1038
|
+
tooltip,
|
|
1039
|
+
palette,
|
|
1040
|
+
eraReserve ? eraLabelY : void 0
|
|
1041
|
+
);
|
|
1042
|
+
renderMarkers(
|
|
1043
|
+
g,
|
|
1044
|
+
timelineMarkers,
|
|
1045
|
+
xScale,
|
|
1046
|
+
false,
|
|
1047
|
+
innerWidth,
|
|
1048
|
+
innerHeight,
|
|
1049
|
+
(d) => fadeToMarker(g, d),
|
|
1050
|
+
() => fadeReset(g),
|
|
1051
|
+
timelineScale,
|
|
1052
|
+
tooltip,
|
|
1053
|
+
palette,
|
|
1054
|
+
markerReserve ? markerLabelY : void 0
|
|
1055
|
+
);
|
|
1056
|
+
if (timelineScale) {
|
|
1057
|
+
renderTimeScale(
|
|
1058
|
+
g,
|
|
1059
|
+
xScale,
|
|
1060
|
+
false,
|
|
1061
|
+
innerWidth,
|
|
1062
|
+
innerHeight,
|
|
1063
|
+
textColor,
|
|
1064
|
+
minDate,
|
|
1065
|
+
maxDate,
|
|
1066
|
+
formatBoundaryLabel(earliestStartDateStr, latestEndDateStr),
|
|
1067
|
+
formatBoundaryLabel(latestEndDateStr, earliestStartDateStr)
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
let curY = 0;
|
|
1071
|
+
for (const lane of lanes) {
|
|
1072
|
+
const laneColor = groupColorMap.get(lane.name) ?? textColor;
|
|
1073
|
+
const isCollapsed = collapsedGroups.has(lane.name);
|
|
1074
|
+
const toggleIcon = isCollapsed ? "\u25B6" : "\u25BC";
|
|
1075
|
+
const bandX = -margin.left + 5;
|
|
1076
|
+
const bandW = margin.left - 7;
|
|
1077
|
+
const bandY = curY;
|
|
1078
|
+
const bandH = sBarH;
|
|
1079
|
+
const sBandRx = ctx.structural(4);
|
|
1080
|
+
const sBandAccentW = ctx.structural(4);
|
|
1081
|
+
const clipId = `tl-band-clip-${tlBandClipCounter++}`;
|
|
1082
|
+
g.append("clipPath").attr("id", clipId).append("rect").attr("x", bandX).attr("y", bandY).attr("width", bandW).attr("height", bandH).attr("rx", sBandRx);
|
|
1083
|
+
g.append("rect").attr("class", "tl-group-header-bg").attr("data-group", lane.name).attr("x", bandX).attr("y", bandY).attr("width", bandW).attr("height", bandH).attr("rx", sBandRx).attr("fill", shapeFill(palette, laneColor, isDark, { solid })).style("pointer-events", "none");
|
|
1084
|
+
g.append("rect").attr("class", "tl-group-header-accent").attr("data-group", lane.name).attr("x", bandX).attr("y", bandY).attr("width", sBandAccentW).attr("height", bandH).attr("fill", laneColor).attr("clip-path", `url(#${clipId})`).style("pointer-events", "none");
|
|
1085
|
+
const headerG = g.append("g").attr("class", "tl-group-header").attr("data-group", lane.name).style("cursor", "pointer").on("mouseenter", () => fadeToGroup(g, lane.name)).on("mouseleave", () => fadeReset(g)).on("click", () => toggleGroup(lane.name));
|
|
1086
|
+
headerG.append("text").attr("x", -margin.left + ctx.aesthetic(10)).attr("y", curY + sBarH / 2).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", `${sLaneHeaderFont}px`).attr("font-weight", "600").text(`${toggleIcon} ${lane.name}`);
|
|
1087
|
+
if (lane.events.length > 0) {
|
|
1088
|
+
const evDates = lane.events.map((ev) => parseTimelineDate(ev.date));
|
|
1089
|
+
const evEndDates = lane.events.filter((ev) => ev.endDate).map((ev) => parseTimelineDate(ev.endDate));
|
|
1090
|
+
const laneMinD = Math.min(...evDates);
|
|
1091
|
+
const laneMaxD = Math.max(...evDates, ...evEndDates);
|
|
1092
|
+
const sx1 = xScale(laneMinD);
|
|
1093
|
+
const sx2 = xScale(laneMaxD);
|
|
1094
|
+
const groupBarW = Math.max(sx2 - sx1, ctx.structural(20));
|
|
1095
|
+
const groupBarG = g.append("g").attr("class", isCollapsed ? "tl-group-summary" : "tl-group-bar").attr("data-group", lane.name).style("cursor", "pointer").on("mouseenter", () => fadeToGroup(g, lane.name)).on("mouseleave", () => fadeReset(g)).on("click", () => toggleGroup(lane.name));
|
|
1096
|
+
groupBarG.append("rect").attr("x", sx1).attr("y", curY).attr("width", groupBarW).attr("height", sBarH).attr("rx", sBarRx).attr("fill", shapeFill(palette, laneColor, isDark, { solid })).attr("stroke", laneColor).attr("stroke-width", sBarStroke);
|
|
1097
|
+
}
|
|
1098
|
+
if (isCollapsed) {
|
|
1099
|
+
curY += rowH + sGroupGap;
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
lane.events.forEach((ev, i) => {
|
|
1103
|
+
const y = curY + (i + 1) * rowH + rowH / 2;
|
|
1104
|
+
const x = xScale(parseTimelineDate(ev.date));
|
|
1105
|
+
const evG = g.append("g").attr("class", "tl-event").attr("data-group", lane.name).attr("data-line-number", String(ev.lineNumber)).attr("data-date", String(parseTimelineDate(ev.date))).attr(
|
|
1106
|
+
"data-end-date",
|
|
1107
|
+
ev.endDate ? String(parseTimelineDate(ev.endDate)) : null
|
|
1108
|
+
).style("cursor", "pointer").on("mouseenter", function(event) {
|
|
1109
|
+
fadeToGroup(g, lane.name);
|
|
1110
|
+
if (timelineScale) {
|
|
1111
|
+
showEventDatesOnScale(
|
|
1112
|
+
g,
|
|
1113
|
+
xScale,
|
|
1114
|
+
ev.date,
|
|
1115
|
+
ev.endDate,
|
|
1116
|
+
innerHeight,
|
|
1117
|
+
laneColor
|
|
1118
|
+
);
|
|
1119
|
+
} else {
|
|
1120
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1121
|
+
}
|
|
1122
|
+
}).on("mouseleave", function() {
|
|
1123
|
+
fadeReset(g);
|
|
1124
|
+
if (timelineScale) {
|
|
1125
|
+
hideEventDatesOnScale(g);
|
|
1126
|
+
} else {
|
|
1127
|
+
hideTooltip(tooltip);
|
|
1128
|
+
}
|
|
1129
|
+
}).on("mousemove", function(event) {
|
|
1130
|
+
if (!timelineScale) {
|
|
1131
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1132
|
+
}
|
|
1133
|
+
}).on("click", () => {
|
|
1134
|
+
if (onClickItem && ev.lineNumber) onClickItem(ev.lineNumber);
|
|
1135
|
+
});
|
|
1136
|
+
setTagAttrs(evG, ev);
|
|
1137
|
+
const evColor = eventColor(ev);
|
|
1138
|
+
const isPoint = !ev.endDate;
|
|
1139
|
+
const icon = isPoint ? "\u25C6" : "\u25CF";
|
|
1140
|
+
const labelEl = evG.append("text").attr("class", "tl-event-label").attr("x", -margin.left + ctx.aesthetic(20)).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("font-size", `${sEventFont}px`).attr("fill", textColor);
|
|
1141
|
+
labelEl.append("tspan").attr("fill", evColor).text(icon);
|
|
1142
|
+
labelEl.append("tspan").attr("fill", textColor).text(" " + ev.label);
|
|
1143
|
+
if (ev.endDate) {
|
|
1144
|
+
const x2 = xScale(parseTimelineDate(ev.endDate));
|
|
1145
|
+
const rectW = Math.max(x2 - x, 4);
|
|
1146
|
+
let fill = shapeFill(palette, evColor, isDark, { solid });
|
|
1147
|
+
let stroke = evColor;
|
|
1148
|
+
if (ev.uncertain) {
|
|
1149
|
+
const gradientId = `uncertain-${ev.lineNumber}`;
|
|
1150
|
+
const strokeGradientId = `uncertain-s-${ev.lineNumber}`;
|
|
1151
|
+
const defs = svg.select("defs").node() || svg.append("defs").node();
|
|
1152
|
+
const defsEl = d3Selection.select(defs);
|
|
1153
|
+
defsEl.append("linearGradient").attr("id", gradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%").selectAll("stop").data([
|
|
1154
|
+
{ offset: "0%", opacity: 1 },
|
|
1155
|
+
{ offset: "80%", opacity: 1 },
|
|
1156
|
+
{ offset: "100%", opacity: 0 }
|
|
1157
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", mix(evColor, bg, 30)).attr("stop-opacity", (d) => d.opacity);
|
|
1158
|
+
defsEl.append("linearGradient").attr("id", strokeGradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%").selectAll("stop").data([
|
|
1159
|
+
{ offset: "0%", opacity: 1 },
|
|
1160
|
+
{ offset: "80%", opacity: 1 },
|
|
1161
|
+
{ offset: "100%", opacity: 0 }
|
|
1162
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", evColor).attr("stop-opacity", (d) => d.opacity);
|
|
1163
|
+
fill = `url(#${gradientId})`;
|
|
1164
|
+
stroke = `url(#${strokeGradientId})`;
|
|
1165
|
+
}
|
|
1166
|
+
evG.append("rect").attr("x", x).attr("y", y - sBarH / 2).attr("width", rectW).attr("height", sBarH).attr("rx", sBarRx).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sBarStroke);
|
|
1167
|
+
} else {
|
|
1168
|
+
evG.append("circle").attr("cx", x).attr("cy", y).attr("r", sPointR).attr("fill", shapeFill(palette, evColor, isDark, { solid })).attr("stroke", evColor).attr("stroke-width", sPointStroke);
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
curY += (lane.events.length + 1) * rowH + sGroupGap;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function renderTimelineVertical(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, _swimlaneTagGroup, _activeTagGroup, _onTagStateChange, _viewMode) {
|
|
1175
|
+
const {
|
|
1176
|
+
width,
|
|
1177
|
+
height,
|
|
1178
|
+
tooltip,
|
|
1179
|
+
solid,
|
|
1180
|
+
textColor,
|
|
1181
|
+
mutedColor,
|
|
1182
|
+
bgColor,
|
|
1183
|
+
bg,
|
|
1184
|
+
groupColorMap,
|
|
1185
|
+
tagLanes,
|
|
1186
|
+
eventColor,
|
|
1187
|
+
minDate,
|
|
1188
|
+
maxDate,
|
|
1189
|
+
datePadding,
|
|
1190
|
+
earliestStartDateStr,
|
|
1191
|
+
latestEndDateStr,
|
|
1192
|
+
tagLegendReserve,
|
|
1193
|
+
ctx
|
|
1194
|
+
} = setup;
|
|
1195
|
+
const { fadeToGroup, fadeToEra, fadeToMarker, fadeReset, setTagAttrs } = hovers;
|
|
1196
|
+
const {
|
|
1197
|
+
timelineEvents,
|
|
1198
|
+
timelineGroups,
|
|
1199
|
+
timelineEras,
|
|
1200
|
+
timelineMarkers,
|
|
1201
|
+
timelineSort,
|
|
1202
|
+
timelineScale,
|
|
1203
|
+
timelineSwimlanes
|
|
1204
|
+
} = parsed;
|
|
1205
|
+
const title = parsed.noTitle ? null : parsed.title;
|
|
1206
|
+
const sPointR = ctx.structural(4);
|
|
1207
|
+
const sPointStroke = ctx.structural(2);
|
|
1208
|
+
const sBarRx = ctx.structural(4);
|
|
1209
|
+
const sBarStroke = ctx.structural(2);
|
|
1210
|
+
const sBarW = ctx.structural(12);
|
|
1211
|
+
const sEventFont = ctx.text(10);
|
|
1212
|
+
const sEventFontSm = ctx.text(11);
|
|
1213
|
+
const sDateFont = ctx.text(10);
|
|
1214
|
+
const sLaneHeaderFont = ctx.text(12);
|
|
1215
|
+
const sDash = `${ctx.structural(4)},${ctx.structural(4)}`;
|
|
1216
|
+
const useGroupedVertical = tagLanes != null || timelineSort === "group" && timelineGroups.length > 0;
|
|
1217
|
+
if (useGroupedVertical) {
|
|
1218
|
+
let laneNames;
|
|
1219
|
+
let laneEventsByName;
|
|
1220
|
+
if (tagLanes) {
|
|
1221
|
+
laneNames = tagLanes.map((l) => l.name);
|
|
1222
|
+
laneEventsByName = new Map(tagLanes.map((l) => [l.name, l.events]));
|
|
1223
|
+
} else {
|
|
1224
|
+
const groupNames = timelineGroups.map((gr) => gr.name);
|
|
1225
|
+
const ungroupedEvents = timelineEvents.filter(
|
|
1226
|
+
(ev) => ev.group === null || !groupNames.includes(ev.group)
|
|
1227
|
+
);
|
|
1228
|
+
laneNames = ungroupedEvents.length > 0 ? [...groupNames, "(Other)"] : groupNames;
|
|
1229
|
+
laneEventsByName = new Map(
|
|
1230
|
+
laneNames.map((name) => [
|
|
1231
|
+
name,
|
|
1232
|
+
timelineEvents.filter(
|
|
1233
|
+
(ev) => name === "(Other)" ? ev.group === null || !groupNames.includes(ev.group) : ev.group === name
|
|
1234
|
+
)
|
|
1235
|
+
])
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1238
|
+
const laneCount = laneNames.length;
|
|
1239
|
+
const scaleMargin = timelineScale ? ctx.aesthetic(40) : 0;
|
|
1240
|
+
const markerMargin = timelineMarkers.length > 0 ? ctx.aesthetic(30) : 0;
|
|
1241
|
+
const margin = {
|
|
1242
|
+
top: ctx.aesthetic(104) + markerMargin + tagLegendReserve,
|
|
1243
|
+
right: ctx.aesthetic(40) + scaleMargin,
|
|
1244
|
+
bottom: ctx.aesthetic(40),
|
|
1245
|
+
left: ctx.aesthetic(60) + scaleMargin
|
|
1246
|
+
};
|
|
1247
|
+
const innerWidth = width - margin.left - margin.right;
|
|
1248
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
1249
|
+
const laneWidth = innerWidth / laneCount;
|
|
1250
|
+
const yScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerHeight]);
|
|
1251
|
+
const svg = d3Selection.select(container).append("svg").attr("viewBox", `0 0 ${width} ${height}`).attr("width", exportDims ? width : "100%").attr("preserveAspectRatio", "xMidYMin meet").style("background", bgColor);
|
|
1252
|
+
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
1253
|
+
renderChartTitle(
|
|
1254
|
+
svg,
|
|
1255
|
+
title,
|
|
1256
|
+
parsed.titleLineNumber,
|
|
1257
|
+
width,
|
|
1258
|
+
textColor,
|
|
1259
|
+
onClickItem
|
|
1260
|
+
);
|
|
1261
|
+
renderEras(
|
|
1262
|
+
g,
|
|
1263
|
+
timelineEras,
|
|
1264
|
+
yScale,
|
|
1265
|
+
true,
|
|
1266
|
+
innerWidth,
|
|
1267
|
+
innerHeight,
|
|
1268
|
+
(s, e) => fadeToEra(g, s, e),
|
|
1269
|
+
() => fadeReset(g),
|
|
1270
|
+
timelineScale,
|
|
1271
|
+
tooltip,
|
|
1272
|
+
palette
|
|
1273
|
+
);
|
|
1274
|
+
renderMarkers(
|
|
1275
|
+
g,
|
|
1276
|
+
timelineMarkers,
|
|
1277
|
+
yScale,
|
|
1278
|
+
true,
|
|
1279
|
+
innerWidth,
|
|
1280
|
+
innerHeight,
|
|
1281
|
+
(d) => fadeToMarker(g, d),
|
|
1282
|
+
() => fadeReset(g),
|
|
1283
|
+
timelineScale,
|
|
1284
|
+
tooltip,
|
|
1285
|
+
palette
|
|
1286
|
+
);
|
|
1287
|
+
if (timelineScale) {
|
|
1288
|
+
renderTimeScale(
|
|
1289
|
+
g,
|
|
1290
|
+
yScale,
|
|
1291
|
+
true,
|
|
1292
|
+
innerWidth,
|
|
1293
|
+
innerHeight,
|
|
1294
|
+
textColor,
|
|
1295
|
+
minDate,
|
|
1296
|
+
maxDate,
|
|
1297
|
+
formatBoundaryLabel(earliestStartDateStr, latestEndDateStr),
|
|
1298
|
+
formatBoundaryLabel(latestEndDateStr, earliestStartDateStr)
|
|
1299
|
+
);
|
|
1300
|
+
}
|
|
1301
|
+
if (timelineSwimlanes || tagLanes) {
|
|
1302
|
+
laneNames.forEach((laneName, laneIdx) => {
|
|
1303
|
+
const laneX = laneIdx * laneWidth;
|
|
1304
|
+
const fillColor = laneIdx % 2 === 0 ? textColor : "transparent";
|
|
1305
|
+
g.append("rect").attr("class", "tl-swimlane").attr("data-group", laneName).attr("x", laneX).attr("y", 0).attr("width", laneWidth).attr("height", innerHeight).attr("fill", fillColor).attr("opacity", 0.06);
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
laneNames.forEach((laneName, laneIdx) => {
|
|
1309
|
+
const laneX = laneIdx * laneWidth;
|
|
1310
|
+
const laneColor = groupColorMap.get(laneName) ?? textColor;
|
|
1311
|
+
const laneCenter = laneX + laneWidth / 2;
|
|
1312
|
+
const headerG = g.append("g").attr("class", "tl-lane-header").attr("data-group", laneName).style("cursor", "pointer").on("mouseenter", () => fadeToGroup(g, laneName)).on("mouseleave", () => fadeReset(g));
|
|
1313
|
+
headerG.append("text").attr("x", laneCenter).attr("y", -ctx.structural(15)).attr("text-anchor", "middle").attr("fill", laneColor).attr("font-size", `${sLaneHeaderFont}px`).attr("font-weight", "600").text(laneName);
|
|
1314
|
+
g.append("line").attr("x1", laneCenter).attr("y1", 0).attr("x2", laneCenter).attr("y2", innerHeight).attr("stroke", mutedColor).attr("stroke-width", 1).attr("stroke-dasharray", sDash);
|
|
1315
|
+
const laneEvents = laneEventsByName.get(laneName) ?? [];
|
|
1316
|
+
for (const ev of laneEvents) {
|
|
1317
|
+
const y = yScale(parseTimelineDate(ev.date));
|
|
1318
|
+
const evG = g.append("g").attr("class", "tl-event").attr("data-group", laneName).attr("data-line-number", String(ev.lineNumber)).attr("data-date", String(parseTimelineDate(ev.date))).attr(
|
|
1319
|
+
"data-end-date",
|
|
1320
|
+
ev.endDate ? String(parseTimelineDate(ev.endDate)) : null
|
|
1321
|
+
).style("cursor", "pointer").on("mouseenter", function(event) {
|
|
1322
|
+
fadeToGroup(g, laneName);
|
|
1323
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1324
|
+
}).on("mouseleave", function() {
|
|
1325
|
+
fadeReset(g);
|
|
1326
|
+
hideTooltip(tooltip);
|
|
1327
|
+
}).on("mousemove", function(event) {
|
|
1328
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1329
|
+
}).on("click", () => {
|
|
1330
|
+
if (onClickItem && ev.lineNumber) onClickItem(ev.lineNumber);
|
|
1331
|
+
});
|
|
1332
|
+
setTagAttrs(evG, ev);
|
|
1333
|
+
const evColor = eventColor(ev);
|
|
1334
|
+
if (ev.endDate) {
|
|
1335
|
+
const y2 = yScale(parseTimelineDate(ev.endDate));
|
|
1336
|
+
const rectH = Math.max(y2 - y, 4);
|
|
1337
|
+
let fill = shapeFill(palette, evColor, isDark, { solid });
|
|
1338
|
+
let stroke = evColor;
|
|
1339
|
+
if (ev.uncertain) {
|
|
1340
|
+
const gradientId = `uncertain-vg-${ev.lineNumber}`;
|
|
1341
|
+
const strokeGradientId = `uncertain-vg-s-${ev.lineNumber}`;
|
|
1342
|
+
const defs = svg.select("defs").node() || svg.append("defs").node();
|
|
1343
|
+
const defsEl = d3Selection.select(defs);
|
|
1344
|
+
defsEl.append("linearGradient").attr("id", gradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "0%").attr("y2", "100%").selectAll("stop").data([
|
|
1345
|
+
{ offset: "0%", opacity: 1 },
|
|
1346
|
+
{ offset: "80%", opacity: 1 },
|
|
1347
|
+
{ offset: "100%", opacity: 0 }
|
|
1348
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", mix(laneColor, bg, 30)).attr("stop-opacity", (d) => d.opacity);
|
|
1349
|
+
defsEl.append("linearGradient").attr("id", strokeGradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "0%").attr("y2", "100%").selectAll("stop").data([
|
|
1350
|
+
{ offset: "0%", opacity: 1 },
|
|
1351
|
+
{ offset: "80%", opacity: 1 },
|
|
1352
|
+
{ offset: "100%", opacity: 0 }
|
|
1353
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", evColor).attr("stop-opacity", (d) => d.opacity);
|
|
1354
|
+
fill = `url(#${gradientId})`;
|
|
1355
|
+
stroke = `url(#${strokeGradientId})`;
|
|
1356
|
+
}
|
|
1357
|
+
evG.append("rect").attr("x", laneCenter - sBarW / 2).attr("y", y).attr("width", sBarW).attr("height", rectH).attr("rx", sBarRx).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sBarStroke);
|
|
1358
|
+
evG.append("text").attr("x", laneCenter + sBarW + ctx.aesthetic(2)).attr("y", y + rectH / 2).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${sEventFont}px`).text(ev.label);
|
|
1359
|
+
} else {
|
|
1360
|
+
evG.append("circle").attr("cx", laneCenter).attr("cy", y).attr("r", sPointR).attr("fill", shapeFill(palette, evColor, isDark, { solid })).attr("stroke", evColor).attr("stroke-width", sPointStroke);
|
|
1361
|
+
evG.append("text").attr("x", laneCenter + ctx.aesthetic(10)).attr("y", y).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${sEventFont}px`).text(ev.label);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
} else {
|
|
1366
|
+
const scaleMargin = timelineScale ? ctx.aesthetic(40) : 0;
|
|
1367
|
+
const markerMargin = timelineMarkers.length > 0 ? ctx.aesthetic(30) : 0;
|
|
1368
|
+
const margin = {
|
|
1369
|
+
top: ctx.aesthetic(104) + markerMargin + tagLegendReserve,
|
|
1370
|
+
right: ctx.aesthetic(200),
|
|
1371
|
+
bottom: ctx.aesthetic(40),
|
|
1372
|
+
left: ctx.aesthetic(60) + scaleMargin
|
|
1373
|
+
};
|
|
1374
|
+
const innerWidth = width - margin.left - margin.right;
|
|
1375
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
1376
|
+
const axisX = ctx.structural(20);
|
|
1377
|
+
const yScale = d3Scale.scaleLinear().domain([minDate - datePadding, maxDate + datePadding]).range([0, innerHeight]);
|
|
1378
|
+
const sorted = timelineEvents.slice().sort((a, b) => parseTimelineDate(a.date) - parseTimelineDate(b.date));
|
|
1379
|
+
const svg = d3Selection.select(container).append("svg").attr("viewBox", `0 0 ${width} ${height}`).attr("width", exportDims ? width : "100%").attr("preserveAspectRatio", "xMidYMin meet").style("background", bgColor);
|
|
1380
|
+
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
1381
|
+
renderChartTitle(
|
|
1382
|
+
svg,
|
|
1383
|
+
title,
|
|
1384
|
+
parsed.titleLineNumber,
|
|
1385
|
+
width,
|
|
1386
|
+
textColor,
|
|
1387
|
+
onClickItem
|
|
1388
|
+
);
|
|
1389
|
+
renderEras(
|
|
1390
|
+
g,
|
|
1391
|
+
timelineEras,
|
|
1392
|
+
yScale,
|
|
1393
|
+
true,
|
|
1394
|
+
innerWidth,
|
|
1395
|
+
innerHeight,
|
|
1396
|
+
(s, e) => fadeToEra(g, s, e),
|
|
1397
|
+
() => fadeReset(g),
|
|
1398
|
+
timelineScale,
|
|
1399
|
+
tooltip,
|
|
1400
|
+
palette
|
|
1401
|
+
);
|
|
1402
|
+
renderMarkers(
|
|
1403
|
+
g,
|
|
1404
|
+
timelineMarkers,
|
|
1405
|
+
yScale,
|
|
1406
|
+
true,
|
|
1407
|
+
innerWidth,
|
|
1408
|
+
innerHeight,
|
|
1409
|
+
(d) => fadeToMarker(g, d),
|
|
1410
|
+
() => fadeReset(g),
|
|
1411
|
+
timelineScale,
|
|
1412
|
+
tooltip,
|
|
1413
|
+
palette
|
|
1414
|
+
);
|
|
1415
|
+
if (timelineScale) {
|
|
1416
|
+
renderTimeScale(
|
|
1417
|
+
g,
|
|
1418
|
+
yScale,
|
|
1419
|
+
true,
|
|
1420
|
+
innerWidth,
|
|
1421
|
+
innerHeight,
|
|
1422
|
+
textColor,
|
|
1423
|
+
minDate,
|
|
1424
|
+
maxDate,
|
|
1425
|
+
formatBoundaryLabel(earliestStartDateStr, latestEndDateStr),
|
|
1426
|
+
formatBoundaryLabel(latestEndDateStr, earliestStartDateStr)
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1429
|
+
if (timelineGroups.length > 0) {
|
|
1430
|
+
renderTimelineGroupLegend(
|
|
1431
|
+
g,
|
|
1432
|
+
timelineGroups,
|
|
1433
|
+
groupColorMap,
|
|
1434
|
+
textColor,
|
|
1435
|
+
palette,
|
|
1436
|
+
isDark,
|
|
1437
|
+
-ctx.aesthetic(55),
|
|
1438
|
+
(name) => fadeToGroup(g, name),
|
|
1439
|
+
() => fadeReset(g)
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
g.append("line").attr("x1", axisX).attr("y1", 0).attr("x2", axisX).attr("y2", innerHeight).attr("stroke", mutedColor).attr("stroke-width", 1).attr("stroke-dasharray", sDash);
|
|
1443
|
+
for (const ev of sorted) {
|
|
1444
|
+
const y = yScale(parseTimelineDate(ev.date));
|
|
1445
|
+
const color = eventColor(ev);
|
|
1446
|
+
const evG = g.append("g").attr("class", "tl-event").attr("data-group", ev.group || "").attr("data-line-number", String(ev.lineNumber)).attr("data-date", String(parseTimelineDate(ev.date))).attr(
|
|
1447
|
+
"data-end-date",
|
|
1448
|
+
ev.endDate ? String(parseTimelineDate(ev.endDate)) : null
|
|
1449
|
+
).style("cursor", "pointer").on("mouseenter", function(event) {
|
|
1450
|
+
if (ev.group && timelineGroups.length > 0) fadeToGroup(g, ev.group);
|
|
1451
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1452
|
+
}).on("mouseleave", function() {
|
|
1453
|
+
fadeReset(g);
|
|
1454
|
+
hideTooltip(tooltip);
|
|
1455
|
+
}).on("mousemove", function(event) {
|
|
1456
|
+
showTooltip(tooltip, buildEventTooltipHtml(ev), event);
|
|
1457
|
+
}).on("click", () => {
|
|
1458
|
+
if (onClickItem && ev.lineNumber) onClickItem(ev.lineNumber);
|
|
1459
|
+
});
|
|
1460
|
+
setTagAttrs(evG, ev);
|
|
1461
|
+
if (ev.endDate) {
|
|
1462
|
+
const y2 = yScale(parseTimelineDate(ev.endDate));
|
|
1463
|
+
const rectH = Math.max(y2 - y, 4);
|
|
1464
|
+
let fill = shapeFill(palette, color, isDark, { solid });
|
|
1465
|
+
let stroke = color;
|
|
1466
|
+
if (ev.uncertain) {
|
|
1467
|
+
const gradientId = `uncertain-v-${ev.lineNumber}`;
|
|
1468
|
+
const strokeGradientId = `uncertain-v-s-${ev.lineNumber}`;
|
|
1469
|
+
const defs = svg.select("defs").node() || svg.append("defs").node();
|
|
1470
|
+
const defsEl = d3Selection.select(defs);
|
|
1471
|
+
defsEl.append("linearGradient").attr("id", gradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "0%").attr("y2", "100%").selectAll("stop").data([
|
|
1472
|
+
{ offset: "0%", opacity: 1 },
|
|
1473
|
+
{ offset: "80%", opacity: 1 },
|
|
1474
|
+
{ offset: "100%", opacity: 0 }
|
|
1475
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", mix(color, bg, 30)).attr("stop-opacity", (d) => d.opacity);
|
|
1476
|
+
defsEl.append("linearGradient").attr("id", strokeGradientId).attr("x1", "0%").attr("y1", "0%").attr("x2", "0%").attr("y2", "100%").selectAll("stop").data([
|
|
1477
|
+
{ offset: "0%", opacity: 1 },
|
|
1478
|
+
{ offset: "80%", opacity: 1 },
|
|
1479
|
+
{ offset: "100%", opacity: 0 }
|
|
1480
|
+
]).enter().append("stop").attr("offset", (d) => d.offset).attr("stop-color", color).attr("stop-opacity", (d) => d.opacity);
|
|
1481
|
+
fill = `url(#${gradientId})`;
|
|
1482
|
+
stroke = `url(#${strokeGradientId})`;
|
|
1483
|
+
}
|
|
1484
|
+
evG.append("rect").attr("x", axisX - sBarW / 2).attr("y", y).attr("width", sBarW).attr("height", rectH).attr("rx", sBarRx).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sBarStroke);
|
|
1485
|
+
evG.append("text").attr("x", axisX + sBarW + ctx.aesthetic(4)).attr("y", y + rectH / 2).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${sEventFontSm}px`).text(ev.label);
|
|
1486
|
+
} else {
|
|
1487
|
+
evG.append("circle").attr("cx", axisX).attr("cy", y).attr("r", sPointR).attr("fill", shapeFill(palette, color, isDark, { solid })).attr("stroke", color).attr("stroke-width", sPointStroke);
|
|
1488
|
+
evG.append("text").attr("x", axisX + sBarW + ctx.aesthetic(4)).attr("y", y).attr("dy", "0.35em").attr("fill", textColor).attr("font-size", `${sEventFontSm}px`).text(ev.label);
|
|
1489
|
+
}
|
|
1490
|
+
evG.append("text").attr("x", axisX - ctx.aesthetic(14)).attr(
|
|
1491
|
+
"y",
|
|
1492
|
+
ev.endDate ? yScale(parseTimelineDate(ev.date)) + Math.max(
|
|
1493
|
+
yScale(parseTimelineDate(ev.endDate)) - yScale(parseTimelineDate(ev.date)),
|
|
1494
|
+
4
|
|
1495
|
+
) / 2 : y
|
|
1496
|
+
).attr("dy", "0.35em").attr("text-anchor", "end").attr("fill", mutedColor).attr("font-size", `${sDateFont}px`).text(ev.date + (ev.endDate ? `\u2192${ev.endDate}` : ""));
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
var timelineCollapseState = /* @__PURE__ */ new WeakMap();
|
|
1501
|
+
var tlBandClipCounter = 0;
|
|
1502
|
+
function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode, exportMode) {
|
|
1503
|
+
const setup = setupTimeline(
|
|
1504
|
+
container,
|
|
1505
|
+
parsed,
|
|
1506
|
+
palette,
|
|
1507
|
+
isDark,
|
|
1508
|
+
exportDims,
|
|
1509
|
+
activeTagGroup,
|
|
1510
|
+
swimlaneTagGroup
|
|
1511
|
+
);
|
|
1512
|
+
if (!setup) return;
|
|
1513
|
+
swimlaneTagGroup = setup.swimlaneTagGroup;
|
|
1514
|
+
const { isVertical, tagLanes } = setup;
|
|
1515
|
+
const hovers = makeTimelineHoverHelpers();
|
|
1516
|
+
let collapsedGroups = timelineCollapseState.get(container);
|
|
1517
|
+
if (!collapsedGroups) {
|
|
1518
|
+
collapsedGroups = /* @__PURE__ */ new Set();
|
|
1519
|
+
timelineCollapseState.set(container, collapsedGroups);
|
|
1520
|
+
}
|
|
1521
|
+
function toggleGroup(name) {
|
|
1522
|
+
if (collapsedGroups.has(name)) collapsedGroups.delete(name);
|
|
1523
|
+
else collapsedGroups.add(name);
|
|
1524
|
+
renderTimeline(
|
|
1525
|
+
container,
|
|
1526
|
+
parsed,
|
|
1527
|
+
palette,
|
|
1528
|
+
isDark,
|
|
1529
|
+
onClickItem,
|
|
1530
|
+
exportDims,
|
|
1531
|
+
activeTagGroup,
|
|
1532
|
+
swimlaneTagGroup,
|
|
1533
|
+
onTagStateChange,
|
|
1534
|
+
viewMode,
|
|
1535
|
+
exportMode
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
if (isVertical) {
|
|
1539
|
+
renderTimelineVertical(
|
|
1540
|
+
container,
|
|
1541
|
+
parsed,
|
|
1542
|
+
palette,
|
|
1543
|
+
isDark,
|
|
1544
|
+
setup,
|
|
1545
|
+
hovers,
|
|
1546
|
+
onClickItem,
|
|
1547
|
+
exportDims,
|
|
1548
|
+
swimlaneTagGroup,
|
|
1549
|
+
activeTagGroup,
|
|
1550
|
+
onTagStateChange,
|
|
1551
|
+
viewMode
|
|
1552
|
+
);
|
|
1553
|
+
return;
|
|
1554
|
+
}
|
|
1555
|
+
const useGroupedHorizontal = tagLanes != null || parsed.timelineSort !== "time" && parsed.timelineGroups.length > 0;
|
|
1556
|
+
if (useGroupedHorizontal) {
|
|
1557
|
+
renderTimelineHorizontalGrouped(
|
|
1558
|
+
container,
|
|
1559
|
+
parsed,
|
|
1560
|
+
palette,
|
|
1561
|
+
isDark,
|
|
1562
|
+
setup,
|
|
1563
|
+
hovers,
|
|
1564
|
+
onClickItem,
|
|
1565
|
+
exportDims,
|
|
1566
|
+
swimlaneTagGroup,
|
|
1567
|
+
activeTagGroup,
|
|
1568
|
+
onTagStateChange,
|
|
1569
|
+
viewMode,
|
|
1570
|
+
collapsedGroups,
|
|
1571
|
+
toggleGroup
|
|
1572
|
+
);
|
|
1573
|
+
} else {
|
|
1574
|
+
renderTimelineHorizontalTimeSort(
|
|
1575
|
+
container,
|
|
1576
|
+
parsed,
|
|
1577
|
+
palette,
|
|
1578
|
+
isDark,
|
|
1579
|
+
setup,
|
|
1580
|
+
hovers,
|
|
1581
|
+
onClickItem,
|
|
1582
|
+
exportDims,
|
|
1583
|
+
swimlaneTagGroup,
|
|
1584
|
+
activeTagGroup,
|
|
1585
|
+
onTagStateChange,
|
|
1586
|
+
viewMode
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
renderTimelineTagLegendOverlay(
|
|
1590
|
+
container,
|
|
1591
|
+
parsed,
|
|
1592
|
+
palette,
|
|
1593
|
+
isDark,
|
|
1594
|
+
setup,
|
|
1595
|
+
hovers,
|
|
1596
|
+
onClickItem,
|
|
1597
|
+
exportDims,
|
|
1598
|
+
swimlaneTagGroup,
|
|
1599
|
+
activeTagGroup,
|
|
1600
|
+
onTagStateChange,
|
|
1601
|
+
viewMode,
|
|
1602
|
+
exportMode
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
export {
|
|
1607
|
+
formatDateLabel,
|
|
1608
|
+
renderTimeline
|
|
1609
|
+
};
|
|
1610
|
+
//# sourceMappingURL=chunk-UWN33VNX.js.map
|