@stackvibe-studio/three 0.2.0 → 0.3.0

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 CHANGED
@@ -1,36 +1,81 @@
1
1
  # @stackvibe-studio/three
2
2
 
3
- 3D visual primitives for hero sections, product cards, and immersive surfaces.
3
+ Product-grade 3D visual primitives, canvas environments, and WebGL components built with Three.js and React Three Fiber.
4
4
 
5
- ## Highlights
5
+ Designed for immersive hero sections, interactive landing page surfaces, and futuristic product cards with smooth 60fps animations.
6
6
 
7
- - Glassmorphism-style 3D card wrapper
8
- - Floating sphere and orb cluster patterns
9
- - React Three Fiber powered with lightweight presets
10
- - New in v0.2.0: OrbCluster for layered hero artwork
7
+ [![npm version](https://img.shields.io/npm/v/@stackvibe-studio/three.svg)](https://www.npmjs.com/package/@stackvibe-studio/three)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
9
 
12
- ## Install
10
+ ## Features
11
+
12
+ - **WaveCanvas**: WebGL undulating sinusoidal mesh and wave canvas with dynamic light physics.
13
+ - **Glass3DCard**: Glassmorphism-style 3D card wrapper with realistic specular reflection and tilt.
14
+ - **FloatingSphere**: Physics-based floating sphere with ambient lighting and rotation.
15
+ - **OrbCluster**: Multi-layered 3D orb cluster designed for ambient hero backgrounds.
16
+ - **Zero layout shift**: Fully responsive canvas containers with graceful fallback rendering.
17
+ - **Framework agnostic**: Works with Next.js (App Router & Pages Router), Vite, Remix, and Gatsby.
18
+
19
+ ## Installation
13
20
 
14
21
  ```bash
22
+ pnpm add @stackvibe-studio/three three @react-three/fiber @react-three/drei
23
+ # or
15
24
  npm install @stackvibe-studio/three three @react-three/fiber @react-three/drei
16
25
  ```
17
26
 
18
- ## Example
27
+ ## Usage
28
+
29
+ ### WaveCanvas (Hero Backgrounds)
30
+
31
+ ```tsx
32
+ import { WaveCanvas } from '@stackvibe-studio/three';
33
+
34
+ export function HeroSection() {
35
+ return (
36
+ <div className="relative h-[500px] w-full overflow-hidden rounded-2xl bg-zinc-950">
37
+ <WaveCanvas
38
+ wireframe={false}
39
+ speed={1.2}
40
+ color="#6366f1"
41
+ className="absolute inset-0"
42
+ />
43
+ <div className="relative z-10 flex h-full flex-col items-center justify-center text-center p-8">
44
+ <h1 className="text-4xl font-bold text-white">Next-Gen Interface Canvas</h1>
45
+ <p className="mt-2 text-zinc-400">Interactive 3D surfaces rendered in real-time WebGL.</p>
46
+ </div>
47
+ </div>
48
+ );
49
+ }
50
+ ```
51
+
52
+ ### Glass3DCard & OrbCluster
19
53
 
20
54
  ```tsx
21
55
  import { Glass3DCard, OrbCluster } from '@stackvibe-studio/three';
22
56
 
23
- export function Example() {
57
+ export function FeatureCard() {
24
58
  return (
25
- <div>
26
- <Glass3DCard className="h-80" />
27
- <OrbCluster />
59
+ <div className="relative flex items-center justify-center p-12">
60
+ <OrbCluster className="absolute inset-0 pointer-events-none opacity-60" />
61
+ <Glass3DCard className="w-80 h-96 p-6">
62
+ <h3 className="text-xl font-bold text-white">Pro Access</h3>
63
+ <p className="text-zinc-400 mt-2">Enterprise-grade WebGL rendering primitives.</p>
64
+ </Glass3DCard>
28
65
  </div>
29
66
  );
30
67
  }
31
68
  ```
32
69
 
33
- ## Related packages
70
+ ## Components Reference
71
+
72
+ | Component | Description | Props |
73
+ | :--- | :--- | :--- |
74
+ | `WaveCanvas` | Real-time undulating 3D sine-wave plane | `wireframe?: boolean`, `speed?: number`, `color?: string`, `className?: string` |
75
+ | `Glass3DCard` | 3D glass card with reflective lighting | `children?: ReactNode`, `className?: string` |
76
+ | `FloatingSphere` | Autonomous 3D floating orb with glow | `color?: string`, `wireframe?: boolean`, `className?: string` |
77
+ | `OrbCluster` | Ambient particle cluster with floating orbs | `count?: number`, `className?: string` |
78
+
79
+ ## License
34
80
 
35
- - @stackvibe-studio/ui
36
- - @stackvibe-studio/motion
81
+ MIT © [StackVibe Studio](https://github.com/StackVibe-Studio/stackvibe-ui)
@@ -0,0 +1,6 @@
1
+ export interface WaveCanvasProps {
2
+ color?: string;
3
+ wireframe?: boolean;
4
+ className?: string;
5
+ }
6
+ export declare function WaveCanvas({ color, wireframe, className }: WaveCanvasProps): import("react").JSX.Element;
package/dist/index.cjs CHANGED
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/index.ts
@@ -23,7 +33,8 @@ var index_exports = {};
23
33
  __export(index_exports, {
24
34
  FloatingSphere: () => FloatingSphere,
25
35
  Glass3DCard: () => Glass3DCard,
26
- OrbCluster: () => OrbCluster
36
+ OrbCluster: () => OrbCluster,
37
+ WaveCanvas: () => WaveCanvas
27
38
  });
28
39
  module.exports = __toCommonJS(index_exports);
29
40
 
@@ -131,9 +142,62 @@ function OrbCluster({
131
142
  ))
132
143
  ] }) });
