@markdy/renderer-dom 0.5.2 → 0.5.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 +4 -1
- package/dist/index.js +10 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,7 +50,10 @@ player.destroy(); // clean up DOM + cancel animations
|
|
|
50
50
|
| `container` | `HTMLElement` | *(required)* | DOM element to mount the scene into |
|
|
51
51
|
| `code` | `string` | *(required)* | MarkdyScript source code |
|
|
52
52
|
| `assets` | `Record<string, string>` | `{}` | Asset URL overrides (key = asset name) |
|
|
53
|
-
| `autoplay` | `boolean` | `
|
|
53
|
+
| `autoplay` | `boolean` | `true` | Start playing immediately |
|
|
54
|
+
| `loop` | `boolean` | `true` | Loop the animation when it reaches the end |
|
|
55
|
+
| `copyright` | `boolean` | `true` | Show a small "Powered by Markdy" badge below the animation |
|
|
56
|
+
| `progressBar` | `boolean` | `true` | Show a rainbow progress bar around the viewport border |
|
|
54
57
|
|
|
55
58
|
### `Player`
|
|
56
59
|
|
package/dist/index.js
CHANGED
|
@@ -663,7 +663,7 @@ function createPlayer(opts) {
|
|
|
663
663
|
if (!progressEl) return;
|
|
664
664
|
const deg = pct * 360;
|
|
665
665
|
const rainbow = "hsl(0,90%,60%), hsl(45,90%,55%), hsl(90,80%,50%), hsl(180,80%,50%), hsl(270,80%,55%), hsl(330,90%,60%)";
|
|
666
|
-
progressEl.style.background = `conic-gradient(from
|
|
666
|
+
progressEl.style.background = `conic-gradient(from 315deg, ${rainbow} ${deg}deg, transparent ${deg}deg)`;
|
|
667
667
|
progressEl.style.mask = `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`;
|
|
668
668
|
progressEl.style.webkitMask = progressEl.style.mask;
|
|
669
669
|
progressEl.style.maskComposite = "exclude";
|
|
@@ -686,7 +686,9 @@ function createPlayer(opts) {
|
|
|
686
686
|
textDecoration: "none",
|
|
687
687
|
padding: "3px 6px 0",
|
|
688
688
|
opacity: "0.7",
|
|
689
|
-
transition: "opacity 0.2s"
|
|
689
|
+
transition: "opacity 0.2s",
|
|
690
|
+
maxWidth: container.style.maxWidth || "100%",
|
|
691
|
+
width: "100%"
|
|
690
692
|
});
|
|
691
693
|
badge.addEventListener("mouseenter", () => {
|
|
692
694
|
badge.style.opacity = "1";
|
|
@@ -694,7 +696,11 @@ function createPlayer(opts) {
|
|
|
694
696
|
badge.addEventListener("mouseleave", () => {
|
|
695
697
|
badge.style.opacity = "0.7";
|
|
696
698
|
});
|
|
697
|
-
container.
|
|
699
|
+
if (container.parentNode) {
|
|
700
|
+
container.parentNode.insertBefore(badge, container.nextSibling);
|
|
701
|
+
} else {
|
|
702
|
+
container.appendChild(badge);
|
|
703
|
+
}
|
|
698
704
|
}
|
|
699
705
|
const scene = document.createElement("div");
|
|
700
706
|
Object.assign(scene.style, {
|
|
@@ -814,7 +820,7 @@ function createPlayer(opts) {
|
|
|
814
820
|
for (const anim of allAnims) anim.cancel();
|
|
815
821
|
resizeObserver.disconnect();
|
|
816
822
|
if (progressEl?.parentNode === viewport) viewport.removeChild(progressEl);
|
|
817
|
-
if (badge?.parentNode
|
|
823
|
+
if (badge?.parentNode) badge.parentNode.removeChild(badge);
|
|
818
824
|
if (viewport.parentNode === container) container.removeChild(viewport);
|
|
819
825
|
}
|
|
820
826
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdy/renderer-dom",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Web Animations API renderer for MarkdyScript scenes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@markdy/core": "0.5.
|
|
46
|
+
"@markdy/core": "0.5.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"tsup": "^8.5.1",
|