@markdy/core 1.0.23 → 1.0.25
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 +19 -9
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,12 @@ The parser and AST types for [MarkdyScript](../../docs/SYNTAX.md) — a diagram-
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Zero runtime dependencies** — pure TypeScript, no DOM or platform APIs
|
|
8
|
-
- **Single-pass parser** — line-by-line state machine with strict `ParseError` diagnostics
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
7
|
+
- **Zero runtime dependencies** — pure TypeScript, no DOM or platform APIs (~14 KB minzipped)
|
|
8
|
+
- **Single-pass parser** — line-by-line state machine with strict `ParseError` line-number diagnostics
|
|
9
|
+
- **17 Specialized Layout Engines** — `architecture`, `flowchart`, `tree`, `sequence`, `state`, `layers`, `nested`, `swimlane`, `timeline`, `gantt`, `medallion`, `flywheel`, `constellation`, `quadrant`, `pyramid`, `radar`, `venn`
|
|
10
|
+
- **8 Semantic Themes** — `paper`, `editorial`, `midnight`, `blueprint`, `graphite`, `nebula`, `terminal`, `sketchy`
|
|
11
|
+
- **Content-Adaptive Canvas Sizing** — automatically calculates optimal aspect ratio and bounds based on diagram items and topology
|
|
12
|
+
- **Well-Architected Governance & AST Diffing** — layer boundaries, deadlock cycle detection, gateway isolation, and semantic AST evolution
|
|
11
13
|
- **Isomorphic** — runs in Node.js, Deno, Bun, edge runtimes, and the browser
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
@@ -27,7 +29,14 @@ pnpm add @markdy/core
|
|
|
27
29
|
## Output preview
|
|
28
30
|
|
|
29
31
|
<p align="center">
|
|
30
|
-
<
|
|
32
|
+
<a href="https://markdy.com/playground/">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-url-shortener.webp" alt="Markdy Core Parser Architecture Preview" width="900" />
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://markdy.com/playground/">
|
|
38
|
+
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-concurrency-decision-flowchart.webp" alt="Markdy Concurrency Flowchart Preview" width="900" />
|
|
39
|
+
</a>
|
|
31
40
|
</p>
|
|
32
41
|
|
|
33
42
|
## Usage
|
|
@@ -72,10 +81,11 @@ try {
|
|
|
72
81
|
| `RenderPlan` | type | Positioned nodes, routed edges, group zones, sequence messages, timed cues, beat ranges |
|
|
73
82
|
| `SceneMeta` | type | Scene configuration; `meta.player` is authoritative, with deprecated flat mirrors retained for compatibility |
|
|
74
83
|
| `PlayerConfig` / `resolvePlayer` | type / function | Grouped playback, controls, interaction, and chrome configuration with host resolution |
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
84
|
+
| `generateThemeFromBrand` | `(hexColor, name?) => { light, dark }` | Generate WCAG-compliant light and dark theme palettes from any brand hex color |
|
|
85
|
+
| `validateArchitectureRules` | `(ast) => Diagnostic[]` | Run Well-Architected rules: cycle detection, layer boundaries, and gateway checks |
|
|
86
|
+
| `diffAST` | `(astA, astB) => ASTDiffResult` | Compare architecture versions, calculate diff metrics, and generate migration scenes |
|
|
87
|
+
| `compressUrlState` / `decompressUrlState` | `(code, opts?) => string` | Zero-dependency URL hash state encoder for shareable playground links |
|
|
88
|
+
| `THEMES` / `resolveTheme` | tokens / function | 8 Semantic theme palettes (`paper`, `editorial`, `nebula`, `midnight`, `blueprint`, `graphite`, `terminal`, `sketchy`) |
|
|
79
89
|
|
|
80
90
|
## Documentation
|
|
81
91
|
|
package/dist/index.js
CHANGED
|
@@ -995,7 +995,7 @@ function layoutRanked(ast, edges, opts) {
|
|
|
995
995
|
return nodes;
|
|
996
996
|
}
|
|
997
997
|
const maxPossibleStep = rankCount > 1 ? (contentW - NODE_W) / (rankCount - 1) : 0;
|
|
998
|
-
const colGap = rankCount > 1 ? Math.min(
|
|
998
|
+
const colGap = rankCount > 1 ? Math.min(300, Math.max(50, maxPossibleStep)) : 0;
|
|
999
999
|
const totalW = (rankCount - 1) * colGap + NODE_W;
|
|
1000
1000
|
const startX = SAFE + Math.max(0, (contentW - totalW) / 2);
|
|
1001
1001
|
for (const [rank, ids] of [...byRank.entries()].sort((a, b) => a[0] - b[0])) {
|
|
@@ -1622,10 +1622,12 @@ function layoutLayers(ast) {
|
|
|
1622
1622
|
function layoutNested(ast) {
|
|
1623
1623
|
const nodeIds = Object.keys(ast.nodes);
|
|
1624
1624
|
if (nodeIds.length === 0) return [];
|
|
1625
|
+
const topHeadroom = 20;
|
|
1626
|
+
const startY = TITLE_BAND + topHeadroom;
|
|
1625
1627
|
const contentW = ast.meta.width - SAFE * 2;
|
|
1626
|
-
const contentH = ast.meta.height -
|
|
1628
|
+
const contentH = ast.meta.height - startY - SAFE;
|
|
1627
1629
|
const centerX = SAFE + contentW / 2;
|
|
1628
|
-
const centerY =
|
|
1630
|
+
const centerY = startY + contentH / 2;
|
|
1629
1631
|
const N = nodeIds.length;
|
|
1630
1632
|
const padX = Math.min(54, contentW * 0.42 / Math.max(N, 1));
|
|
1631
1633
|
const padY = Math.min(48, contentH * 0.42 / Math.max(N, 1));
|
|
@@ -1641,7 +1643,7 @@ function layoutNested(ast) {
|
|
|
1641
1643
|
y = centerY - h / 2 + (N > 1 ? 16 : 0);
|
|
1642
1644
|
} else {
|
|
1643
1645
|
x = SAFE + idx * padX;
|
|
1644
|
-
y =
|
|
1646
|
+
y = startY + idx * padY;
|
|
1645
1647
|
w = contentW - idx * padX * 2;
|
|
1646
1648
|
h = contentH - idx * padY * 2;
|
|
1647
1649
|
}
|
package/package.json
CHANGED