133
144
  }
145
+
146
+ // src/components/wave-canvas.tsx
147
+ var import_fiber4 = require("@react-three/fiber");
148
+ var import_react = require("react");
149
+ var THREE = __toESM(require("three"), 1);
150
+ var import_jsx_runtime4 = require("react/jsx-runtime");
151
+ function WaveMesh({ color = "#8b5cf6", wireframe = false }) {
152
+ const meshRef = (0, import_react.useRef)(null);
153
+ const { positions, originalZ } = (0, import_react.useMemo)(() => {
154
+ const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
155
+ const pos = geo.attributes.position;
156
+ const orig = new Float32Array(pos.count);
157
+ for (let i = 0; i < pos.count; i++) {
158
+ orig[i] = pos.getZ(i);
159
+ }
160
+ return { positions: pos, originalZ: orig };
161
+ }, []);
162
+ (0, import_fiber4.useFrame)(({ clock }) => {
163
+ if (!meshRef.current) return;
164
+ const t = clock.getElapsedTime() * 1.5;
165
+ const geom = meshRef.current.geometry;
166
+ const pos = geom.attributes.position;
167
+ for (let i = 0; i < pos.count; i++) {
168
+ const u = pos.getX(i);
169
+ const v = pos.getY(i);
170
+ const z = Math.sin(u * 1.5 + t) * 0.25 + Math.cos(v * 1.5 + t) * 0.25;
171
+ pos.setZ(i, z);
172
+ }
173
+ pos.needsUpdate = true;
174
+ });
175
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("mesh", { ref: meshRef, rotation: [-Math.PI / 3, 0, 0], children: [
176
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("planeGeometry", { args: [6, 6, 32, 32] }),
177
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
178
+ "meshStandardMaterial",
179
+ {
180
+ color,
181
+ wireframe,
182
+ roughness: 0.3,
183
+ metalness: 0.5,
184
+ side: THREE.DoubleSide
185
+ }
186
+ )
187
+ ] });
188
+ }
189
+ function WaveCanvas({ color = "#8b5cf6", wireframe = false, className = "" }) {
190
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: ["h-64 w-full rounded-3xl overflow-hidden bg-slate-950/50", className].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_fiber4.Canvas, { camera: { position: [0, -1, 3], fov: 60 }, children: [
191
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ambientLight", { intensity: 0.8 }),
192
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
194
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(WaveMesh, { color, wireframe })
195
+ ] }) });
196
+ }
134
197
  // Annotate the CommonJS export names for ESM import in node:
