@markdy/astro 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 +6 -3
- package/package.json +2 -2
- package/src/Markdy.astro +21 -1
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- **SSR placeholder** — correctly-sized `<div>` prevents layout shift before hydration
|
|
8
8
|
- **Viewport-triggered hydration** — `IntersectionObserver` with 100px root margin
|
|
9
9
|
- **View Transition compatible** — re-observes elements on `astro:page-load`
|
|
10
|
+
- **Semantic node cards** — inherits renderer SVG glyphs for technical node kinds
|
|
10
11
|
- **Zero config** — pass your MarkdyScript code as a prop
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
@@ -36,7 +37,7 @@ Astro integration provides an island wrapper for lazy client-side hydration.
|
|
|
36
37
|
import { Markdy } from "@markdy/astro";
|
|
37
38
|
|
|
38
39
|
const code = `
|
|
39
|
-
scene "Request" theme=
|
|
40
|
+
scene "Request" theme=paper width=800 height=400
|
|
40
41
|
browser Web
|
|
41
42
|
service API
|
|
42
43
|
beat main:
|
|
@@ -54,7 +55,7 @@ const code = `
|
|
|
54
55
|
import { Markdy } from "@markdy/astro";
|
|
55
56
|
|
|
56
57
|
export const code = `
|
|
57
|
-
scene "Request" theme=
|
|
58
|
+
scene "Request" theme=paper width=600 height=300
|
|
58
59
|
browser Web
|
|
59
60
|
service API
|
|
60
61
|
beat main:
|
|
@@ -77,7 +78,9 @@ export const code = `
|
|
|
77
78
|
| `autoplay` | `boolean` | `true` | Start playing on hydration |
|
|
78
79
|
| `loop` | `boolean` | `true` | Loop the animation when it ends |
|
|
79
80
|
| `copyright` | `boolean` | `true` | Show a "Powered by Markdy" badge below the animation |
|
|
80
|
-
| `progressBar` | `boolean` | `true` |
|
|
81
|
+
| `progressBar` | `boolean` | `true` | Deprecated compatibility flag for the rainbow scene-boundary progress bar |
|
|
82
|
+
| `sceneBoundaryProgress` | `boolean` | `progressBar` | Preferred flag for the rainbow scene-boundary progress bar |
|
|
83
|
+
| `playbackRate` | `number` | `1` | Timeline speed multiplier |
|
|
81
84
|
| `class` | `string` | — | CSS class for the outer wrapper |
|
|
82
85
|
|
|
83
86
|
> **Tip:** Match `width`, `height`, and `bg` props to your `scene` declaration values to avoid a visual flash on hydration.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/astro",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Astro island component for animated MarkdyScript architecture diagrams.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@markdy/renderer-dom": "0.8.
|
|
40
|
+
"@markdy/renderer-dom": "0.8.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"astro": ">=4.0.0"
|
package/src/Markdy.astro
CHANGED
|
@@ -42,6 +42,10 @@ export interface Props {
|
|
|
42
42
|
copyright?: boolean;
|
|
43
43
|
/** Show a rainbow progress bar around the viewport border. Defaults to true. */
|
|
44
44
|
progressBar?: boolean;
|
|
45
|
+
/** Preferred flag to show/hide rainbow progress at scene boundary. Defaults to true. */
|
|
46
|
+
sceneBoundaryProgress?: boolean;
|
|
47
|
+
/** Playback speed multiplier. Defaults to 1. */
|
|
48
|
+
playbackRate?: number;
|
|
45
49
|
class?: string;
|
|
46
50
|
/**
|
|
47
51
|
* Short human-readable title for the animation.
|
|
@@ -66,6 +70,8 @@ const {
|
|
|
66
70
|
loop = true,
|
|
67
71
|
copyright = true,
|
|
68
72
|
progressBar = true,
|
|
73
|
+
sceneBoundaryProgress,
|
|
74
|
+
playbackRate = 1,
|
|
69
75
|
class: className,
|
|
70
76
|
title = "Markdy animation",
|
|
71
77
|
description,
|
|
@@ -80,6 +86,8 @@ const {
|
|
|
80
86
|
data-markdy-loop={String(loop)}
|
|
81
87
|
data-markdy-copyright={String(copyright)}
|
|
82
88
|
data-markdy-progress-bar={String(progressBar)}
|
|
89
|
+
data-markdy-scene-boundary-progress={String(sceneBoundaryProgress ?? progressBar)}
|
|
90
|
+
data-markdy-playback-rate={String(playbackRate)}
|
|
83
91
|
role="img"
|
|
84
92
|
aria-label={title}
|
|
85
93
|
aria-busy="true"
|
|
@@ -243,6 +251,8 @@ const {
|
|
|
243
251
|
const loop = el.dataset.markdyLoop !== "false";
|
|
244
252
|
const copyright = el.dataset.markdyCopyright !== "false";
|
|
245
253
|
const progressBar = el.dataset.markdyProgressBar !== "false";
|
|
254
|
+
const sceneBoundaryProgress = el.dataset.markdySceneBoundaryProgress !== "false";
|
|
255
|
+
const playbackRate = Number(el.dataset.markdyPlaybackRate ?? "1");
|
|
246
256
|
|
|
247
257
|
// Code-split: renderer-dom is NOT part of the initial page bundle.
|
|
248
258
|
const { createPlayer } = await import("@markdy/renderer-dom");
|
|
@@ -251,7 +261,17 @@ const {
|
|
|
251
261
|
// async import resolves, so there is no flash of empty content.
|
|
252
262
|
el.innerHTML = "";
|
|
253
263
|
|
|
254
|
-
createPlayer({
|
|
264
|
+
createPlayer({
|
|
265
|
+
container: el,
|
|
266
|
+
code,
|
|
267
|
+
assets,
|
|
268
|
+
autoplay,
|
|
269
|
+
loop,
|
|
270
|
+
copyright,
|
|
271
|
+
progressBar,
|
|
272
|
+
sceneBoundaryProgress,
|
|
273
|
+
playbackRate: Number.isFinite(playbackRate) && playbackRate > 0 ? playbackRate : 1,
|
|
274
|
+
});
|
|
255
275
|
|
|
256
276
|
el.dataset.markdyInit = "done";
|
|
257
277
|
el.removeAttribute("aria-busy");
|