@diagrammo/dgmo 0.94.0 → 0.96.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/README.md +1 -1
- package/dist/advanced.d.ts +97 -570
- package/dist/advanced.js +176 -352
- package/dist/block.d.ts +6 -0
- package/dist/block.js +59 -57
- package/dist/{calculator-BNH3GSJE.js → calculator-GIB7POFX.js} +2 -2
- package/dist/{chart-meta-BbjsRY7o.d.ts → chart-meta-uImk4eTn.d.ts} +1 -1
- package/dist/chart-meta.d.ts +2 -2
- package/dist/chart-meta.js +16 -16
- package/dist/{chart-types-Cppnp31G.d.ts → chart-types-CBVYiLqy.d.ts} +1 -5
- package/dist/{charts-d3-SZV2SFTM.js → charts-d3-IRP5VANE.js} +5 -5
- package/dist/{chunk-MLY5ALOV.js → chunk-2BYFNZVM.js} +2 -2
- package/dist/{chunk-OSSTOSXU.js → chunk-2M3K6GD2.js} +3 -6
- package/dist/{chunk-CDM6XMOT.js → chunk-34JOHSVE.js} +2 -2
- package/dist/chunk-35A3J4Z5.js +14 -0
- package/dist/{chunk-HI6R27YA.js → chunk-3W73ZP6W.js} +9 -4
- package/dist/{chunk-IHN6WDEY.js → chunk-4B45SNZH.js} +5 -5
- package/dist/{chunk-AULZD45V.js → chunk-5ARANBIE.js} +2 -2
- package/dist/{chunk-DDIOWNHS.js → chunk-5BG4OSWJ.js} +6 -6
- package/dist/{chunk-6JCTW74W.js → chunk-5G4DOOX2.js} +1 -1
- package/dist/{chunk-JT2BG7LM.js → chunk-5GU6C5WB.js} +3 -3
- package/dist/{chunk-EBIDNRSR.js → chunk-5H7SA5ZD.js} +1 -1
- package/dist/{chunk-CN4RDJDV.js → chunk-5LG526X7.js} +1 -1
- package/dist/{chunk-VDY2GR6U.js → chunk-67N26CER.js} +2 -2
- package/dist/{chunk-G3HZ4PGE.js → chunk-67RKJEKF.js} +6 -6
- package/dist/{chunk-D3K4U3ZM.js → chunk-6K2W3FH7.js} +8 -5
- package/dist/{chunk-C6G36F5S.js → chunk-7UWVHNPM.js} +4 -4
- package/dist/{chunk-FWVE373X.js → chunk-AQRSEQZV.js} +1 -1
- package/dist/{chunk-BQO24BDM.js → chunk-AUXUNV73.js} +1 -1
- package/dist/{chunk-3PP746YM.js → chunk-B2YVZ3QU.js} +1 -1
- package/dist/{chunk-QPQWY5RU.js → chunk-B5CEV7IR.js} +3 -3
- package/dist/{chunk-J7Q4AB23.js → chunk-B7BSRVNC.js} +2 -2
- package/dist/{chunk-IXHWS2HI.js → chunk-BD4O4D2A.js} +2 -2
- package/dist/{chunk-4TEPDQHJ.js → chunk-BUVLLK3D.js} +7 -7
- package/dist/{chunk-B25IWGDH.js → chunk-CD7VQCDL.js} +8 -8
- package/dist/{chunk-I37S3EZE.js → chunk-CP73WWLN.js} +371 -286
- package/dist/{chunk-GI5R5B3S.js → chunk-D7DGLJ7N.js} +2 -2
- package/dist/{chunk-3TWBMU7K.js → chunk-DKCVAQU3.js} +9 -9
- package/dist/{chunk-KBDMEOLI.js → chunk-DPNSDCR3.js} +1 -1
- package/dist/{chunk-BRGRIZQB.js → chunk-DWMQ24JR.js} +2 -2
- package/dist/{chunk-4XYZJTFO.js → chunk-EM5SA7NC.js} +11 -3
- package/dist/{chunk-AM42TLSZ.js → chunk-EMGNCG5C.js} +1 -1
- package/dist/{chunk-3KVUFHUJ.js → chunk-EPB3UEMD.js} +2 -2
- package/dist/{chunk-NXU4N5WT.js → chunk-EZ6BI5LL.js} +1 -1
- package/dist/{chunk-2ZW4NBYX.js → chunk-FBK32S4D.js} +1 -1
- package/dist/{chunk-2I4UQG7W.js → chunk-FHX373L5.js} +1 -1
- package/dist/{chunk-AQQUJEDN.js → chunk-FKJWZWNU.js} +1 -1
- package/dist/{chunk-TIIZIAGS.js → chunk-FUYEXLAN.js} +6 -13
- package/dist/{chunk-TASRGDYP.js → chunk-GEHK4UD5.js} +3 -3
- package/dist/{chunk-ZD3QCNB7.js → chunk-GLL237AP.js} +2 -2
- package/dist/{chunk-PGSGJLUR.js → chunk-GM2SLMQW.js} +2 -2
- package/dist/{chunk-NOQB4KMV.js → chunk-H7JVKUA5.js} +5 -5
- package/dist/{chunk-DNM3XZCK.js → chunk-H7RQG4PH.js} +2 -2
- package/dist/{chunk-7SXV7NUS.js → chunk-HH3DHNQA.js} +2 -2
- package/dist/{chunk-GWQRTA5W.js → chunk-HZX4QZGR.js} +1 -1
- package/dist/{chunk-KBEWVCK3.js → chunk-I2I2FKAK.js} +1 -1
- package/dist/{chunk-2HSHWPTO.js → chunk-I3ZRIMR7.js} +10 -10
- package/dist/{chunk-7IOZ6JE4.js → chunk-IKXQ6NVR.js} +7 -7
- package/dist/{chunk-XJQ6Z3FO.js → chunk-IQZSKWE5.js} +3 -3
- package/dist/{chunk-3GUEYQGL.js → chunk-ITDF3MWD.js} +3 -3
- package/dist/{chunk-JXGSTBW6.js → chunk-IU7XKZA6.js} +2 -2
- package/dist/{chunk-RITTLIDJ.js → chunk-IZFJZCF6.js} +4 -4
- package/dist/{chunk-DRQSB72S.js → chunk-JBAFAKGX.js} +7 -7
- package/dist/{chunk-VSAKEMDD.js → chunk-JCC3B2GS.js} +8 -2
- package/dist/{chunk-66JTY4AN.js → chunk-JRN2CRXJ.js} +1 -1
- package/dist/{chunk-2FDQEQID.js → chunk-K2SFH3GJ.js} +2 -2
- package/dist/{chunk-NM5V5EKY.js → chunk-K2WXMXI2.js} +1 -1
- package/dist/{chunk-XKCRKD2B.js → chunk-KDWEOT54.js} +24 -12
- package/dist/{chunk-PVWIBKV2.js → chunk-KQAPFIYF.js} +2 -2
- package/dist/{chunk-4SACN2C5.js → chunk-LGUFJ7Y2.js} +1 -1
- package/dist/{chunk-AYUSD4Z6.js → chunk-LRHPBWOY.js} +5 -5
- package/dist/{chunk-DLJJOCIT.js → chunk-M4ZUIW3J.js} +3 -3
- package/dist/{chunk-CIHHTS5B.js → chunk-MAYTYF5S.js} +3 -3
- package/dist/{chunk-5ZUZZDW5.js → chunk-MVUNMJKO.js} +46 -52
- package/dist/{chunk-KBHT5XEY.js → chunk-MYHR3PMH.js} +194 -35
- package/dist/{chunk-NBAAIRFP.js → chunk-NI4L6HEU.js} +4 -1
- package/dist/{chunk-A2A2I4Z4.js → chunk-O2HNVNKO.js} +2 -2
- package/dist/{chunk-2XMTZ5JR.js → chunk-OAZ6BIIB.js} +3 -3
- package/dist/{chunk-IZHGT5HD.js → chunk-OO4GUE4E.js} +3 -3
- package/dist/{chunk-KSZB7TIY.js → chunk-OYGJZA24.js} +8 -8
- package/dist/{chunk-H6BT45SN.js → chunk-P2GNNEMN.js} +1 -1
- package/dist/{chunk-5HAYT43L.js → chunk-P3PSLC2K.js} +22 -6
- package/dist/{chunk-HHVIE45A.js → chunk-P6LKX3IQ.js} +4 -4
- package/dist/{chunk-NMS5XSLX.js → chunk-PGD6CNWO.js} +1 -1
- package/dist/{chunk-NVZ7R4EK.js → chunk-PWZEJNO6.js} +3 -3
- package/dist/{chunk-NPDVWFAQ.js → chunk-QEU6VM4O.js} +1 -1
- package/dist/{chunk-UIEKW4SG.js → chunk-R5L5E3TC.js} +0 -1
- package/dist/{chunk-2WQ3YZMN.js → chunk-RGFVHYDP.js} +2 -2
- package/dist/{chunk-YQMIKX54.js → chunk-RIK6WUMO.js} +62 -29
- package/dist/{chunk-BH2SF4TT.js → chunk-RTRORHSP.js} +1 -1
- package/dist/{chunk-4SP6OUO7.js → chunk-RVOSA4RR.js} +845 -193
- package/dist/{chunk-LKZCUFOW.js → chunk-SCYVGPLI.js} +2 -2
- package/dist/{chunk-XIUGSUE4.js → chunk-SIABEREK.js} +6 -2
- package/dist/{chunk-P7TRFL4P.js → chunk-SQBCNEJB.js} +4 -1
- package/dist/{chunk-3ZP3QC47.js → chunk-THTYCJGF.js} +2 -2
- package/dist/{chunk-4EX4OKGZ.js → chunk-TIPNNOZC.js} +5 -5
- package/dist/{chunk-UZ7EZW3B.js → chunk-TO53KK2P.js} +6 -1
- package/dist/{chunk-2MS623GW.js → chunk-TPCP2UOI.js} +3 -3
- package/dist/{chunk-Y3SIQN4J.js → chunk-TUOZ6AXC.js} +2 -2
- package/dist/{chunk-KRPLP5LP.js → chunk-U6N547QA.js} +1 -1
- package/dist/{chunk-RESEJSCV.js → chunk-VJ7NLYFE.js} +2 -2
- package/dist/{chunk-UXNA2H2V.js → chunk-VLI6AWS3.js} +2 -2
- package/dist/{chunk-TDAGJJPZ.js → chunk-VNAPEZX2.js} +1 -1
- package/dist/{chunk-EBVVMUAA.js → chunk-VVTCUIPN.js} +1 -1
- package/dist/{chunk-FVTYJUXR.js → chunk-W5MMPPGX.js} +2 -2
- package/dist/{chunk-BQMHJ6OW.js → chunk-WGNP5ND2.js} +20 -12
- package/dist/{chunk-5OTA2PUH.js → chunk-WLGOIMTI.js} +2 -2
- package/dist/{chunk-IGJEKO2P.js → chunk-WTPS73RM.js} +4 -4
- package/dist/{chunk-R6EGUTIV.js → chunk-YFIUABSF.js} +2 -2
- package/dist/{chunk-7PJBJ2DU.js → chunk-YSGOXZBB.js} +1 -1
- package/dist/{chunk-ZECJ7Q6C.js → chunk-YVIPJGFG.js} +2 -2
- package/dist/{chunk-5KKZXA44.js → chunk-ZBOIYC2G.js} +4 -2
- package/dist/{chunk-RBVFNUAL.js → chunk-ZOKD5F7M.js} +2 -2
- package/dist/{collapse-BSPH3BFM.js → collapse-6X5S2S3G.js} +2 -1
- package/dist/completion-registry.js +6 -37
- package/dist/copy-image.d.ts +34 -0
- package/dist/copy-image.js +96 -0
- package/dist/countdown.js +1 -1
- package/dist/dgmo-router-EPBQKQW2.js +100 -0
- package/dist/{dimensions-DS6FWLRY.js → dimensions-DBCRBZIU.js} +4 -4
- package/dist/editor.js +2 -7
- package/dist/{flowchart-parser-NZXASOZG.js → flowchart-parser-SM5LHF2D.js} +4 -4
- package/dist/{flowchart-renderer-PTCRIANF.js → flowchart-renderer-PPS2GTTD.js} +10 -10
- package/dist/highlight.js +3 -8
- package/dist/index.d.ts +42 -6
- package/dist/index.js +62 -57
- package/dist/{layout-MXHR3P35.js → layout-3J72UULM.js} +3 -3
- package/dist/{layout-U3AH6M7J.js → layout-AF4KA5B2.js} +4 -4
- package/dist/{layout-IT4ZTV6C.js → layout-FCFUVCRI.js} +7 -7
- package/dist/{layout-KV27UW25.js → layout-H2KP5A6M.js} +1 -1
- package/dist/{layout-ND26WVX2.js → layout-IXQNVRBE.js} +3 -3
- package/dist/{layout-ISSBWBH7.js → layout-KELSNWBD.js} +7 -7
- package/dist/{layout-JTIRCKAW.js → layout-LNVIH45F.js} +3 -3
- package/dist/{layout-VC3MXRB4.js → layout-MPSH3YWE.js} +7 -7
- package/dist/{layout-HFBK5UEG.js → layout-PPIVGJXD.js} +2 -2
- package/dist/{layout-RH3N46HP.js → layout-R6G4MEO3.js} +4 -3
- package/dist/{layout-search-BBX2BMEF.js → layout-search-C2TYUH4L.js} +5 -5
- package/dist/{parser-BT4NI6JY.js → parser-2AXU2MHJ.js} +3 -3
- package/dist/{parser-3QIFY5IN.js → parser-4BOP77CD.js} +2 -2
- package/dist/{parser-TAYRTCPR.js → parser-4GHAYZKZ.js} +5 -5
- package/dist/{parser-LTRQASGB.js → parser-5HQPPVHJ.js} +3 -3
- package/dist/{parser-EAQPZX2B.js → parser-5RUD4A3X.js} +3 -3
- package/dist/{parser-BJ7RJNUM.js → parser-6WURFLOB.js} +3 -3
- package/dist/{parser-R3LPEQIT.js → parser-722KLLAQ.js} +4 -4
- package/dist/{parser-KMKVFET2.js → parser-B7SCN7FG.js} +2 -2
- package/dist/{parser-TUAEX6ML.js → parser-BNRX35NT.js} +3 -3
- package/dist/{parser-NL73FSFI.js → parser-BPYHIG24.js} +3 -3
- package/dist/{parser-3LT3ZUUC.js → parser-CRJYLOHA.js} +2 -2
- package/dist/{parser-NUU3DVW4.js → parser-DGLKH4NT.js} +2 -2
- package/dist/{parser-5UZV32ZI.js → parser-DRUGM3R6.js} +2 -2
- package/dist/{parser-KLCSFQ3J.js → parser-DWV2CYBS.js} +3 -3
- package/dist/{parser-2IKPQVKX.js → parser-F3JJNIFC.js} +3 -3
- package/dist/{parser-EFF22GYO.js → parser-F75WNYMK.js} +3 -3
- package/dist/{parser-RTWPFKXG.js → parser-GBQY3WOZ.js} +3 -3
- package/dist/{parser-F7NDRPMA.js → parser-GM5B2EPW.js} +3 -3
- package/dist/{parser-K2DI26SC.js → parser-H6HT2WFQ.js} +2 -2
- package/dist/{parser-PEZ7RN43.js → parser-HM6FEX5K.js} +3 -3
- package/dist/{parser-YG625J5H.js → parser-L7SI3PW4.js} +4 -4
- package/dist/{parser-GMQJISZ6.js → parser-LUJX7AXO.js} +2 -2
- package/dist/{parser-A3AN76RQ.js → parser-MWINQNQW.js} +3 -3
- package/dist/{parser-KJPPUN4D.js → parser-OHBBDCG4.js} +2 -2
- package/dist/{parser-4RFY7D52.js → parser-QWTECQEC.js} +5 -5
- package/dist/{parser-4TBSWULQ.js → parser-TTGZYLYD.js} +3 -3
- package/dist/{parser-6TDWUKM5.js → parser-UHKROC7Z.js} +3 -3
- package/dist/{parser-H5OODY5N.js → parser-W6NX3AIV.js} +3 -3
- package/dist/{parser-GDLKUBTO.js → parser-WIKXZP4X.js} +2 -2
- package/dist/{parser-4Y6PODW6.js → parser-XEJP37GQ.js} +3 -3
- package/dist/{parser-RCIEKN7Y.js → parser-Y7QXD2UR.js} +2 -2
- package/dist/{parser-7QKQ4P4P.js → parser-ZV756RMP.js} +5 -5
- package/dist/{parser-KKF6Y5MM.js → parser-ZWWQZ4XZ.js} +4 -3
- package/dist/{redraw-AHW7EUUF.js → redraw-BZ4GI6IC.js} +6 -4
- package/dist/{redraw-STZ4WJAI.js → redraw-LEOXS7C6.js} +3 -3
- package/dist/{renderer-J3GPDK73.js → renderer-2MCV75JQ.js} +12 -12
- package/dist/{renderer-TINHO2IO.js → renderer-2V2XY2V7.js} +4 -4
- package/dist/{renderer-PHLCYVSN.js → renderer-5AEDVLAA.js} +8 -7
- package/dist/{renderer-W4MUMXJE.js → renderer-5GP7YUS4.js} +3 -3
- package/dist/{renderer-FMTLSOCX.js → renderer-66NCRXSC.js} +6 -6
- package/dist/{renderer-AM7P4LN7.js → renderer-6HU44IGJ.js} +4 -4
- package/dist/{renderer-JJ4QW3SK.js → renderer-7C76HP5W.js} +6 -6
- package/dist/{renderer-O6RP52CQ.js → renderer-7RAMBMTH.js} +6 -6
- package/dist/{renderer-M5DUMITP.js → renderer-BYLQ37T2.js} +8 -8
- package/dist/{renderer-7OGGV327.js → renderer-CVCCW7UT.js} +4 -4
- package/dist/{renderer-QTPWRRJ7.js → renderer-D6EH5UQ6.js} +6 -6
- package/dist/renderer-E3334XLT.js +84 -0
- package/dist/{renderer-IXBOT6DU.js → renderer-F7YGMEGQ.js} +2 -2
- package/dist/{renderer-XCLARXCK.js → renderer-GKY55M4Z.js} +5 -5
- package/dist/{renderer-KJ3V5BYP.js → renderer-LFZKG2GR.js} +5 -5
- package/dist/{renderer-2LYX6NHN.js → renderer-LJPUCG3U.js} +5 -5
- package/dist/{renderer-DAZWHNLI.js → renderer-MGF2NNGG.js} +3 -3
- package/dist/{renderer-HX6ICPDX.js → renderer-MVBAQP3M.js} +4 -4
- package/dist/{renderer-XOWDERU2.js → renderer-MZIWP55B.js} +5 -5
- package/dist/{renderer-MWZC7TMD.js → renderer-N6PM5CSG.js} +7 -7
- package/dist/{renderer-ISQJ2ELA.js → renderer-N75E3UVY.js} +5 -5
- package/dist/{renderer-53B523PM.js → renderer-ONENGXFQ.js} +7 -7
- package/dist/{renderer-RUSQJFFC.js → renderer-PEJF6R2I.js} +2 -2
- package/dist/{renderer-36446HSH.js → renderer-QZJZIAT3.js} +2 -2
- package/dist/{renderer-UTEEJDGB.js → renderer-SYRH3B62.js} +6 -6
- package/dist/{renderer-LNP23NSM.js → renderer-TS5NHOQD.js} +6 -6
- package/dist/{renderer-J7ZSTJUE.js → renderer-VNJOZPSH.js} +7 -7
- package/dist/{renderer-OUDHH5MV.js → renderer-VNUDN6F5.js} +12 -12
- package/dist/{renderer-JYHA6R2D.js → renderer-VUXAAGUG.js} +5 -5
- package/dist/{renderer-BXD5KVSR.js → renderer-YJVQT7QG.js} +6 -6
- package/dist/{renderer-radial-WFUX3Z3C.js → renderer-radial-4R7AKETK.js} +5 -5
- package/dist/{state-parser-KPVW5CRI.js → state-parser-EQBBEKHR.js} +5 -5
- package/dist/{state-renderer-ZVEI265C.js → state-renderer-SOGZ2CNN.js} +12 -12
- package/dist/{themes-DzIH3Hjv.d.ts → themes-CbJL3w8L.d.ts} +1 -1
- package/docs/ai-integration.md +5 -6
- package/docs/language-reference.md +69 -105
- package/gallery/fixtures/whiteboard.dgmo +1 -0
- package/package.json +5 -1
- package/dist/chunk-6BQSDF77.js +0 -734
- package/dist/chunk-NWSPPGIE.js +0 -60
- package/dist/chunk-VBMRZCMQ.js +0 -1465
- package/dist/chunk-WZBZXZ6T.js +0 -636
- package/dist/dgmo-router-E5O7RJSW.js +0 -101
- package/dist/layout-D4L44NRG.js +0 -11
- package/dist/parser-YHDGKPZI.js +0 -14
- package/dist/renderer-4SE7R22T.js +0 -85
- package/dist/renderer-WPN2SXGT.js +0 -29
- package/gallery/fixtures/sketch.dgmo +0 -22
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
drawCylinderCard,
|
|
3
3
|
drawQueueCard
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4B45SNZH.js";
|
|
5
5
|
import {
|
|
6
6
|
CYLINDER_RY,
|
|
7
|
+
FILE_WAVE,
|
|
7
8
|
QUEUE_CAP
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZBOIYC2G.js";
|
|
9
10
|
import {
|
|
10
11
|
WHITEBOARD_COLORS,
|
|
11
12
|
WHITEBOARD_NOTE_COLOR
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SQBCNEJB.js";
|
|
13
14
|
import {
|
|
14
15
|
renderChartTitle
|
|
15
16
|
} from "./chunk-6XLMTAEX.js";
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
} from "./chunk-VLC6WNRD.js";
|
|
19
20
|
import {
|
|
20
21
|
renderIntegratedLegend
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PGD6CNWO.js";
|
|
22
23
|
import {
|
|
23
24
|
getMaxLegendReservedHeight
|
|
24
25
|
} from "./chunk-JILEYZ2V.js";
|
|
@@ -68,6 +69,32 @@ function roundedRect(x, y, w, h, radius) {
|
|
|
68
69
|
...ellipse(x + w - r, y + h - r, r, r)
|
|
69
70
|
];
|
|
70
71
|
}
|
|
72
|
+
function whiteboardFileWave(h) {
|
|
73
|
+
return Math.max(0, Math.min(FILE_WAVE, h / 4));
|
|
74
|
+
}
|
|
75
|
+
var FILE_WAVE_STEPS = 16;
|
|
76
|
+
function whiteboardFileWavePoints(x, y, w, h, steps = FILE_WAVE_STEPS) {
|
|
77
|
+
const wave = whiteboardFileWave(h);
|
|
78
|
+
const b = y + h - wave;
|
|
79
|
+
const xs = [x + w, x + w * 0.75, x + w * 0.25, x];
|
|
80
|
+
const ys = [b, b + 2 * wave, b - wave, b];
|
|
81
|
+
const out = [];
|
|
82
|
+
for (let i = 0; i <= steps; i++) {
|
|
83
|
+
const t = i / steps;
|
|
84
|
+
const u = 1 - t;
|
|
85
|
+
const k = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
|
|
86
|
+
out.push({
|
|
87
|
+
x: k[0] * xs[0] + k[1] * xs[1] + k[2] * xs[2] + k[3] * xs[3],
|
|
88
|
+
y: k[0] * ys[0] + k[1] * ys[1] + k[2] * ys[2] + k[3] * ys[3]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
function whiteboardFilePath(x, y, w, h) {
|
|
94
|
+
const wave = whiteboardFileWave(h);
|
|
95
|
+
const b = y + h - wave;
|
|
96
|
+
return `M ${x} ${y} L ${x + w} ${y} L ${x + w} ${b} C ${x + w * 0.75} ${b + 2 * wave}, ${x + w * 0.25} ${b - wave}, ${x} ${b} Z`;
|
|
97
|
+
}
|
|
71
98
|
function piecesOf(s) {
|
|
72
99
|
const { x, y, width: w, height: h } = s;
|
|
73
100
|
if (s.kind === "note") {
|
|
@@ -105,6 +132,26 @@ function piecesOf(s) {
|
|
|
105
132
|
...ellipse(x + w - cap, cy, cap, h / 2)
|
|
106
133
|
];
|
|
107
134
|
}
|
|
135
|
+
case "file": {
|
|
136
|
+
const pts = whiteboardFileWavePoints(x, y, w, h);
|
|
137
|
+
const top = Math.min(...pts.map((p) => p.y));
|
|
138
|
+
const strips = [];
|
|
139
|
+
for (let i = pts.length - 1; i > 0; i--) {
|
|
140
|
+
const a = pts[i];
|
|
141
|
+
const b = pts[i - 1];
|
|
142
|
+
if (b.x - a.x < EPS || Math.max(a.y, b.y) - top < EPS) continue;
|
|
143
|
+
strips.push({
|
|
144
|
+
kind: "poly",
|
|
145
|
+
pts: [
|
|
146
|
+
{ x: a.x, y: top },
|
|
147
|
+
{ x: b.x, y: top },
|
|
148
|
+
{ x: b.x, y: Math.max(b.y, top) },
|
|
149
|
+
{ x: a.x, y: Math.max(a.y, top) }
|
|
150
|
+
]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return [...rect(x, y, x + w, top), ...strips];
|
|
154
|
+
}
|
|
108
155
|
}
|
|
109
156
|
}
|
|
110
157
|
function halfPlanes(pts) {
|
|
@@ -132,6 +179,17 @@ function pieceContains(p, px, py) {
|
|
|
132
179
|
function whiteboardShapeContains(shape, point) {
|
|
133
180
|
return piecesOf(shape).some((p) => pieceContains(p, point.x, point.y));
|
|
134
181
|
}
|
|
182
|
+
function whiteboardLabelPosition(shape, elements) {
|
|
183
|
+
if (shape.labelPosition) return shape.labelPosition;
|
|
184
|
+
return shape.shape === "rectangle" && whiteboardEnclosesAny(shape, elements) ? "top" : "middle";
|
|
185
|
+
}
|
|
186
|
+
function whiteboardEnclosesAny(outer, elements) {
|
|
187
|
+
const x1 = outer.x + outer.width;
|
|
188
|
+
const y1 = outer.y + outer.height;
|
|
189
|
+
return elements.some(
|
|
190
|
+
(el) => el !== outer && (el.kind === "shape" || el.kind === "note" || el.kind === "image") && el.x >= outer.x && el.y >= outer.y && el.x + el.width <= x1 && el.y + el.height <= y1 && !(el.x === outer.x && el.y === outer.y && el.width === outer.width && el.height === outer.height)
|
|
191
|
+
);
|
|
192
|
+
}
|
|
135
193
|
function whiteboardShapeAt(point, elements) {
|
|
136
194
|
for (let i = elements.length - 1; i >= 0; i--) {
|
|
137
195
|
const el = elements[i];
|
|
@@ -331,9 +389,35 @@ function whiteboardSegmentMidpoint(s) {
|
|
|
331
389
|
y: (s.y1 + 2 * s.cy + s.y2) / 4
|
|
332
390
|
};
|
|
333
391
|
}
|
|
392
|
+
var DRAW_BAND = {
|
|
393
|
+
image: 0,
|
|
394
|
+
shape: 1,
|
|
395
|
+
note: 1,
|
|
396
|
+
arrow: 1,
|
|
397
|
+
line: 1,
|
|
398
|
+
text: 2,
|
|
399
|
+
ink: 3
|
|
400
|
+
};
|
|
401
|
+
function whiteboardDrawBand(el) {
|
|
402
|
+
return DRAW_BAND[el.kind];
|
|
403
|
+
}
|
|
404
|
+
function whiteboardDrawOrder(elements) {
|
|
405
|
+
const key = elements.map((el, i) => {
|
|
406
|
+
if (el.kind !== "arrow" && el.kind !== "line") return i;
|
|
407
|
+
const { from, to } = whiteboardConnectorAttachments(el, elements);
|
|
408
|
+
const last = Math.max(from, to);
|
|
409
|
+
return last > i ? last + 0.5 : i;
|
|
410
|
+
});
|
|
411
|
+
return elements.map((_, i) => i).sort(
|
|
412
|
+
(a, b) => DRAW_BAND[elements[a].kind] - DRAW_BAND[elements[b].kind] || key[a] - key[b] || a - b
|
|
413
|
+
);
|
|
414
|
+
}
|
|
334
415
|
|
|
335
416
|
// src/whiteboard/label.ts
|
|
336
417
|
var WHITEBOARD_LABEL_FONT = 14;
|
|
418
|
+
var WHITEBOARD_CONTAINER_FONT = 16;
|
|
419
|
+
var WHITEBOARD_CONTAINER_WEIGHT = 600;
|
|
420
|
+
var CONTAINER_GAP = 4;
|
|
337
421
|
var WHITEBOARD_NOTE_FONT = 12;
|
|
338
422
|
var WHITEBOARD_LABEL_LINE = 1.25;
|
|
339
423
|
var LABEL_PAD = 8;
|
|
@@ -361,7 +445,7 @@ function whiteboardLabelHeight(box) {
|
|
|
361
445
|
return Math.max(box.height - 2 * WHITEBOARD_NOTE_PAD, 0);
|
|
362
446
|
}
|
|
363
447
|
const shape = "shape" in box ? box.shape : "rectangle";
|
|
364
|
-
const inset = shape === "ellipse" ? box.height * ELLIPSE_INSET : shape === "database" ? 2 * CYLINDER_RY : 0;
|
|
448
|
+
const inset = shape === "ellipse" ? box.height * ELLIPSE_INSET : shape === "database" ? 2 * CYLINDER_RY : shape === "file" ? whiteboardFileWave(box.height) / 2 : 0;
|
|
365
449
|
return Math.max(box.height - 2 * (LABEL_PAD + inset), 0);
|
|
366
450
|
}
|
|
367
451
|
function wrapWhiteboardLabel(label, box) {
|
|
@@ -370,20 +454,22 @@ function wrapWhiteboardLabel(label, box) {
|
|
|
370
454
|
const font = "kind" in box && box.kind === "note" ? WHITEBOARD_NOTE_FONT : WHITEBOARD_LABEL_FONT;
|
|
371
455
|
return label.split("\n").flatMap((line) => line ? wrapTextToWidth(line, font, width) : [""]);
|
|
372
456
|
}
|
|
373
|
-
function fitWhiteboardLabel(label, box) {
|
|
457
|
+
function fitWhiteboardLabel(label, box, opts = {}) {
|
|
374
458
|
const isNote = "kind" in box && box.kind === "note";
|
|
375
|
-
const full = isNote ? WHITEBOARD_NOTE_FONT : WHITEBOARD_LABEL_FONT;
|
|
459
|
+
const full = opts.font ?? (isNote ? WHITEBOARD_NOTE_FONT : WHITEBOARD_LABEL_FONT);
|
|
376
460
|
const pad = isNote ? WHITEBOARD_NOTE_PAD : LABEL_PAD;
|
|
377
461
|
if (!label) return { lines: [], font: full, top: pad };
|
|
462
|
+
const bold = opts.bold ?? false;
|
|
378
463
|
const width = whiteboardLabelWidth(box);
|
|
379
|
-
const height = whiteboardLabelHeight(box);
|
|
464
|
+
const height = opts.height ?? whiteboardLabelHeight(box);
|
|
465
|
+
const measure = (l, font2) => measureText(l, font2, { bold });
|
|
380
466
|
const wrap = (font2, hardBreak) => label.split("\n").flatMap(
|
|
381
|
-
(line) => line ? wrapTextToWidth(line, font2, width, { hardBreak }) : [""]
|
|
467
|
+
(line) => line ? wrapTextToWidth(line, font2, width, { hardBreak, bold }) : [""]
|
|
382
468
|
);
|
|
383
469
|
const tall = (n, font2) => n * font2 * WHITEBOARD_LABEL_LINE > height;
|
|
384
470
|
for (let font2 = full; font2 >= WHITEBOARD_LABEL_MIN_FONT; font2--) {
|
|
385
471
|
const lines2 = wrap(font2, false);
|
|
386
|
-
if (!tall(lines2.length, font2) && lines2.every((l) =>
|
|
472
|
+
if (!tall(lines2.length, font2) && lines2.every((l) => measure(l, font2) <= width))
|
|
387
473
|
return { lines: lines2, font: font2, top: pad };
|
|
388
474
|
}
|
|
389
475
|
const font = WHITEBOARD_LABEL_MIN_FONT;
|
|
@@ -399,11 +485,76 @@ function fitWhiteboardLabel(label, box) {
|
|
|
399
485
|
if (lines.length <= room) return { lines, font, top };
|
|
400
486
|
const kept = lines.slice(0, room);
|
|
401
487
|
let last = kept[room - 1];
|
|
402
|
-
while (last &&
|
|
488
|
+
while (last && measure(`${last}\u2026`, font) > width)
|
|
403
489
|
last = [...last].slice(0, -1).join("");
|
|
404
490
|
kept[room - 1] = `${last.trimEnd()}\u2026`;
|
|
405
491
|
return { lines: kept, font, top };
|
|
406
492
|
}
|
|
493
|
+
function whiteboardLabelCentreY(box, position, blockHeight) {
|
|
494
|
+
if (position === "middle") return box.y + box.height / 2;
|
|
495
|
+
const innerTop = box.y + (box.height - whiteboardLabelHeight(box)) / 2;
|
|
496
|
+
return innerTop + blockHeight / 2;
|
|
497
|
+
}
|
|
498
|
+
function whiteboardShapeLabel(el, elements, text = el.label) {
|
|
499
|
+
const block = (n, font2) => n * font2 * WHITEBOARD_LABEL_LINE;
|
|
500
|
+
const top = whiteboardLabelPosition(el, elements) === "top";
|
|
501
|
+
const inset = (el.height - whiteboardLabelHeight(el)) / 2;
|
|
502
|
+
const innerTop = el.y + inset;
|
|
503
|
+
const innerBottom = el.y + el.height - inset;
|
|
504
|
+
const spans = [];
|
|
505
|
+
for (const o of elements) {
|
|
506
|
+
if (o === el) continue;
|
|
507
|
+
if (o.kind !== "shape" && o.kind !== "note" && o.kind !== "image") continue;
|
|
508
|
+
const ox1 = o.x + o.width;
|
|
509
|
+
const oy1 = o.y + o.height;
|
|
510
|
+
const overlaps = o.x < el.x + el.width && ox1 > el.x && o.y < el.y + el.height && oy1 > el.y;
|
|
511
|
+
const encloses = o.x <= el.x && o.y <= el.y && ox1 >= el.x + el.width && oy1 >= el.y + el.height;
|
|
512
|
+
if (overlaps && !encloses)
|
|
513
|
+
spans.push([o.y - CONTAINER_GAP, oy1 + CONTAINER_GAP]);
|
|
514
|
+
}
|
|
515
|
+
spans.sort((a, b) => a[0] - b[0]);
|
|
516
|
+
const strips = [];
|
|
517
|
+
let from = innerTop;
|
|
518
|
+
for (const [y0, y1] of spans) {
|
|
519
|
+
if (y0 > from) strips.push([from, Math.min(y0, innerBottom)]);
|
|
520
|
+
from = Math.max(from, y1);
|
|
521
|
+
}
|
|
522
|
+
if (from < innerBottom) strips.push([from, innerBottom]);
|
|
523
|
+
const floorLine = block(1, WHITEBOARD_LABEL_MIN_FONT);
|
|
524
|
+
const roomy = strips.filter(([a, b]) => b - a >= floorLine);
|
|
525
|
+
const font = top ? WHITEBOARD_CONTAINER_FONT : WHITEBOARD_LABEL_FONT;
|
|
526
|
+
const opts = top ? { font, bold: true } : {};
|
|
527
|
+
const into = ([a, b], centre) => {
|
|
528
|
+
const fit2 = fitWhiteboardLabel(text, el, { ...opts, height: b - a });
|
|
529
|
+
const h = block(fit2.lines.length, fit2.font);
|
|
530
|
+
const cy = Math.min(Math.max(centre, a + h / 2), b - h / 2);
|
|
531
|
+
return { lines: fit2.lines, font: fit2.font, bold: top, cy, onEdge: false };
|
|
532
|
+
};
|
|
533
|
+
if (top) {
|
|
534
|
+
const first = roomy[0];
|
|
535
|
+
if (first?.[0] === innerTop) return into(first, -Infinity);
|
|
536
|
+
const last = roomy.at(-1);
|
|
537
|
+
if (last?.[1] === innerBottom) return into(last, Infinity);
|
|
538
|
+
} else {
|
|
539
|
+
const mid = el.y + el.height / 2;
|
|
540
|
+
const strip = roomy.find(([a, b]) => a <= mid && mid <= b) ?? roomy.reduce(
|
|
541
|
+
(best, s) => !best || s[1] - s[0] > best[1] - best[0] ? s : best,
|
|
542
|
+
void 0
|
|
543
|
+
);
|
|
544
|
+
if (strip) return into(strip, mid);
|
|
545
|
+
}
|
|
546
|
+
const fit = fitWhiteboardLabel(text.replace(/\n/g, " "), el, {
|
|
547
|
+
...opts,
|
|
548
|
+
height: block(1, font)
|
|
549
|
+
});
|
|
550
|
+
return {
|
|
551
|
+
lines: fit.lines.slice(0, 1),
|
|
552
|
+
font: fit.font,
|
|
553
|
+
bold: top,
|
|
554
|
+
cy: el.y,
|
|
555
|
+
onEdge: true
|
|
556
|
+
};
|
|
557
|
+
}
|
|
407
558
|
|
|
408
559
|
// src/whiteboard/renderer.ts
|
|
409
560
|
function visibleWhiteboardIndices(parsed, options = {}) {
|
|
@@ -477,8 +628,8 @@ var SAFE_IMAGE_HREF_RE = /^(https?:|blob:|data:image\/)/i;
|
|
|
477
628
|
function labelLines(label) {
|
|
478
629
|
return label.split("\n");
|
|
479
630
|
}
|
|
480
|
-
function widest(lines, font) {
|
|
481
|
-
return Math.max(0, ...lines.map((l) => measureText(l, font)));
|
|
631
|
+
function widest(lines, font, bold = false) {
|
|
632
|
+
return Math.max(0, ...lines.map((l) => measureText(l, font, { bold })));
|
|
482
633
|
}
|
|
483
634
|
function grow(b, x0, y0, x1, y1) {
|
|
484
635
|
b.minX = Math.min(b.minX, x0, x1);
|
|
@@ -498,7 +649,7 @@ function whiteboardBounds(parsed, options = {}) {
|
|
|
498
649
|
maxY: -Infinity
|
|
499
650
|
};
|
|
500
651
|
const elements = visibleWhiteboardElements(parsed, options);
|
|
501
|
-
const labelAt = placeConnectorLabels(elements);
|
|
652
|
+
const labelAt = placeConnectorLabels(elements, parsed.elements);
|
|
502
653
|
for (const el of elements) {
|
|
503
654
|
switch (el.kind) {
|
|
504
655
|
case "shape":
|
|
@@ -590,7 +741,7 @@ function connectorLabelBox(lines, x, y) {
|
|
|
590
741
|
const hh = lines.length * WHITEBOARD_LABEL_FONT * WHITEBOARD_LABEL_LINE / 2 + LABEL_CLEAR;
|
|
591
742
|
return { x0: x - hw, y0: y - hh, x1: x + hw, y1: y + hh };
|
|
592
743
|
}
|
|
593
|
-
function authoredTextBoxes(elements) {
|
|
744
|
+
function authoredTextBoxes(elements, all) {
|
|
594
745
|
const boxes = [];
|
|
595
746
|
for (const el of elements) {
|
|
596
747
|
if (el.kind === "text") {
|
|
@@ -609,20 +760,19 @@ function authoredTextBoxes(elements) {
|
|
|
609
760
|
y1: el.y + Math.max(el.height, noteTextHeight(el))
|
|
610
761
|
});
|
|
611
762
|
} else if (el.kind === "shape" && el.label) {
|
|
612
|
-
const { lines, font } =
|
|
763
|
+
const { lines, font, bold, cy } = whiteboardShapeLabel(el, all);
|
|
613
764
|
if (lines.length === 0) continue;
|
|
614
765
|
const cx = el.x + el.width / 2 + whiteboardLabelShift(el);
|
|
615
|
-
const cy = el.y + el.height / 2;
|
|
616
|
-
const hw = widest(lines, font) / 2;
|
|
617
766
|
const hh = lines.length * font * WHITEBOARD_LABEL_LINE / 2;
|
|
767
|
+
const hw = widest(lines, font, bold) / 2;
|
|
618
768
|
boxes.push({ x0: cx - hw, y0: cy - hh, x1: cx + hw, y1: cy + hh });
|
|
619
769
|
}
|
|
620
770
|
}
|
|
621
771
|
return boxes;
|
|
622
772
|
}
|
|
623
|
-
function placeConnectorLabels(elements) {
|
|
773
|
+
function placeConnectorLabels(elements, all) {
|
|
624
774
|
const placed = /* @__PURE__ */ new Map();
|
|
625
|
-
const taken = authoredTextBoxes(elements);
|
|
775
|
+
const taken = authoredTextBoxes(elements, all);
|
|
626
776
|
for (const el of elements) {
|
|
627
777
|
if (el.kind !== "arrow" && el.kind !== "line" || !el.label) continue;
|
|
628
778
|
const lines = labelLines(el.label);
|
|
@@ -739,7 +889,7 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
|
|
|
739
889
|
const titleOffset = showTitle ? TITLE_BAND : 0;
|
|
740
890
|
const elements = visibleWhiteboardElements(parsed, options);
|
|
741
891
|
const b = whiteboardBounds(parsed, options);
|
|
742
|
-
const labelAt = placeConnectorLabels(elements);
|
|
892
|
+
const labelAt = placeConnectorLabels(elements, parsed.elements);
|
|
743
893
|
const contentW = b.maxX - b.minX;
|
|
744
894
|
const contentH = b.maxY - b.minY;
|
|
745
895
|
const titleW = showTitle ? measureText(parsed.title, TITLE_FONT_SIZE, { bold: true }) : 0;
|
|
@@ -783,11 +933,16 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
|
|
|
783
933
|
}
|
|
784
934
|
const canvas = svg.append("g").attr("class", "whiteboard-canvas").attr("transform", `translate(${round2(tx)},${round2(ty)})`);
|
|
785
935
|
const halo = palette.bg;
|
|
786
|
-
const centredLabel = (g, {
|
|
936
|
+
const centredLabel = (g, {
|
|
937
|
+
lines,
|
|
938
|
+
font,
|
|
939
|
+
bold
|
|
940
|
+
}, cx, cy, color, ground) => {
|
|
787
941
|
if (lines.length === 0) return;
|
|
788
942
|
const lh = font * WHITEBOARD_LABEL_LINE;
|
|
789
943
|
const top = cy - lines.length * lh / 2 + lh * BASELINE;
|
|
790
944
|
const t = g.append("text").attr("class", "whiteboard-label").attr("text-anchor", "middle").attr("font-size", font).attr("fill", color).attr("stroke", ground).attr("stroke-width", LABEL_HALO).attr("stroke-linejoin", "round").attr("paint-order", "stroke");
|
|
945
|
+
if (bold) t.attr("font-weight", WHITEBOARD_CONTAINER_WEIGHT);
|
|
791
946
|
appendLines(t, lines, cx, top, lh);
|
|
792
947
|
};
|
|
793
948
|
const drawImage = (g, el) => {
|
|
@@ -820,6 +975,8 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
|
|
|
820
975
|
g.append("rect").attr("x", el.x).attr("y", el.y).attr("width", el.width).attr("height", el.height).attr("rx", Math.min(RECT_RADIUS, el.width / 2, el.height / 2)).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", SHAPE_STROKE);
|
|
821
976
|
} else if (el.shape === "ellipse") {
|
|
822
977
|
g.append("ellipse").attr("cx", cx).attr("cy", cy).attr("rx", el.width / 2).attr("ry", el.height / 2).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", SHAPE_STROKE);
|
|
978
|
+
} else if (el.shape === "file") {
|
|
979
|
+
g.append("path").attr("d", whiteboardFilePath(el.x, el.y, el.width, el.height)).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", SHAPE_STROKE);
|
|
823
980
|
} else {
|
|
824
981
|
const inner = g.append("g").attr("transform", `translate(${round2(cx)},${round2(cy)})`);
|
|
825
982
|
if (el.shape === "database") {
|
|
@@ -828,13 +985,14 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
|
|
|
828
985
|
drawQueueCard(inner, el.width, el.height, fill, stroke);
|
|
829
986
|
}
|
|
830
987
|
}
|
|
988
|
+
const label = whiteboardShapeLabel(el, parsed.elements);
|
|
831
989
|
centredLabel(
|
|
832
990
|
g,
|
|
833
|
-
|
|
991
|
+
label,
|
|
834
992
|
cx + whiteboardLabelShift(el),
|
|
835
|
-
cy,
|
|
993
|
+
label.cy,
|
|
836
994
|
labelColor,
|
|
837
|
-
fill === "none" ? halo : fill
|
|
995
|
+
label.onEdge || fill === "none" ? halo : fill
|
|
838
996
|
);
|
|
839
997
|
break;
|
|
840
998
|
}
|
|
@@ -926,17 +1084,8 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
|
|
|
926
1084
|
};
|
|
927
1085
|
for (const el of inDrawOrder(elements)) drawElement(el);
|
|
928
1086
|
}
|
|
929
|
-
var DRAW_BAND = {
|
|
930
|
-
image: 0,
|
|
931
|
-
shape: 1,
|
|
932
|
-
note: 2,
|
|
933
|
-
arrow: 3,
|
|
934
|
-
line: 3,
|
|
935
|
-
text: 4,
|
|
936
|
-
ink: 5
|
|
937
|
-
};
|
|
938
1087
|
function inDrawOrder(elements) {
|
|
939
|
-
return elements.map((
|
|
1088
|
+
return whiteboardDrawOrder(elements).map((i) => elements[i]);
|
|
940
1089
|
}
|
|
941
1090
|
function appendLines(t, lines, x, firstY, lh) {
|
|
942
1091
|
lines.forEach((ln, i) => {
|
|
@@ -950,13 +1099,21 @@ function round2(n) {
|
|
|
950
1099
|
|
|
951
1100
|
export {
|
|
952
1101
|
whiteboardNoteFold,
|
|
1102
|
+
whiteboardFileWave,
|
|
1103
|
+
whiteboardFileWavePoints,
|
|
1104
|
+
whiteboardFilePath,
|
|
953
1105
|
whiteboardShapeContains,
|
|
1106
|
+
whiteboardLabelPosition,
|
|
954
1107
|
whiteboardShapeAt,
|
|
955
1108
|
whiteboardConnectorAttachments,
|
|
956
1109
|
clipWhiteboardConnector,
|
|
957
1110
|
whiteboardBendHandle,
|
|
958
1111
|
whiteboardBendFor,
|
|
959
1112
|
whiteboardSegmentMidpoint,
|
|
1113
|
+
whiteboardDrawBand,
|
|
1114
|
+
whiteboardDrawOrder,
|
|
1115
|
+
WHITEBOARD_CONTAINER_FONT,
|
|
1116
|
+
WHITEBOARD_CONTAINER_WEIGHT,
|
|
960
1117
|
WHITEBOARD_NOTE_FONT,
|
|
961
1118
|
WHITEBOARD_LABEL_MIN_FONT,
|
|
962
1119
|
whiteboardLabelWidth,
|
|
@@ -964,6 +1121,8 @@ export {
|
|
|
964
1121
|
whiteboardLabelHeight,
|
|
965
1122
|
wrapWhiteboardLabel,
|
|
966
1123
|
fitWhiteboardLabel,
|
|
1124
|
+
whiteboardLabelCentreY,
|
|
1125
|
+
whiteboardShapeLabel,
|
|
967
1126
|
visibleWhiteboardIndices,
|
|
968
1127
|
visibleWhiteboardElements,
|
|
969
1128
|
IMAGE_NOT_UPLOADED,
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// src/pert/layout.ts
|
|
12
12
|
import dagre from "@dagrejs/dagre";
|
|
13
|
+
function layoutInPlace(g) {
|
|
14
|
+
dagre.layout(g);
|
|
15
|
+
}
|
|
13
16
|
var DEFAULT_NODE_HEIGHT = 90;
|
|
14
17
|
var MILESTONE_NODE_HEIGHT = DEFAULT_NODE_HEIGHT;
|
|
15
18
|
var COLLAPSED_GROUP_HEIGHT = 90;
|
|
@@ -185,7 +188,7 @@ function relayoutPert(resolved, overrides, collapsedGroupIds = /* @__PURE__ */ n
|
|
|
185
188
|
seenEdges.add(k);
|
|
186
189
|
g.setEdge(src, tgt, {});
|
|
187
190
|
}
|
|
188
|
-
|
|
191
|
+
layoutInPlace(g);
|
|
189
192
|
const swimApplied = applySwimLanes(
|
|
190
193
|
g,
|
|
191
194
|
resolved,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
injectDefaultTagMetadata,
|
|
10
10
|
resolveTagColor,
|
|
11
11
|
tagAttrKey
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
13
13
|
import {
|
|
14
14
|
legendSuppressed
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FUYEXLAN.js";
|
|
16
16
|
import {
|
|
17
17
|
LEGEND_CAPSULE_PAD,
|
|
18
18
|
LEGEND_DOT_R,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
resolveNotes,
|
|
6
6
|
tryCollectNote
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HH3DHNQA.js";
|
|
8
8
|
import {
|
|
9
9
|
normalizeName
|
|
10
10
|
} from "./chunk-NOTA6TEI.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
tagAttrKey,
|
|
19
19
|
validateTagGroupNames,
|
|
20
20
|
validateTagValues
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
22
22
|
import {
|
|
23
23
|
AliasRegistry,
|
|
24
24
|
BOXES_AND_LINES_REGISTRY,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
tryParseSharedOption,
|
|
32
32
|
warnUnknownMetaKeys,
|
|
33
33
|
withTagAliases
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FUYEXLAN.js";
|
|
35
35
|
import {
|
|
36
36
|
makeDgmoError,
|
|
37
37
|
suggest
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
INLINE_HEADER_PAD,
|
|
12
12
|
layoutInlineHeader
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-R5L5E3TC.js";
|
|
14
14
|
import {
|
|
15
15
|
TITLE_FONT_SIZE,
|
|
16
16
|
TITLE_FONT_WEIGHT,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
keepSwimlaneToggleFocus,
|
|
26
26
|
renderIntegratedLegend,
|
|
27
27
|
wireSwimlaneToggle
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PGD6CNWO.js";
|
|
29
29
|
import {
|
|
30
30
|
controlsGroupCapsuleWidth,
|
|
31
31
|
getLegendExtent,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
resolveActiveTagGroup,
|
|
43
43
|
resolveTagColor,
|
|
44
44
|
tagAttrKey
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
46
46
|
import {
|
|
47
47
|
LEGEND_CAPSULE_PAD,
|
|
48
48
|
LEGEND_DOT_R,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computeNodeSizing,
|
|
3
|
-
layoutPert
|
|
4
|
-
} from "./chunk-NBAAIRFP.js";
|
|
5
1
|
import {
|
|
6
2
|
analyzePert
|
|
7
3
|
} from "./chunk-FOTH2WWP.js";
|
|
4
|
+
import {
|
|
5
|
+
computeNodeSizing,
|
|
6
|
+
layoutPert
|
|
7
|
+
} from "./chunk-NI4L6HEU.js";
|
|
8
8
|
import {
|
|
9
9
|
serializeSvg
|
|
10
10
|
} from "./chunk-CYRB2JTN.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
INLINE_HEADER_PAD,
|
|
16
16
|
layoutInlineHeader
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-R5L5E3TC.js";
|
|
18
18
|
import {
|
|
19
19
|
CAPTION_BOX_PADDING_X,
|
|
20
20
|
CAPTION_BOX_PADDING_Y,
|
|
@@ -43,13 +43,13 @@ import {
|
|
|
43
43
|
} from "./chunk-XCKNFFKM.js";
|
|
44
44
|
import {
|
|
45
45
|
renderIntegratedLegend
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-PGD6CNWO.js";
|
|
47
47
|
import {
|
|
48
48
|
getLegendExtent
|
|
49
49
|
} from "./chunk-JILEYZ2V.js";
|
|
50
50
|
import {
|
|
51
51
|
parsePert
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-34JOHSVE.js";
|
|
53
53
|
import {
|
|
54
54
|
addCalendarDays,
|
|
55
55
|
formatDuration,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
resolveGroupTagColor,
|
|
67
67
|
resolveTagColor,
|
|
68
68
|
tagAttrKey
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
70
70
|
import {
|
|
71
71
|
LEGEND_HEIGHT
|
|
72
72
|
} from "./chunk-UOCWYLYT.js";
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WHITEBOARD_COLORS,
|
|
3
3
|
WHITEBOARD_ELEMENT_KEYWORDS,
|
|
4
|
+
WHITEBOARD_LABEL_POSITIONS,
|
|
4
5
|
WHITEBOARD_NOTE_COLOR,
|
|
5
6
|
WHITEBOARD_NOTE_HEIGHT,
|
|
6
7
|
WHITEBOARD_NOTE_WIDTH,
|
|
7
8
|
isWhiteboardColor,
|
|
8
9
|
isWhiteboardShapeKind
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SQBCNEJB.js";
|
|
10
11
|
import {
|
|
11
12
|
extractPaletteDirective
|
|
12
13
|
} from "./chunk-CYTFO2LF.js";
|
|
13
14
|
import {
|
|
14
15
|
matchTagBlockHeading
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
16
17
|
import {
|
|
17
18
|
parseFirstLine,
|
|
18
19
|
recognizeGlobalBoolean
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FUYEXLAN.js";
|
|
20
21
|
import {
|
|
21
22
|
makeDgmoError,
|
|
22
23
|
makeFail,
|
|
@@ -45,7 +46,7 @@ var WHITEBOARD_DIAGNOSTICS = [
|
|
|
45
46
|
severity: "warning",
|
|
46
47
|
chartType: "whiteboard",
|
|
47
48
|
title: "Unknown whiteboard element",
|
|
48
|
-
message: (p) => `Unknown element "${s(p.word)}" \u2014 a whiteboard line starts with rectangle, ellipse, database, queue, note, arrow, line, text, image or ink; line skipped${p.hint ? `. ${s(p.hint)}` : ""}`,
|
|
49
|
+
message: (p) => `Unknown element "${s(p.word)}" \u2014 a whiteboard line starts with rectangle, ellipse, database, queue, file, note, arrow, line, text, image or ink; line skipped${p.hint ? `. ${s(p.hint)}` : ""}`,
|
|
49
50
|
hint: "Start the line with one of the ten element keywords.",
|
|
50
51
|
example: "whiteboard\nsquare Start at: 0 0, size: 120 60"
|
|
51
52
|
},
|
|
@@ -100,7 +101,7 @@ var WHITEBOARD_DIAGNOSTICS = [
|
|
|
100
101
|
chartType: "whiteboard",
|
|
101
102
|
title: "Unknown whiteboard value",
|
|
102
103
|
message: (p) => `Unknown ${s(p.key)}: "${s(p.value)}" \u2014 ${s(p.fallback)} used instead (valid: ${s(p.valid)})${p.hint ? `. ${s(p.hint)}` : ""}`,
|
|
103
|
-
hint: "Shapes take `fill: solid` or `fill: outline`; arrows take `heads: both`; arrows and lines take `bend:` as a whole number.",
|
|
104
|
+
hint: "Shapes take `fill: solid` or `fill: outline`, and `label: top` or `label: middle`; arrows take `heads: both`; arrows and lines take `bend:` as a whole number.",
|
|
104
105
|
example: "whiteboard\nrectangle at: 0 0, size: 100 60, fill: hatched"
|
|
105
106
|
},
|
|
106
107
|
{
|
|
@@ -353,8 +354,9 @@ var INK_WIDTH_RE = /^\d+(\.\d+)?$/;
|
|
|
353
354
|
var INK_WIDTH_MAX = 200;
|
|
354
355
|
var WRITTEN_STYLES = ["dashed"];
|
|
355
356
|
var WRITTEN_FILLS = ["solid", "outline"];
|
|
357
|
+
var labelPart = (p) => p ? { labelPosition: p } : {};
|
|
356
358
|
var KEYS_BY_KIND = {
|
|
357
|
-
shape: ["at", "size", "color", "fill"],
|
|
359
|
+
shape: ["at", "size", "color", "fill", "label"],
|
|
358
360
|
note: ["at", "size", "color"],
|
|
359
361
|
arrow: ["from", "to", "color", "style", "heads", "bend"],
|
|
360
362
|
line: ["from", "to", "color", "style", "bend"],
|
|
@@ -480,6 +482,19 @@ function parseWhiteboard(content, _palette) {
|
|
|
480
482
|
});
|
|
481
483
|
return "tint";
|
|
482
484
|
};
|
|
485
|
+
const readLabelPosition = (raw, line) => {
|
|
486
|
+
if (raw === void 0) return void 0;
|
|
487
|
+
const v = raw.trim().toLowerCase();
|
|
488
|
+
if (v === "top" || v === "middle") return v;
|
|
489
|
+
warn(line, WHITEBOARD_DIAGNOSTIC_CODES.BAD_VALUE, {
|
|
490
|
+
key: "label",
|
|
491
|
+
value: raw,
|
|
492
|
+
fallback: "automatic",
|
|
493
|
+
valid: WHITEBOARD_LABEL_POSITIONS.join(", "),
|
|
494
|
+
hint: suggest(v, WHITEBOARD_LABEL_POSITIONS) ?? ""
|
|
495
|
+
});
|
|
496
|
+
return void 0;
|
|
497
|
+
};
|
|
483
498
|
const readHeads = (raw, line) => {
|
|
484
499
|
if (raw === void 0) return "end";
|
|
485
500
|
const v = raw.trim().toLowerCase();
|
|
@@ -684,6 +699,7 @@ function parseWhiteboard(content, _palette) {
|
|
|
684
699
|
label: joinLabel(name, body),
|
|
685
700
|
color: readColor(meta.get("color"), lineNumber),
|
|
686
701
|
fill: readFill(meta.get("fill"), lineNumber),
|
|
702
|
+
...labelPart(readLabelPosition(meta.get("label"), lineNumber)),
|
|
687
703
|
lineNumber
|
|
688
704
|
});
|
|
689
705
|
continue;
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
mapLegendConfig,
|
|
4
4
|
mapLegendGroups,
|
|
5
5
|
parsePathRings
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EMGNCG5C.js";
|
|
7
7
|
import {
|
|
8
8
|
buildSwatches
|
|
9
9
|
} from "./chunk-T7NWBVSC.js";
|
|
10
10
|
import {
|
|
11
11
|
parseClock
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EZ6BI5LL.js";
|
|
13
13
|
import {
|
|
14
14
|
fixedParts,
|
|
15
15
|
fixedTimeCells,
|
|
@@ -25,13 +25,13 @@ import {
|
|
|
25
25
|
} from "./chunk-VLC6WNRD.js";
|
|
26
26
|
import {
|
|
27
27
|
renderIntegratedLegend
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PGD6CNWO.js";
|
|
29
29
|
import {
|
|
30
30
|
FONT_FAMILY
|
|
31
31
|
} from "./chunk-ICLB27PZ.js";
|
|
32
32
|
import {
|
|
33
33
|
tagAttrKey
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-LGUFJ7Y2.js";
|
|
35
35
|
import {
|
|
36
36
|
measureText
|
|
37
37
|
} from "./chunk-KAO7JL4I.js";
|