@diagrammo/dgmo 0.0.1
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/LICENSE +21 -0
- package/README.md +335 -0
- package/dist/index.cjs +6698 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +685 -0
- package/dist/index.d.ts +685 -0
- package/dist/index.js +6611 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
- package/src/chartjs.ts +784 -0
- package/src/colors.ts +75 -0
- package/src/d3.ts +5021 -0
- package/src/dgmo-mermaid.ts +247 -0
- package/src/dgmo-router.ts +77 -0
- package/src/echarts.ts +1207 -0
- package/src/index.ts +126 -0
- package/src/palettes/bold.ts +59 -0
- package/src/palettes/catppuccin.ts +76 -0
- package/src/palettes/color-utils.ts +191 -0
- package/src/palettes/gruvbox.ts +77 -0
- package/src/palettes/index.ts +35 -0
- package/src/palettes/mermaid-bridge.ts +220 -0
- package/src/palettes/nord.ts +59 -0
- package/src/palettes/one-dark.ts +62 -0
- package/src/palettes/registry.ts +92 -0
- package/src/palettes/rose-pine.ts +76 -0
- package/src/palettes/solarized.ts +69 -0
- package/src/palettes/tokyo-night.ts +78 -0
- package/src/palettes/types.ts +67 -0
- package/src/sequence/parser.ts +531 -0
- package/src/sequence/participant-inference.ts +178 -0
- package/src/sequence/renderer.ts +1487 -0
package/src/colors.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Shared Nord Color Palette
|
|
3
|
+
// ============================================================
|
|
4
|
+
|
|
5
|
+
/** Complete 16-entry Nord palette. */
|
|
6
|
+
export const nord = {
|
|
7
|
+
// Polar Night (dark)
|
|
8
|
+
nord0: '#2e3440',
|
|
9
|
+
nord1: '#3b4252',
|
|
10
|
+
nord2: '#434c5e',
|
|
11
|
+
nord3: '#4c566a',
|
|
12
|
+
// Snow Storm (light)
|
|
13
|
+
nord4: '#d8dee9',
|
|
14
|
+
nord5: '#e5e9f0',
|
|
15
|
+
nord6: '#eceff4',
|
|
16
|
+
// Frost (accent blues)
|
|
17
|
+
nord7: '#8fbcbb',
|
|
18
|
+
nord8: '#88c0d0',
|
|
19
|
+
nord9: '#81a1c1',
|
|
20
|
+
nord10: '#5e81ac',
|
|
21
|
+
// Aurora (colors)
|
|
22
|
+
nord11: '#bf616a', // red
|
|
23
|
+
nord12: '#d08770', // orange
|
|
24
|
+
nord13: '#ebcb8b', // yellow
|
|
25
|
+
nord14: '#a3be8c', // green
|
|
26
|
+
nord15: '#b48ead', // purple
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Color name → Nord hex for inline `(color)` annotations. */
|
|
30
|
+
export const colorNames: Record<string, string> = {
|
|
31
|
+
red: nord.nord11,
|
|
32
|
+
orange: nord.nord12,
|
|
33
|
+
yellow: nord.nord13,
|
|
34
|
+
green: nord.nord14,
|
|
35
|
+
blue: nord.nord10,
|
|
36
|
+
purple: nord.nord15,
|
|
37
|
+
teal: nord.nord7,
|
|
38
|
+
cyan: nord.nord8,
|
|
39
|
+
lightblue: nord.nord8,
|
|
40
|
+
gray: nord.nord3,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Resolves a color name or hex code to a valid CSS color.
|
|
45
|
+
* When a palette is provided, named colors resolve against its color map first.
|
|
46
|
+
* Hex codes (e.g. "#ff0000") are passed through regardless of palette (FR8).
|
|
47
|
+
* Unknown names are returned as-is.
|
|
48
|
+
*/
|
|
49
|
+
export function resolveColor(
|
|
50
|
+
color: string,
|
|
51
|
+
palette?: { colors: Record<string, string> }
|
|
52
|
+
): string {
|
|
53
|
+
const lower = color.toLowerCase();
|
|
54
|
+
if (lower.startsWith('#')) return lower;
|
|
55
|
+
|
|
56
|
+
if (palette) {
|
|
57
|
+
const named = palette.colors[lower];
|
|
58
|
+
if (named) return named;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (colorNames[lower]) return colorNames[lower];
|
|
62
|
+
return color;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
66
|
+
export const seriesColors = [
|
|
67
|
+
nord.nord10, // blue
|
|
68
|
+
nord.nord14, // green
|
|
69
|
+
nord.nord13, // yellow
|
|
70
|
+
nord.nord12, // orange
|
|
71
|
+
nord.nord15, // purple
|
|
72
|
+
nord.nord11, // red
|
|
73
|
+
nord.nord7, // teal
|
|
74
|
+
nord.nord8, // light blue
|
|
75
|
+
];
|