@diagrammo/dgmo 0.50.1 → 0.50.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.ts +6578 -0
- package/dist/advanced.js +6 -6
- package/dist/auto.d.ts +54 -0
- package/dist/auto.js +103 -103
- package/dist/auto.mjs +99 -8
- package/dist/block.d.ts +130 -0
- package/dist/block.js +13 -7
- package/dist/{charts-d3-LR6D3D7A.js → charts-d3-MUW3LTML.js} +3 -3
- package/dist/{chunk-7PQYTZMA.js → chunk-5WFIYXQ6.js} +5 -5
- package/dist/{chunk-YIA4LEX4.js → chunk-DN66GPY5.js} +74 -3
- package/dist/{chunk-VVZRV54S.js → chunk-KQ57MHRO.js} +2 -2
- package/dist/{chunk-4S52SK6G.js → chunk-QJJZSROI.js} +10 -3
- package/dist/{chunk-ZAD4HV2G.js → chunk-SVTI362O.js} +9 -9
- package/dist/{chunk-Y4RNXEAO.js → chunk-T5SHNNGP.js} +81 -1
- package/dist/{chunk-XDXNDSKO.js → chunk-XEGTMVYY.js} +4 -1
- package/dist/cli.cjs +124 -124
- package/dist/{dgmo-router-YTU3ENAX.js → dgmo-router-CE2G67FV.js} +3 -3
- package/dist/element.d.ts +62 -0
- package/dist/element.js +100 -100
- package/dist/element.mjs +99 -8
- package/dist/index.d.ts +185 -0
- package/dist/index.js +7 -5
- package/dist/{renderer-72LGR2YF.js → renderer-5KVCNMOJ.js} +2 -2
- package/dist/{renderer-PJM35LJN.js → renderer-P5ROYQGU.js} +2 -2
- package/dist/themes-PdPR1-hC.d.ts +916 -0
- package/docs/language-reference.md +5 -0
- package/gallery/fixtures/countdown-far.dgmo +2 -0
- package/package.json +1 -1
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
parseVenn,
|
|
15
15
|
parseVisualization,
|
|
16
16
|
parseWordcloud
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KQ57MHRO.js";
|
|
18
18
|
import {
|
|
19
19
|
renderDataChartD3
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-QJJZSROI.js";
|
|
21
21
|
import {
|
|
22
22
|
computeQuadrantPointLabels
|
|
23
23
|
} from "./chunk-HGN652MU.js";
|
|
@@ -2363,13 +2363,13 @@ function resolveArcChordOverride(content, detectedType, palette) {
|
|
|
2363
2363
|
}
|
|
2364
2364
|
async function renderForExport(content, theme, palette, viewState, options) {
|
|
2365
2365
|
const exportMode = options?.exportMode ?? false;
|
|
2366
|
-
const { parseDgmoChartType } = await import("./dgmo-router-
|
|
2366
|
+
const { parseDgmoChartType } = await import("./dgmo-router-CE2G67FV.js");
|
|
2367
2367
|
const detectedTypeRaw = parseDgmoChartType(content);
|
|
2368
2368
|
const override = resolveArcChordOverride(content, detectedTypeRaw, palette);
|
|
2369
2369
|
const renderContent = override?.content ?? content;
|
|
2370
2370
|
const detectedType = override?.type ?? detectedTypeRaw;
|
|
2371
2371
|
if (detectedType !== null) {
|
|
2372
|
-
const { supportsD3DataChart, renderDataChartD3: renderDataChartD32 } = await import("./charts-d3-
|
|
2372
|
+
const { supportsD3DataChart, renderDataChartD3: renderDataChartD32 } = await import("./charts-d3-MUW3LTML.js");
|
|
2373
2373
|
if (supportsD3DataChart(detectedType)) {
|
|
2374
2374
|
return renderDataChartD32(renderContent, theme, palette);
|
|
2375
2375
|
}
|
|
@@ -3279,7 +3279,7 @@ async function exportGoal(ctx) {
|
|
|
3279
3279
|
async function exportCountdown(ctx) {
|
|
3280
3280
|
const { content, theme, palette } = ctx;
|
|
3281
3281
|
const { parseCountdown } = await import("./parser-CSFUN3CT.js");
|
|
3282
|
-
const { renderCountdownForExport } = await import("./renderer-
|
|
3282
|
+
const { renderCountdownForExport } = await import("./renderer-P5ROYQGU.js");
|
|
3283
3283
|
const effectivePalette = await resolveExportPalette(theme, palette);
|
|
3284
3284
|
const parsed = parseCountdown(content, effectivePalette);
|
|
3285
3285
|
if (parsed.error) return "";
|
|
@@ -3293,7 +3293,7 @@ async function exportCountdown(ctx) {
|
|
|
3293
3293
|
async function exportClock(ctx) {
|
|
3294
3294
|
const { content, theme, palette } = ctx;
|
|
3295
3295
|
const { parseClock } = await import("./parser-RZPVAQVX.js");
|
|
3296
|
-
const { renderClockForExport } = await import("./renderer-
|
|
3296
|
+
const { renderClockForExport } = await import("./renderer-5KVCNMOJ.js");
|
|
3297
3297
|
const effectivePalette = await resolveExportPalette(theme, palette);
|
|
3298
3298
|
const parsed = parseClock(content, effectivePalette);
|
|
3299
3299
|
if (parsed.error) return "";
|
|
@@ -4046,7 +4046,7 @@ async function render(content, options) {
|
|
|
4046
4046
|
try {
|
|
4047
4047
|
const raw = await renderDataChartD3(renderContent, theme, paletteColors);
|
|
4048
4048
|
const svg2 = injectHoverStyles(raw, chartType, { bakeHover });
|
|
4049
|
-
return { svg: svg2, diagnostics };
|
|
4049
|
+
return { svg: svg2, diagnostics, chartType: chartType ?? void 0 };
|
|
4050
4050
|
} finally {
|
|
4051
4051
|
releaseDom();
|
|
4052
4052
|
}
|
|
@@ -4087,7 +4087,7 @@ async function render(content, options) {
|
|
|
4087
4087
|
} catch {
|
|
4088
4088
|
}
|
|
4089
4089
|
}
|
|
4090
|
-
return { svg, diagnostics };
|
|
4090
|
+
return { svg, diagnostics, chartType: chartType ?? void 0 };
|
|
4091
4091
|
}
|
|
4092
4092
|
|
|
4093
4093
|
// src/sharing.ts
|
|
@@ -4201,4 +4201,4 @@ export {
|
|
|
4201
4201
|
encodeDiagramUrl,
|
|
4202
4202
|
decodeDiagramUrl
|
|
4203
4203
|
};
|
|
4204
|
-
//# sourceMappingURL=chunk-
|
|
4204
|
+
//# sourceMappingURL=chunk-SVTI362O.js.map
|
|
@@ -167,6 +167,7 @@ function haloRect(svg, x, y, w, h, rx, C) {
|
|
|
167
167
|
function pickBand(nowMs, resolvedMs, hasTime) {
|
|
168
168
|
const days = dayDelta(nowMs, resolvedMs);
|
|
169
169
|
if (hasTime && days <= 0) return "clock";
|
|
170
|
+
if (days > 3 * 365) return "years";
|
|
170
171
|
if (days > 365) return "year";
|
|
171
172
|
if (days > 92) return "months";
|
|
172
173
|
if (days > 18) return "monthgrid";
|
|
@@ -198,9 +199,31 @@ function monthGridLayout(nowMs, resolvedMs, contentW) {
|
|
|
198
199
|
}
|
|
199
200
|
return { months, dim };
|
|
200
201
|
}
|
|
202
|
+
function yearsLayout(nowMs, resolvedMs) {
|
|
203
|
+
const y0 = new Date(nowMs).getFullYear();
|
|
204
|
+
const y1 = new Date(resolvedMs).getFullYear();
|
|
205
|
+
const d0 = Math.floor(y0 / 10) * 10;
|
|
206
|
+
const d1 = Math.floor(y1 / 10) * 10;
|
|
207
|
+
return { d0, d1, rows: (d1 - d0) / 10 + 1 };
|
|
208
|
+
}
|
|
201
209
|
function bandHeightFor(kind, nowMs, resolvedMs, contentW) {
|
|
202
210
|
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
|
203
211
|
switch (kind) {
|
|
212
|
+
case "years": {
|
|
213
|
+
const { rows } = yearsLayout(nowMs, resolvedMs);
|
|
214
|
+
const rowGap = 11;
|
|
215
|
+
const labW = 54;
|
|
216
|
+
const gap = 7;
|
|
217
|
+
const cellW = (contentW - labW - 10 * gap) / 10;
|
|
218
|
+
let cellH = clamp(cellW * 0.5, 26, 40);
|
|
219
|
+
const MAX = 380;
|
|
220
|
+
let total = rows * cellH + (rows - 1) * rowGap;
|
|
221
|
+
if (total > MAX) {
|
|
222
|
+
cellH = Math.max(9, (MAX - (rows - 1) * rowGap) / rows);
|
|
223
|
+
total = rows * cellH + (rows - 1) * rowGap;
|
|
224
|
+
}
|
|
225
|
+
return total;
|
|
226
|
+
}
|
|
204
227
|
case "year": {
|
|
205
228
|
const R = new Date(resolvedMs).getFullYear() - new Date(nowMs).getFullYear() + 1;
|
|
206
229
|
const yearW = 66;
|
|
@@ -239,6 +262,61 @@ function bandHeightFor(kind, nowMs, resolvedMs, contentW) {
|
|
|
239
262
|
return clamp(contentW * 0.22, 125, 170);
|
|
240
263
|
}
|
|
241
264
|
}
|
|
265
|
+
function vizYears(svg, g, nowMs, resolvedMs, C) {
|
|
266
|
+
const now = new Date(nowMs);
|
|
267
|
+
const ev = new Date(resolvedMs);
|
|
268
|
+
const nowY = now.getFullYear();
|
|
269
|
+
const evY = ev.getFullYear();
|
|
270
|
+
const { d0, rows } = yearsLayout(nowMs, resolvedMs);
|
|
271
|
+
const labW = 54;
|
|
272
|
+
const gap = 7;
|
|
273
|
+
const rowGap = 11;
|
|
274
|
+
const rowH = (g.height - rowGap * (rows - 1)) / rows;
|
|
275
|
+
const cellH = rowH;
|
|
276
|
+
const cellW = (g.contentW - labW - 10 * gap) / 10;
|
|
277
|
+
const rx = Math.min(6, Math.min(cellW, cellH) * 0.22);
|
|
278
|
+
const showLabel = cellH >= 18 && cellW >= 22;
|
|
279
|
+
const yrFont = Math.min(12, cellW * 0.34, cellH * 0.5);
|
|
280
|
+
for (let r = 0; r < rows; r++) {
|
|
281
|
+
const dec = d0 + r * 10;
|
|
282
|
+
const ry = g.top + r * (rowH + rowGap);
|
|
283
|
+
aText(
|
|
284
|
+
svg,
|
|
285
|
+
g.left + labW - 12,
|
|
286
|
+
ry + rowH / 2,
|
|
287
|
+
Math.min(14, rowH * 0.5),
|
|
288
|
+
C.muted,
|
|
289
|
+
800,
|
|
290
|
+
"end",
|
|
291
|
+
`${dec}s`,
|
|
292
|
+
{ "dominant-baseline": "central" }
|
|
293
|
+
);
|
|
294
|
+
for (let i = 0; i < 10; i++) {
|
|
295
|
+
const yr = dec + i;
|
|
296
|
+
const before = yr < nowY;
|
|
297
|
+
const isNow = yr === nowY;
|
|
298
|
+
const isEv = yr === evY;
|
|
299
|
+
const between = yr > nowY && yr < evY;
|
|
300
|
+
const st = isEv ? roleStyle(C, "event") : isNow ? roleStyle(C, "today") : between ? gradStyle(C, (yr - nowY) / (evY - nowY)) : roleStyle(C, before ? "past" : "future");
|
|
301
|
+
const x = g.left + labW + i * (cellW + gap);
|
|
302
|
+
aRect(svg, x, ry, cellW, cellH, rx, st.fill, st.stroke, 1);
|
|
303
|
+
if (isEv) haloRect(svg, x, ry, cellW, cellH, rx, C);
|
|
304
|
+
if (showLabel) {
|
|
305
|
+
aText(
|
|
306
|
+
svg,
|
|
307
|
+
x + cellW / 2,
|
|
308
|
+
ry + cellH / 2,
|
|
309
|
+
yrFont,
|
|
310
|
+
st.text,
|
|
311
|
+
isNow || isEv ? 800 : 650,
|
|
312
|
+
"middle",
|
|
313
|
+
String(yr),
|
|
314
|
+
{ "dominant-baseline": "central" }
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
242
320
|
function vizYear(svg, g, nowMs, resolvedMs, C) {
|
|
243
321
|
const now = new Date(nowMs);
|
|
244
322
|
const ev = new Date(resolvedMs);
|
|
@@ -750,6 +828,8 @@ function pad2(n) {
|
|
|
750
828
|
}
|
|
751
829
|
function drawBand(svg, kind, g, nowMs, resolvedMs, C) {
|
|
752
830
|
switch (kind) {
|
|
831
|
+
case "years":
|
|
832
|
+
return vizYears(svg, g, nowMs, resolvedMs, C);
|
|
753
833
|
case "year":
|
|
754
834
|
return vizYear(svg, g, nowMs, resolvedMs, C);
|
|
755
835
|
case "months":
|
|
@@ -949,4 +1029,4 @@ export {
|
|
|
949
1029
|
renderCountdown,
|
|
950
1030
|
renderCountdownForExport
|
|
951
1031
|
};
|
|
952
|
-
//# sourceMappingURL=chunk-
|
|
1032
|
+
//# sourceMappingURL=chunk-T5SHNNGP.js.map
|
|
@@ -45,6 +45,7 @@ var KNOWN_BOOLEANS = /* @__PURE__ */ new Set([
|
|
|
45
45
|
"orientation-horizontal",
|
|
46
46
|
"solid-fill",
|
|
47
47
|
"no-title",
|
|
48
|
+
"no-auto-y",
|
|
48
49
|
"fill",
|
|
49
50
|
"hole"
|
|
50
51
|
]);
|
|
@@ -176,6 +177,8 @@ function parseChart(content, palette) {
|
|
|
176
177
|
result.solidFill = true;
|
|
177
178
|
} else if (firstToken === "no-title") {
|
|
178
179
|
result.noTitle = true;
|
|
180
|
+
} else if (firstToken === "no-auto-y") {
|
|
181
|
+
result.noAutoY = true;
|
|
179
182
|
} else if (firstToken === "fill") {
|
|
180
183
|
result.fill = true;
|
|
181
184
|
} else if (firstToken === "hole") {
|
|
@@ -1054,4 +1057,4 @@ export {
|
|
|
1054
1057
|
getSimpleChartLegendGroups,
|
|
1055
1058
|
getExtendedChartLegendGroups
|
|
1056
1059
|
};
|
|
1057
|
-
//# sourceMappingURL=chunk-
|
|
1060
|
+
//# sourceMappingURL=chunk-XEGTMVYY.js.map
|