@diagrammo/dgmo 0.48.2 → 0.50.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/.cursorrules +12 -3
- package/.github/copilot-instructions.md +12 -3
- package/.windsurfrules +12 -3
- package/SKILL.md +12 -3
- package/dist/advanced.d.ts +851 -1
- package/dist/advanced.js +601 -177
- package/dist/auto.css +63 -0
- package/dist/auto.js +220 -110
- package/dist/auto.mjs +45920 -33167
- package/dist/block.css +63 -0
- package/dist/block.d.ts +13 -5
- package/dist/block.js +239 -62
- package/dist/{charts-d3-QOZHKTCT.js → charts-d3-DKUD7MQE.js} +9 -8
- package/dist/{chunk-3MQQNXPD.js → chunk-2C56LEML.js} +3 -3
- package/dist/{chunk-L66GEFB6.js → chunk-2JJ2KNPI.js} +4 -4
- package/dist/{chunk-6SM5NJQH.js → chunk-2QYTMIRR.js} +4 -4
- package/dist/{chunk-RJE5JTVK.js → chunk-3G6TMNVF.js} +7 -7
- package/dist/{chunk-MO5YHHMQ.js → chunk-3LKM6FMW.js} +2 -2
- package/dist/{chunk-76OWZ3BA.js → chunk-3P2DKJCG.js} +2 -2
- package/dist/chunk-3TDRHT4J.js +1043 -0
- package/dist/chunk-3XPUDB7B.js +420 -0
- package/dist/{chunk-2LACINWN.js → chunk-3ZPC476N.js} +7 -7
- package/dist/{chunk-G2H74XJZ.js → chunk-4BMJQFNK.js} +8 -8
- package/dist/{chunk-THXCFRTU.js → chunk-4S723I74.js} +9 -9
- package/dist/{chunk-6NYWYNBI.js → chunk-4XK3FLFB.js} +3 -3
- package/dist/chunk-5JSWBPZZ.js +607 -0
- package/dist/{chunk-WCT3NYCV.js → chunk-5LWQH6QV.js} +1 -1
- package/dist/{chunk-7DTWEFUE.js → chunk-5Z736BSU.js} +8 -8
- package/dist/{chunk-ERLBPDGU.js → chunk-6BFZKBGD.js} +2 -2
- package/dist/{chunk-6HO5ZTXK.js → chunk-6IAA2QQ2.js} +2 -2
- package/dist/{chunk-H6PI3KJT.js → chunk-6IUAK7RZ.js} +2 -2
- package/dist/{chunk-RTLBSQ3G.js → chunk-6M5PJFQG.js} +3 -3
- package/dist/{chunk-Z5CGSFJB.js → chunk-6X4AKWLF.js} +4 -4
- package/dist/{chunk-OJR3MQYV.js → chunk-6ZT4U37Q.js} +291 -52
- package/dist/{chunk-5QXL4NYS.js → chunk-7G2ER4CY.js} +10 -5
- package/dist/chunk-7PQYTZMA.js +681 -0
- package/dist/{chunk-OURHMODR.js → chunk-7RB5Q6MB.js} +11 -11
- package/dist/{chunk-YAA6IID3.js → chunk-7UEMZREK.js} +2 -2
- package/dist/{chunk-AN2MOO5T.js → chunk-A3WQVFBS.js} +3 -3
- package/dist/{chunk-VOKGH627.js → chunk-AHGF2YYA.js} +13 -3
- package/dist/{chunk-CI2G3OEB.js → chunk-ASS5YYIZ.js} +12 -12
- package/dist/{chunk-TYS6CSS5.js → chunk-BCYVE3N5.js} +2 -2
- package/dist/chunk-BDXC7MDK.js +2395 -0
- package/dist/chunk-BTUTZMPT.js +482 -0
- package/dist/{chunk-YGJTDXVR.js → chunk-C4GQDB5L.js} +2 -2
- package/dist/{chunk-Y2ZE3MSG.js → chunk-C63UWAKM.js} +2 -2
- package/dist/{chunk-725LDASD.js → chunk-CLD2OKV7.js} +2 -2
- package/dist/{chunk-WBRZJOEC.js → chunk-CMCR5WBW.js} +3 -3
- package/dist/{chunk-IZMRON6C.js → chunk-CVV36CWI.js} +2 -2
- package/dist/chunk-DMJJ3CEQ.js +254 -0
- package/dist/{chunk-MZSBFAPJ.js → chunk-EJTKV7CY.js} +9 -9
- package/dist/{chunk-FITOLXSX.js → chunk-EOFPYPAU.js} +26 -2
- package/dist/{chunk-X5LCYCL5.js → chunk-ER5SCQWQ.js} +5 -5
- package/dist/{chunk-4OHACBGX.js → chunk-F2L5GCQ4.js} +2 -2
- package/dist/{chunk-FCIIHT24.js → chunk-F5UDBSJY.js} +7 -7
- package/dist/{chunk-3JLKYGBQ.js → chunk-F7BFXWNQ.js} +2 -2
- package/dist/{chunk-FANX6UJR.js → chunk-FAL7NOK3.js} +11 -11
- package/dist/{chunk-BUPDIHML.js → chunk-FB2WHOEQ.js} +4 -4
- package/dist/chunk-FL4IOQ37.js +379 -0
- package/dist/{chunk-LIOHW36Z.js → chunk-GBE54KY6.js} +6 -5
- package/dist/{chunk-RUNNI6VE.js → chunk-GL5UZ6NY.js} +3 -3
- package/dist/{chunk-4GRI7MEB.js → chunk-GPWHQ5FJ.js} +6 -6
- package/dist/chunk-GROQGHCT.js +960 -0
- package/dist/{chunk-SGZYXELT.js → chunk-H73FP42Q.js} +9 -6
- package/dist/{chunk-PBAHEPLQ.js → chunk-HGN652MU.js} +7 -6
- package/dist/{chunk-3SMGIJDD.js → chunk-HHXOONLX.js} +13 -1
- package/dist/{chunk-QOOUC2J5.js → chunk-HQCHYB5F.js} +2 -2
- package/dist/{chunk-AELOBFW5.js → chunk-I4IFRCUB.js} +3 -3
- package/dist/{chunk-GMR5MFHJ.js → chunk-I7F2A35O.js} +2 -2
- package/dist/{chunk-T2OE3YQB.js → chunk-IA3FJYWR.js} +3 -3
- package/dist/chunk-IAEC4KLA.js +492 -0
- package/dist/chunk-IVKC4GID.js +32 -0
- package/dist/{chunk-HSH73DP6.js → chunk-JFYIP7XU.js} +139 -39
- package/dist/{chunk-CKNVO24D.js → chunk-JZNMXEIV.js} +2 -2
- package/dist/chunk-KJXIHOVL.js +940 -0
- package/dist/chunk-L2ZTFHAY.js +331 -0
- package/dist/{chunk-B7JUCQUA.js → chunk-M5RXSRO2.js} +4 -4
- package/dist/{chunk-ULOEATBZ.js → chunk-NFFIKVNO.js} +106 -29
- package/dist/{chunk-PZMETGLY.js → chunk-NISQC5KW.js} +358 -122
- package/dist/chunk-O4VUFXIH.js +574 -0
- package/dist/{chunk-RVMRZAPB.js → chunk-O76UD6VJ.js} +3 -3
- package/dist/{chunk-JM4LEPY3.js → chunk-O7NUCTFU.js} +2 -2
- package/dist/{chunk-JED6ZDEE.js → chunk-O7WP4ZD4.js} +2 -2
- package/dist/{chunk-EVCVDTXE.js → chunk-OHQEMBLI.js} +3 -3
- package/dist/{chunk-ZBWMSD5N.js → chunk-ONA5KPV3.js} +4 -4
- package/dist/{chunk-Y3J7VR52.js → chunk-OTAL43EH.js} +34 -2
- package/dist/{chunk-WCSOJFU3.js → chunk-OTP5KVLO.js} +3 -3
- package/dist/{chunk-RYEGFMUO.js → chunk-PGEGPSCZ.js} +2 -2
- package/dist/{chunk-ZO27FGJS.js → chunk-PH5X4GIP.js} +2 -2
- package/dist/{chunk-ZJEL4H2R.js → chunk-PJUGRJHJ.js} +9 -9
- package/dist/{chunk-ZGR7ULFJ.js → chunk-PLZI6KPM.js} +26 -14
- package/dist/{chunk-3R5POCTZ.js → chunk-PMN3Q7RJ.js} +6 -6
- package/dist/{chunk-YGJZWZTY.js → chunk-PZFVK3IH.js} +2 -2
- package/dist/chunk-Q4V4XQWV.js +158 -0
- package/dist/chunk-QDFNCATJ.js +325 -0
- package/dist/{chunk-QEBUY5NY.js → chunk-QFQ35BTO.js} +4 -4
- package/dist/chunk-QQJUTGQH.js +135 -0
- package/dist/{chunk-PWIHZ6NJ.js → chunk-QUJGFNFN.js} +4 -4
- package/dist/{chunk-J5FIXQRT.js → chunk-R56LASIN.js} +4 -4
- package/dist/{chunk-SRTU6HMQ.js → chunk-RV26LTUU.js} +8 -8
- package/dist/chunk-RV6A2B5S.js +354 -0
- package/dist/{chunk-EB6FPQUP.js → chunk-S5GRONXL.js} +3 -3
- package/dist/{chunk-5MLYVTYM.js → chunk-SCHXJTZL.js} +2 -2
- package/dist/{chunk-T3UBLACL.js → chunk-SCQ5VPUF.js} +19 -5
- package/dist/{chunk-PBHE5UG6.js → chunk-SGFZZAUO.js} +46 -12
- package/dist/{chunk-BUVJFRPY.js → chunk-SU2VBK4L.js} +4 -4
- package/dist/{chunk-SML67VPV.js → chunk-T4BRO3Z6.js} +3 -3
- package/dist/{chunk-NURGB5Z4.js → chunk-TSA237IM.js} +2 -2
- package/dist/chunk-TWCLK2GA.js +273 -0
- package/dist/{chunk-IJZFN3HM.js → chunk-TWQUYVP3.js} +4 -4
- package/dist/{chunk-DKEPS5LH.js → chunk-U2HGPLZS.js} +36 -2
- package/dist/{chunk-B65G5DNL.js → chunk-URSQLCTR.js} +3 -3
- package/dist/{chunk-ILKORZ3H.js → chunk-UUS2GIJZ.js} +7 -7
- package/dist/{chunk-XAKEUMEJ.js → chunk-UXOSVCLJ.js} +4 -4
- package/dist/{chunk-QLCCJEJI.js → chunk-WCUHAQKB.js} +2 -2
- package/dist/{chunk-WVAJFAIA.js → chunk-WWN566I7.js} +257 -101
- package/dist/{chunk-IPWPWM6R.js → chunk-X2NMFTG3.js} +111 -10
- package/dist/{chunk-UWN33VNX.js → chunk-XCLHOZAM.js} +10 -10
- package/dist/{chunk-P235SVAH.js → chunk-XDXNDSKO.js} +2 -2
- package/dist/chunk-XHVV4NVW.js +51 -0
- package/dist/{chunk-33LCUH4H.js → chunk-XMVQ5F4M.js} +4 -4
- package/dist/{chunk-MITI6NOL.js → chunk-YA7D2N2O.js} +11 -11
- package/dist/{chunk-7JEGTRLD.js → chunk-YB3FW24O.js} +3 -3
- package/dist/chunk-YNRDWYZP.js +295 -0
- package/dist/{chunk-44CM72SQ.js → chunk-YZLMKW4T.js} +3 -3
- package/dist/chunk-Z6XJQ6KO.js +452 -0
- package/dist/cli.cjs +179 -133
- package/dist/clock.d.ts +10 -0
- package/dist/clock.js +235 -0
- package/dist/countdown.d.ts +12 -0
- package/dist/countdown.js +450 -0
- package/dist/dgmo-router-QOMFCOOV.js +84 -0
- package/dist/dimensions-P5FSX2QN.js +22 -0
- package/dist/editor.js +43 -2
- package/dist/element.js +220 -110
- package/dist/element.mjs +45920 -33167
- package/dist/{flowchart-parser-ZNSKIBVR.js → flowchart-parser-OE4WHLTF.js} +4 -4
- package/dist/{flowchart-renderer-SNDSII4D.js → flowchart-renderer-GPCSMTOR.js} +8 -8
- package/dist/highlight.d.ts +17 -1
- package/dist/highlight.js +163 -6
- package/dist/index.d.ts +5 -1
- package/dist/index.js +199 -233
- package/dist/{layout-HRBZPFCN.js → layout-34CLNICW.js} +5 -5
- package/dist/layout-46366KBT.js +10 -0
- package/dist/{layout-HWDSRX5E.js → layout-5BG6DFCU.js} +6 -6
- package/dist/layout-6RDJHS6E.js +9 -0
- package/dist/{layout-7QXCNOVS.js → layout-7H4H46CS.js} +3 -3
- package/dist/{layout-46N4JJYK.js → layout-7SKMFYHL.js} +5 -5
- package/dist/{layout-EE6GE46Y.js → layout-DC4TVXER.js} +5 -5
- package/dist/layout-FGQWRYYW.js +14 -0
- package/dist/{layout-S2QBYSK2.js → layout-NXG63LWH.js} +3 -3
- package/dist/{layout-N76NR4ZO.js → layout-PUQCB6AN.js} +7 -7
- package/dist/{layout-HYZPWAK5.js → layout-QNUQLEHU.js} +3 -3
- package/dist/{layout-UM5F4DJB.js → layout-T3OZU5QW.js} +5 -5
- package/dist/layout-TJIWF7EM.js +14 -0
- package/dist/layout-VYELEAW7.js +14 -0
- package/dist/{layout-5RA6QWR6.js → layout-WZHNDT2O.js} +6 -6
- package/dist/{layout-search-OYV77HHS.js → layout-search-QS44PI5R.js} +6 -6
- package/dist/{parser-6BTRLKRZ.js → parser-45DENHFZ.js} +4 -4
- package/dist/{parser-TFZFBVWN.js → parser-4AI5ZN5F.js} +3 -3
- package/dist/{parser-XDVELHRK.js → parser-4P36TUVD.js} +4 -4
- package/dist/{parser-ZSDPZYQP.js → parser-5AURY4A6.js} +4 -4
- package/dist/{parser-N5O4IHUN.js → parser-A2BEFMGK.js} +4 -4
- package/dist/parser-B5FVS7O6.js +11 -0
- package/dist/{parser-NGU3ETO6.js → parser-C2HF2C2E.js} +4 -4
- package/dist/parser-CSFUN3CT.js +14 -0
- package/dist/{parser-TRTHDFPP.js → parser-D3QT6GWN.js} +5 -5
- package/dist/parser-D5637H5H.js +15 -0
- package/dist/{parser-VQP2UJ6W.js → parser-DFFEDKHH.js} +3 -3
- package/dist/parser-DOKMZXVZ.js +13 -0
- package/dist/parser-FMPCVFRK.js +15 -0
- package/dist/{parser-Y6WTBU76.js → parser-HYRTF3DO.js} +3 -3
- package/dist/{parser-I6KXEYFK.js → parser-I2UIJKVQ.js} +4 -4
- package/dist/{parser-O5J4VBII.js → parser-IBWNAPY4.js} +3 -3
- package/dist/{parser-PQ3POX45.js → parser-KUQWRPIT.js} +4 -4
- package/dist/{parser-2MFP2H2E.js → parser-LWKKBNSA.js} +3 -3
- package/dist/{parser-OV7NOBW6.js → parser-O4QFCUW7.js} +5 -5
- package/dist/{parser-IXSZZQHY.js → parser-PGMQDD4G.js} +4 -4
- package/dist/{parser-3STE62GB.js → parser-Q4QKCIWQ.js} +4 -4
- package/dist/parser-QTOB4KFL.js +14 -0
- package/dist/{parser-2EWECDSA.js → parser-QYYM4QVW.js} +4 -4
- package/dist/{parser-4OGOBJJ4.js → parser-RZMQP7MM.js} +4 -4
- package/dist/parser-RZPVAQVX.js +11 -0
- package/dist/parser-SOUJOEYI.js +13 -0
- package/dist/{parser-4FL2CMDG.js → parser-UQE5OWZI.js} +5 -5
- package/dist/{parser-NRAI6O25.js → parser-WAV5JRPT.js} +4 -4
- package/dist/{parser-KNSQSKQO.js → parser-YLKYBRIT.js} +5 -5
- package/dist/{parser-XKRP7QKP.js → parser-YS7TOS2K.js} +3 -3
- package/dist/{parser-AQETEVRW.js → parser-ZSOWUBML.js} +5 -5
- package/dist/{parser-CFZD5IBL.js → parser-ZTBATMLX.js} +4 -4
- package/dist/{renderer-VACVQYML.js → renderer-35HSIDMZ.js} +8 -8
- package/dist/{renderer-5MYBMBYO.js → renderer-4ITCHBT7.js} +5 -5
- package/dist/{renderer-CLJHQPBJ.js → renderer-67NPCBIS.js} +11 -11
- package/dist/{renderer-5NDVNDAZ.js → renderer-6GHYK7DX.js} +9 -9
- package/dist/{renderer-Z7I3W2PP.js → renderer-6RNGHC5Z.js} +8 -8
- package/dist/renderer-72LGR2YF.js +14 -0
- package/dist/{renderer-KQB7UGDS.js → renderer-7RH2SI3B.js} +3 -3
- package/dist/renderer-7SWMIFMM.js +21 -0
- package/dist/renderer-BBCEFILK.js +24 -0
- package/dist/{renderer-JGBKUCZD.js → renderer-BSW7SRIZ.js} +4 -4
- package/dist/{renderer-BYCNMBF7.js → renderer-BY533UWU.js} +11 -11
- package/dist/{renderer-6W5462RB.js → renderer-BZSBPTZJ.js} +9 -9
- package/dist/{renderer-7MVLWWQD.js → renderer-CXUC4KAD.js} +9 -9
- package/dist/{renderer-QIWVHWZO.js → renderer-DAXMXIKD.js} +3 -3
- package/dist/renderer-FZUKFUNZ.js +23 -0
- package/dist/renderer-G2NLGNKF.js +17 -0
- package/dist/renderer-GO3FE3RA.js +24 -0
- package/dist/{renderer-ZGNTUWC4.js → renderer-HPGR6USK.js} +8 -8
- package/dist/{renderer-UV6MI64M.js → renderer-HVCU2C3Z.js} +3 -3
- package/dist/renderer-ICJN2SA2.js +24 -0
- package/dist/{renderer-AWWAF6XD.js → renderer-INEXO7B6.js} +10 -10
- package/dist/{renderer-YY2OSF6E.js → renderer-KDYCFRBX.js} +8 -8
- package/dist/renderer-KY4KQBTF.js +19 -0
- package/dist/{renderer-B2OMQIQG.js → renderer-LBN65V45.js} +13 -13
- package/dist/{renderer-N43WR5GV.js → renderer-MGBWOCXG.js} +10 -10
- package/dist/{renderer-PGX2TKVS.js → renderer-O4JKUGKO.js} +8 -8
- package/dist/{renderer-4JHRUBE6.js → renderer-OOGFODWP.js} +10 -10
- package/dist/{renderer-6EEZHMH4.js → renderer-Q6ZKPLS6.js} +9 -9
- package/dist/{renderer-RPOA5YPZ.js → renderer-SZQ326M5.js} +12 -12
- package/dist/{renderer-ZRNG54CW.js → renderer-TKG6LS4U.js} +11 -11
- package/dist/{renderer-W4M6QLIJ.js → renderer-TQMZGDAX.js} +13 -13
- package/dist/renderer-radial-JELMHQ24.js +21 -0
- package/dist/{resolver-NOAA7ID7.js → resolver-FHBCO3PL.js} +3 -3
- package/dist/{state-parser-Z2V23ATR.js → state-parser-3REXRK3R.js} +4 -4
- package/dist/{state-renderer-B4DQBM6M.js → state-renderer-XYLNRWXR.js} +8 -8
- package/docs/ai-integration.md +12 -3
- package/docs/language-reference.md +429 -24
- package/gallery/fixtures/body.dgmo +17 -0
- package/gallery/fixtures/bracket.dgmo +30 -0
- package/gallery/fixtures/clock.dgmo +8 -0
- package/gallery/fixtures/countdown.dgmo +3 -0
- package/gallery/fixtures/family.dgmo +23 -0
- package/gallery/fixtures/goal.dgmo +4 -0
- package/gallery/fixtures/sketch.dgmo +22 -0
- package/package.json +12 -4
- package/dist/chunk-ODZVHU3R.js +0 -153
- package/dist/dgmo-router-X35VLZLM.js +0 -73
- package/dist/dimensions-J3FHIMJ6.js +0 -22
- package/dist/layout-5T6RH5M6.js +0 -14
- package/dist/layout-G23F7LDH.js +0 -9
- package/dist/layout-OB3RI63S.js +0 -14
- package/dist/parser-JAL2HD4I.js +0 -13
- package/dist/renderer-SMIBCRVB.js +0 -24
- package/dist/renderer-radial-C32GPJQ7.js +0 -21
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compactNumber
|
|
3
|
+
} from "./chunk-CVV36CWI.js";
|
|
4
|
+
import {
|
|
5
|
+
parseInlineMarkdown
|
|
6
|
+
} from "./chunk-3HDBAXF5.js";
|
|
7
|
+
import {
|
|
8
|
+
TITLE_FONT_WEIGHT
|
|
9
|
+
} from "./chunk-A4GOY3PE.js";
|
|
10
|
+
import {
|
|
11
|
+
FONT_FAMILY
|
|
12
|
+
} from "./chunk-6KFWC4CO.js";
|
|
13
|
+
import {
|
|
14
|
+
getSeriesColors,
|
|
15
|
+
mix,
|
|
16
|
+
shapeFill,
|
|
17
|
+
themeBaseBg
|
|
18
|
+
} from "./chunk-P6T66CCZ.js";
|
|
19
|
+
import {
|
|
20
|
+
resolveColor
|
|
21
|
+
} from "./chunk-TLVIHFRO.js";
|
|
22
|
+
|
|
23
|
+
// src/goal/renderer.ts
|
|
24
|
+
import * as d3Selection from "d3-selection";
|
|
25
|
+
function clamp(x, lo, hi) {
|
|
26
|
+
return Math.max(lo, Math.min(hi, x));
|
|
27
|
+
}
|
|
28
|
+
var GOAL_TITLE_SIZE = 30;
|
|
29
|
+
function computeMetrics(parsed) {
|
|
30
|
+
const pctFrac = parsed.hasTarget ? parsed.now / parsed.target : 0;
|
|
31
|
+
const fillFrac = clamp(pctFrac, 0, 1);
|
|
32
|
+
const pctLabel = `${Math.round(pctFrac * 100)}%`;
|
|
33
|
+
const targetLabel = parsed.hasTarget ? compactNumber(parsed.target) : "?";
|
|
34
|
+
const valueLabel = `${compactNumber(parsed.now)} / ${targetLabel}`;
|
|
35
|
+
const ariaTarget = parsed.hasTarget ? parsed.target : "?";
|
|
36
|
+
const ariaLabel = `${parsed.title ?? "Goal"}: ${parsed.now} of ${ariaTarget} (${Math.round(
|
|
37
|
+
pctFrac * 100
|
|
38
|
+
)}%)`;
|
|
39
|
+
return { pctFrac, fillFrac, pctLabel, valueLabel, ariaLabel };
|
|
40
|
+
}
|
|
41
|
+
function autoBandColor(pctFrac, palette) {
|
|
42
|
+
const name = pctFrac < 0.5 ? "red" : pctFrac < 0.8 ? "orange" : "green";
|
|
43
|
+
return resolveColor(name, palette) || name;
|
|
44
|
+
}
|
|
45
|
+
function resolvePaint(parsed, palette, isDark, pctFrac) {
|
|
46
|
+
const autoColor = !parsed.options.noAutoColor && parsed.hasTarget ? autoBandColor(pctFrac, palette) : null;
|
|
47
|
+
const base = parsed.color && resolveColor(parsed.color, palette) || parsed.color || autoColor || getSeriesColors(palette)[0];
|
|
48
|
+
return {
|
|
49
|
+
base,
|
|
50
|
+
fill: shapeFill(palette, base, isDark, { solid: parsed.options.solidFill }),
|
|
51
|
+
track: mix(palette.border, themeBaseBg(palette, isDark), 45),
|
|
52
|
+
text: palette.text,
|
|
53
|
+
muted: mix(palette.text, themeBaseBg(palette, isDark), 55)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function renderGoal(container, parsed, palette, isDark, exportDims) {
|
|
57
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
58
|
+
const cw = exportDims?.width ?? container.clientWidth;
|
|
59
|
+
const ch = exportDims?.height ?? container.clientHeight;
|
|
60
|
+
if (cw <= 0 || ch <= 0) return;
|
|
61
|
+
const metrics = computeMetrics(parsed);
|
|
62
|
+
const paint = resolvePaint(parsed, palette, isDark, metrics.pctFrac);
|
|
63
|
+
const svg = d3Selection.select(container).append("svg").attr("width", cw).attr("height", ch).attr("preserveAspectRatio", "xMidYMid meet").attr("xmlns", "http://www.w3.org/2000/svg").attr("role", "img").attr("aria-label", metrics.ariaLabel).style("font-family", FONT_FAMILY);
|
|
64
|
+
const box = parsed.mode === "thermometer" ? renderThermometer(svg, parsed, metrics, paint) : parsed.mode === "gauge" ? renderGauge(svg, parsed, metrics, paint) : renderBar(svg, parsed, metrics, paint);
|
|
65
|
+
const pad = 30;
|
|
66
|
+
const vx = box.minX - pad;
|
|
67
|
+
const vy = box.minY - pad;
|
|
68
|
+
const vw = box.maxX - box.minX + pad * 2;
|
|
69
|
+
const vh = box.maxY - box.minY + pad * 2;
|
|
70
|
+
svg.attr("viewBox", `${vx} ${vy} ${vw} ${vh}`);
|
|
71
|
+
svg.insert("rect", ":first-child").attr("x", vx).attr("y", vy).attr("width", vw).attr("height", vh).attr("fill", palette.bg);
|
|
72
|
+
}
|
|
73
|
+
function renderGoalForExport(container, parsed, palette, isDark, exportDims) {
|
|
74
|
+
renderGoal(container, parsed, palette, isDark, exportDims);
|
|
75
|
+
}
|
|
76
|
+
function displayLen(token) {
|
|
77
|
+
return token.replace(/\[(.+?)\]\((.+?)\)/g, "$1").replace(/\*\*|__|\*|_|`/g, "").length;
|
|
78
|
+
}
|
|
79
|
+
function wrapText(text, maxChars) {
|
|
80
|
+
const words = text.split(/\s+/);
|
|
81
|
+
const lines = [];
|
|
82
|
+
let cur = "";
|
|
83
|
+
for (const w of words) {
|
|
84
|
+
const next = cur ? `${cur} ${w}` : w;
|
|
85
|
+
if (displayLen(next) > maxChars && cur) {
|
|
86
|
+
lines.push(cur);
|
|
87
|
+
cur = w;
|
|
88
|
+
} else {
|
|
89
|
+
cur = next;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (cur) lines.push(cur);
|
|
93
|
+
return lines;
|
|
94
|
+
}
|
|
95
|
+
function layoutDescription(description, colLeft, maxChars) {
|
|
96
|
+
const out = [];
|
|
97
|
+
const indent = 18;
|
|
98
|
+
const contentX = colLeft + indent;
|
|
99
|
+
for (const raw of description.split("\n")) {
|
|
100
|
+
const t = raw.trim();
|
|
101
|
+
if (t === "") {
|
|
102
|
+
out.push({ text: "", x: colLeft });
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const bullet = /^[-*]\s+/.test(t);
|
|
106
|
+
if (bullet) {
|
|
107
|
+
const content = t.replace(/^[-*]\s+/, "");
|
|
108
|
+
const wrapped = wrapText(content, Math.max(6, maxChars - 3));
|
|
109
|
+
wrapped.forEach((wl, k) => {
|
|
110
|
+
out.push(
|
|
111
|
+
k === 0 ? { text: wl, x: contentX, bulletX: colLeft } : { text: wl, x: contentX }
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
for (const wl of wrapText(t, maxChars))
|
|
116
|
+
out.push({ text: wl, x: colLeft });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
function renderWrappedMarkdown(textEl, lines, lineH) {
|
|
122
|
+
lines.forEach((line, li) => {
|
|
123
|
+
const dy = li === 0 ? 0 : lineH;
|
|
124
|
+
if (line.text === "" && line.bulletX === void 0) {
|
|
125
|
+
textEl.append("tspan").attr("x", line.x).attr("dy", dy).text(" ");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (line.bulletX !== void 0) {
|
|
129
|
+
textEl.append("tspan").attr("x", line.bulletX).attr("dy", dy).text("\u2022");
|
|
130
|
+
}
|
|
131
|
+
let first = true;
|
|
132
|
+
for (const span of parseInlineMarkdown(line.text)) {
|
|
133
|
+
const tspan = textEl.append("tspan").text(span.text);
|
|
134
|
+
if (first) {
|
|
135
|
+
tspan.attr("x", line.x);
|
|
136
|
+
if (line.bulletX === void 0) tspan.attr("dy", dy);
|
|
137
|
+
first = false;
|
|
138
|
+
}
|
|
139
|
+
if (span.bold) tspan.attr("font-weight", "bold");
|
|
140
|
+
if (span.italic) tspan.attr("font-style", "italic");
|
|
141
|
+
if (span.code) tspan.attr("font-family", "monospace");
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function drawNote(svg, description, paint, left, top, width) {
|
|
146
|
+
const descSize = 15;
|
|
147
|
+
const lineH = descSize * 1.4;
|
|
148
|
+
const maxChars = Math.max(8, Math.floor(width / (descSize * 0.46)));
|
|
149
|
+
const firstY = top + descSize;
|
|
150
|
+
const lines = layoutDescription(description, left, maxChars);
|
|
151
|
+
const desc = svg.append("text").attr("x", left).attr("y", firstY).attr("text-anchor", "start").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", descSize).attr("font-weight", 500);
|
|
152
|
+
renderWrappedMarkdown(desc, lines, lineH);
|
|
153
|
+
return firstY + lines.length * lineH;
|
|
154
|
+
}
|
|
155
|
+
function faceTitle(svg, parsed, paint, x, y, anchor = "middle", size = GOAL_TITLE_SIZE) {
|
|
156
|
+
if (!parsed.title || parsed.options.noTitle) return;
|
|
157
|
+
svg.append("text").attr("class", "chart-title").attr("x", x).attr("y", y).attr("text-anchor", anchor).attr("fill", paint.text).attr("font-family", FONT_FAMILY).attr("font-size", size).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber).text(parsed.title);
|
|
158
|
+
}
|
|
159
|
+
function renderBar(svg, parsed, metrics, paint) {
|
|
160
|
+
const trackH = 52;
|
|
161
|
+
const r = trackH / 2;
|
|
162
|
+
const trackW = 620;
|
|
163
|
+
const gap = parsed.hasTarget ? 18 : 0;
|
|
164
|
+
const targetLabelW = parsed.hasTarget ? 80 : 0;
|
|
165
|
+
const x = 0;
|
|
166
|
+
const hasTitle = !!parsed.title && !parsed.options.noTitle;
|
|
167
|
+
const showPct = !parsed.options.noPercent && parsed.hasTarget;
|
|
168
|
+
const titleSize = GOAL_TITLE_SIZE;
|
|
169
|
+
if (hasTitle) faceTitle(svg, parsed, paint, x, titleSize - 2, "start");
|
|
170
|
+
const barRight = x + trackW;
|
|
171
|
+
if (showPct) {
|
|
172
|
+
svg.append("text").attr("x", barRight).attr("y", titleSize - 2).attr("text-anchor", "end").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", titleSize).attr("font-weight", 700).text(metrics.pctLabel);
|
|
173
|
+
}
|
|
174
|
+
const y = hasTitle || showPct ? titleSize + 14 : 0;
|
|
175
|
+
const barCy = y + trackH / 2;
|
|
176
|
+
const g = svg.append("g").attr("class", "goal-bar");
|
|
177
|
+
g.append("rect").attr("x", x).attr("y", y).attr("width", trackW).attr("height", trackH).attr("rx", r).attr("fill", paint.track);
|
|
178
|
+
const fillW = trackW * metrics.fillFrac;
|
|
179
|
+
if (fillW > 0.5) {
|
|
180
|
+
g.append("rect").attr("x", x).attr("y", y).attr("width", fillW).attr("height", trackH).attr("rx", r).attr("fill", paint.fill).attr("stroke", paint.base).attr("stroke-width", 2);
|
|
181
|
+
}
|
|
182
|
+
if (!parsed.options.noValue) {
|
|
183
|
+
const valX = Math.max(x + fillW - 16, x + 52);
|
|
184
|
+
g.append("text").attr("x", valX).attr("y", barCy + 24 * 0.35).attr("text-anchor", "end").attr("fill", paint.base).attr("font-family", FONT_FAMILY).attr("font-size", 24).attr("font-weight", 700).text(compactNumber(parsed.now));
|
|
185
|
+
}
|
|
186
|
+
if (parsed.hasTarget) {
|
|
187
|
+
g.append("text").attr("x", barRight + gap).attr("y", barCy + 26 * 0.35).attr("text-anchor", "start").attr("fill", paint.text).attr("font-family", FONT_FAMILY).attr("font-size", 26).attr("font-weight", 700).text(compactNumber(parsed.target));
|
|
188
|
+
}
|
|
189
|
+
let bottom = y + trackH;
|
|
190
|
+
if (parsed.description && !parsed.options.noNote) {
|
|
191
|
+
bottom = drawNote(svg, parsed.description, paint, x, bottom + 40, trackW);
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
minX: 0,
|
|
195
|
+
minY: 0,
|
|
196
|
+
maxX: barRight + gap + targetLabelW,
|
|
197
|
+
maxY: bottom
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function renderThermometer(svg, parsed, metrics, paint) {
|
|
201
|
+
const tubeW = 68;
|
|
202
|
+
const r = tubeW / 2;
|
|
203
|
+
const bulbR = 52;
|
|
204
|
+
const inset = 8;
|
|
205
|
+
const totalH = 440;
|
|
206
|
+
const glassTop = 0;
|
|
207
|
+
const bulbCy = totalH - bulbR;
|
|
208
|
+
const textColW = 440;
|
|
209
|
+
const gap = 56;
|
|
210
|
+
const colLeft = 0;
|
|
211
|
+
const cx = colLeft + textColW + gap + r;
|
|
212
|
+
const bodyPath = (topY, halfW, br, roundedCap) => {
|
|
213
|
+
const yJoin = bulbCy - Math.sqrt(br * br - halfW * halfW);
|
|
214
|
+
const bulb = `L ${cx + halfW} ${yJoin} A ${br} ${br} 0 1 1 ${cx - halfW} ${yJoin} Z`;
|
|
215
|
+
return roundedCap ? `M ${cx - halfW} ${topY + halfW} A ${halfW} ${halfW} 0 0 1 ${cx + halfW} ${topY + halfW} ${bulb}` : `M ${cx - halfW} ${topY} L ${cx + halfW} ${topY} ${bulb}`;
|
|
216
|
+
};
|
|
217
|
+
const g = svg.append("g").attr("class", "goal-thermometer");
|
|
218
|
+
g.append("path").attr("d", bodyPath(glassTop, r, bulbR, true)).attr("fill", paint.track);
|
|
219
|
+
const mHalf = r - inset;
|
|
220
|
+
const mBulb = bulbR - inset;
|
|
221
|
+
const yTop = glassTop + r;
|
|
222
|
+
const yBase = bulbCy - Math.sqrt(mBulb * mBulb - mHalf * mHalf);
|
|
223
|
+
const yForFrac = (f) => yTop + (1 - f) * (yBase - yTop);
|
|
224
|
+
const fillTopY = clamp(yForFrac(metrics.fillFrac), yTop, yBase);
|
|
225
|
+
g.append("path").attr("d", bodyPath(fillTopY, mHalf, mBulb, false)).attr("fill", paint.fill).attr("stroke", paint.base).attr("stroke-width", 2).attr("stroke-linejoin", "round");
|
|
226
|
+
if (parsed.hasTarget) {
|
|
227
|
+
const edgeX = cx + r;
|
|
228
|
+
const tickLabelX = edgeX + 14;
|
|
229
|
+
const drawTick = (f, major) => {
|
|
230
|
+
const isTarget = f === 1;
|
|
231
|
+
const y = yForFrac(f);
|
|
232
|
+
g.append("line").attr("x1", edgeX).attr("y1", y).attr("x2", edgeX - (isTarget ? 26 : major ? 18 : 10)).attr("y2", y).attr("stroke", isTarget ? paint.base : paint.muted).attr("stroke-width", isTarget ? 4 : major ? 2 : 1.5);
|
|
233
|
+
if (isTarget) {
|
|
234
|
+
g.append("text").attr("x", tickLabelX).attr("y", y - 20).attr("text-anchor", "start").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", 15).attr("font-weight", 600).attr("letter-spacing", 1).text("TARGET");
|
|
235
|
+
}
|
|
236
|
+
if (major) {
|
|
237
|
+
g.append("text").attr("x", tickLabelX).attr("y", y + (isTarget ? 30 * 0.35 : 19 * 0.35)).attr("text-anchor", "start").attr("fill", isTarget ? paint.text : paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", isTarget ? 30 : 19).attr("font-weight", isTarget ? 700 : 500).text(compactNumber(parsed.target * f));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
for (const f of [0.25, 0.75]) drawTick(f, false);
|
|
241
|
+
for (const f of [0, 0.5, 1]) drawTick(f, true);
|
|
242
|
+
g.append("text").attr("x", tickLabelX).attr("y", fillTopY + 42 * 0.35).attr("text-anchor", "start").attr("fill", paint.base).attr("font-family", FONT_FAMILY).attr("font-size", 42).attr("font-weight", 700).text(compactNumber(parsed.now));
|
|
243
|
+
}
|
|
244
|
+
const titleSize = GOAL_TITLE_SIZE;
|
|
245
|
+
let cursorY = glassTop;
|
|
246
|
+
if (parsed.title && !parsed.options.noTitle) {
|
|
247
|
+
svg.append("text").attr("class", "chart-title").attr("x", colLeft).attr("y", cursorY + titleSize).attr("text-anchor", "start").attr("fill", paint.text).attr("font-family", FONT_FAMILY).attr("font-size", titleSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber).text(parsed.title);
|
|
248
|
+
cursorY += titleSize + 16;
|
|
249
|
+
}
|
|
250
|
+
if (!parsed.options.noPercent) {
|
|
251
|
+
svg.append("text").attr("x", colLeft).attr("y", cursorY + 52).attr("text-anchor", "start").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", 64).attr("font-weight", 700).text(metrics.pctLabel);
|
|
252
|
+
cursorY += 76;
|
|
253
|
+
}
|
|
254
|
+
let colBottom = cursorY;
|
|
255
|
+
if (parsed.description && !parsed.options.noNote) {
|
|
256
|
+
colBottom = drawNote(
|
|
257
|
+
svg,
|
|
258
|
+
parsed.description,
|
|
259
|
+
paint,
|
|
260
|
+
colLeft,
|
|
261
|
+
cursorY + 8,
|
|
262
|
+
textColW
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
const rightExtent = parsed.hasTarget ? cx + r + 14 + 76 : cx + r + 20;
|
|
266
|
+
return {
|
|
267
|
+
minX: 0,
|
|
268
|
+
minY: 0,
|
|
269
|
+
maxX: rightExtent,
|
|
270
|
+
maxY: Math.max(bulbCy + bulbR, colBottom)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function arcPath(cx, cy, r, t0, t1) {
|
|
274
|
+
const a0 = Math.PI - t0 * Math.PI;
|
|
275
|
+
const a1 = Math.PI - t1 * Math.PI;
|
|
276
|
+
const x0 = cx + r * Math.cos(a0);
|
|
277
|
+
const y0 = cy - r * Math.sin(a0);
|
|
278
|
+
const x1 = cx + r * Math.cos(a1);
|
|
279
|
+
const y1 = cy - r * Math.sin(a1);
|
|
280
|
+
return `M ${x0} ${y0} A ${r} ${r} 0 0 1 ${x1} ${y1}`;
|
|
281
|
+
}
|
|
282
|
+
function renderGauge(svg, parsed, metrics, paint) {
|
|
283
|
+
const stroke = 36;
|
|
284
|
+
const r = 210;
|
|
285
|
+
const hasNote = !!parsed.description && !parsed.options.noNote;
|
|
286
|
+
const colW = hasNote ? 400 : 0;
|
|
287
|
+
const colGap = hasNote ? 56 : 0;
|
|
288
|
+
const colLeft = 0;
|
|
289
|
+
const hasTopTitle = !hasNote && !!parsed.title && !parsed.options.noTitle;
|
|
290
|
+
const topTitleH = hasTopTitle ? GOAL_TITLE_SIZE + 6 + 16 : 0;
|
|
291
|
+
const cx = colLeft + colW + colGap + r;
|
|
292
|
+
const cy = r + stroke / 2 + topTitleH;
|
|
293
|
+
const g = svg.append("g").attr("class", "goal-gauge");
|
|
294
|
+
const crestTop = cy - r - stroke / 2;
|
|
295
|
+
let colBottom = crestTop;
|
|
296
|
+
if (hasNote) {
|
|
297
|
+
const titleSize = GOAL_TITLE_SIZE;
|
|
298
|
+
let top = crestTop;
|
|
299
|
+
if (parsed.title && !parsed.options.noTitle) {
|
|
300
|
+
svg.append("text").attr("class", "chart-title").attr("x", colLeft).attr("y", top + titleSize * 0.78).attr("text-anchor", "start").attr("fill", paint.text).attr("font-family", FONT_FAMILY).attr("font-size", titleSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber).text(parsed.title);
|
|
301
|
+
top += titleSize * 0.78 + 16;
|
|
302
|
+
}
|
|
303
|
+
colBottom = drawNote(svg, parsed.description, paint, colLeft, top, colW);
|
|
304
|
+
} else if (hasTopTitle) {
|
|
305
|
+
faceTitle(svg, parsed, paint, cx, GOAL_TITLE_SIZE);
|
|
306
|
+
}
|
|
307
|
+
g.append("path").attr("d", arcPath(cx, cy, r, 0, 1)).attr("fill", "none").attr("stroke", paint.track).attr("stroke-width", stroke).attr("stroke-linecap", "round");
|
|
308
|
+
if (metrics.fillFrac > 1e-3) {
|
|
309
|
+
g.append("path").attr("d", arcPath(cx, cy, r, 0, metrics.fillFrac)).attr("fill", "none").attr("stroke", paint.fill).attr("stroke-width", stroke).attr("stroke-linecap", "round");
|
|
310
|
+
}
|
|
311
|
+
const a = Math.PI - metrics.fillFrac * Math.PI;
|
|
312
|
+
const needleLen = r - stroke / 2 - 6;
|
|
313
|
+
const nx = cx + needleLen * Math.cos(a);
|
|
314
|
+
const ny = cy - needleLen * Math.sin(a);
|
|
315
|
+
g.append("line").attr("x1", cx).attr("y1", cy).attr("x2", nx).attr("y2", ny).attr("stroke", paint.text).attr("stroke-width", 5).attr("stroke-linecap", "round");
|
|
316
|
+
g.append("circle").attr("cx", cx).attr("cy", cy).attr("r", 11).attr("fill", paint.text);
|
|
317
|
+
const nowLabel = compactNumber(parsed.now);
|
|
318
|
+
const nowSize = Math.min(
|
|
319
|
+
r * 0.62,
|
|
320
|
+
140,
|
|
321
|
+
r * 0.95 / Math.max(1, nowLabel.length * 0.6)
|
|
322
|
+
);
|
|
323
|
+
const nowY = cy - r * 0.42;
|
|
324
|
+
g.append("text").attr("x", cx).attr("y", nowY + nowSize * 0.35).attr("text-anchor", "middle").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", nowSize).attr("font-weight", 700).text(nowLabel);
|
|
325
|
+
if (parsed.hasTarget) {
|
|
326
|
+
const bandInner = r - stroke / 2;
|
|
327
|
+
for (const f of [0, 0.25, 0.5, 0.75, 1]) {
|
|
328
|
+
const isTarget = f === 1;
|
|
329
|
+
const ang = Math.PI - f * Math.PI;
|
|
330
|
+
const ca = Math.cos(ang);
|
|
331
|
+
const sa = Math.sin(ang);
|
|
332
|
+
g.append("line").attr("x1", cx + bandInner * ca).attr("y1", cy - bandInner * sa).attr("x2", cx + (bandInner - (isTarget ? 20 : 12)) * ca).attr("y2", cy - (bandInner - (isTarget ? 20 : 12)) * sa).attr("stroke", isTarget ? paint.base : paint.muted).attr("stroke-width", isTarget ? 4 : 2);
|
|
333
|
+
const lr = bandInner - (isTarget ? 40 : 26);
|
|
334
|
+
const anchor = ca > 0.2 ? "end" : ca < -0.2 ? "start" : "middle";
|
|
335
|
+
if (isTarget) {
|
|
336
|
+
g.append("text").attr("x", cx + lr * ca).attr("y", cy - lr * sa - 20).attr("text-anchor", anchor).attr("dominant-baseline", "middle").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", 15).attr("font-weight", 600).attr("letter-spacing", 1).text("TARGET");
|
|
337
|
+
}
|
|
338
|
+
g.append("text").attr("x", cx + lr * ca).attr("y", cy - lr * sa).attr("text-anchor", anchor).attr("dominant-baseline", sa > 0.7 ? "hanging" : "middle").attr("fill", isTarget ? paint.text : paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", isTarget ? 30 : 18).attr("font-weight", isTarget ? 700 : 500).text(compactNumber(parsed.target * f));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const rightLabel = parsed.hasTarget ? 74 : 20;
|
|
342
|
+
return {
|
|
343
|
+
minX: 0,
|
|
344
|
+
minY: Math.min(0, crestTop),
|
|
345
|
+
maxX: cx + r + rightLabel,
|
|
346
|
+
maxY: Math.max(cy + 34, colBottom)
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export {
|
|
351
|
+
renderGoal,
|
|
352
|
+
renderGoalForExport
|
|
353
|
+
};
|
|
354
|
+
//# sourceMappingURL=chunk-RV6A2B5S.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
tagAttrKey,
|
|
11
11
|
validateTagGroupNames,
|
|
12
12
|
validateTagValues
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WCUHAQKB.js";
|
|
14
14
|
import {
|
|
15
15
|
MINDMAP_REGISTRY,
|
|
16
16
|
OPTION_NOCOLON_RE,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tryParseSharedOption,
|
|
22
22
|
warnUnknownMetaKeys,
|
|
23
23
|
withTagAliases
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-OTAL43EH.js";
|
|
25
25
|
import {
|
|
26
26
|
formatDgmoError,
|
|
27
27
|
makeDgmoError,
|
|
@@ -313,4 +313,4 @@ function findMetadataParent(indent, indentStack) {
|
|
|
313
313
|
export {
|
|
314
314
|
parseMindmap
|
|
315
315
|
};
|
|
316
|
-
//# sourceMappingURL=chunk-
|
|
316
|
+
//# sourceMappingURL=chunk-S5GRONXL.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractColor,
|
|
3
3
|
measureIndent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OTAL43EH.js";
|
|
5
5
|
import {
|
|
6
6
|
makeDgmoError
|
|
7
7
|
} from "./chunk-CXK4DZH3.js";
|
|
@@ -73,4 +73,4 @@ function tryCollectNote(lines, index, indent, palette, diagnostics) {
|
|
|
73
73
|
export {
|
|
74
74
|
tryCollectNote
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-SCHXJTZL.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-6EK55ART.js";
|
|
5
5
|
import {
|
|
6
6
|
noteBoxSize
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BCYVE3N5.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveNotes
|
|
10
10
|
} from "./chunk-FMDSF3OV.js";
|
|
@@ -92,9 +92,23 @@ function layoutGraph(graph, options) {
|
|
|
92
92
|
for (const edge of graph.edges) {
|
|
93
93
|
const key = `${edge.source}->${edge.target}`;
|
|
94
94
|
edgeDataMap.set(key, edge);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
}
|
|
96
|
+
const outgoingBySource = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const edge of graph.edges) {
|
|
98
|
+
let group = outgoingBySource.get(edge.source);
|
|
99
|
+
if (!group) {
|
|
100
|
+
group = [];
|
|
101
|
+
outgoingBySource.set(edge.source, group);
|
|
102
|
+
}
|
|
103
|
+
group.push(edge);
|
|
104
|
+
}
|
|
105
|
+
for (const group of outgoingBySource.values()) {
|
|
106
|
+
for (let i = group.length - 1; i >= 0; i--) {
|
|
107
|
+
const edge = group[i];
|
|
108
|
+
g.setEdge(edge.source, edge.target, {
|
|
109
|
+
label: edge.label ?? ""
|
|
110
|
+
});
|
|
111
|
+
}
|
|
98
112
|
}
|
|
99
113
|
dagre.layout(g);
|
|
100
114
|
const collapsedGroupIds = collapsedChildCounts ? new Set(collapsedChildCounts.keys()) : /* @__PURE__ */ new Set();
|
|
@@ -296,4 +310,4 @@ function layoutGraph(graph, options) {
|
|
|
296
310
|
export {
|
|
297
311
|
layoutGraph
|
|
298
312
|
};
|
|
299
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-SCQ5VPUF.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-A44USUV7.js";
|
|
4
4
|
import {
|
|
5
5
|
layoutInfra
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C63UWAKM.js";
|
|
7
7
|
import {
|
|
8
8
|
renderInlineText
|
|
9
9
|
} from "./chunk-3HDBAXF5.js";
|
|
@@ -13,15 +13,15 @@ import {
|
|
|
13
13
|
EDGE_STROKE_WIDTH,
|
|
14
14
|
NODE_STROKE_WIDTH
|
|
15
15
|
} from "./chunk-3CIOJ5YJ.js";
|
|
16
|
-
import {
|
|
17
|
-
renderIntegratedLegend
|
|
18
|
-
} from "./chunk-PWIHZ6NJ.js";
|
|
19
16
|
import {
|
|
20
17
|
ScaleContext
|
|
21
18
|
} from "./chunk-YYVTBZZC.js";
|
|
19
|
+
import {
|
|
20
|
+
renderIntegratedLegend
|
|
21
|
+
} from "./chunk-QUJGFNFN.js";
|
|
22
22
|
import {
|
|
23
23
|
getMaxLegendReservedHeight
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7UEMZREK.js";
|
|
25
25
|
import {
|
|
26
26
|
TITLE_FONT_SIZE,
|
|
27
27
|
TITLE_FONT_WEIGHT,
|
|
@@ -41,15 +41,15 @@ import {
|
|
|
41
41
|
LEGEND_PILL_FONT_SIZE,
|
|
42
42
|
LEGEND_PILL_PAD,
|
|
43
43
|
measureLegendText
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-HQCHYB5F.js";
|
|
45
45
|
import {
|
|
46
46
|
CHAR_WIDTH_RATIO,
|
|
47
47
|
measureText,
|
|
48
48
|
truncateText
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-5LWQH6QV.js";
|
|
50
50
|
import {
|
|
51
51
|
parseInfra
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-XMVQ5F4M.js";
|
|
53
53
|
import {
|
|
54
54
|
preprocessDescriptionLine
|
|
55
55
|
} from "./chunk-IYULMRBE.js";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
} from "./chunk-P6T66CCZ.js";
|
|
61
61
|
import {
|
|
62
62
|
tagAttrKey
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-WCUHAQKB.js";
|
|
64
64
|
import {
|
|
65
65
|
resolveColor
|
|
66
66
|
} from "./chunk-TLVIHFRO.js";
|
|
@@ -189,6 +189,40 @@ function buildPathD(pts, direction) {
|
|
|
189
189
|
}
|
|
190
190
|
return gen(pts) ?? "";
|
|
191
191
|
}
|
|
192
|
+
var GROUP_PSEUDO_NODE_DEFAULTS = {
|
|
193
|
+
computedRps: 0,
|
|
194
|
+
overloaded: false,
|
|
195
|
+
rateLimited: false,
|
|
196
|
+
isEdge: false,
|
|
197
|
+
computedLatencyMs: 0,
|
|
198
|
+
computedLatencyPercentiles: { p50: 0, p90: 0, p99: 0 },
|
|
199
|
+
computedUptime: 1,
|
|
200
|
+
computedAvailability: 1,
|
|
201
|
+
computedAvailabilityPercentiles: { p50: 1, p90: 1, p99: 1 },
|
|
202
|
+
computedCbState: "closed",
|
|
203
|
+
computedInstances: 1,
|
|
204
|
+
computedConcurrentInvocations: 0,
|
|
205
|
+
properties: [],
|
|
206
|
+
tags: {}
|
|
207
|
+
};
|
|
208
|
+
function nodeMapWithGroups(nodes, groups) {
|
|
209
|
+
const map = new Map(nodes.map((n) => [n.id, n]));
|
|
210
|
+
for (const g of groups) {
|
|
211
|
+
if (map.has(g.id)) continue;
|
|
212
|
+
map.set(g.id, {
|
|
213
|
+
...GROUP_PSEUDO_NODE_DEFAULTS,
|
|
214
|
+
id: g.id,
|
|
215
|
+
label: g.label,
|
|
216
|
+
x: g.x + g.width / 2,
|
|
217
|
+
y: g.y + g.height / 2,
|
|
218
|
+
width: g.width,
|
|
219
|
+
height: g.height,
|
|
220
|
+
groupId: g.id,
|
|
221
|
+
lineNumber: g.lineNumber
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return map;
|
|
225
|
+
}
|
|
192
226
|
function computePortPts(edges, nodeMap, direction) {
|
|
193
227
|
const srcPts = /* @__PURE__ */ new Map();
|
|
194
228
|
const tgtPts = /* @__PURE__ */ new Map();
|
|
@@ -845,7 +879,7 @@ function renderGroups(svg, groups, palette, _isDark, sc = buildScaledConstants(S
|
|
|
845
879
|
}
|
|
846
880
|
}
|
|
847
881
|
function renderEdgePaths(svg, edges, nodes, groups, palette, _isDark, animate, direction, speedMultiplier = 1, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
848
|
-
const nodeMap =
|
|
882
|
+
const nodeMap = nodeMapWithGroups(nodes, groups);
|
|
849
883
|
const maxRps = Math.max(...edges.map((e) => e.computedRps), 1);
|
|
850
884
|
const { srcPts, tgtPts } = computePortPts(edges, nodeMap, direction);
|
|
851
885
|
for (const edge of edges) {
|
|
@@ -886,7 +920,7 @@ function renderEdgePaths(svg, edges, nodes, groups, palette, _isDark, animate, d
|
|
|
886
920
|
}
|
|
887
921
|
}
|
|
888
922
|
function renderEdgeLabels(svg, edges, nodes, groups, palette, _isDark, animate, direction, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
889
|
-
const nodeMap =
|
|
923
|
+
const nodeMap = nodeMapWithGroups(nodes, groups);
|
|
890
924
|
const { srcPts, tgtPts } = computePortPts(edges, nodeMap, direction);
|
|
891
925
|
for (const edge of edges) {
|
|
892
926
|
if (edge.points.length === 0) continue;
|
|
@@ -1527,4 +1561,4 @@ export {
|
|
|
1527
1561
|
renderInfra,
|
|
1528
1562
|
parseAndLayoutInfra
|
|
1529
1563
|
};
|
|
1530
|
-
//# sourceMappingURL=chunk-
|
|
1564
|
+
//# sourceMappingURL=chunk-SGFZZAUO.js.map
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
tagAttrKey,
|
|
8
8
|
validateTagGroupNames,
|
|
9
9
|
validateTagValues
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WCUHAQKB.js";
|
|
11
11
|
import {
|
|
12
12
|
tryCollectNote
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SCHXJTZL.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveNotes
|
|
16
16
|
} from "./chunk-FMDSF3OV.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
tryParseSharedOption,
|
|
31
31
|
warnUnknownMetaKeys,
|
|
32
32
|
withTagAliases
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-OTAL43EH.js";
|
|
34
34
|
import {
|
|
35
35
|
makeDgmoError,
|
|
36
36
|
suggest
|
|
@@ -884,4 +884,4 @@ export {
|
|
|
884
884
|
looksLikeBoxesAndLines,
|
|
885
885
|
parseBoxesAndLines
|
|
886
886
|
};
|
|
887
|
-
//# sourceMappingURL=chunk-
|
|
887
|
+
//# sourceMappingURL=chunk-SU2VBK4L.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
stripDefaultModifier,
|
|
9
9
|
validateTagGroupNames,
|
|
10
10
|
validateTagValues
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WCUHAQKB.js";
|
|
12
12
|
import {
|
|
13
13
|
parseArrow,
|
|
14
14
|
parseInArrowLabel
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
splitNameAndMeta,
|
|
27
27
|
warnUnknownMetaKeys,
|
|
28
28
|
withTagAliases
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OTAL43EH.js";
|
|
30
30
|
import {
|
|
31
31
|
NAME_DIAGNOSTIC_CODES,
|
|
32
32
|
formatDgmoError,
|
|
@@ -1022,4 +1022,4 @@ export {
|
|
|
1022
1022
|
parseSequenceDgmo,
|
|
1023
1023
|
looksLikeSequence
|
|
1024
1024
|
};
|
|
1025
|
-
//# sourceMappingURL=chunk-
|
|
1025
|
+
//# sourceMappingURL=chunk-T4BRO3Z6.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
parseFirstLine,
|
|
6
6
|
splitNameAndMeta,
|
|
7
7
|
warnUnknownMetaKeys
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OTAL43EH.js";
|
|
9
9
|
import {
|
|
10
10
|
makeDgmoError,
|
|
11
11
|
makeFail,
|
|
@@ -332,4 +332,4 @@ function assignGlobalNumbers(result) {
|
|
|
332
332
|
export {
|
|
333
333
|
parseTechRadar
|
|
334
334
|
};
|
|
335
|
-
//# sourceMappingURL=chunk-
|
|
335
|
+
//# sourceMappingURL=chunk-TSA237IM.js.map
|