@tuwaio/docs-ui 0.0.29 → 0.0.31
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/components/CodeBlock.cjs +61 -0
- package/dist/components/CodeBlock.d.cts +20 -0
- package/dist/components/CodeBlock.d.ts +20 -0
- package/dist/components/CodeBlock.js +37 -0
- package/dist/components/CodeHighlighter.cjs +52 -0
- package/dist/components/CodeHighlighter.d.cts +10 -0
- package/dist/components/CodeHighlighter.d.ts +10 -0
- package/dist/components/CodeHighlighter.js +18 -0
- package/dist/components/CopyIconButton.cjs +44 -0
- package/dist/components/CopyIconButton.d.cts +9 -0
- package/dist/components/CopyIconButton.d.ts +9 -0
- package/dist/components/CopyIconButton.js +20 -0
- package/dist/components/Features.cjs +42 -0
- package/dist/components/Features.d.cts +11 -0
- package/dist/components/Features.d.ts +11 -0
- package/dist/components/Features.js +18 -0
- package/dist/components/Footer.cjs +66 -0
- package/dist/components/Footer.d.cts +9 -0
- package/dist/components/Footer.d.ts +9 -0
- package/dist/components/Footer.js +42 -0
- package/dist/components/Logo.cjs +75 -0
- package/dist/components/Logo.d.cts +12 -0
- package/dist/components/Logo.d.ts +12 -0
- package/dist/components/Logo.js +41 -0
- package/dist/components/NavBar.cjs +50 -0
- package/dist/components/NavBar.d.cts +16 -0
- package/dist/components/NavBar.d.ts +16 -0
- package/dist/components/NavBar.js +26 -0
- package/dist/components/NoSSR.cjs +36 -0
- package/dist/components/NoSSR.d.cts +16 -0
- package/dist/components/NoSSR.d.ts +16 -0
- package/dist/components/NoSSR.js +16 -0
- package/dist/components/PackageInstallationTabs.cjs +64 -0
- package/dist/components/PackageInstallationTabs.d.cts +8 -0
- package/dist/components/PackageInstallationTabs.d.ts +8 -0
- package/dist/components/PackageInstallationTabs.js +40 -0
- package/dist/components/StarryBackground.cjs +162 -0
- package/dist/components/StarryBackground.d.cts +5 -0
- package/dist/components/StarryBackground.d.ts +5 -0
- package/dist/components/StarryBackground.js +142 -0
- package/dist/components/StyledLink.cjs +44 -0
- package/dist/components/StyledLink.d.cts +9 -0
- package/dist/components/StyledLink.d.ts +9 -0
- package/dist/components/StyledLink.js +20 -0
- package/dist/components/ThemeSwitcher.cjs +96 -0
- package/dist/components/ThemeSwitcher.d.cts +9 -0
- package/dist/components/ThemeSwitcher.d.ts +9 -0
- package/dist/components/ThemeSwitcher.js +72 -0
- package/dist/components/VideoPlayer.cjs +103 -0
- package/dist/components/VideoPlayer.d.cts +34 -0
- package/dist/components/VideoPlayer.d.ts +34 -0
- package/dist/components/VideoPlayer.js +79 -0
- package/dist/index.cjs +68 -2
- package/dist/index.css +3 -3
- package/dist/index.d.cts +15 -139
- package/dist/index.d.ts +15 -139
- package/dist/index.js +19 -2
- package/dist/utils.cjs +52 -0
- package/dist/utils.d.cts +16 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.js +27 -0
- package/package.json +11 -10
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
const NUM_STARS = 100;
|
|
5
|
+
const STAR_RADIUS_MIN = 0.9;
|
|
6
|
+
const STAR_RADIUS_MAX = 2.7;
|
|
7
|
+
const STAR_VELOCITY_FACTOR = 0.3;
|
|
8
|
+
const STAR_INITIAL_OPACITY_MIN = 0.5;
|
|
9
|
+
const STAR_INITIAL_OPACITY_RANGE = 0.5;
|
|
10
|
+
const MOUSE_REPEL_DISTANCE = 150;
|
|
11
|
+
const MOUSE_REPEL_DISTANCE_SQ = MOUSE_REPEL_DISTANCE * MOUSE_REPEL_DISTANCE;
|
|
12
|
+
const MOUSE_REPEL_FORCE = 2;
|
|
13
|
+
const LINE_MAX_DISTANCE = 120;
|
|
14
|
+
const LINE_MAX_DISTANCE_SQ = LINE_MAX_DISTANCE * LINE_MAX_DISTANCE;
|
|
15
|
+
const LINE_WIDTH = 0.75;
|
|
16
|
+
const TWINKLE_SPEED = 1e-3;
|
|
17
|
+
function StarryBackground() {
|
|
18
|
+
const canvasRef = useRef(null);
|
|
19
|
+
const mouseRef = useRef({ x: 0, y: 0 });
|
|
20
|
+
const starsRef = useRef([]);
|
|
21
|
+
const animationIdRef = useRef(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const canvas = canvasRef.current;
|
|
24
|
+
if (!canvas) return;
|
|
25
|
+
const ctx = canvas.getContext("2d");
|
|
26
|
+
if (!ctx) return;
|
|
27
|
+
const setCanvasSize = () => {
|
|
28
|
+
canvas.width = window.innerWidth;
|
|
29
|
+
canvas.height = window.innerHeight;
|
|
30
|
+
};
|
|
31
|
+
const createStars = () => {
|
|
32
|
+
const stars = [];
|
|
33
|
+
for (let i = 0; i < NUM_STARS; i++) {
|
|
34
|
+
stars.push({
|
|
35
|
+
x: Math.random() * canvas.width,
|
|
36
|
+
y: Math.random() * canvas.height,
|
|
37
|
+
radius: Math.random() * (STAR_RADIUS_MAX - STAR_RADIUS_MIN) + STAR_RADIUS_MIN,
|
|
38
|
+
vx: (Math.random() - 0.5) * STAR_VELOCITY_FACTOR,
|
|
39
|
+
vy: (Math.random() - 0.5) * STAR_VELOCITY_FACTOR,
|
|
40
|
+
opacity: Math.random() * STAR_INITIAL_OPACITY_RANGE + STAR_INITIAL_OPACITY_MIN
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return stars;
|
|
44
|
+
};
|
|
45
|
+
const handleMouseMove = (e) => {
|
|
46
|
+
mouseRef.current.x = e.clientX;
|
|
47
|
+
mouseRef.current.y = e.clientY;
|
|
48
|
+
};
|
|
49
|
+
const handleResize = () => {
|
|
50
|
+
setCanvasSize();
|
|
51
|
+
starsRef.current = createStars();
|
|
52
|
+
};
|
|
53
|
+
const updateAndDrawScene = (timestamp) => {
|
|
54
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
55
|
+
const stars = starsRef.current;
|
|
56
|
+
const mouse = mouseRef.current;
|
|
57
|
+
const isDark = document.documentElement.classList.contains("dark");
|
|
58
|
+
for (const star of stars) {
|
|
59
|
+
star.x += star.vx;
|
|
60
|
+
star.y += star.vy;
|
|
61
|
+
if (star.x < 0 || star.x > canvas.width) star.vx = -star.vx;
|
|
62
|
+
if (star.y < 0 || star.y > canvas.height) star.vy = -star.vy;
|
|
63
|
+
const dxMouse = mouse.x - star.x;
|
|
64
|
+
const dyMouse = mouse.y - star.y;
|
|
65
|
+
const distMouseSq = dxMouse * dxMouse + dyMouse * dyMouse;
|
|
66
|
+
if (distMouseSq < MOUSE_REPEL_DISTANCE_SQ) {
|
|
67
|
+
const distance = Math.sqrt(distMouseSq);
|
|
68
|
+
const force = (MOUSE_REPEL_DISTANCE - distance) / MOUSE_REPEL_DISTANCE;
|
|
69
|
+
const forceX = dxMouse / distance * force * MOUSE_REPEL_FORCE;
|
|
70
|
+
const forceY = dyMouse / distance * force * MOUSE_REPEL_FORCE;
|
|
71
|
+
star.x -= forceX;
|
|
72
|
+
star.y -= forceY;
|
|
73
|
+
}
|
|
74
|
+
star.opacity = 0.3 + Math.sin(timestamp * TWINKLE_SPEED + star.x) * 0.5 + 0.5;
|
|
75
|
+
const clampedOpacity = Math.min(star.opacity, 1);
|
|
76
|
+
const gradient = ctx.createRadialGradient(star.x, star.y, 0, star.x, star.y, star.radius);
|
|
77
|
+
if (isDark) {
|
|
78
|
+
gradient.addColorStop(0, `rgba(255, 255, 255, ${clampedOpacity})`);
|
|
79
|
+
gradient.addColorStop(0.5, `rgba(147, 197, 253, ${clampedOpacity * 0.6})`);
|
|
80
|
+
gradient.addColorStop(1, "rgba(59, 130, 246, 0)");
|
|
81
|
+
} else {
|
|
82
|
+
gradient.addColorStop(0, `rgba(15, 23, 42, ${clampedOpacity})`);
|
|
83
|
+
gradient.addColorStop(0.5, `rgba(71, 85, 105, ${clampedOpacity * 0.6})`);
|
|
84
|
+
gradient.addColorStop(1, "rgba(148, 163, 184, 0)");
|
|
85
|
+
}
|
|
86
|
+
ctx.beginPath();
|
|
87
|
+
ctx.arc(star.x, star.y, star.radius, 0, Math.PI * 2);
|
|
88
|
+
ctx.fillStyle = gradient;
|
|
89
|
+
ctx.fill();
|
|
90
|
+
}
|
|
91
|
+
ctx.lineWidth = LINE_WIDTH;
|
|
92
|
+
for (let i = 0; i < stars.length; i++) {
|
|
93
|
+
const star1 = stars[i];
|
|
94
|
+
for (let j = i + 1; j < stars.length; j++) {
|
|
95
|
+
const star2 = stars[j];
|
|
96
|
+
const dx = star1.x - star2.x;
|
|
97
|
+
const dy = star1.y - star2.y;
|
|
98
|
+
const distanceSq = dx * dx + dy * dy;
|
|
99
|
+
if (distanceSq < LINE_MAX_DISTANCE_SQ) {
|
|
100
|
+
const opacity = 0.2 * (1 - distanceSq / LINE_MAX_DISTANCE_SQ);
|
|
101
|
+
if (isDark) {
|
|
102
|
+
ctx.strokeStyle = `rgba(147, 197, 253, ${opacity})`;
|
|
103
|
+
} else {
|
|
104
|
+
ctx.strokeStyle = `rgba(71, 85, 105, ${opacity * 1.5})`;
|
|
105
|
+
}
|
|
106
|
+
ctx.beginPath();
|
|
107
|
+
ctx.moveTo(star1.x, star1.y);
|
|
108
|
+
ctx.lineTo(star2.x, star2.y);
|
|
109
|
+
ctx.stroke();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const animate = () => {
|
|
115
|
+
const timestamp = Date.now();
|
|
116
|
+
updateAndDrawScene(timestamp);
|
|
117
|
+
animationIdRef.current = requestAnimationFrame(animate);
|
|
118
|
+
};
|
|
119
|
+
setCanvasSize();
|
|
120
|
+
starsRef.current = createStars();
|
|
121
|
+
animate();
|
|
122
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
123
|
+
window.addEventListener("resize", handleResize);
|
|
124
|
+
return () => {
|
|
125
|
+
if (animationIdRef.current) {
|
|
126
|
+
cancelAnimationFrame(animationIdRef.current);
|
|
127
|
+
}
|
|
128
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
129
|
+
window.removeEventListener("resize", handleResize);
|
|
130
|
+
};
|
|
131
|
+
}, []);
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"canvas",
|
|
134
|
+
{
|
|
135
|
+
ref: canvasRef,
|
|
136
|
+
className: "tuwadocs:absolute tuwadocs:inset-0 tuwadocs:w-full tuwadocs:h-full tuwadocs:bg-gradient-to-b tuwadocs:from-slate-200 tuwadocs:to-slate-350 tuwadocs:dark:from-[#0a0e27] tuwadocs:dark:to-[#1a1f3a]"
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
StarryBackground as default
|
|
142
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var StyledLink_exports = {};
|
|
20
|
+
__export(StyledLink_exports, {
|
|
21
|
+
StyledLink: () => StyledLink
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(StyledLink_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_nova_core = require("@tuwaio/nova-core");
|
|
26
|
+
function StyledLink({ href, children }) {
|
|
27
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
"a",
|
|
29
|
+
{
|
|
30
|
+
className: (0, import_nova_core.cn)(
|
|
31
|
+
"tuwadocs:font-medium tuwadocs:text-[var(--tuwa-text-accent)]",
|
|
32
|
+
"tuwadocs:transition-all tuwadocs:hover:underline tuwadocs:underline-offset-4"
|
|
33
|
+
),
|
|
34
|
+
href,
|
|
35
|
+
target: "_blank",
|
|
36
|
+
rel: "noopener noreferrer",
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
StyledLink
|
|
44
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@tuwaio/nova-core";
|
|
3
|
+
function StyledLink({ href, children }) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"a",
|
|
6
|
+
{
|
|
7
|
+
className: cn(
|
|
8
|
+
"tuwadocs:font-medium tuwadocs:text-[var(--tuwa-text-accent)]",
|
|
9
|
+
"tuwadocs:transition-all tuwadocs:hover:underline tuwadocs:underline-offset-4"
|
|
10
|
+
),
|
|
11
|
+
href,
|
|
12
|
+
target: "_blank",
|
|
13
|
+
rel: "noopener noreferrer",
|
|
14
|
+
children
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
StyledLink
|
|
20
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var ThemeSwitcher_exports = {};
|
|
21
|
+
__export(ThemeSwitcher_exports, {
|
|
22
|
+
ThemeSwitcher: () => ThemeSwitcher
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ThemeSwitcher_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_solid = require("@heroicons/react/24/solid");
|
|
27
|
+
var import_nova_core = require("@tuwaio/nova-core");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
function ThemeSwitcher({ theme, onToggle }) {
|
|
30
|
+
const [mounted, setMounted] = (0, import_react.useState)(false);
|
|
31
|
+
(0, import_react.useEffect)(() => {
|
|
32
|
+
setMounted(true);
|
|
33
|
+
}, []);
|
|
34
|
+
const defaultStyles = "tuwadocs:bg-black/5 tuwadocs:border-black/5 tuwadocs:hover:bg-black/10 tuwadocs:dark:bg-white/10 tuwadocs:dark:border-white/10 tuwadocs:dark:hover:bg-white/20";
|
|
35
|
+
if (!mounted) {
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: (0, import_nova_core.cn)(
|
|
40
|
+
"tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:border tuwadocs:opacity-0",
|
|
41
|
+
defaultStyles
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
const isDark = theme === "dark";
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
48
|
+
"button",
|
|
49
|
+
{
|
|
50
|
+
onClick: onToggle,
|
|
51
|
+
className: (0, import_nova_core.cn)(
|
|
52
|
+
"tuwadocs:group tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:cursor-pointer tuwadocs:items-center tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:p-1 tuwadocs:transition-all tuwadocs:duration-300 tuwadocs:ease-in-out tuwadocs:backdrop-blur-sm tuwadocs:border",
|
|
53
|
+
defaultStyles
|
|
54
|
+
),
|
|
55
|
+
"aria-label": "Toggle theme",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: (0, import_nova_core.cn)(
|
|
61
|
+
"tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:md:hidden",
|
|
62
|
+
isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: (0, import_nova_core.cn)(
|
|
70
|
+
"tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:md:h-7 tuwadocs:md:w-7 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:hidden tuwadocs:md:block",
|
|
71
|
+
isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tuwadocs:relative tuwadocs:z-20 tuwadocs:flex tuwadocs:w-full tuwadocs:justify-between", children: [
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:flex-1 tuwadocs:items-center tuwadocs:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
+
import_solid.SunIcon,
|
|
78
|
+
{
|
|
79
|
+
className: `tuwadocs:h-6 tuwadocs:w-6 tuwadocs:relative tuwadocs:-left-[2px] tuwadocs:md:h-5 tuwadocs:md:w-5 tuwadocs:transition-colors tuwadocs:duration-300 ${!isDark ? "tuwadocs:text-yellow-500" : "tuwadocs:text-slate-500 tuwadocs:group-hover:text-yellow-400"}`
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tuwadocs:flex tuwadocs:flex-1 tuwadocs:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
+
import_solid.MoonIcon,
|
|
84
|
+
{
|
|
85
|
+
className: `tuwadocs:h-6 tuwadocs:w-6 tuwadocs:relative tuwadocs:left-[2px] tuwadocs:md:h-5 tuwadocs:md:w-5 tuwadocs:transition-colors tuwadocs:duration-300 ${isDark ? "tuwadocs:text-indigo-400" : "tuwadocs:text-slate-500 tuwadocs:group-hover:text-indigo-300"}`
|
|
86
|
+
}
|
|
87
|
+
) })
|
|
88
|
+
] })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
ThemeSwitcher
|
|
96
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { MoonIcon, SunIcon } from "@heroicons/react/24/solid";
|
|
4
|
+
import { cn } from "@tuwaio/nova-core";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
function ThemeSwitcher({ theme, onToggle }) {
|
|
7
|
+
const [mounted, setMounted] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setMounted(true);
|
|
10
|
+
}, []);
|
|
11
|
+
const defaultStyles = "tuwadocs:bg-black/5 tuwadocs:border-black/5 tuwadocs:hover:bg-black/10 tuwadocs:dark:bg-white/10 tuwadocs:dark:border-white/10 tuwadocs:dark:hover:bg-white/20";
|
|
12
|
+
if (!mounted) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: cn(
|
|
17
|
+
"tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:border tuwadocs:opacity-0",
|
|
18
|
+
defaultStyles
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const isDark = theme === "dark";
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
onClick: onToggle,
|
|
28
|
+
className: cn(
|
|
29
|
+
"tuwadocs:group tuwadocs:relative tuwadocs:flex tuwadocs:h-10 tuwadocs:w-20 tuwadocs:md:h-8 tuwadocs:md:w-16 tuwadocs:cursor-pointer tuwadocs:items-center tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:p-1 tuwadocs:transition-all tuwadocs:duration-300 tuwadocs:ease-in-out tuwadocs:backdrop-blur-sm tuwadocs:border",
|
|
30
|
+
defaultStyles
|
|
31
|
+
),
|
|
32
|
+
"aria-label": "Toggle theme",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: cn(
|
|
38
|
+
"tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:md:hidden",
|
|
39
|
+
isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: cn(
|
|
47
|
+
"tuwadocs:absolute tuwadocs:top-[1px] tuwadocs:left-[2px] tuwadocs:z-10 tuwadocs:h-9 tuwadocs:w-9 tuwadocs:md:h-7 tuwadocs:md:w-7 tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-[var(--tuwa-bg-primary)] tuwadocs:shadow-md tuwadocs:hidden tuwadocs:md:block",
|
|
48
|
+
isDark ? "tuwa-slide-dark" : "tuwa-slide-light"
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsxs("div", { className: "tuwadocs:relative tuwadocs:z-20 tuwadocs:flex tuwadocs:w-full tuwadocs:justify-between", children: [
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: "tuwadocs:flex tuwadocs:flex-1 tuwadocs:items-center tuwadocs:justify-center", children: /* @__PURE__ */ jsx(
|
|
54
|
+
SunIcon,
|
|
55
|
+
{
|
|
56
|
+
className: `tuwadocs:h-6 tuwadocs:w-6 tuwadocs:relative tuwadocs:-left-[2px] tuwadocs:md:h-5 tuwadocs:md:w-5 tuwadocs:transition-colors tuwadocs:duration-300 ${!isDark ? "tuwadocs:text-yellow-500" : "tuwadocs:text-slate-500 tuwadocs:group-hover:text-yellow-400"}`
|
|
57
|
+
}
|
|
58
|
+
) }),
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: "tuwadocs:flex tuwadocs:flex-1 tuwadocs:justify-center", children: /* @__PURE__ */ jsx(
|
|
60
|
+
MoonIcon,
|
|
61
|
+
{
|
|
62
|
+
className: `tuwadocs:h-6 tuwadocs:w-6 tuwadocs:relative tuwadocs:left-[2px] tuwadocs:md:h-5 tuwadocs:md:w-5 tuwadocs:transition-colors tuwadocs:duration-300 ${isDark ? "tuwadocs:text-indigo-400" : "tuwadocs:text-slate-500 tuwadocs:group-hover:text-indigo-300"}`
|
|
63
|
+
}
|
|
64
|
+
) })
|
|
65
|
+
] })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
ThemeSwitcher
|
|
72
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var VideoPlayer_exports = {};
|
|
21
|
+
__export(VideoPlayer_exports, {
|
|
22
|
+
VideoPlayer: () => VideoPlayer
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(VideoPlayer_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_nova_core = require("@tuwaio/nova-core");
|
|
27
|
+
const aspectMap = {
|
|
28
|
+
"aspect-square": "tuwadocs:aspect-square",
|
|
29
|
+
"aspect-video": "tuwadocs:aspect-video",
|
|
30
|
+
"aspect-[4/3]": "tuwadocs:aspect-[4/3]",
|
|
31
|
+
"aspect-[3/2]": "tuwadocs:aspect-[3/2]",
|
|
32
|
+
"aspect-[21/9]": "tuwadocs:aspect-[21/9]"
|
|
33
|
+
};
|
|
34
|
+
const VideoPlayer = ({
|
|
35
|
+
src,
|
|
36
|
+
poster,
|
|
37
|
+
autoplay = false,
|
|
38
|
+
muted = false,
|
|
39
|
+
loop = false,
|
|
40
|
+
controls = true,
|
|
41
|
+
className = "",
|
|
42
|
+
aspectRatio = "aspect-video",
|
|
43
|
+
onPlay,
|
|
44
|
+
onPause,
|
|
45
|
+
onEnded,
|
|
46
|
+
"aria-label": ariaLabel
|
|
47
|
+
}) => {
|
|
48
|
+
const mappedAspectRatio = aspectMap[aspectRatio] || "tuwadocs:aspect-video";
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_nova_core.cn)(
|
|
53
|
+
// Container with aspect ratio and responsive design
|
|
54
|
+
"tuwadocs:relative tuwadocs:w-full tuwadocs:overflow-hidden tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-black tuwadocs:my-4",
|
|
55
|
+
mappedAspectRatio,
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
59
|
+
"video",
|
|
60
|
+
{
|
|
61
|
+
src,
|
|
62
|
+
poster,
|
|
63
|
+
controls,
|
|
64
|
+
autoPlay: autoplay,
|
|
65
|
+
muted,
|
|
66
|
+
loop,
|
|
67
|
+
className: (0, import_nova_core.cn)(
|
|
68
|
+
// Video fills container completely
|
|
69
|
+
"tuwadocs:absolute tuwadocs:inset-0 tuwadocs:h-full tuwadocs:w-full tuwadocs:object-contain",
|
|
70
|
+
// Smooth transitions and focus states
|
|
71
|
+
"tuwadocs:transition-opacity tuwadocs:duration-200",
|
|
72
|
+
"tuwadocs:focus:outline-none tuwadocs:focus:ring-[length:var(--tuwa-ring-width)] tuwadocs:focus:ring-[var(--tuwa-text-accent)] tuwadocs:focus:ring-offset-[length:var(--tuwa-ring-width)] tuwadocs:focus:ring-offset-[var(--tuwa-bg-primary)]"
|
|
73
|
+
),
|
|
74
|
+
onPlay,
|
|
75
|
+
onPause,
|
|
76
|
+
onEnded,
|
|
77
|
+
"aria-label": ariaLabel,
|
|
78
|
+
preload: "metadata",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("track", { kind: "captions" }),
|
|
81
|
+
"Your browser does not support the video tag. Please",
|
|
82
|
+
" ",
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
"a",
|
|
85
|
+
{
|
|
86
|
+
href: src,
|
|
87
|
+
download: true,
|
|
88
|
+
className: "tuwadocs:text-[var(--tuwa-text-accent)] tuwadocs:underline tuwadocs:hover:opacity-80",
|
|
89
|
+
children: "download the video"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
" ",
|
|
93
|
+
"to watch it."
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
VideoPlayer
|
|
103
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props for the VideoPlayer component.
|
|
5
|
+
*/
|
|
6
|
+
interface VideoPlayerProps {
|
|
7
|
+
/** Path to the video file in the /public directory */
|
|
8
|
+
src: string;
|
|
9
|
+
/** Optional poster image to display before video plays */
|
|
10
|
+
poster?: string;
|
|
11
|
+
/** Whether the video should autoplay (Note: most browsers require muted for autoplay) */
|
|
12
|
+
autoplay?: boolean;
|
|
13
|
+
/** Whether the video should be muted */
|
|
14
|
+
muted?: boolean;
|
|
15
|
+
/** Whether the video should loop */
|
|
16
|
+
loop?: boolean;
|
|
17
|
+
/** Whether to show video controls */
|
|
18
|
+
controls?: boolean;
|
|
19
|
+
/** Optional CSS class name for the container */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Custom aspect ratio using Tailwind aspect-ratio classes (default: 'aspect-video' for 16:9) */
|
|
22
|
+
aspectRatio?: 'aspect-square' | 'aspect-video' | 'aspect-[4/3]' | 'aspect-[3/2]' | 'aspect-[21/9]';
|
|
23
|
+
/** Callback function called when video starts playing */
|
|
24
|
+
onPlay?: () => void;
|
|
25
|
+
/** Callback function called when video is paused */
|
|
26
|
+
onPause?: () => void;
|
|
27
|
+
/** Callback function called when video ends */
|
|
28
|
+
onEnded?: () => void;
|
|
29
|
+
/** ARIA label for accessibility */
|
|
30
|
+
'aria-label'?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const VideoPlayer: react__default.FC<VideoPlayerProps>;
|
|
33
|
+
|
|
34
|
+
export { VideoPlayer, type VideoPlayerProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Props for the VideoPlayer component.
|
|
5
|
+
*/
|
|
6
|
+
interface VideoPlayerProps {
|
|
7
|
+
/** Path to the video file in the /public directory */
|
|
8
|
+
src: string;
|
|
9
|
+
/** Optional poster image to display before video plays */
|
|
10
|
+
poster?: string;
|
|
11
|
+
/** Whether the video should autoplay (Note: most browsers require muted for autoplay) */
|
|
12
|
+
autoplay?: boolean;
|
|
13
|
+
/** Whether the video should be muted */
|
|
14
|
+
muted?: boolean;
|
|
15
|
+
/** Whether the video should loop */
|
|
16
|
+
loop?: boolean;
|
|
17
|
+
/** Whether to show video controls */
|
|
18
|
+
controls?: boolean;
|
|
19
|
+
/** Optional CSS class name for the container */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Custom aspect ratio using Tailwind aspect-ratio classes (default: 'aspect-video' for 16:9) */
|
|
22
|
+
aspectRatio?: 'aspect-square' | 'aspect-video' | 'aspect-[4/3]' | 'aspect-[3/2]' | 'aspect-[21/9]';
|
|
23
|
+
/** Callback function called when video starts playing */
|
|
24
|
+
onPlay?: () => void;
|
|
25
|
+
/** Callback function called when video is paused */
|
|
26
|
+
onPause?: () => void;
|
|
27
|
+
/** Callback function called when video ends */
|
|
28
|
+
onEnded?: () => void;
|
|
29
|
+
/** ARIA label for accessibility */
|
|
30
|
+
'aria-label'?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const VideoPlayer: react__default.FC<VideoPlayerProps>;
|
|
33
|
+
|
|
34
|
+
export { VideoPlayer, type VideoPlayerProps };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@tuwaio/nova-core";
|
|
4
|
+
const aspectMap = {
|
|
5
|
+
"aspect-square": "tuwadocs:aspect-square",
|
|
6
|
+
"aspect-video": "tuwadocs:aspect-video",
|
|
7
|
+
"aspect-[4/3]": "tuwadocs:aspect-[4/3]",
|
|
8
|
+
"aspect-[3/2]": "tuwadocs:aspect-[3/2]",
|
|
9
|
+
"aspect-[21/9]": "tuwadocs:aspect-[21/9]"
|
|
10
|
+
};
|
|
11
|
+
const VideoPlayer = ({
|
|
12
|
+
src,
|
|
13
|
+
poster,
|
|
14
|
+
autoplay = false,
|
|
15
|
+
muted = false,
|
|
16
|
+
loop = false,
|
|
17
|
+
controls = true,
|
|
18
|
+
className = "",
|
|
19
|
+
aspectRatio = "aspect-video",
|
|
20
|
+
onPlay,
|
|
21
|
+
onPause,
|
|
22
|
+
onEnded,
|
|
23
|
+
"aria-label": ariaLabel
|
|
24
|
+
}) => {
|
|
25
|
+
const mappedAspectRatio = aspectMap[aspectRatio] || "tuwadocs:aspect-video";
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
// Container with aspect ratio and responsive design
|
|
31
|
+
"tuwadocs:relative tuwadocs:w-full tuwadocs:overflow-hidden tuwadocs:rounded-[var(--tuwa-rounded-corners)] tuwadocs:bg-black tuwadocs:my-4",
|
|
32
|
+
mappedAspectRatio,
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
children: /* @__PURE__ */ jsxs(
|
|
36
|
+
"video",
|
|
37
|
+
{
|
|
38
|
+
src,
|
|
39
|
+
poster,
|
|
40
|
+
controls,
|
|
41
|
+
autoPlay: autoplay,
|
|
42
|
+
muted,
|
|
43
|
+
loop,
|
|
44
|
+
className: cn(
|
|
45
|
+
// Video fills container completely
|
|
46
|
+
"tuwadocs:absolute tuwadocs:inset-0 tuwadocs:h-full tuwadocs:w-full tuwadocs:object-contain",
|
|
47
|
+
// Smooth transitions and focus states
|
|
48
|
+
"tuwadocs:transition-opacity tuwadocs:duration-200",
|
|
49
|
+
"tuwadocs:focus:outline-none tuwadocs:focus:ring-[length:var(--tuwa-ring-width)] tuwadocs:focus:ring-[var(--tuwa-text-accent)] tuwadocs:focus:ring-offset-[length:var(--tuwa-ring-width)] tuwadocs:focus:ring-offset-[var(--tuwa-bg-primary)]"
|
|
50
|
+
),
|
|
51
|
+
onPlay,
|
|
52
|
+
onPause,
|
|
53
|
+
onEnded,
|
|
54
|
+
"aria-label": ariaLabel,
|
|
55
|
+
preload: "metadata",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx("track", { kind: "captions" }),
|
|
58
|
+
"Your browser does not support the video tag. Please",
|
|
59
|
+
" ",
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"a",
|
|
62
|
+
{
|
|
63
|
+
href: src,
|
|
64
|
+
download: true,
|
|
65
|
+
className: "tuwadocs:text-[var(--tuwa-text-accent)] tuwadocs:underline tuwadocs:hover:opacity-80",
|
|
66
|
+
children: "download the video"
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
" ",
|
|
70
|
+
"to watch it."
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
VideoPlayer
|
|
79
|
+
};
|