135
198
  0 && (module.exports = {
136
199
  FloatingSphere,
137
200
  Glass3DCard,
138
- OrbCluster
201
+ OrbCluster,
202
+ WaveCanvas
139
203
  });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './components/floating-sphere';
2
2
  export * from './components/glass-3d-card';
3
3
  export * from './components/orb-cluster';
4
+ export * from './components/wave-canvas';
package/dist/index.js CHANGED
@@ -104,8 +104,61 @@ function OrbCluster({
104
104
  ))
105
105
  ] }) });
106
106
  }
107
+
108
+ // src/components/wave-canvas.tsx
109
+ import { Canvas as Canvas4, useFrame } from "@react-three/fiber";
110
+ import { useRef, useMemo } from "react";
111
+ import * as THREE from "three";
112
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
113
+ function WaveMesh({ color = "#8b5cf6", wireframe = false }) {
114
+ const meshRef = useRef(null);
115
+ const { positions, originalZ } = useMemo(() => {
116
+ const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
117
+ const pos = geo.attributes.position;
118
+ const orig = new Float32Array(pos.count);
119
+ for (let i = 0; i < pos.count; i++) {
120
+ orig[i] = pos.getZ(i);
121
+ }
122
+ return { positions: pos, originalZ: orig };
123
+ }, []);
124
+ useFrame(({ clock }) => {
125
+ if (!meshRef.current) return;
126
+ const t = clock.getElapsedTime() * 1.5;
127
+ const geom = meshRef.current.geometry;
128
+ const pos = geom.attributes.position;
129
+ for (let i = 0; i < pos.count; i++) {
130
+ const u = pos.getX(i);
131
+ const v = pos.getY(i);
132
+ const z = Math.sin(u * 1.5 + t) * 0.25 + Math.cos(v * 1.5 + t) * 0.25;
133
+ pos.setZ(i, z);
134
+ }
135
+ pos.needsUpdate = true;
136
+ });
137
+ return /* @__PURE__ */ jsxs4("mesh", { ref: meshRef, rotation: [-Math.PI / 3, 0, 0], children: [
138
+ /* @__PURE__ */ jsx4("planeGeometry", { args: [6, 6, 32, 32] }),
139
+ /* @__PURE__ */ jsx4(
140
+ "meshStandardMaterial",
141
+ {
142
+ color,
143
+ wireframe,
144
+ roughness: 0.3,
145
+ metalness: 0.5,
146
+ side: THREE.DoubleSide
147
+ }
148
+ )
149
+ ] });
150
+ }
151
+ function WaveCanvas({ color = "#8b5cf6", wireframe = false, className = "" }) {
152
+ return /* @__PURE__ */ jsx4("div", { className: ["h-64 w-full rounded-3xl overflow-hidden bg-slate-950/50", className].join(" "), children: /* @__PURE__ */ jsxs4(Canvas4, { camera: { position: [0, -1, 3], fov: 60 }, children: [
153
+ /* @__PURE__ */ jsx4("ambientLight", { intensity: 0.8 }),
154
+ /* @__PURE__ */ jsx4("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
155
+ /* @__PURE__ */ jsx4("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
156
+ /* @__PURE__ */ jsx4(WaveMesh, { color, wireframe })
157
+ ] }) });
158
+ }
107
159
  export {
108
160
  FloatingSphere,
109
161
  Glass3DCard,
110
- OrbCluster
162
+ OrbCluster,
163
+ WaveCanvas
111
164
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackvibe-studio/three",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "3D component layer for StackVibe UI.",
6
6
  "repository": {