@markdy/renderer-dom 1.1.7 → 1.3.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/README.md +58 -110
- package/dist/index.d.ts +178 -50
- package/dist/index.js +2574 -717
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
# @markdy/renderer-dom
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://markdy.com/playground/"><img src="https://img.shields.io/badge/⚡_Live_Studio-markdy.com%2Fplayground-3b82f6?style=for-the-badge" alt="Live Studio" /></a>
|
|
5
|
+
<a href="https://markdy.com/docs/"><img src="https://img.shields.io/badge/📖_Docs-Documentation-10b981?style=for-the-badge" alt="Documentation" /></a>
|
|
6
|
+
<a href="https://markdy.com/examples/"><img src="https://img.shields.io/badge/🌟_Blueprints-30+_Examples-f59e0b?style=for-the-badge" alt="Examples" /></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
Web Animations API renderer for [MarkdyScript](https://markdy.com/docs/) scenes. Translates a parsed AST into 60fps GPU-accelerated DOM elements and drives the animation timeline with interactive analytical capabilities (Blast Radius, Route Pathfinder, and SVG/GIF export).
|
|
10
|
+
|
|
11
|
+
> 🚀 **Try it live**: Test MarkdyScript in the browser at **[markdy.com/playground](https://markdy.com/playground/)**
|
|
12
|
+
> 📚 **Documentation**: Complete syntax guide and examples at **[markdy.com/docs](https://markdy.com/docs/)**
|
|
4
13
|
|
|
5
14
|
## Features
|
|
6
15
|
|
|
7
16
|
- **Browser-native** — Web Animations API + CSS transforms, no Canvas or GSAP (~24 KB minzipped)
|
|
17
|
+
- **Blast Radius & Upstream Impact Lens** — compute and highlight transitive inward callers and outward impact chains dynamically
|
|
18
|
+
- **Route Pathfinder** — discover and animate the shortest topological communication route between any two services
|
|
19
|
+
- **Dynamic Port Multiplexing & Fillet Connectors** — renders balanced parallel connection lanes with smooth rounded corner paths
|
|
8
20
|
- **17 Diagram Layout Topologies** — `architecture`, `flowchart`, `tree`, `sequence`, `state`, `layers`, `nested`, `swimlane`, `timeline`, `gantt`, `medallion`, `flywheel`, `constellation`, `quadrant`, `pyramid`, `radar`, `venn`
|
|
9
|
-
- **Dynamic Theme Switching** — live runtime switching across
|
|
21
|
+
- **Dynamic Theme Switching** — live runtime switching across 10 semantic themes (`paper`, `editorial`, `midnight`, `blueprint`, `graphite`, `nebula`, `terminal`, `sketchy`, `ink`, `doodle`)
|
|
10
22
|
- **Flow edges** — `->` request, `<-` response, `~>` event, `--` dependency, each with its own stroke, plus animated traveling pulse
|
|
11
23
|
- **Beat-driven cues** — `show`, `hide`, `glow`, `focus`, and `frame` camera zooms, sequenced by named beats
|
|
12
24
|
- **Media Exporters** — zero-dep animated GIF89a exporter with LZW compression and Figma-ready vector SVG export
|
|
@@ -21,133 +33,69 @@ Web Animations API renderer for [MarkdyScript](../../docs/SYNTAX.md) scenes. Tra
|
|
|
21
33
|
pnpm add @markdy/core @markdy/renderer-dom
|
|
22
34
|
```
|
|
23
35
|
|
|
24
|
-
## Package
|
|
36
|
+
## Package Position
|
|
25
37
|
|
|
26
38
|
```text
|
|
27
|
-
@markdy/core -> @markdy/renderer-dom -> browser scene playback
|
|
28
|
-
|
|
29
|
-
This package consumes parsed AST and drives DOM + Web Animations API timelines.
|
|
39
|
+
@markdy/core -> @markdy/renderer-dom -> browser scene playback & impact lens
|
|
30
40
|
```
|
|
31
41
|
|
|
32
|
-
## Output preview
|
|
33
|
-
|
|
34
|
-
<p align="center">
|
|
35
|
-
<a href="https://markdy.com/playground/">
|
|
36
|
-
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-lakehouse-medallion.webp" alt="Markdy DOM Renderer Lakehouse Medallion Output" width="900" />
|
|
37
|
-
</a>
|
|
38
|
-
</p>
|
|
39
|
-
<p align="center">
|
|
40
|
-
<a href="https://markdy.com/playground/">
|
|
41
|
-
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-nebula-constellation.webp" alt="Markdy DOM Renderer Nebula Constellation Output" width="900" />
|
|
42
|
-
</a>
|
|
43
|
-
</p>
|
|
44
|
-
|
|
45
42
|
## Usage
|
|
46
43
|
|
|
47
44
|
```typescript
|
|
48
|
-
import { createDiagram } from "@markdy/renderer-dom";
|
|
45
|
+
import { createDiagram, calculateBlastRadius, findShortestRoute } from "@markdy/renderer-dom";
|
|
46
|
+
import { parse } from "@markdy/core";
|
|
47
|
+
|
|
48
|
+
const code = `
|
|
49
|
+
scene "FinTech Checkout" theme=paper
|
|
50
|
+
layout LR
|
|
51
|
+
|
|
52
|
+
browser Client "Web Client"
|
|
53
|
+
gateway Gateway "API Gateway"
|
|
54
|
+
service PaymentSvc "Payment Service" @src="src/pay/index.ts#L10"
|
|
55
|
+
database LedgerDb "Ledger DB" icon=postgresql
|
|
56
|
+
|
|
57
|
+
beat checkout:
|
|
58
|
+
show $nodes stagger=60ms
|
|
59
|
+
Client -> Gateway "POST /checkout" -> PaymentSvc "Process" -> LedgerDb "Commit"
|
|
60
|
+
`;
|
|
49
61
|
|
|
50
62
|
const diagram = createDiagram({
|
|
51
63
|
container: document.getElementById("scene")!,
|
|
52
|
-
code
|
|
53
|
-
scene "Cache-Aside Architecture" theme=paper
|
|
54
|
-
layout LR
|
|
55
|
-
|
|
56
|
-
browser Client "Web Client"
|
|
57
|
-
gateway Gateway "API Gateway"
|
|
58
|
-
service Shortener "URL Service"
|
|
59
|
-
cache Redis "Redis Cluster"
|
|
60
|
-
|
|
61
|
-
beat hit:
|
|
62
|
-
show $nodes stagger=60ms
|
|
63
|
-
Client -> Gateway "GET /x9" -> Shortener "resolve"
|
|
64
|
-
Shortener -> Redis "GET slug:x9"
|
|
65
|
-
Shortener <- Redis "200 Target URL"
|
|
66
|
-
Client <- Gateway "301 Redirect"
|
|
67
|
-
`,
|
|
64
|
+
code,
|
|
68
65
|
autoplay: true,
|
|
69
66
|
});
|
|
70
67
|
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## API
|
|
79
|
-
|
|
80
|
-
### `createDiagram(options: DiagramOptions): Diagram`
|
|
81
|
-
|
|
82
|
-
| Option | Type | Default | Description |
|
|
83
|
-
|---|---|---|---|
|
|
84
|
-
| `container` | `HTMLElement` | *(required)* | DOM element to mount the scene into |
|
|
85
|
-
| `code` | `string` | *(required)* | MarkdyScript source code |
|
|
86
|
-
| `autoplay` | `boolean` | `player.playback.autoplay ?? true` | Override whether playback starts immediately |
|
|
87
|
-
| `loop` | `boolean` | `player.playback.loop ?? true` | Override whether playback loops at the end |
|
|
88
|
-
| `copyright` | `boolean` | `player.chrome.badge ?? true` | Show the linked badge at the footer's right edge |
|
|
89
|
-
| `progressBar` | `boolean \| string` | `true` | Deprecated compatibility flag for the scene-boundary progress bar |
|
|
90
|
-
| `sceneBoundaryProgress` | `boolean \| string` | `player.chrome.progress` | Override boundary progress, or pass a custom color/gradient |
|
|
91
|
-
| `progressColor` | `string` | `player.chrome.color` or rainbow | Override the progress color or gradient |
|
|
92
|
-
| `playbackRate` | `number` | `player.playback.rate ?? 1` | Override the initial timeline multiplier |
|
|
93
|
-
| `interactiveViewport` | `boolean` | `player.interaction` | `true` supplies default gestures; `false` suppresses script gestures |
|
|
94
|
-
| `controls` | `boolean` | `player.controls` | `true` supplies legacy toolbar defaults; `false` suppresses script controls |
|
|
95
|
-
| `shareUrl` | `string` | Markdy playground | Base URL used by the Share control when building `#code=` links |
|
|
96
|
-
| `onWarning` | `(warning: Diagnostic) => void` | `console.warn` | Called for each soft parse warning |
|
|
97
|
-
| `onTimeUpdate` | `(seconds: number, durationSeconds: number) => void` | — | Called whenever playback or seek changes the current time |
|
|
98
|
-
| `onPlayStateChange` | `(playing: boolean) => void` | — | Called when playback starts or pauses |
|
|
99
|
-
|
|
100
|
-
> **Note:** Prefer grouped `player:` configuration in MarkdyScript. Omitted host options preserve it; host `false` suppresses controls or interaction, while host `true` supplies legacy defaults for leaves the script does not set. A speed selector renders only with at least two distinct positive `speeds` values.
|
|
101
|
-
|
|
102
|
-
### `Diagram`
|
|
103
|
-
|
|
104
|
-
| Method | Description |
|
|
105
|
-
|---|---|
|
|
106
|
-
| `play()` | Start or resume playback |
|
|
107
|
-
| `pause()` | Pause at current position |
|
|
108
|
-
| `seek(seconds)` | Jump to a specific time |
|
|
109
|
-
| `setPlaybackRate(rate)` | Change timeline speed; ignores non-positive or non-finite values |
|
|
110
|
-
| `playbackRate()` | Current timeline speed multiplier |
|
|
111
|
-
| `currentTime()` | Current playback position in seconds |
|
|
112
|
-
| `duration()` | Total scene duration in seconds |
|
|
113
|
-
| `isPlaying()` | Whether the scene is currently playing |
|
|
114
|
-
| `setTheme(themeName)` | Switch theme dynamically at runtime across all 8 supported themes |
|
|
115
|
-
| `exportGif(options?)` | Render zero-dependency animated GIF89a with LZW compression |
|
|
116
|
-
| `exportSvg()` | Export Figma-compatible vector SVG snapshot of the current frame |
|
|
117
|
-
| `beats()` | Named `beat` ranges, in author order (empty if none) |
|
|
118
|
-
| `seekToBeat(name)` | Seek to the start of a named beat; no-op if the name doesn't match |
|
|
119
|
-
| `destroy()` | Remove DOM elements and cancel all animations |
|
|
120
|
-
|
|
121
|
-
## Module Structure
|
|
68
|
+
// Calculate Blast Radius
|
|
69
|
+
const ast = parse(code);
|
|
70
|
+
const impact = calculateBlastRadius("PaymentSvc", ast);
|
|
71
|
+
console.log("Upstream callers:", impact.upstreamNodeIds); // ['Gateway', 'Client']
|
|
72
|
+
console.log("Downstream blast:", impact.downstreamNodeIds); // ['LedgerDb']
|
|
122
73
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
diagram.ts — Public API, rAF loop, progress bar, responsive scaling
|
|
127
|
-
nodes.ts — Node element factory + scene title
|
|
128
|
-
edges.ts — Flow-edge SVG runtime, routing, and cue animations
|
|
129
|
-
sequence.ts — Participant lifelines, messages, and activation spans
|
|
130
|
-
tree.ts — Shared parent/child bus connectors
|
|
131
|
-
groups.ts — Group boundary zones
|
|
132
|
-
annotations.ts — Editorial callouts and leader lines
|
|
133
|
-
constellation.ts — Nebula halos, orbit rings, and deterministic stars
|
|
134
|
-
geometry/
|
|
135
|
-
rect.ts — Rects, points, and hit-testing (DOM-free, unit tested)
|
|
136
|
-
path.ts — Polyline measurement + obstacle-aware orthogonal routing
|
|
137
|
-
theme.ts — Scene ambience styles and theme-token application
|
|
74
|
+
// Shortest Route Pathfinder
|
|
75
|
+
const shortestPath = findShortestRoute("Client", "LedgerDb", ast);
|
|
76
|
+
console.log("Route:", shortestPath); // ['Client', 'Gateway', 'PaymentSvc', 'LedgerDb']
|
|
138
77
|
```
|
|
139
78
|
|
|
140
|
-
|
|
79
|
+
## API Exports
|
|
141
80
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
81
|
+
| Export | Type | Description |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `createDiagram(options)` | `Function` | Mounts and drives an animated diagram in a DOM container |
|
|
84
|
+
| `calculateBlastRadius(nodeId, ast)` | `Function` | Computes upstream dependency callers and downstream blast radius |
|
|
85
|
+
| `findShortestRoute(fromId, toId, ast)` | `Function` | Finds the shortest topological message path between two nodes |
|
|
86
|
+
| `applyImpactHighlight(container, impact)` | `Function` | Highlights affected subgraph and dims non-impacted nodes |
|
|
87
|
+
| `clearImpactHighlight(container)` | `Function` | Resets all impact highlighting |
|
|
88
|
+
| `exportDiagramAsVectorSvg(container, opts?)` | `Function` | Export pure SVG vector snapshot of active scene frame |
|
|
89
|
+
| `exportDiagramAsPng(container, opts?)` | `Function` | Export high-DPI rasterized PNG Blob |
|
|
90
|
+
| `exportDiagramAsGif(diagram, opts?)` | `Function` | Export animated GIF89a recording |
|
|
145
91
|
|
|
146
|
-
## Documentation
|
|
92
|
+
## Ecosystem & Documentation
|
|
147
93
|
|
|
148
|
-
- **[
|
|
149
|
-
- **[
|
|
94
|
+
- ⚡ **[Interactive Studio / Playground](https://markdy.com/playground/)** — edit MarkdyScript with instant live preview in your browser
|
|
95
|
+
- 📖 **[Syntax Guide & Reference](https://markdy.com/docs/)** — complete language specification and keywords
|
|
96
|
+
- 🌟 **[Canonical Blueprints](https://markdy.com/examples/)** — production-grade distributed system and cloud architectures
|
|
97
|
+
- 📦 **[GitHub Repository](https://github.com/HoangYell/markdy-com)** — source code, benchmarks, and issue tracker
|
|
150
98
|
|
|
151
99
|
## License
|
|
152
100
|
|
|
153
|
-
[MIT](
|
|
101
|
+
[MIT](https://github.com/HoangYell/markdy-com/blob/main/LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,92 @@
|
|
|
1
|
-
import { BeatRange, ThemeTokens, PlayerControlsConfig, Diagnostic,
|
|
1
|
+
import { RenderPlan, BeatRange, ThemeTokens, PlayerControlsConfig, Diagnostic, PositionedNode, DiagramAST } from '@markdy/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* packages/renderer-dom/src/export/svg-exporter.ts
|
|
5
|
+
* Standalone Pure Vector SVG & Figma-compatible design token asset export.
|
|
6
|
+
* Zero external dependencies.
|
|
7
|
+
*
|
|
8
|
+
* Produces 100% native vector SVG elements (<rect>, <path>, <text>, <g>, <marker>)
|
|
9
|
+
* that open cleanly in macOS Preview, Figma, Illustrator, GitHub, and all browsers.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface SvgExportOptions {
|
|
13
|
+
includeThemeStyles?: boolean;
|
|
14
|
+
transparentBackground?: boolean;
|
|
15
|
+
scale?: number;
|
|
16
|
+
mode?: "pure" | "foreignObject";
|
|
17
|
+
nodeStates?: Map<string, {
|
|
18
|
+
opacity: number;
|
|
19
|
+
transform?: string;
|
|
20
|
+
}>;
|
|
21
|
+
edgeStates?: Map<string, {
|
|
22
|
+
opacity: number;
|
|
23
|
+
strokeDashoffset?: string;
|
|
24
|
+
}>;
|
|
25
|
+
sequenceMessageStates?: Map<string, {
|
|
26
|
+
opacity: number;
|
|
27
|
+
}>;
|
|
28
|
+
sequenceActivationStates?: Map<number, {
|
|
29
|
+
opacity: number;
|
|
30
|
+
}>;
|
|
31
|
+
flowDots?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
r: number;
|
|
35
|
+
fill: string;
|
|
36
|
+
opacity: number;
|
|
37
|
+
}[];
|
|
38
|
+
activeCaption?: {
|
|
39
|
+
text: string;
|
|
40
|
+
opacity: number;
|
|
41
|
+
};
|
|
42
|
+
cameraTransform?: string;
|
|
43
|
+
}
|
|
44
|
+
declare function renderPureVectorSvg(plan: RenderPlan, options?: SvgExportOptions): string;
|
|
45
|
+
/**
|
|
46
|
+
* Serialize a live diagram container into Pure Vector SVG without foreignObject,
|
|
47
|
+
* capturing the active animated states (opacity, transforms, stroke offsets).
|
|
48
|
+
*/
|
|
49
|
+
declare function exportLiveSceneAsPureVectorSvg(containerEl: HTMLElement, options?: SvgExportOptions): string;
|
|
50
|
+
/**
|
|
51
|
+
* Main Vector SVG Export Function
|
|
52
|
+
* Accepts a MarkdyScript code string, a RenderPlan, or an HTMLElement container.
|
|
53
|
+
*/
|
|
54
|
+
declare function exportDiagramAsVectorSvg(target: HTMLElement | string | RenderPlan, options?: SvgExportOptions): string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* packages/renderer-dom/src/export/png-exporter.ts
|
|
58
|
+
* High-DPI raster PNG export with 2x retina scaling.
|
|
59
|
+
* Zero external dependencies.
|
|
60
|
+
*
|
|
61
|
+
* Fix: Inline all external resources (images, fonts) as base64 data URIs
|
|
62
|
+
* before drawing the SVG to canvas. A foreignObject-wrapped SVG taints the
|
|
63
|
+
* canvas whenever it references any external URL, so every resource must be
|
|
64
|
+
* inlined first.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
interface PngExportOptions extends SvgExportOptions {
|
|
68
|
+
pixelRatio?: number;
|
|
69
|
+
}
|
|
70
|
+
declare function exportDiagramAsPng(containerEl: HTMLElement, options?: PngExportOptions): Promise<Blob>;
|
|
71
|
+
|
|
72
|
+
interface TimelineController {
|
|
73
|
+
seek(seconds: number): void;
|
|
74
|
+
currentTime(): number;
|
|
75
|
+
duration(): number;
|
|
76
|
+
isPlaying(): boolean;
|
|
77
|
+
play(): void;
|
|
78
|
+
pause(): void;
|
|
79
|
+
}
|
|
80
|
+
interface GifDiagramExportOptions extends SvgExportOptions {
|
|
81
|
+
fps?: number;
|
|
82
|
+
pixelRatio?: number;
|
|
83
|
+
loop?: boolean;
|
|
84
|
+
dither?: boolean;
|
|
85
|
+
diff?: boolean;
|
|
86
|
+
holdEndMs?: number;
|
|
87
|
+
onProgress?: (progress: number, currentFrame: number, totalFrames: number) => void;
|
|
88
|
+
}
|
|
89
|
+
declare function exportDiagramAsGif(container: HTMLElement, timeline: TimelineController, options?: GifDiagramExportOptions): Promise<Blob>;
|
|
2
90
|
|
|
3
91
|
/**
|
|
4
92
|
* Markdy diagram runtime — renders a RenderPlan via WAAPI.
|
|
@@ -53,20 +141,26 @@ interface Diagram {
|
|
|
53
141
|
nextBeat(): void;
|
|
54
142
|
prevBeat(): void;
|
|
55
143
|
setTheme(theme: string | ThemeTokens): void;
|
|
144
|
+
exportSvg(options?: SvgExportOptions): string;
|
|
145
|
+
exportPng(options?: PngExportOptions): Promise<Blob>;
|
|
146
|
+
exportGif(options?: GifDiagramExportOptions): Promise<Blob>;
|
|
56
147
|
destroy(): void;
|
|
57
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Detects the host environment's theme mode (dark vs light).
|
|
151
|
+
* Universal support for Tailwind, Next.js, Starlight, Docusaurus, Bootstrap 5.3,
|
|
152
|
+
* GitHub Markdown, VS Code webviews, computed background lightness, and OS color schemes.
|
|
153
|
+
* Default light mode is "paper", default dark mode is "nebula".
|
|
154
|
+
*/
|
|
155
|
+
declare function detectHostTheme(container?: HTMLElement): "nebula" | "paper";
|
|
58
156
|
declare function createDiagram(opts: DiagramOptions): Diagram;
|
|
59
157
|
|
|
60
158
|
type SvgSpec = Array<[string, Record<string, string>]>;
|
|
61
159
|
type IconSpec = SvgSpec;
|
|
62
160
|
/** Read-only monochrome glyph registry; callers can inspect or choose keys without injecting markup. */
|
|
63
161
|
declare const ICON_REGISTRY: Readonly<Record<string, IconSpec>>;
|
|
162
|
+
declare function iconKeyForNode(node: PositionedNode): string;
|
|
64
163
|
|
|
65
|
-
/**
|
|
66
|
-
* packages/renderer-dom/src/export/gif-encoder.ts
|
|
67
|
-
* Pure TypeScript GIF89a Encoder with LZW Compression & Floyd-Steinberg Dithering.
|
|
68
|
-
* Zero external dependencies.
|
|
69
|
-
*/
|
|
70
164
|
interface AnimationRecordFrame {
|
|
71
165
|
imageData: ImageData;
|
|
72
166
|
delayMs: number;
|
|
@@ -74,52 +168,10 @@ interface AnimationRecordFrame {
|
|
|
74
168
|
interface GifExportOptions {
|
|
75
169
|
dither?: boolean;
|
|
76
170
|
loop?: boolean;
|
|
171
|
+
diff?: boolean;
|
|
77
172
|
}
|
|
78
173
|
declare function encodeGifSequence(frames: AnimationRecordFrame[], options?: GifExportOptions): Uint8Array;
|
|
79
174
|
|
|
80
|
-
/**
|
|
81
|
-
* packages/renderer-dom/src/export/svg-exporter.ts
|
|
82
|
-
* Standalone Vector SVG & Figma-compatible design token asset export.
|
|
83
|
-
* Zero external dependencies.
|
|
84
|
-
*/
|
|
85
|
-
interface SvgExportOptions {
|
|
86
|
-
includeThemeStyles?: boolean;
|
|
87
|
-
transparentBackground?: boolean;
|
|
88
|
-
scale?: number;
|
|
89
|
-
}
|
|
90
|
-
declare function exportDiagramAsVectorSvg(containerEl: HTMLElement, options?: SvgExportOptions): string;
|
|
91
|
-
|
|
92
|
-
interface TimelineController {
|
|
93
|
-
seek(seconds: number): void;
|
|
94
|
-
currentTime(): number;
|
|
95
|
-
duration(): number;
|
|
96
|
-
isPlaying(): boolean;
|
|
97
|
-
play(): void;
|
|
98
|
-
pause(): void;
|
|
99
|
-
}
|
|
100
|
-
interface GifDiagramExportOptions extends SvgExportOptions {
|
|
101
|
-
fps?: number;
|
|
102
|
-
pixelRatio?: number;
|
|
103
|
-
loop?: boolean;
|
|
104
|
-
}
|
|
105
|
-
declare function exportDiagramAsGif(container: HTMLElement, timeline: TimelineController, options?: GifDiagramExportOptions): Promise<Blob>;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* packages/renderer-dom/src/export/png-exporter.ts
|
|
109
|
-
* High-DPI raster PNG export with 2x retina scaling.
|
|
110
|
-
* Zero external dependencies.
|
|
111
|
-
*
|
|
112
|
-
* Fix: Inline all external resources (images, fonts) as base64 data URIs
|
|
113
|
-
* before drawing the SVG to canvas. A foreignObject-wrapped SVG taints the
|
|
114
|
-
* canvas whenever it references any external URL, so every resource must be
|
|
115
|
-
* inlined first.
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
interface PngExportOptions extends SvgExportOptions {
|
|
119
|
-
pixelRatio?: number;
|
|
120
|
-
}
|
|
121
|
-
declare function exportDiagramAsPng(containerEl: HTMLElement, options?: PngExportOptions): Promise<Blob>;
|
|
122
|
-
|
|
123
175
|
/**
|
|
124
176
|
* packages/renderer-dom/src/presentation-controller.ts
|
|
125
177
|
* Interactive Beat Navigation & Keyboard-driven presentation controller.
|
|
@@ -147,4 +199,80 @@ declare class DiagramPresentationController {
|
|
|
147
199
|
destroy(): void;
|
|
148
200
|
}
|
|
149
201
|
|
|
150
|
-
|
|
202
|
+
/**
|
|
203
|
+
* packages/renderer-dom/src/impact.ts
|
|
204
|
+
* Upstream/Downstream Blast Radius & Route Pathfinder for Markdy.
|
|
205
|
+
* Clean-room re-engineered interactive topology analysis.
|
|
206
|
+
* Zero external dependencies.
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
interface BlastRadiusResult {
|
|
210
|
+
rootNodeId: string;
|
|
211
|
+
upstreamNodeIds: Set<string>;
|
|
212
|
+
downstreamNodeIds: Set<string>;
|
|
213
|
+
allImpactedNodeIds: Set<string>;
|
|
214
|
+
connectedEdgeKeys: Set<string>;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Traverses diagram topology to compute upstream (who depends on this)
|
|
218
|
+
* and downstream (who does this depend on) blast radius.
|
|
219
|
+
*/
|
|
220
|
+
declare function calculateBlastRadius(nodeId: string, ast: DiagramAST, maxDepth?: number): BlastRadiusResult;
|
|
221
|
+
/**
|
|
222
|
+
* Finds the shortest topological path between two nodes in the diagram.
|
|
223
|
+
*/
|
|
224
|
+
declare function findShortestRoute(fromId: string, toId: string, ast: DiagramAST): string[] | null;
|
|
225
|
+
/**
|
|
226
|
+
* Highlights impacted nodes and edges within a rendered diagram container.
|
|
227
|
+
*/
|
|
228
|
+
declare function applyImpactHighlight(container: HTMLElement, impact: BlastRadiusResult): void;
|
|
229
|
+
/**
|
|
230
|
+
* Clears any active impact highlighting on the diagram.
|
|
231
|
+
*/
|
|
232
|
+
declare function clearImpactHighlight(container: HTMLElement): void;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* packages/renderer-dom/src/export/share-card.ts
|
|
236
|
+
* High-Impact 1200x630 Contextual Share Card Export Pipeline for Markdy.
|
|
237
|
+
* Clean-room re-engineered OpenGraph & Presentation Share Card synthesis.
|
|
238
|
+
* Zero external dependencies.
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
interface ShareCardOptions extends SvgExportOptions {
|
|
242
|
+
title?: string;
|
|
243
|
+
subtitle?: string;
|
|
244
|
+
variant?: "standard" | "route" | "reach";
|
|
245
|
+
theme?: "midnight" | "paper" | "blueprint" | "graphite" | "editorial" | "nebula" | "terminal";
|
|
246
|
+
pixelRatio?: number;
|
|
247
|
+
}
|
|
248
|
+
interface RouteCardOptions extends ShareCardOptions {
|
|
249
|
+
from: string;
|
|
250
|
+
to: string;
|
|
251
|
+
hops?: number;
|
|
252
|
+
protocol?: string;
|
|
253
|
+
}
|
|
254
|
+
interface ReachCardOptions extends ShareCardOptions {
|
|
255
|
+
rootId: string;
|
|
256
|
+
direction: "upstream" | "downstream" | "both";
|
|
257
|
+
impactedNodeCount?: number;
|
|
258
|
+
edgeCount?: number;
|
|
259
|
+
maxDepth?: number;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Wraps pure vector SVG within a high-density 1200x630 OpenGraph / Social Share Card.
|
|
263
|
+
*/
|
|
264
|
+
declare function renderShareCardSvg(diagramSvgXml: string, options?: ShareCardOptions): string;
|
|
265
|
+
/**
|
|
266
|
+
* Exports the live diagram container as a 1200x630 Share Card PNG Blob.
|
|
267
|
+
*/
|
|
268
|
+
declare function exportDiagramAsShareCard(containerEl: HTMLElement, options?: ShareCardOptions): Promise<Blob>;
|
|
269
|
+
/**
|
|
270
|
+
* Exports a focused message route as a 1200x630 Route Share Card PNG Blob.
|
|
271
|
+
*/
|
|
272
|
+
declare function exportRouteShareCard(containerEl: HTMLElement, route: RouteCardOptions, options?: ShareCardOptions): Promise<Blob>;
|
|
273
|
+
/**
|
|
274
|
+
* Exports an upstream or downstream blast radius subgraph as a 1200x630 Reach Share Card PNG Blob.
|
|
275
|
+
*/
|
|
276
|
+
declare function exportReachShareCard(containerEl: HTMLElement, reach: ReachCardOptions, options?: ShareCardOptions): Promise<Blob>;
|
|
277
|
+
|
|
278
|
+
export { type AnimationRecordFrame, type BlastRadiusResult, type ControllerOptions, type Diagram, type DiagramOptions, DiagramPresentationController, type GifDiagramExportOptions, type GifExportOptions, ICON_REGISTRY, type IconSpec, type PngExportOptions, type ReachCardOptions, type RouteCardOptions, type ShareCardOptions, type SvgExportOptions, type TimelineController, applyImpactHighlight, calculateBlastRadius, clearImpactHighlight, createDiagram, detectHostTheme, encodeGifSequence, exportDiagramAsGif, exportDiagramAsPng, exportDiagramAsShareCard, exportDiagramAsVectorSvg, exportLiveSceneAsPureVectorSvg, exportReachShareCard, exportRouteShareCard, findShortestRoute, iconKeyForNode, renderPureVectorSvg, renderShareCardSvg };
|