@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260326104921 → 0.8.1-dev.20260326110644
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/dist/index.d.mts +17 -32
- package/dist/index.d.ts +17 -32
- package/dist/index.js +1242 -3408
- package/dist/index.mjs +1255 -3109
- package/package.json +1 -7
- package/dist/CopyButton-XONTQQW7.mjs +0 -55
- package/dist/HlsPlayer-FFEIK6FG.mjs +0 -7
- package/dist/IframeClient-J22NMEVY.mjs +0 -96
- package/dist/chunk-CVVLFQ4J.mjs +0 -131
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acoustte-digital-services/digitalstore-controls-dev",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.20260326110644",
|
|
4
4
|
"description": "Reusable React components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -12,15 +12,9 @@
|
|
|
12
12
|
"build": "tsup"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"katex": "^0.16.0",
|
|
16
15
|
"react": "^18 || ^19",
|
|
17
16
|
"react-dom": "^18 || ^19"
|
|
18
17
|
},
|
|
19
|
-
"peerDependenciesMeta": {
|
|
20
|
-
"katex": {
|
|
21
|
-
"optional": true
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
18
|
"devDependencies": {
|
|
25
19
|
"@types/node": "^25.5.0",
|
|
26
20
|
"@types/react": "^19",
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/CopyButton.tsx
|
|
4
|
-
import { useState, useRef, useEffect } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function CopyButton({ text }) {
|
|
7
|
-
const [copied, setCopied] = useState(false);
|
|
8
|
-
const timeoutRef = useRef(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
return () => {
|
|
11
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
12
|
-
};
|
|
13
|
-
}, []);
|
|
14
|
-
const handleCopy = async () => {
|
|
15
|
-
try {
|
|
16
|
-
await navigator.clipboard.writeText(text);
|
|
17
|
-
setCopied(true);
|
|
18
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
19
|
-
timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.error("Failed to copy: ", err);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return /* @__PURE__ */ jsxs(
|
|
25
|
-
"button",
|
|
26
|
-
{
|
|
27
|
-
onClick: handleCopy,
|
|
28
|
-
className: "flex gap-1 items-center hover:text-white transition",
|
|
29
|
-
children: [
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
31
|
-
"svg",
|
|
32
|
-
{
|
|
33
|
-
width: "16",
|
|
34
|
-
height: "16",
|
|
35
|
-
viewBox: "0 0 24 24",
|
|
36
|
-
className: "w-4 h-4",
|
|
37
|
-
fill: "currentColor",
|
|
38
|
-
children: /* @__PURE__ */ jsx(
|
|
39
|
-
"path",
|
|
40
|
-
{
|
|
41
|
-
fillRule: "evenodd",
|
|
42
|
-
clipRule: "evenodd",
|
|
43
|
-
d: "M12 4C10.8954 4 10 4.89543 10 6H14C14 4.89543 13.1046 4 12 4ZM8.53513 4C9.22675 2.8044 10.5194 2 12 2C13.4806 2 14.7733 2.8044 15.4649 4H17C18.6569 4 20 5.34315 20 7V19C20 20.6569 18.6569 22 17 22H7C5.34315 22 4 20.6569 4 19V7C4 5.34315 5.34315 4 7 4H8.53513ZM8 6H7C6.44772 6 6 6.44772 6 7V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V7C18 6.44772 17.5523 6 17 6H16C16 7.10457 15.1046 8 14 8H10C8.89543 8 8 7.10457 8 6Z"
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
),
|
|
48
|
-
copied ? "Copied!" : "Copy code"
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
54
|
-
CopyButton as default
|
|
55
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
4
|
-
import React2, { useEffect, useRef, useState } from "react";
|
|
5
|
-
|
|
6
|
-
// src/components/IFrameLoaderView.tsx
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
var IFrameLoaderView = (props) => {
|
|
10
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
11
|
-
props.isDataFound == null && /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsxs("div", { className: "mt-4 bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
12
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center mb-4", children: [
|
|
13
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
14
|
-
/* @__PURE__ */ jsxs("div", { className: "ml-2", children: [
|
|
15
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
16
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
17
|
-
] })
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
20
|
-
/* @__PURE__ */ jsxs("div", { className: "animate-pulse", children: [
|
|
21
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
22
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
23
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
24
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
25
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
26
|
-
] }),
|
|
27
|
-
/* @__PURE__ */ jsxs("div", { className: "animate-pulse", children: [
|
|
28
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
29
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
30
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
31
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
32
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
33
|
-
] }),
|
|
34
|
-
/* @__PURE__ */ jsxs("div", { className: "animate-pulse", children: [
|
|
35
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
36
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
37
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
38
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
39
|
-
/* @__PURE__ */ jsx("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
40
|
-
] })
|
|
41
|
-
] })
|
|
42
|
-
] }) }),
|
|
43
|
-
props.children
|
|
44
|
-
] });
|
|
45
|
-
};
|
|
46
|
-
var IFrameLoaderView_default = IFrameLoaderView;
|
|
47
|
-
|
|
48
|
-
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
49
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
50
|
-
var IframeClient = ({ src }) => {
|
|
51
|
-
const iframeRef = useRef(null);
|
|
52
|
-
const [iframeHeight, setIframeHeight] = useState("100%");
|
|
53
|
-
const [isDataFound, setIsDataFound] = useState(null);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const handleReceiveMessage = (event) => {
|
|
56
|
-
const eventName = event?.data?.eventName;
|
|
57
|
-
const payload = event?.data?.payload;
|
|
58
|
-
if (eventName === "SET_HEIGHT" && payload?.height) {
|
|
59
|
-
let height = 500;
|
|
60
|
-
if (payload.height > 500) {
|
|
61
|
-
height = payload.height + 50;
|
|
62
|
-
}
|
|
63
|
-
setIframeHeight(`${height}px`);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
window.addEventListener("message", handleReceiveMessage);
|
|
67
|
-
return () => window.removeEventListener("message", handleReceiveMessage);
|
|
68
|
-
}, []);
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const handleResize = () => {
|
|
71
|
-
if (iframeRef.current) {
|
|
72
|
-
iframeRef.current.contentWindow?.postMessage({ eventName: "RESIZE" }, "*");
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
window.addEventListener("resize", handleResize);
|
|
76
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
77
|
-
}, []);
|
|
78
|
-
const handleIframeLoad = () => {
|
|
79
|
-
setIsDataFound(true);
|
|
80
|
-
};
|
|
81
|
-
return /* @__PURE__ */ jsx2(React2.Fragment, { children: /* @__PURE__ */ jsx2(IFrameLoaderView_default, { isDataFound, children: /* @__PURE__ */ jsx2(
|
|
82
|
-
"iframe",
|
|
83
|
-
{
|
|
84
|
-
ref: iframeRef,
|
|
85
|
-
src,
|
|
86
|
-
className: "w-full h-full border-none",
|
|
87
|
-
scrolling: "no",
|
|
88
|
-
style: { height: iframeHeight },
|
|
89
|
-
onLoad: handleIframeLoad
|
|
90
|
-
}
|
|
91
|
-
) }) });
|
|
92
|
-
};
|
|
93
|
-
var IframeClient_default = IframeClient;
|
|
94
|
-
export {
|
|
95
|
-
IframeClient_default as default
|
|
96
|
-
};
|
package/dist/chunk-CVVLFQ4J.mjs
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
// src/components/HlsPlayer.tsx
|
|
2
|
-
import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
3
|
-
import Hls from "hls.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
var HlsPlayer = React.memo(
|
|
6
|
-
({
|
|
7
|
-
assetUrl,
|
|
8
|
-
posterUrl,
|
|
9
|
-
intrinsicWidth,
|
|
10
|
-
intrinsicHeight,
|
|
11
|
-
showControls = true,
|
|
12
|
-
loop = false,
|
|
13
|
-
playOptions = "autoplay"
|
|
14
|
-
}) => {
|
|
15
|
-
const videoRef = useRef(null);
|
|
16
|
-
const hlsRef = useRef(null);
|
|
17
|
-
const [isPlaying, setIsPlaying] = useState(playOptions === "autoplay");
|
|
18
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
19
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
20
|
-
const wasManuallyPausedRef = useRef(false);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const checkMobile = () => {
|
|
23
|
-
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
24
|
-
const isSmallScreen = window.innerWidth <= 768;
|
|
25
|
-
const ua = navigator.userAgent.toLowerCase();
|
|
26
|
-
const isMobileUA = /android|iphone|ipad|ipod/i.test(ua);
|
|
27
|
-
setIsMobile(hasTouch || isSmallScreen || isMobileUA);
|
|
28
|
-
};
|
|
29
|
-
checkMobile();
|
|
30
|
-
window.addEventListener("resize", checkMobile);
|
|
31
|
-
return () => window.removeEventListener("resize", checkMobile);
|
|
32
|
-
}, []);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const v = videoRef.current;
|
|
35
|
-
if (!v || !assetUrl) return;
|
|
36
|
-
if (hlsRef.current) {
|
|
37
|
-
hlsRef.current.destroy();
|
|
38
|
-
hlsRef.current = null;
|
|
39
|
-
}
|
|
40
|
-
if (Hls.isSupported()) {
|
|
41
|
-
const hls = new Hls();
|
|
42
|
-
hls.loadSource(assetUrl);
|
|
43
|
-
hls.attachMedia(v);
|
|
44
|
-
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
45
|
-
if (isPlaying && !wasManuallyPausedRef.current) {
|
|
46
|
-
v.play().catch(console.error);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
hlsRef.current = hls;
|
|
50
|
-
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
51
|
-
v.src = assetUrl;
|
|
52
|
-
}
|
|
53
|
-
}, [assetUrl, isPlaying]);
|
|
54
|
-
const handlePlayPause = useCallback(() => {
|
|
55
|
-
const v = videoRef.current;
|
|
56
|
-
if (!v) return;
|
|
57
|
-
if (v.paused) {
|
|
58
|
-
wasManuallyPausedRef.current = false;
|
|
59
|
-
v.play().then(() => setIsPlaying(true));
|
|
60
|
-
} else {
|
|
61
|
-
wasManuallyPausedRef.current = true;
|
|
62
|
-
v.pause();
|
|
63
|
-
setIsPlaying(false);
|
|
64
|
-
}
|
|
65
|
-
}, []);
|
|
66
|
-
const handleMouseEnter = useCallback(() => {
|
|
67
|
-
if (isMobile) return;
|
|
68
|
-
setIsHovered(true);
|
|
69
|
-
if (playOptions === "playOnHover" && videoRef.current && !wasManuallyPausedRef.current) {
|
|
70
|
-
videoRef.current.play().then(() => setIsPlaying(true));
|
|
71
|
-
}
|
|
72
|
-
}, [playOptions, isMobile]);
|
|
73
|
-
const handleMouseLeave = useCallback(() => {
|
|
74
|
-
if (isMobile) return;
|
|
75
|
-
setIsHovered(false);
|
|
76
|
-
if (playOptions === "playOnHover" && videoRef.current) {
|
|
77
|
-
videoRef.current.pause();
|
|
78
|
-
videoRef.current.currentTime = 0;
|
|
79
|
-
setIsPlaying(false);
|
|
80
|
-
}
|
|
81
|
-
}, [playOptions, isMobile]);
|
|
82
|
-
return /* @__PURE__ */ jsxs(
|
|
83
|
-
"div",
|
|
84
|
-
{
|
|
85
|
-
className: "relative w-full aspect-video bg-black",
|
|
86
|
-
onMouseEnter: handleMouseEnter,
|
|
87
|
-
onMouseLeave: handleMouseLeave,
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
"video",
|
|
91
|
-
{
|
|
92
|
-
ref: videoRef,
|
|
93
|
-
className: "w-full h-full object-contain",
|
|
94
|
-
poster: posterUrl,
|
|
95
|
-
controls: showControls && (isMobile || isPlaying),
|
|
96
|
-
muted: playOptions === "autoplay" || playOptions === "playOnHover",
|
|
97
|
-
autoPlay: playOptions === "autoplay",
|
|
98
|
-
loop,
|
|
99
|
-
playsInline: true,
|
|
100
|
-
onClick: !isMobile && !isPlaying ? handlePlayPause : void 0
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
!isMobile && playOptions === "playOnHover" && posterUrl && /* @__PURE__ */ jsx(
|
|
104
|
-
"img",
|
|
105
|
-
{
|
|
106
|
-
src: posterUrl,
|
|
107
|
-
width: intrinsicWidth,
|
|
108
|
-
height: intrinsicHeight,
|
|
109
|
-
alt: "poster",
|
|
110
|
-
className: `absolute inset-0 object-cover transition-opacity ${isHovered ? "opacity-0" : "opacity-100"}`
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
!isMobile && !isPlaying && /* @__PURE__ */ jsx(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
className: "absolute inset-0 flex items-center justify-center cursor-pointer",
|
|
117
|
-
onClick: handlePlayPause,
|
|
118
|
-
children: "\u25B6"
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
HlsPlayer.displayName = "HlsPlayer";
|
|
127
|
-
var HlsPlayer_default = HlsPlayer;
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
HlsPlayer_default
|
|
131
|
-
};
|