@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260930111822 → 0.8.1-dev.20261001021620
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/CounterNodeClient-LNVEXZQE.mjs +87 -0
- package/dist/CounterNodeClient-ULMKR64R.mjs +85 -0
- package/dist/index.js +633 -611
- package/dist/index.mjs +184 -254
- package/dist/server.js +482 -460
- package/dist/server.mjs +80 -150
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
|
|
5
|
+
// src/components/pageRenderingEngine/nodes/CounterNodeClient.tsx
|
|
6
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var FORMAT_CLASSES = {
|
|
9
|
+
center: "justify-center text-center",
|
|
10
|
+
right: "justify-end text-right",
|
|
11
|
+
left: "justify-start text-left",
|
|
12
|
+
justify: "justify-between text-justify"
|
|
13
|
+
};
|
|
14
|
+
var CounterNodeClient = ({ node }) => {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
const startValue = typeof node?.startValue === "number" ? node.startValue : Number(node?.startValue) || 0;
|
|
17
|
+
const endValue = typeof node?.endValue === "number" ? node.endValue : Number(node?.endValue) || 0;
|
|
18
|
+
const duration = Math.max(Number(node?.duration) || 2e3, 300);
|
|
19
|
+
const prefix = node?.prefix ?? "";
|
|
20
|
+
const suffix = node?.suffix ?? "";
|
|
21
|
+
const format = node?.format;
|
|
22
|
+
const [displayValue, setDisplayValue] = useState(startValue);
|
|
23
|
+
const hasAnimatedRef = useRef(false);
|
|
24
|
+
const runAnimation = useCallback(() => {
|
|
25
|
+
let startTime = null;
|
|
26
|
+
let animationFrameId;
|
|
27
|
+
const step = (timestamp) => {
|
|
28
|
+
if (!startTime) startTime = timestamp;
|
|
29
|
+
const progress = Math.min((timestamp - startTime) / duration, 1);
|
|
30
|
+
const easeOutProgress = 1 - Math.pow(1 - progress, 3);
|
|
31
|
+
const currentVal = Math.round(startValue + (endValue - startValue) * easeOutProgress);
|
|
32
|
+
setDisplayValue(currentVal);
|
|
33
|
+
if (progress < 1) {
|
|
34
|
+
animationFrameId = requestAnimationFrame(step);
|
|
35
|
+
} else {
|
|
36
|
+
setDisplayValue(endValue);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
animationFrameId = requestAnimationFrame(step);
|
|
40
|
+
return () => {
|
|
41
|
+
if (animationFrameId) {
|
|
42
|
+
cancelAnimationFrame(animationFrameId);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, [startValue, endValue, duration]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const currentRef = ref.current;
|
|
48
|
+
if (!currentRef) return;
|
|
49
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
50
|
+
return runAnimation();
|
|
51
|
+
}
|
|
52
|
+
const observer = new IntersectionObserver(
|
|
53
|
+
(entries) => {
|
|
54
|
+
entries.forEach((entry) => {
|
|
55
|
+
if (entry.isIntersecting && !hasAnimatedRef.current) {
|
|
56
|
+
hasAnimatedRef.current = true;
|
|
57
|
+
runAnimation();
|
|
58
|
+
observer.unobserve(entry.target);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
{ threshold: 0.1 }
|
|
63
|
+
);
|
|
64
|
+
observer.observe(currentRef);
|
|
65
|
+
return () => {
|
|
66
|
+
observer.disconnect();
|
|
67
|
+
};
|
|
68
|
+
}, [runAnimation]);
|
|
69
|
+
if (!node) return null;
|
|
70
|
+
const alignClass = format && FORMAT_CLASSES[format] || "justify-center text-center";
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: `counter-node inline-flex items-center ${alignClass}`,
|
|
76
|
+
children: /* @__PURE__ */ jsxs("span", { className: "counter-display text-3xl font-bold tracking-tight", children: [
|
|
77
|
+
prefix,
|
|
78
|
+
displayValue.toLocaleString(),
|
|
79
|
+
suffix
|
|
80
|
+
] })
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
var CounterNodeClient_default = CounterNodeClient;
|
|
85
|
+
export {
|
|
86
|
+
CounterNodeClient_default as default
|
|
87
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/pageRenderingEngine/nodes/CounterNodeClient.tsx
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var FORMAT_CLASSES = {
|
|
7
|
+
center: "justify-center text-center",
|
|
8
|
+
right: "justify-end text-right",
|
|
9
|
+
left: "justify-start text-left",
|
|
10
|
+
justify: "justify-between text-justify"
|
|
11
|
+
};
|
|
12
|
+
var CounterNodeClient = ({ node }) => {
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
const startValue = typeof node?.startValue === "number" ? node.startValue : Number(node?.startValue) || 0;
|
|
15
|
+
const endValue = typeof node?.endValue === "number" ? node.endValue : Number(node?.endValue) || 0;
|
|
16
|
+
const duration = Math.max(Number(node?.duration) || 2e3, 300);
|
|
17
|
+
const prefix = node?.prefix ?? "";
|
|
18
|
+
const suffix = node?.suffix ?? "";
|
|
19
|
+
const format = node?.format;
|
|
20
|
+
const [displayValue, setDisplayValue] = useState(startValue);
|
|
21
|
+
const hasAnimatedRef = useRef(false);
|
|
22
|
+
const runAnimation = useCallback(() => {
|
|
23
|
+
let startTime = null;
|
|
24
|
+
let animationFrameId;
|
|
25
|
+
const step = (timestamp) => {
|
|
26
|
+
if (!startTime) startTime = timestamp;
|
|
27
|
+
const progress = Math.min((timestamp - startTime) / duration, 1);
|
|
28
|
+
const easeOutProgress = 1 - Math.pow(1 - progress, 3);
|
|
29
|
+
const currentVal = Math.round(startValue + (endValue - startValue) * easeOutProgress);
|
|
30
|
+
setDisplayValue(currentVal);
|
|
31
|
+
if (progress < 1) {
|
|
32
|
+
animationFrameId = requestAnimationFrame(step);
|
|
33
|
+
} else {
|
|
34
|
+
setDisplayValue(endValue);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
animationFrameId = requestAnimationFrame(step);
|
|
38
|
+
return () => {
|
|
39
|
+
if (animationFrameId) {
|
|
40
|
+
cancelAnimationFrame(animationFrameId);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [startValue, endValue, duration]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const currentRef = ref.current;
|
|
46
|
+
if (!currentRef) return;
|
|
47
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
48
|
+
return runAnimation();
|
|
49
|
+
}
|
|
50
|
+
const observer = new IntersectionObserver(
|
|
51
|
+
(entries) => {
|
|
52
|
+
entries.forEach((entry) => {
|
|
53
|
+
if (entry.isIntersecting && !hasAnimatedRef.current) {
|
|
54
|
+
hasAnimatedRef.current = true;
|
|
55
|
+
runAnimation();
|
|
56
|
+
observer.unobserve(entry.target);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
{ threshold: 0.1 }
|
|
61
|
+
);
|
|
62
|
+
observer.observe(currentRef);
|
|
63
|
+
return () => {
|
|
64
|
+
observer.disconnect();
|
|
65
|
+
};
|
|
66
|
+
}, [runAnimation]);
|
|
67
|
+
if (!node) return null;
|
|
68
|
+
const alignClass = format && FORMAT_CLASSES[format] || "justify-center text-center";
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
ref,
|
|
73
|
+
className: `counter-node inline-flex items-center ${alignClass}`,
|
|
74
|
+
children: /* @__PURE__ */ jsxs("span", { className: "counter-display text-3xl font-bold tracking-tight", children: [
|
|
75
|
+
prefix,
|
|
76
|
+
displayValue.toLocaleString(),
|
|
77
|
+
suffix
|
|
78
|
+
] })
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
var CounterNodeClient_default = CounterNodeClient;
|
|
83
|
+
export {
|
|
84
|
+
CounterNodeClient_default as default
|
|
85
|
+
};
|