@diagrammo/dgmo 0.46.0 → 0.47.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.cts +3 -855
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.cjs +1 -1
- 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/dist/chunk-7JEGTRLD.js +338 -0
- 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/chunk-DKEPS5LH.js +315 -0
- 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/dist/chunk-QEBUY5NY.js +1685 -0
- 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/dist/chunk-YRYKTYMQ.js +186 -0
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/dist/chunk-Z72XRXD4.js +787 -0
- 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.cjs +1 -1
- 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.cjs +3 -3
- package/dist/index.d.cts +3 -469
- 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.cts +908 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/utils/title-constants.ts
|
|
2
|
+
var TITLE_FONT_SIZE = 20;
|
|
3
|
+
var TITLE_FONT_WEIGHT = "700";
|
|
4
|
+
var TITLE_Y = 30;
|
|
5
|
+
var TITLE_OFFSET = 40;
|
|
6
|
+
var CAPTION_FONT_SIZE = 13;
|
|
7
|
+
var CAPTION_FONT_WEIGHT = "400";
|
|
8
|
+
var CAPTION_LINE_HEIGHT = 18;
|
|
9
|
+
var CAPTION_TOP_GAP = 12;
|
|
10
|
+
var CAPTION_BOX_PADDING_X = 16;
|
|
11
|
+
var CAPTION_BOX_PADDING_Y = 12;
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
TITLE_FONT_SIZE,
|
|
15
|
+
TITLE_FONT_WEIGHT,
|
|
16
|
+
TITLE_Y,
|
|
17
|
+
TITLE_OFFSET,
|
|
18
|
+
CAPTION_FONT_SIZE,
|
|
19
|
+
CAPTION_FONT_WEIGHT,
|
|
20
|
+
CAPTION_LINE_HEIGHT,
|
|
21
|
+
CAPTION_TOP_GAP,
|
|
22
|
+
CAPTION_BOX_PADDING_X,
|
|
23
|
+
CAPTION_BOX_PADDING_Y
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-A4GOY3PE.js.map
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderInlineText
|
|
3
|
+
} from "./chunk-3HDBAXF5.js";
|
|
4
|
+
import {
|
|
5
|
+
wrapDescriptionLines
|
|
6
|
+
} from "./chunk-BMR4CIEO.js";
|
|
7
|
+
import {
|
|
8
|
+
ScaleContext
|
|
9
|
+
} from "./chunk-YYVTBZZC.js";
|
|
10
|
+
import {
|
|
11
|
+
TITLE_FONT_SIZE,
|
|
12
|
+
TITLE_FONT_WEIGHT,
|
|
13
|
+
TITLE_Y
|
|
14
|
+
} from "./chunk-A4GOY3PE.js";
|
|
15
|
+
import {
|
|
16
|
+
FONT_FAMILY
|
|
17
|
+
} from "./chunk-6KFWC4CO.js";
|
|
18
|
+
import {
|
|
19
|
+
CHAR_WIDTH_RATIO
|
|
20
|
+
} from "./chunk-WCT3NYCV.js";
|
|
21
|
+
import {
|
|
22
|
+
contrastText,
|
|
23
|
+
getSeriesColors,
|
|
24
|
+
shapeFill
|
|
25
|
+
} from "./chunk-P6T66CCZ.js";
|
|
26
|
+
import {
|
|
27
|
+
resolveColor
|
|
28
|
+
} from "./chunk-TLVIHFRO.js";
|
|
29
|
+
|
|
30
|
+
// src/ring/renderer.ts
|
|
31
|
+
import * as d3Selection from "d3-selection";
|
|
32
|
+
var TITLE_AREA_HEIGHT = 50;
|
|
33
|
+
var H_MARGIN_FRAC = 0.03;
|
|
34
|
+
var V_MARGIN = 16;
|
|
35
|
+
var RING_AREA_FRAC_NO_DESC = 0.78;
|
|
36
|
+
var RING_AREA_FRAC_WITH_DESC = 0.58;
|
|
37
|
+
var DESC_GAP = 28;
|
|
38
|
+
var DESC_ACCENT_WIDTH = 3;
|
|
39
|
+
var DESC_ACCENT_GAP = 12;
|
|
40
|
+
var BULLET_BODY_INDENT = 10;
|
|
41
|
+
var RING_STROKE_WIDTH = 1;
|
|
42
|
+
var RING_STROKE_OPACITY = 0.4;
|
|
43
|
+
var DESC_LINE_CAP = 4;
|
|
44
|
+
var LABEL_FONT_MIN = 12;
|
|
45
|
+
var LABEL_FONT_MAX = 22;
|
|
46
|
+
var DESC_FONT_MIN = 11;
|
|
47
|
+
var DESC_FONT_MAX = 15;
|
|
48
|
+
function renderRing(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
49
|
+
if (parsed.layers.length === 0) return;
|
|
50
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
51
|
+
const width = exportDims?.width ?? container.clientWidth;
|
|
52
|
+
const height = exportDims?.height ?? container.clientHeight;
|
|
53
|
+
if (width <= 0 || height <= 0) return;
|
|
54
|
+
const idealWidth = width;
|
|
55
|
+
const sctx = exportDims ? ScaleContext.identity() : ScaleContext.from(width, idealWidth);
|
|
56
|
+
const sTitleFontSize = sctx.text(TITLE_FONT_SIZE);
|
|
57
|
+
const sTitleY = sctx.structural(TITLE_Y);
|
|
58
|
+
const sTitleAreaHeight = sctx.structural(TITLE_AREA_HEIGHT);
|
|
59
|
+
const sVMargin = sctx.aesthetic(V_MARGIN);
|
|
60
|
+
const N = parsed.layers.length;
|
|
61
|
+
const hasAnyDescription = parsed.layers.some((l) => l.description.length > 0);
|
|
62
|
+
const showTitle = !!parsed.title && parsed.options["no-title"] !== "on";
|
|
63
|
+
const titleH = showTitle ? sTitleAreaHeight : 0;
|
|
64
|
+
const bodyTop = titleH + sVMargin;
|
|
65
|
+
const bodyBottom = height - sVMargin;
|
|
66
|
+
const bodyHeight = Math.max(60, bodyBottom - bodyTop);
|
|
67
|
+
const sideMargin = width * H_MARGIN_FRAC;
|
|
68
|
+
const usableWidth = width - sideMargin * 2;
|
|
69
|
+
const ringAreaFrac = hasAnyDescription ? RING_AREA_FRAC_WITH_DESC : RING_AREA_FRAC_NO_DESC;
|
|
70
|
+
const ringDiameterByWidth = usableWidth * ringAreaFrac;
|
|
71
|
+
const ringDiameterByHeight = bodyHeight;
|
|
72
|
+
const ringDiameter = Math.min(ringDiameterByWidth, ringDiameterByHeight);
|
|
73
|
+
const outerRadius = ringDiameter / 2;
|
|
74
|
+
const thickness = outerRadius / N;
|
|
75
|
+
const cy = bodyTop + bodyHeight / 2;
|
|
76
|
+
const cx = hasAnyDescription ? sideMargin + usableWidth * ringAreaFrac / 2 : width / 2;
|
|
77
|
+
const descAccentX = cx + outerRadius + DESC_GAP;
|
|
78
|
+
const descTextX = descAccentX + DESC_ACCENT_WIDTH + DESC_ACCENT_GAP;
|
|
79
|
+
const descTextWidth = Math.max(80, width - sideMargin - descTextX);
|
|
80
|
+
const naturalLabelFont = Math.round(thickness * 0.45);
|
|
81
|
+
const inBandLabelsVisible = naturalLabelFont >= LABEL_FONT_MIN;
|
|
82
|
+
const labelFont = clamp(naturalLabelFont, LABEL_FONT_MIN, LABEL_FONT_MAX);
|
|
83
|
+
const descFont = hasAnyDescription ? clamp(Math.round(descTextWidth / 30), DESC_FONT_MIN, DESC_FONT_MAX) : DESC_FONT_MIN;
|
|
84
|
+
const descLineHeight = Math.round(descFont * 1.35);
|
|
85
|
+
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMid meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY);
|
|
86
|
+
if (sctx.isBelowFloor) {
|
|
87
|
+
svg.attr("width", "100%");
|
|
88
|
+
}
|
|
89
|
+
svg.append("rect").attr("width", width).attr("height", height).attr("fill", palette.bg);
|
|
90
|
+
if (showTitle) {
|
|
91
|
+
const titleText = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", sTitleY).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber).text(parsed.title).style("cursor", onClickItem ? "pointer" : "default");
|
|
92
|
+
if (onClickItem) {
|
|
93
|
+
titleText.on("click", () => onClickItem(parsed.titleLineNumber));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const seriesColors = getSeriesColors(palette);
|
|
97
|
+
const resolveLayerColor = (layer, i) => {
|
|
98
|
+
if (layer.color) {
|
|
99
|
+
const named = resolveColor(layer.color, palette);
|
|
100
|
+
if (named) return named;
|
|
101
|
+
}
|
|
102
|
+
return seriesColors[i % seriesColors.length];
|
|
103
|
+
};
|
|
104
|
+
const solid = parsed.options["solid-fill"] === "on";
|
|
105
|
+
const layerColors = parsed.layers.map((l, i) => resolveLayerColor(l, i));
|
|
106
|
+
const layerFills = layerColors.map(
|
|
107
|
+
(c) => shapeFill(palette, c, isDark, { solid })
|
|
108
|
+
);
|
|
109
|
+
const diagramG = svg.append("g").attr("class", "ring-body");
|
|
110
|
+
const strokeColor = palette.text;
|
|
111
|
+
for (let i = 0; i < N; i++) {
|
|
112
|
+
const layer = parsed.layers[i];
|
|
113
|
+
const rOuter = (i + 1) * thickness;
|
|
114
|
+
const rInner = i * thickness;
|
|
115
|
+
const fill = layerFills[i];
|
|
116
|
+
const layerG = diagramG.append("g").attr("class", "ring-layer").attr("data-line-number", layer.lineNumber);
|
|
117
|
+
if (onClickItem) {
|
|
118
|
+
const ln = layer.lineNumber;
|
|
119
|
+
layerG.style("cursor", "pointer").on("click", () => onClickItem(ln));
|
|
120
|
+
}
|
|
121
|
+
if (i === 0) {
|
|
122
|
+
layerG.append("circle").attr("cx", cx).attr("cy", cy).attr("r", rOuter).attr("fill", fill).attr("stroke", strokeColor).attr("stroke-width", RING_STROKE_WIDTH).attr("stroke-opacity", RING_STROKE_OPACITY);
|
|
123
|
+
} else {
|
|
124
|
+
const d = `M ${cx - rOuter} ${cy} A ${rOuter} ${rOuter} 0 1 0 ${cx + rOuter} ${cy} A ${rOuter} ${rOuter} 0 1 0 ${cx - rOuter} ${cy} M ${cx - rInner} ${cy} A ${rInner} ${rInner} 0 1 0 ${cx + rInner} ${cy} A ${rInner} ${rInner} 0 1 0 ${cx - rInner} ${cy} Z`;
|
|
125
|
+
layerG.append("path").attr("d", d).attr("fill-rule", "evenodd").attr("fill", fill).attr("stroke", strokeColor).attr("stroke-width", RING_STROKE_WIDTH).attr("stroke-opacity", RING_STROKE_OPACITY);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (inBandLabelsVisible) {
|
|
129
|
+
const labelsG = svg.append("g").attr("class", "ring-labels");
|
|
130
|
+
for (let i = 0; i < N; i++) {
|
|
131
|
+
const layer = parsed.layers[i];
|
|
132
|
+
const fill = layerFills[i];
|
|
133
|
+
const isInnermost = i === 0;
|
|
134
|
+
const labelY = isInnermost ? cy : cy - (i + 0.5) * thickness;
|
|
135
|
+
const fittedFont = labelFont;
|
|
136
|
+
const textColor = contrastText(
|
|
137
|
+
fill,
|
|
138
|
+
palette.textOnFillLight,
|
|
139
|
+
palette.textOnFillDark
|
|
140
|
+
);
|
|
141
|
+
const labelG = labelsG.append("g").attr("class", "ring-label-group").attr("data-line-number", layer.lineNumber);
|
|
142
|
+
const label = labelG.append("text").attr("class", "ring-label").attr("x", cx).attr("y", labelY).attr("dy", "0.35em").attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", fittedFont).attr("font-weight", 600).style("pointer-events", "none");
|
|
143
|
+
renderInlineText(label, layer.label, palette, fittedFont);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (hasAnyDescription || !inBandLabelsVisible) {
|
|
147
|
+
renderSideDescriptions({
|
|
148
|
+
parentG: svg.append("g").attr("class", "ring-descriptions"),
|
|
149
|
+
layers: parsed.layers,
|
|
150
|
+
colors: layerColors,
|
|
151
|
+
accentX: descAccentX,
|
|
152
|
+
textX: descTextX,
|
|
153
|
+
textWidth: descTextWidth,
|
|
154
|
+
topY: bodyTop,
|
|
155
|
+
bottomY: bodyBottom,
|
|
156
|
+
descFont,
|
|
157
|
+
descLineHeight,
|
|
158
|
+
palette,
|
|
159
|
+
...onClickItem !== void 0 && { onClickItem }
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function renderRingForExport(container, parsed, palette, isDark, exportDims) {
|
|
164
|
+
renderRing(container, parsed, palette, isDark, void 0, exportDims);
|
|
165
|
+
}
|
|
166
|
+
function renderSideDescriptions(args) {
|
|
167
|
+
const {
|
|
168
|
+
parentG,
|
|
169
|
+
layers,
|
|
170
|
+
colors,
|
|
171
|
+
accentX,
|
|
172
|
+
textX,
|
|
173
|
+
textWidth,
|
|
174
|
+
topY,
|
|
175
|
+
bottomY,
|
|
176
|
+
descFont,
|
|
177
|
+
descLineHeight,
|
|
178
|
+
palette,
|
|
179
|
+
onClickItem
|
|
180
|
+
} = args;
|
|
181
|
+
const charsPerLine = Math.max(
|
|
182
|
+
8,
|
|
183
|
+
Math.floor(textWidth / (descFont * CHAR_WIDTH_RATIO))
|
|
184
|
+
);
|
|
185
|
+
const labelRowH = Math.round(descFont * 1.3);
|
|
186
|
+
const gutter = Math.max(8, Math.round(descFont * 0.6));
|
|
187
|
+
const availableH = bottomY - topY;
|
|
188
|
+
const computeStack = (cap) => {
|
|
189
|
+
const wraps2 = layers.map(
|
|
190
|
+
(l) => truncateWithEllipsis(
|
|
191
|
+
wrapDescriptionLines(l.description.slice(), charsPerLine),
|
|
192
|
+
cap
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
const blockHeights2 = wraps2.map(
|
|
196
|
+
(lines) => labelRowH + lines.length * descLineHeight
|
|
197
|
+
);
|
|
198
|
+
const totalH2 = blockHeights2.reduce((s, h) => s + h, 0) + gutter * Math.max(0, layers.length - 1);
|
|
199
|
+
return { wraps: wraps2, blockHeights: blockHeights2, totalH: totalH2 };
|
|
200
|
+
};
|
|
201
|
+
let stack = computeStack(DESC_LINE_CAP);
|
|
202
|
+
for (let cap = DESC_LINE_CAP - 1; cap >= 0 && stack.totalH > availableH; cap--) {
|
|
203
|
+
stack = computeStack(cap);
|
|
204
|
+
}
|
|
205
|
+
const { wraps, blockHeights, totalH } = stack;
|
|
206
|
+
let cursorY = topY + Math.max(0, (availableH - totalH) / 2);
|
|
207
|
+
for (let i = 0; i < layers.length; i++) {
|
|
208
|
+
const layer = layers[i];
|
|
209
|
+
const lines = wraps[i];
|
|
210
|
+
const blockH = blockHeights[i];
|
|
211
|
+
const blockG = parentG.append("g").attr("class", "ring-desc").attr("data-line-number", layer.lineNumber);
|
|
212
|
+
if (onClickItem) {
|
|
213
|
+
const ln = layer.lineNumber;
|
|
214
|
+
blockG.style("cursor", "pointer").on("click", () => onClickItem(ln));
|
|
215
|
+
}
|
|
216
|
+
blockG.append("rect").attr("x", accentX).attr("y", cursorY).attr("width", DESC_ACCENT_WIDTH).attr("height", blockH).attr("rx", DESC_ACCENT_WIDTH / 2).attr("fill", colors[i]);
|
|
217
|
+
const labelEl = blockG.append("text").attr("x", textX).attr("y", cursorY + Math.round(labelRowH * 0.7)).attr("text-anchor", "start").attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", descFont).attr("font-weight", 600);
|
|
218
|
+
renderInlineText(labelEl, layer.label, palette, descFont);
|
|
219
|
+
let lineY = cursorY + labelRowH + Math.round(descLineHeight * 0.4);
|
|
220
|
+
for (const line of lines) {
|
|
221
|
+
const isBullet = line.kind === "bullet-first" || line.kind === "bullet-cont";
|
|
222
|
+
if (line.kind === "bullet-first") {
|
|
223
|
+
blockG.append("text").attr("x", textX).attr("y", lineY).attr("text-anchor", "start").attr("fill", palette.textMuted).attr("font-family", FONT_FAMILY).attr("font-size", descFont).text("\u2022");
|
|
224
|
+
}
|
|
225
|
+
const textEl = blockG.append("text").attr("x", isBullet ? textX + BULLET_BODY_INDENT : textX).attr("y", lineY).attr("text-anchor", "start").attr("fill", palette.textMuted).attr("font-family", FONT_FAMILY).attr("font-size", descFont);
|
|
226
|
+
renderInlineText(textEl, line.text, palette, descFont);
|
|
227
|
+
lineY += descLineHeight;
|
|
228
|
+
}
|
|
229
|
+
cursorY += blockH + gutter;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function truncateWithEllipsis(lines, cap) {
|
|
233
|
+
if (lines.length <= cap) return lines.slice();
|
|
234
|
+
const visible = lines.slice(0, cap);
|
|
235
|
+
if (visible.length === 0) return visible;
|
|
236
|
+
const last = visible[visible.length - 1];
|
|
237
|
+
visible[visible.length - 1] = {
|
|
238
|
+
...last,
|
|
239
|
+
text: last.text.endsWith("\u2026") ? last.text : `${last.text} \u2026`
|
|
240
|
+
};
|
|
241
|
+
return visible;
|
|
242
|
+
}
|
|
243
|
+
function clamp(x, lo, hi) {
|
|
244
|
+
return Math.max(lo, Math.min(hi, x));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export {
|
|
248
|
+
renderRing,
|
|
249
|
+
renderRingForExport
|
|
250
|
+
};
|
|
251
|
+
//# sourceMappingURL=chunk-A4VFQH5G.js.map
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AUTO_TAG_COLOR_SENTINEL,
|
|
3
|
+
finalizeAutoTagColors,
|
|
4
|
+
matchTagBlockHeading,
|
|
5
|
+
stripDefaultModifier,
|
|
6
|
+
tagAttrKey,
|
|
7
|
+
validateTagGroupNames
|
|
8
|
+
} from "./chunk-QLCCJEJI.js";
|
|
9
|
+
import {
|
|
10
|
+
normalizeName
|
|
11
|
+
} from "./chunk-NOTA6TEI.js";
|
|
12
|
+
import {
|
|
13
|
+
KANBAN_REGISTRY,
|
|
14
|
+
OPTION_NOCOLON_RE,
|
|
15
|
+
extractColor,
|
|
16
|
+
measureIndent,
|
|
17
|
+
parseFirstLine,
|
|
18
|
+
splitNameAndMeta,
|
|
19
|
+
warnUnknownMetaKeys,
|
|
20
|
+
withTagAliases
|
|
21
|
+
} from "./chunk-Y3J7VR52.js";
|
|
22
|
+
import {
|
|
23
|
+
resolveColorWithDiagnostic
|
|
24
|
+
} from "./chunk-TLVIHFRO.js";
|
|
25
|
+
import {
|
|
26
|
+
formatDgmoError,
|
|
27
|
+
makeDgmoError,
|
|
28
|
+
makeFail,
|
|
29
|
+
suggest
|
|
30
|
+
} from "./chunk-CXK4DZH3.js";
|
|
31
|
+
|
|
32
|
+
// src/kanban/parser.ts
|
|
33
|
+
var COLUMN_RE = /^\[(.+?)\]\s*(.*)$/;
|
|
34
|
+
var PALETTE_COLOR_WORD_RE = /^(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\b/;
|
|
35
|
+
var AS_ALIAS_TOKEN_RE = /^as\s+([A-Za-z][A-Za-z0-9_]{0,11})\b/;
|
|
36
|
+
var KNOWN_OPTIONS = /* @__PURE__ */ new Set(["hide", "active-tag", "lane-by"]);
|
|
37
|
+
var KNOWN_BOOLEANS = /* @__PURE__ */ new Set(["solid-fill", "no-title"]);
|
|
38
|
+
var REMOVED_BOOLEANS = {
|
|
39
|
+
"no-auto-color": '"no-auto-color" was removed \u2014 colors are always auto-assigned from the palette; delete this line.'
|
|
40
|
+
};
|
|
41
|
+
function parseKanban(content, palette) {
|
|
42
|
+
const options = {};
|
|
43
|
+
const result = {
|
|
44
|
+
type: "kanban",
|
|
45
|
+
columns: [],
|
|
46
|
+
tagGroups: [],
|
|
47
|
+
options,
|
|
48
|
+
diagnostics: [],
|
|
49
|
+
error: null
|
|
50
|
+
};
|
|
51
|
+
const fail = makeFail(result);
|
|
52
|
+
const warn = (line, message) => {
|
|
53
|
+
result.diagnostics.push(makeDgmoError(line, message, "warning"));
|
|
54
|
+
};
|
|
55
|
+
if (!content?.trim()) {
|
|
56
|
+
return fail(0, "No content provided");
|
|
57
|
+
}
|
|
58
|
+
const lines = content.split("\n");
|
|
59
|
+
let contentStarted = false;
|
|
60
|
+
let currentTagGroup = null;
|
|
61
|
+
let currentColumn = null;
|
|
62
|
+
let currentCard = null;
|
|
63
|
+
let cardBaseIndent = 0;
|
|
64
|
+
let columnCounter = 0;
|
|
65
|
+
let cardCounter = 0;
|
|
66
|
+
const metaAliasMap = /* @__PURE__ */ new Map();
|
|
67
|
+
const nameAliasMap = /* @__PURE__ */ new Map();
|
|
68
|
+
const tagValueSets = /* @__PURE__ */ new Map();
|
|
69
|
+
for (let i = 0; i < lines.length; i++) {
|
|
70
|
+
const line = lines[i];
|
|
71
|
+
const lineNumber = i + 1;
|
|
72
|
+
const trimmed = line.trim();
|
|
73
|
+
if (!trimmed) {
|
|
74
|
+
if (currentTagGroup) currentTagGroup = null;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (trimmed.startsWith("//")) continue;
|
|
78
|
+
if (!contentStarted && !currentTagGroup) {
|
|
79
|
+
const firstLine = parseFirstLine(trimmed);
|
|
80
|
+
if (firstLine) {
|
|
81
|
+
if (firstLine.chartType !== "kanban") {
|
|
82
|
+
const allTypes = [
|
|
83
|
+
"kanban",
|
|
84
|
+
"org",
|
|
85
|
+
"class",
|
|
86
|
+
"flowchart",
|
|
87
|
+
"sequence",
|
|
88
|
+
"er",
|
|
89
|
+
"bar",
|
|
90
|
+
"line",
|
|
91
|
+
"pie"
|
|
92
|
+
];
|
|
93
|
+
let msg = `Expected chart type "kanban", got "${firstLine.chartType}"`;
|
|
94
|
+
const hint = suggest(firstLine.chartType, allTypes);
|
|
95
|
+
if (hint) msg += `. ${hint}`;
|
|
96
|
+
return fail(lineNumber, msg);
|
|
97
|
+
}
|
|
98
|
+
if (firstLine.title) {
|
|
99
|
+
result.title = firstLine.title;
|
|
100
|
+
result.titleLineNumber = lineNumber;
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!contentStarted) {
|
|
106
|
+
const tagBlockMatch = matchTagBlockHeading(trimmed);
|
|
107
|
+
if (tagBlockMatch) {
|
|
108
|
+
currentTagGroup = {
|
|
109
|
+
name: tagBlockMatch.name,
|
|
110
|
+
...tagBlockMatch.alias !== void 0 && {
|
|
111
|
+
alias: tagBlockMatch.alias
|
|
112
|
+
},
|
|
113
|
+
entries: [],
|
|
114
|
+
lineNumber
|
|
115
|
+
};
|
|
116
|
+
if (tagBlockMatch.alias) {
|
|
117
|
+
metaAliasMap.set(
|
|
118
|
+
normalizeName(tagBlockMatch.alias),
|
|
119
|
+
tagAttrKey(tagBlockMatch.name)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
metaAliasMap.set(
|
|
123
|
+
normalizeName(tagBlockMatch.name),
|
|
124
|
+
tagAttrKey(tagBlockMatch.name)
|
|
125
|
+
);
|
|
126
|
+
result.tagGroups.push(currentTagGroup);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!contentStarted && !currentTagGroup && measureIndent(line) === 0) {
|
|
131
|
+
const optMatch = trimmed.match(OPTION_NOCOLON_RE);
|
|
132
|
+
if (optMatch && !COLUMN_RE.test(trimmed)) {
|
|
133
|
+
const key = optMatch[1].trim().toLowerCase();
|
|
134
|
+
if (KNOWN_OPTIONS.has(key)) {
|
|
135
|
+
options[key] = optMatch[2].trim();
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const removedMsg = REMOVED_BOOLEANS[trimmed.toLowerCase()];
|
|
140
|
+
if (removedMsg && !COLUMN_RE.test(trimmed)) {
|
|
141
|
+
warn(lineNumber, removedMsg);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (KNOWN_BOOLEANS.has(trimmed.toLowerCase()) && !COLUMN_RE.test(trimmed)) {
|
|
145
|
+
options[trimmed.toLowerCase()] = "on";
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (currentTagGroup && !contentStarted) {
|
|
150
|
+
const indent2 = measureIndent(line);
|
|
151
|
+
if (indent2 > 0) {
|
|
152
|
+
const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
|
|
153
|
+
const { label, color } = extractColor(
|
|
154
|
+
cleanEntry,
|
|
155
|
+
palette,
|
|
156
|
+
result.diagnostics,
|
|
157
|
+
lineNumber
|
|
158
|
+
);
|
|
159
|
+
if (isDefault) {
|
|
160
|
+
currentTagGroup.defaultValue = label;
|
|
161
|
+
} else if (currentTagGroup.entries.length === 0) {
|
|
162
|
+
currentTagGroup.defaultValue = label;
|
|
163
|
+
}
|
|
164
|
+
currentTagGroup.entries.push({
|
|
165
|
+
value: label,
|
|
166
|
+
color: color ?? AUTO_TAG_COLOR_SENTINEL,
|
|
167
|
+
lineNumber
|
|
168
|
+
});
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
currentTagGroup = null;
|
|
172
|
+
}
|
|
173
|
+
const indent = measureIndent(line);
|
|
174
|
+
const columnMatch = indent === 0 ? trimmed.match(COLUMN_RE) : null;
|
|
175
|
+
if (columnMatch) {
|
|
176
|
+
contentStarted = true;
|
|
177
|
+
currentTagGroup = null;
|
|
178
|
+
if (currentCard) {
|
|
179
|
+
currentCard.endLineNumber = lineNumber - 1;
|
|
180
|
+
while (currentCard.endLineNumber > currentCard.lineNumber && !lines[currentCard.endLineNumber - 1].trim()) {
|
|
181
|
+
currentCard.endLineNumber--;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
currentCard = null;
|
|
185
|
+
columnCounter++;
|
|
186
|
+
const colName = columnMatch[1].trim();
|
|
187
|
+
let tail = (columnMatch[2] ?? "").trim();
|
|
188
|
+
let colColor;
|
|
189
|
+
const colorMatch = tail.match(PALETTE_COLOR_WORD_RE);
|
|
190
|
+
if (colorMatch) {
|
|
191
|
+
colColor = resolveColorWithDiagnostic(
|
|
192
|
+
colorMatch[1],
|
|
193
|
+
lineNumber,
|
|
194
|
+
result.diagnostics,
|
|
195
|
+
palette
|
|
196
|
+
);
|
|
197
|
+
tail = tail.substring(colorMatch[0].length).trim();
|
|
198
|
+
}
|
|
199
|
+
let colAlias;
|
|
200
|
+
const aliasMatch = tail.match(AS_ALIAS_TOKEN_RE);
|
|
201
|
+
if (aliasMatch) {
|
|
202
|
+
colAlias = aliasMatch[1];
|
|
203
|
+
tail = tail.substring(aliasMatch[0].length).trim();
|
|
204
|
+
}
|
|
205
|
+
const columnMetadata = {};
|
|
206
|
+
let wipLimit;
|
|
207
|
+
if (tail.length > 0) {
|
|
208
|
+
const registry = withTagAliases(
|
|
209
|
+
KANBAN_REGISTRY,
|
|
210
|
+
new Set(metaAliasMap.keys())
|
|
211
|
+
);
|
|
212
|
+
const split = splitNameAndMeta(
|
|
213
|
+
tail,
|
|
214
|
+
registry,
|
|
215
|
+
metaAliasMap,
|
|
216
|
+
void 0,
|
|
217
|
+
result.diagnostics,
|
|
218
|
+
lineNumber
|
|
219
|
+
);
|
|
220
|
+
warnUnknownMetaKeys(
|
|
221
|
+
split.meta,
|
|
222
|
+
registry,
|
|
223
|
+
(msg) => warn(lineNumber, msg),
|
|
224
|
+
split.name
|
|
225
|
+
);
|
|
226
|
+
Object.assign(columnMetadata, split.meta);
|
|
227
|
+
}
|
|
228
|
+
if (columnMetadata["wip"]) {
|
|
229
|
+
const wipVal = parseInt(columnMetadata["wip"], 10);
|
|
230
|
+
if (!isNaN(wipVal)) wipLimit = wipVal;
|
|
231
|
+
}
|
|
232
|
+
let colCollapsed = false;
|
|
233
|
+
if (columnMetadata["collapsed"]?.toLowerCase() === "true") {
|
|
234
|
+
colCollapsed = true;
|
|
235
|
+
delete columnMetadata["collapsed"];
|
|
236
|
+
}
|
|
237
|
+
const colId = `col-${columnCounter}`;
|
|
238
|
+
if (colAlias) nameAliasMap.set(colAlias, colId);
|
|
239
|
+
currentColumn = {
|
|
240
|
+
id: colId,
|
|
241
|
+
name: colName,
|
|
242
|
+
...wipLimit !== void 0 && { wipLimit },
|
|
243
|
+
...colColor !== void 0 && { color: colColor },
|
|
244
|
+
...colCollapsed && { collapsed: true },
|
|
245
|
+
cards: [],
|
|
246
|
+
lineNumber,
|
|
247
|
+
metadata: columnMetadata
|
|
248
|
+
};
|
|
249
|
+
result.columns.push(currentColumn);
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (!contentStarted) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (!currentColumn) {
|
|
256
|
+
warn(
|
|
257
|
+
lineNumber,
|
|
258
|
+
"Card line found before any column. Declare a column first with '[Column Name]', then indent cards beneath it. (\xA711)"
|
|
259
|
+
);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (currentCard && indent > cardBaseIndent) {
|
|
263
|
+
currentCard.details.push(trimmed);
|
|
264
|
+
currentCard.endLineNumber = lineNumber;
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
if (indent > 0) {
|
|
268
|
+
cardCounter++;
|
|
269
|
+
const card = parseCardLine(
|
|
270
|
+
trimmed,
|
|
271
|
+
lineNumber,
|
|
272
|
+
cardCounter,
|
|
273
|
+
metaAliasMap,
|
|
274
|
+
palette,
|
|
275
|
+
result.diagnostics
|
|
276
|
+
);
|
|
277
|
+
if (currentColumn.metadata) {
|
|
278
|
+
const cardTags = card.tags;
|
|
279
|
+
for (const [key, value] of Object.entries(currentColumn.metadata)) {
|
|
280
|
+
if (key === "wip") continue;
|
|
281
|
+
if (!(key in cardTags)) {
|
|
282
|
+
cardTags[key] = value;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
cardBaseIndent = indent;
|
|
287
|
+
currentCard = card;
|
|
288
|
+
currentColumn.cards.push(card);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
warn(
|
|
292
|
+
lineNumber,
|
|
293
|
+
currentColumn ? `Unexpected line: '${trimmed}'. Expected an indented card name or column header like '[Column Name]'.` : `Unexpected line: '${trimmed}'. Expected a column header like '[Column Name]'.`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
if (currentCard) {
|
|
297
|
+
}
|
|
298
|
+
for (const group of result.tagGroups) {
|
|
299
|
+
const values = new Set(group.entries.map((e) => e.value.toLowerCase()));
|
|
300
|
+
tagValueSets.set(tagAttrKey(group.name), values);
|
|
301
|
+
}
|
|
302
|
+
for (const col of result.columns) {
|
|
303
|
+
if (col.wipLimit != null && col.cards.length > col.wipLimit) {
|
|
304
|
+
warn(
|
|
305
|
+
col.lineNumber,
|
|
306
|
+
`Column "${col.name}" has ${col.cards.length} cards but WIP limit is ${col.wipLimit}`
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
for (const col of result.columns) {
|
|
311
|
+
for (const card of col.cards) {
|
|
312
|
+
for (const [tagKey, tagValue] of Object.entries(card.tags)) {
|
|
313
|
+
const groupKey = metaAliasMap.get(tagKey.toLowerCase()) ?? tagKey.toLowerCase();
|
|
314
|
+
const validValues = tagValueSets.get(groupKey);
|
|
315
|
+
if (validValues && !validValues.has(tagValue.toLowerCase())) {
|
|
316
|
+
const entries = result.tagGroups.find((g) => g.name.toLowerCase() === groupKey)?.entries.map((e) => e.value);
|
|
317
|
+
let msg = `Unknown tag value "${tagValue}" for group "${groupKey}"`;
|
|
318
|
+
if (entries) {
|
|
319
|
+
const hint = suggest(tagValue, entries);
|
|
320
|
+
if (hint) msg += `. ${hint}`;
|
|
321
|
+
}
|
|
322
|
+
warn(card.lineNumber, msg);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (result.columns.length === 0 && !result.error) {
|
|
328
|
+
return fail(1, "No columns found. Use [Column Name] to define columns");
|
|
329
|
+
}
|
|
330
|
+
finalizeAutoTagColors(
|
|
331
|
+
result.tagGroups,
|
|
332
|
+
palette
|
|
333
|
+
);
|
|
334
|
+
validateTagGroupNames(result.tagGroups, warn, (line, msg) => {
|
|
335
|
+
const diag = makeDgmoError(line, msg);
|
|
336
|
+
result.diagnostics.push(diag);
|
|
337
|
+
if (!result.error) result.error = formatDgmoError(diag);
|
|
338
|
+
});
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
function parseCardLine(trimmed, lineNumber, counter, metaAliasMap, _palette, diagnostics) {
|
|
342
|
+
const registry = withTagAliases(
|
|
343
|
+
KANBAN_REGISTRY,
|
|
344
|
+
new Set(metaAliasMap.keys())
|
|
345
|
+
);
|
|
346
|
+
const split = splitNameAndMeta(
|
|
347
|
+
trimmed,
|
|
348
|
+
registry,
|
|
349
|
+
metaAliasMap,
|
|
350
|
+
void 0,
|
|
351
|
+
diagnostics,
|
|
352
|
+
lineNumber
|
|
353
|
+
);
|
|
354
|
+
warnUnknownMetaKeys(
|
|
355
|
+
split.meta,
|
|
356
|
+
registry,
|
|
357
|
+
(msg) => diagnostics?.push(makeDgmoError(lineNumber, msg, "warning")),
|
|
358
|
+
split.name
|
|
359
|
+
);
|
|
360
|
+
const title = split.color !== void 0 ? `${split.name} ${split.color}` : split.name;
|
|
361
|
+
const tags = { ...split.meta };
|
|
362
|
+
return {
|
|
363
|
+
id: `card-${counter}`,
|
|
364
|
+
title,
|
|
365
|
+
tags,
|
|
366
|
+
details: [],
|
|
367
|
+
lineNumber,
|
|
368
|
+
endLineNumber: lineNumber
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export {
|
|
373
|
+
parseKanban
|
|
374
|
+
};
|
|
375
|
+
//# sourceMappingURL=chunk-AELOBFW5.js.map
|