@markdy/core 0.8.1 → 0.8.3
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/index.d.ts +10 -0
- package/dist/index.js +86 -24
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,15 @@ type ThemeTokens = {
|
|
|
128
128
|
gridMajor: string;
|
|
129
129
|
vignette: string;
|
|
130
130
|
accent: string;
|
|
131
|
+
/** Node card fill (falls back to surface derivations when omitted). */
|
|
132
|
+
nodeSurface?: string;
|
|
133
|
+
nodeSurfaceRaised?: string;
|
|
134
|
+
/** Node hairline / inset ring color. */
|
|
135
|
+
hairline?: string;
|
|
136
|
+
/** Ambient drop-shadow color (rgba). */
|
|
137
|
+
shadow?: string;
|
|
138
|
+
/** Edge label pill fill. */
|
|
139
|
+
labelPlate?: string;
|
|
131
140
|
roles: Record<string, string>;
|
|
132
141
|
edges: Record<EdgeKind, string>;
|
|
133
142
|
};
|
|
@@ -141,6 +150,7 @@ type PositionedNode = {
|
|
|
141
150
|
width: number;
|
|
142
151
|
height: number;
|
|
143
152
|
style?: Record<string, unknown>;
|
|
153
|
+
props?: Record<string, unknown>;
|
|
144
154
|
opacity: number;
|
|
145
155
|
};
|
|
146
156
|
type RoutedEdge = {
|
package/dist/index.js
CHANGED
|
@@ -355,7 +355,18 @@ function nodeRole(kind) {
|
|
|
355
355
|
return TECHNICAL_NODE_KINDS[kind] ?? "compute";
|
|
356
356
|
}
|
|
357
357
|
function humanizeId(id) {
|
|
358
|
-
|
|
358
|
+
const acronyms = /* @__PURE__ */ new Set(["api", "cdn", "db", "dns", "http", "https", "id", "jwt", "oidc", "sdk", "tls", "ui", "url"]);
|
|
359
|
+
const exactCase = /* @__PURE__ */ new Map([
|
|
360
|
+
["etcd", "etcd"],
|
|
361
|
+
["kubectl", "kubectl"]
|
|
362
|
+
]);
|
|
363
|
+
return id.replace(/[_-]+/g, " ").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/([a-z\d])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean).map((word) => {
|
|
364
|
+
const lower = word.toLowerCase();
|
|
365
|
+
const exact = exactCase.get(lower);
|
|
366
|
+
if (exact) return exact;
|
|
367
|
+
if (acronyms.has(lower)) return lower.toUpperCase();
|
|
368
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
369
|
+
}).join(" ");
|
|
359
370
|
}
|
|
360
371
|
var NODE_ALIASES = {
|
|
361
372
|
db: "database",
|
|
@@ -370,10 +381,10 @@ function canonicalNodeKind(kind) {
|
|
|
370
381
|
}
|
|
371
382
|
|
|
372
383
|
// src/compiler.ts
|
|
373
|
-
var SAFE =
|
|
374
|
-
var TITLE_BAND =
|
|
375
|
-
var NODE_W =
|
|
376
|
-
var NODE_H =
|
|
384
|
+
var SAFE = 44;
|
|
385
|
+
var TITLE_BAND = 76;
|
|
386
|
+
var NODE_W = 168;
|
|
387
|
+
var NODE_H = 72;
|
|
377
388
|
var DEFAULTS = {
|
|
378
389
|
show: 0.35,
|
|
379
390
|
hide: 0.35,
|
|
@@ -487,6 +498,7 @@ function layoutNodes(ast, edges) {
|
|
|
487
498
|
width: NODE_W,
|
|
488
499
|
height: NODE_H,
|
|
489
500
|
style,
|
|
501
|
+
props: decl.props,
|
|
490
502
|
opacity: 0
|
|
491
503
|
});
|
|
492
504
|
});
|
|
@@ -649,37 +661,87 @@ var EDGE_COLORS = {
|
|
|
649
661
|
var THEMES = {
|
|
650
662
|
midnight: {
|
|
651
663
|
name: "midnight",
|
|
652
|
-
canvas: "#
|
|
653
|
-
surface: "#
|
|
654
|
-
surfaceRaised: "#
|
|
655
|
-
border: "#
|
|
664
|
+
canvas: "#070d18",
|
|
665
|
+
surface: "#0e1a2c",
|
|
666
|
+
surfaceRaised: "#152538",
|
|
667
|
+
border: "#28384f",
|
|
656
668
|
text: "#f4f7fb",
|
|
657
|
-
textMuted: "#
|
|
658
|
-
gridMinor: "rgba(148, 163, 184, 0.
|
|
659
|
-
gridMajor: "rgba(148, 163, 184, 0.
|
|
660
|
-
vignette: "rgba(2, 6, 23, 0.
|
|
669
|
+
textMuted: "#93a4bb",
|
|
670
|
+
gridMinor: "rgba(148, 163, 184, 0.10)",
|
|
671
|
+
gridMajor: "rgba(148, 163, 184, 0.16)",
|
|
672
|
+
vignette: "rgba(2, 6, 23, 0.7)",
|
|
661
673
|
accent: "#38bdf8",
|
|
674
|
+
nodeSurface: "#111f33",
|
|
675
|
+
nodeSurfaceRaised: "#1a2c44",
|
|
676
|
+
hairline: "rgba(148, 163, 184, 0.16)",
|
|
677
|
+
shadow: "rgba(2, 6, 23, 0.6)",
|
|
678
|
+
labelPlate: "#0f1c2e",
|
|
662
679
|
roles: { ...ROLE_COLORS },
|
|
663
680
|
edges: { ...EDGE_COLORS }
|
|
664
681
|
},
|
|
665
682
|
paper: {
|
|
666
683
|
name: "paper",
|
|
667
|
-
canvas: "#
|
|
684
|
+
canvas: "#f6f8fc",
|
|
668
685
|
surface: "#ffffff",
|
|
669
|
-
surfaceRaised: "#
|
|
670
|
-
border: "#
|
|
671
|
-
text: "#
|
|
672
|
-
textMuted: "#
|
|
673
|
-
gridMinor: "rgba(15, 23, 42, 0.
|
|
674
|
-
gridMajor: "rgba(15, 23, 42, 0.
|
|
675
|
-
vignette: "rgba(
|
|
676
|
-
accent: "#
|
|
686
|
+
surfaceRaised: "#f0f4f9",
|
|
687
|
+
border: "#d3dde9",
|
|
688
|
+
text: "#0f1c2e",
|
|
689
|
+
textMuted: "#5a6b80",
|
|
690
|
+
gridMinor: "rgba(15, 23, 42, 0.06)",
|
|
691
|
+
gridMajor: "rgba(15, 23, 42, 0.10)",
|
|
692
|
+
vignette: "rgba(226, 232, 240, 0.6)",
|
|
693
|
+
accent: "#0284c7",
|
|
694
|
+
nodeSurface: "#ffffff",
|
|
695
|
+
nodeSurfaceRaised: "#f7fafd",
|
|
696
|
+
hairline: "rgba(15, 23, 42, 0.10)",
|
|
697
|
+
shadow: "rgba(15, 23, 42, 0.14)",
|
|
698
|
+
labelPlate: "#ffffff",
|
|
699
|
+
roles: { ...ROLE_COLORS },
|
|
700
|
+
edges: { ...EDGE_COLORS }
|
|
701
|
+
},
|
|
702
|
+
blueprint: {
|
|
703
|
+
name: "blueprint",
|
|
704
|
+
canvas: "#0a1a3a",
|
|
705
|
+
surface: "#10214a",
|
|
706
|
+
surfaceRaised: "#182c5c",
|
|
707
|
+
border: "#2c477f",
|
|
708
|
+
text: "#eaf1ff",
|
|
709
|
+
textMuted: "#9fb6e0",
|
|
710
|
+
gridMinor: "rgba(125, 170, 255, 0.12)",
|
|
711
|
+
gridMajor: "rgba(125, 170, 255, 0.2)",
|
|
712
|
+
vignette: "rgba(4, 12, 34, 0.72)",
|
|
713
|
+
accent: "#5ba3ff",
|
|
714
|
+
nodeSurface: "#122452",
|
|
715
|
+
nodeSurfaceRaised: "#1b3068",
|
|
716
|
+
hairline: "rgba(125, 170, 255, 0.18)",
|
|
717
|
+
shadow: "rgba(3, 10, 30, 0.6)",
|
|
718
|
+
labelPlate: "#10214a",
|
|
719
|
+
roles: { ...ROLE_COLORS },
|
|
720
|
+
edges: { ...EDGE_COLORS }
|
|
721
|
+
},
|
|
722
|
+
graphite: {
|
|
723
|
+
name: "graphite",
|
|
724
|
+
canvas: "#111317",
|
|
725
|
+
surface: "#191c22",
|
|
726
|
+
surfaceRaised: "#22262e",
|
|
727
|
+
border: "#343a45",
|
|
728
|
+
text: "#eef1f5",
|
|
729
|
+
textMuted: "#9aa3b1",
|
|
730
|
+
gridMinor: "rgba(160, 170, 185, 0.08)",
|
|
731
|
+
gridMajor: "rgba(160, 170, 185, 0.14)",
|
|
732
|
+
vignette: "rgba(0, 0, 0, 0.6)",
|
|
733
|
+
accent: "#2dd4bf",
|
|
734
|
+
nodeSurface: "#1c2028",
|
|
735
|
+
nodeSurfaceRaised: "#262b34",
|
|
736
|
+
hairline: "rgba(160, 170, 185, 0.14)",
|
|
737
|
+
shadow: "rgba(0, 0, 0, 0.55)",
|
|
738
|
+
labelPlate: "#191c22",
|
|
677
739
|
roles: { ...ROLE_COLORS },
|
|
678
740
|
edges: { ...EDGE_COLORS }
|
|
679
741
|
}
|
|
680
742
|
};
|
|
681
743
|
function resolveTheme(name) {
|
|
682
|
-
return THEMES[name] ?? THEMES.
|
|
744
|
+
return THEMES[name] ?? THEMES.paper;
|
|
683
745
|
}
|
|
684
746
|
|
|
685
747
|
// src/parser.ts
|
|
@@ -942,7 +1004,7 @@ function parse(source, opts = {}) {
|
|
|
942
1004
|
width: 1280,
|
|
943
1005
|
height: 720,
|
|
944
1006
|
fps: 60,
|
|
945
|
-
theme: "
|
|
1007
|
+
theme: "paper",
|
|
946
1008
|
direction: "LR"
|
|
947
1009
|
};
|
|
948
1010
|
const styles = {};
|
package/package.json
CHANGED