@markdy/renderer-dom 1.4.3 → 1.4.4
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 +13 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +24 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
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
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
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
|
+
<a href="https://github.com/sponsors/HoangYell"><img src="https://img.shields.io/badge/💖_Sponsor-Support_Markdy-ea4aaa?style=for-the-badge" alt="Sponsor Markdy" /></a>
|
|
7
8
|
</p>
|
|
8
9
|
|
|
9
10
|
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
|
|
|
11
12
|
> 🚀 **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/)**
|
|
13
|
+
> 📚 **Documentation**: Complete syntax guide and examples at **[markdy.com/docs](https://markdy.com/docs/)**
|
|
14
|
+
> 💼 **Enterprise & Commercial**: Free under MIT. To support development or request custom architecture blueprints, explore **[GitHub Sponsors](https://github.com/sponsors/HoangYell)**.
|
|
13
15
|
|
|
14
16
|
## Features
|
|
15
17
|
|
|
@@ -149,6 +151,16 @@ when capture fails. Browser font and cross-origin image restrictions still apply
|
|
|
149
151
|
| `exportDiagramAsPng(container, opts?)` | `Function` | Export high-DPI rasterized PNG Blob |
|
|
150
152
|
| `exportDiagramAsGif(container, timeline, opts?)` | `Function` | Export animated GIF89a recording |
|
|
151
153
|
|
|
154
|
+
## Development & Visual Harness
|
|
155
|
+
|
|
156
|
+
To inspect the renderer visually during local development:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
pnpm --filter @markdy/renderer-dom run harness
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The harness runs on **`http://127.0.0.1:4325`** (port 4325 is decoupled from Astro's default port 4321 to avoid collisions with documentation previews). It serves canonical test fixtures, live theme switching, and real-time interactive DOM rendering.
|
|
163
|
+
|
|
152
164
|
## Ecosystem & Documentation
|
|
153
165
|
|
|
154
166
|
- ⚡ **[Interactive Studio / Playground](https://markdy.com/playground/)** — edit MarkdyScript with instant live preview in your browser
|
package/dist/index.d.ts
CHANGED
|
@@ -186,6 +186,18 @@ interface DiagramOptions {
|
|
|
186
186
|
* Defaults to 28px for grouped diagrams and 22px for ungrouped diagrams.
|
|
187
187
|
*/
|
|
188
188
|
contentPadding?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Initial fit-all-in-view state. Defaults to true when undeclared.
|
|
191
|
+
* If false, starts in unconstrained mode.
|
|
192
|
+
*/
|
|
193
|
+
defaultFit?: boolean;
|
|
194
|
+
/** Alias for defaultFit. */
|
|
195
|
+
fit?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Optional custom fullscreen toggle handler.
|
|
198
|
+
* When provided, the footer fullscreen control delegates toggling to this callback.
|
|
199
|
+
*/
|
|
200
|
+
onFullscreen?: (isFull: boolean) => void;
|
|
189
201
|
}
|
|
190
202
|
interface Diagram {
|
|
191
203
|
play(): void;
|
|
@@ -206,6 +218,7 @@ interface Diagram {
|
|
|
206
218
|
exportGif(options?: GifDiagramExportOptions): Promise<Blob>;
|
|
207
219
|
resize(): void;
|
|
208
220
|
resetView(): void;
|
|
221
|
+
syncFullscreen(isFull?: boolean): void;
|
|
209
222
|
destroy(): void;
|
|
210
223
|
}
|
|
211
224
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6211,11 +6211,14 @@ function createDiagram(opts) {
|
|
|
6211
6211
|
onTimeUpdate,
|
|
6212
6212
|
onPlayStateChange,
|
|
6213
6213
|
onEnded,
|
|
6214
|
+
onFullscreen,
|
|
6214
6215
|
responsiveLayout = "auto",
|
|
6215
6216
|
fitMode = "auto",
|
|
6216
6217
|
minReadableScale = 0.9,
|
|
6217
6218
|
targetWidthRatio = 0.96,
|
|
6218
|
-
contentPadding
|
|
6219
|
+
contentPadding,
|
|
6220
|
+
defaultFit,
|
|
6221
|
+
fit: explicitFitOption
|
|
6219
6222
|
} = opts;
|
|
6220
6223
|
function detectContainerOrientation(previous) {
|
|
6221
6224
|
const width = container.clientWidth || (typeof window === "undefined" ? 1024 : window.innerWidth);
|
|
@@ -6835,7 +6838,11 @@ function createDiagram(opts) {
|
|
|
6835
6838
|
let controlsTimeEl = null;
|
|
6836
6839
|
let controlsFitButton = null;
|
|
6837
6840
|
let closeCodePanel = null;
|
|
6838
|
-
|
|
6841
|
+
const explicitFit = defaultFit ?? explicitFitOption;
|
|
6842
|
+
let fitViewActive = explicitFit !== void 0 ? Boolean(explicitFit) : plan.meta.player?.controls?.fit !== void 0 ? Boolean(plan.meta.player.controls.fit) : opts.fitMode === "contain" || Boolean(fitViewButton);
|
|
6843
|
+
if (fitViewActive) {
|
|
6844
|
+
cameraLayer.style.setProperty("transform", "none", "important");
|
|
6845
|
+
}
|
|
6839
6846
|
const ICONS2 = {
|
|
6840
6847
|
play: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>',
|
|
6841
6848
|
pause: '<svg class="markdy-icon" width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>',
|
|
@@ -7207,8 +7214,12 @@ function createDiagram(opts) {
|
|
|
7207
7214
|
resetView() {
|
|
7208
7215
|
resetViewportTransform();
|
|
7209
7216
|
},
|
|
7217
|
+
syncFullscreen(isFull) {
|
|
7218
|
+
syncFullscreenHandler?.(isFull);
|
|
7219
|
+
},
|
|
7210
7220
|
destroy() {
|
|
7211
7221
|
diagram.pause();
|
|
7222
|
+
syncFullscreenHandler = null;
|
|
7212
7223
|
hostThemeObserver?.disconnect();
|
|
7213
7224
|
hostThemeObserver = null;
|
|
7214
7225
|
if (colorSchemeQuery && mediaQueryListener) {
|
|
@@ -7612,7 +7623,7 @@ function createDiagram(opts) {
|
|
|
7612
7623
|
if (!fitViewButton) return;
|
|
7613
7624
|
controlsFitButton = makeControlButton("Fit", "Fit all items in view and ignore camera zoom", ICONS2.fit);
|
|
7614
7625
|
controlsFitButton.className = "markdy-control-fit";
|
|
7615
|
-
controlsFitButton.setAttribute("aria-pressed", "false");
|
|
7626
|
+
controlsFitButton.setAttribute("aria-pressed", fitViewActive ? "true" : "false");
|
|
7616
7627
|
controlsFitButton.addEventListener("click", toggleFitView);
|
|
7617
7628
|
toolbar.appendChild(controlsFitButton);
|
|
7618
7629
|
}
|
|
@@ -7624,6 +7635,7 @@ function createDiagram(opts) {
|
|
|
7624
7635
|
toolbar.appendChild(button);
|
|
7625
7636
|
}
|
|
7626
7637
|
let removeFullscreenListeners = null;
|
|
7638
|
+
let syncFullscreenHandler = null;
|
|
7627
7639
|
function mountFullscreenControl(toolbar) {
|
|
7628
7640
|
if (!fullscreenButton) return;
|
|
7629
7641
|
const button = makeControlButton("Full", "Toggle fullscreen view", ICONS2.fullscreen);
|
|
@@ -7641,8 +7653,8 @@ function createDiagram(opts) {
|
|
|
7641
7653
|
document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled
|
|
7642
7654
|
);
|
|
7643
7655
|
}
|
|
7644
|
-
function syncFullscreenState() {
|
|
7645
|
-
const isFull = isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
|
|
7656
|
+
function syncFullscreenState(explicitFull) {
|
|
7657
|
+
const isFull = typeof explicitFull === "boolean" ? explicitFull : isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
|
|
7646
7658
|
button.setAttribute("aria-pressed", isFull ? "true" : "false");
|
|
7647
7659
|
button.title = isFull ? "Exit fullscreen" : "Toggle fullscreen view";
|
|
7648
7660
|
button.innerHTML = isFull ? `${ICONS2.fullscreen}Exit` : `${ICONS2.fullscreen}Full`;
|
|
@@ -7674,9 +7686,14 @@ function createDiagram(opts) {
|
|
|
7674
7686
|
syncControls();
|
|
7675
7687
|
}, 120);
|
|
7676
7688
|
}
|
|
7689
|
+
syncFullscreenHandler = (isFull) => syncFullscreenState(isFull);
|
|
7677
7690
|
async function toggleFullscreen() {
|
|
7678
7691
|
try {
|
|
7679
|
-
const isCurrentlyFull = isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
|
|
7692
|
+
const isCurrentlyFull = button.getAttribute("aria-pressed") === "true" || isPseudoFull || document.fullscreenElement === host || document.fullscreenElement === viewport || document.webkitFullscreenElement === host || document.webkitFullscreenElement === viewport || document.mozFullScreenElement === host || document.msFullscreenElement === host;
|
|
7693
|
+
if (onFullscreen) {
|
|
7694
|
+
onFullscreen(!isCurrentlyFull);
|
|
7695
|
+
return;
|
|
7696
|
+
}
|
|
7680
7697
|
if (!isCurrentlyFull) {
|
|
7681
7698
|
let enteredNative = false;
|
|
7682
7699
|
if (isNativeFullscreenSupported()) {
|
|
@@ -7744,6 +7761,7 @@ function createDiagram(opts) {
|
|
|
7744
7761
|
document.addEventListener("MSFullscreenChange", syncFullscreenState);
|
|
7745
7762
|
window.addEventListener("keydown", handleEscKey);
|
|
7746
7763
|
removeFullscreenListeners = () => {
|
|
7764
|
+
syncFullscreenHandler = null;
|
|
7747
7765
|
document.removeEventListener("fullscreenchange", syncFullscreenState);
|
|
7748
7766
|
document.removeEventListener("webkitfullscreenchange", syncFullscreenState);
|
|
7749
7767
|
document.removeEventListener("mozfullscreenchange", syncFullscreenState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/renderer-dom",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Browser renderer for diagram-native animated MarkdyScript architecture diagrams, built on the Web Animations API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"html2canvas": "^1.4.1",
|
|
49
|
-
"@markdy/core": "1.4.
|
|
49
|
+
"@markdy/core": "1.4.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"jsdom": "^29.1.1",
|
|
53
53
|
"tsup": "^8.5.1",
|
|
54
54
|
"typescript": "^5.9.3",
|
|
55
55
|
"vitest": "^4.1.7",
|
|
56
|
-
"@markdy/stdlib-systems": "1.4.
|
|
56
|
+
"@markdy/stdlib-systems": "1.4.4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsup",
|