@sreedev/my3dui 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sreekanth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,536 @@
1
+ # M3DUI - Modern 3D-Inspired UI Component Library
2
+
3
+ A TypeScript React component library combining beautiful 2D UI components with cutting-edge 3D visual effects using Three.js. Built on top of shadcn/ui, Radix UI, Framer Motion, and @react-three/fiber for maximum flexibility and extensibility.
4
+
5
+ ## Features
6
+
7
+ 🎨 **Rich Component Library**
8
+ - 50+ pre-built UI components
9
+ - 3D-enhanced variants of common components
10
+ - Fully TypeScript support
11
+ - Dark mode support via next-themes
12
+ - Fully customizable with Tailwind CSS
13
+
14
+ 🎬 **3D Visual Effects**
15
+ - Three.js integration via @react-three/fiber
16
+ - Bloom effects and post-processing
17
+ - Particle systems and animations
18
+ - 3D model viewers and galleries
19
+ - Custom WebGL effects
20
+
21
+ 🎭 **Animation & Motion**
22
+ - Framer Motion integration
23
+ - Smooth transitions and interactions
24
+ - Spring animations
25
+ - Gesture controls
26
+
27
+ 📦 **Developer Experience**
28
+ - ESM, CJS, and type declarations included
29
+ - Tree-shakeable exports
30
+ - Full TypeScript support
31
+ - No peer dependency conflicts
32
+ - Modular imports for code-splitting
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm install m3dui react react-dom
38
+ # or
39
+ yarn add m3dui react react-dom
40
+ # or
41
+ pnpm add m3dui react react-dom
42
+ ```
43
+
44
+ ### Optional Dependencies
45
+
46
+ For 3D component support, install the following packages:
47
+
48
+ ```bash
49
+ npm install three @react-three/fiber @react-three/drei
50
+ ```
51
+
52
+ ## Quick Start
53
+
54
+ ### Basic Button3D Component
55
+
56
+ ```tsx
57
+ import React from 'react';
58
+ import { Button3D } from 'm3dui';
59
+
60
+ export function MyComponent() {
61
+ return (
62
+ <Button3D
63
+ variant="primary"
64
+ size="lg"
65
+ onClick={() => console.log('Clicked!')}
66
+ >
67
+ Click Me
68
+ </Button3D>
69
+ );
70
+ }
71
+ ```
72
+
73
+ ### Card3D Component
74
+
75
+ ```tsx
76
+ import { Card3D } from 'm3dui';
77
+
78
+ export function MyCard() {
79
+ return (
80
+ <Card3D className="w-96">
81
+ <div className="p-6">
82
+ <h2 className="text-2xl font-bold">Card Title</h2>
83
+ <p className="text-gray-600">Card content goes here</p>
84
+ </div>
85
+ </Card3D>
86
+ );
87
+ }
88
+ ```
89
+
90
+ ### Using Standard Components
91
+
92
+ ```tsx
93
+ import {
94
+ Button,
95
+ Input,
96
+ Select,
97
+ Badge,
98
+ Card
99
+ } from 'm3dui';
100
+
101
+ export function StandardUI() {
102
+ return (
103
+ <Card>
104
+ <div className="space-y-4">
105
+ <Input placeholder="Enter text..." />
106
+ <Select>
107
+ <option>Option 1</option>
108
+ <option>Option 2</option>
109
+ </Select>
110
+ <Button>Submit</Button>
111
+ </div>
112
+ </Card>
113
+ );
114
+ }
115
+ ```
116
+
117
+ ## 3D Components Guide
118
+
119
+ ### Using 3D Effects with Canvas
120
+
121
+ m3dui 3D components require a `<Canvas>` from @react-three/fiber:
122
+
123
+ ```tsx
124
+ import { Canvas } from '@react-three/fiber';
125
+ import { Bloom } from 'm3dui';
126
+
127
+ export function MyScene() {
128
+ return (
129
+ <Canvas>
130
+ <Bloom intensity={1.5} radius={0.8} threshold={0.5} />
131
+ {/* Your 3D content */}
132
+ </Canvas>
133
+ );
134
+ }
135
+ ```
136
+
137
+ ### Bloom Effect
138
+
139
+ ```tsx
140
+ import { Canvas } from '@react-three/fiber';
141
+ import { Bloom } from 'm3dui';
142
+
143
+ export function BloomExample() {
144
+ return (
145
+ <Canvas>
146
+ <Bloom
147
+ intensity={1.2} // Effect intensity
148
+ radius={0.5} // Blur radius
149
+ threshold={0.2} // Light threshold
150
+ />
151
+ <mesh>
152
+ <boxGeometry args={[1, 1, 1]} />
153
+ <meshBasicMaterial color="white" emissive="#00ff00" />
154
+ </mesh>
155
+ </Canvas>
156
+ );
157
+ }
158
+ ```
159
+
160
+ ### 3D Image/Video Planes
161
+
162
+ ```tsx
163
+ import { Canvas } from '@react-three/fiber';
164
+ import { ImagePlane, VideoPlane } from 'm3dui';
165
+
166
+ export function MediaPlanes() {
167
+ return (
168
+ <Canvas>
169
+ <ImagePlane
170
+ src="/path/to/image.jpg"
171
+ width={4}
172
+ height={3}
173
+ />
174
+ </Canvas>
175
+ );
176
+ }
177
+ ```
178
+
179
+ ### Gallery3D Component
180
+
181
+ ```tsx
182
+ import { Canvas } from '@react-three/fiber';
183
+ import { Gallery3D } from 'm3dui';
184
+
185
+ export function MyGallery() {
186
+ const images = [
187
+ '/image1.jpg',
188
+ '/image2.jpg',
189
+ '/image3.jpg',
190
+ ];
191
+
192
+ return (
193
+ <Canvas>
194
+ <Gallery3D images={images} />
195
+ </Canvas>
196
+ );
197
+ }
198
+ ```
199
+
200
+ ### Map3D Component
201
+
202
+ ```tsx
203
+ import { Canvas } from '@react-three/fiber';
204
+ import { Map3D } from 'm3dui';
205
+
206
+ export function InteractiveMap() {
207
+ return (
208
+ <Canvas>
209
+ <Map3D
210
+ latitude={40.7128}
211
+ longitude={-74.0060}
212
+ zoom={12}
213
+ />
214
+ </Canvas>
215
+ );
216
+ }
217
+ ```
218
+
219
+ ### Particle System
220
+
221
+ ```tsx
222
+ import { Canvas } from '@react-three/fiber';
223
+ import { Particles } from 'm3dui';
224
+
225
+ export function ParticleEffect() {
226
+ return (
227
+ <Canvas>
228
+ <Particles
229
+ count={1000}
230
+ color="0x00ff00"
231
+ speed={0.5}
232
+ />
233
+ </Canvas>
234
+ );
235
+ }
236
+ ```
237
+
238
+ ## Component API Reference
239
+
240
+ ### Button3D
241
+
242
+ ```tsx
243
+ interface Button3DProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
244
+ variant?: 'primary' | 'secondary' | 'accent' | 'destructive' | 'outline' | 'ghost' | 'glass';
245
+ size?: 'sm' | 'md' | 'lg' | 'icon' | 'default';
246
+ loading?: boolean;
247
+ asChild?: boolean;
248
+ shadowColor?: string;
249
+ }
250
+ ```
251
+
252
+ ### Card3D
253
+
254
+ ```tsx
255
+ interface Card3DProps extends React.HTMLAttributes<HTMLDivElement> {
256
+ elevation?: number;
257
+ glow?: boolean;
258
+ glowColor?: string;
259
+ }
260
+ ```
261
+
262
+ ### Input3D
263
+
264
+ ```tsx
265
+ interface Input3DProps extends React.InputHTMLAttributes<HTMLInputElement> {
266
+ variant?: 'default' | 'gradient' | 'glass';
267
+ icon?: React.ReactNode;
268
+ }
269
+ ```
270
+
271
+ ### Bloom
272
+
273
+ ```tsx
274
+ interface BloomProps {
275
+ intensity?: number; // Default: 1.0
276
+ radius?: number; // Default: 0.4
277
+ threshold?: number; // Default: 0
278
+ }
279
+ ```
280
+
281
+ ### Particles
282
+
283
+ ```tsx
284
+ interface ParticlesProps {
285
+ count?: number; // Default: 100
286
+ color?: string; // Hex color
287
+ speed?: number; // Default: 1
288
+ size?: number; // Default: 1
289
+ }
290
+ ```
291
+
292
+ ## Theming
293
+
294
+ ### Using next-themes
295
+
296
+ m3dui supports dark mode seamlessly via next-themes:
297
+
298
+ ```tsx
299
+ import { ThemeProvider } from 'next-themes';
300
+ import MyApp from './App';
301
+
302
+ export function App() {
303
+ return (
304
+ <ThemeProvider attribute="class">
305
+ <MyApp />
306
+ </ThemeProvider>
307
+ );
308
+ }
309
+ ```
310
+
311
+ ### Custom Tailwind Config
312
+
313
+ ```js
314
+ // tailwind.config.js
315
+ module.exports = {
316
+ content: [
317
+ './node_modules/m3dui/**/*.{js,ts,jsx,tsx}',
318
+ ],
319
+ theme: {
320
+ extend: {
321
+ colors: {
322
+ 'primary': '#your-color',
323
+ }
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
329
+ ## Peer Dependencies
330
+
331
+ The following peer dependencies are required:
332
+
333
+ ```json
334
+ {
335
+ "react": ">=18.0.0",
336
+ "react-dom": ">=18.0.0",
337
+ "three": ">=0.150.0"
338
+ }
339
+ ```
340
+
341
+ Optional peer dependencies for 3D features:
342
+ - `@react-three/fiber` (^8.0.0)
343
+ - `@react-three/drei` (^9.0.0)
344
+
345
+ ## Building from Source
346
+
347
+ ```bash
348
+ # Install dependencies
349
+ npm install
350
+
351
+ # Type checking
352
+ npm run lint
353
+
354
+ # Build library
355
+ npm run build
356
+
357
+ # Watch mode (development)
358
+ npm run dev
359
+ ```
360
+
361
+ ## Project Structure
362
+
363
+ ```
364
+ src/
365
+ ├── components/
366
+ │ ├── layouts/ # Layout components (Container, Stack, Grid, etc.)
367
+ │ └── ui/ # UI components (Button3D, Card3D, etc.)
368
+ ├── hooks/ # Custom React hooks
369
+ ├── lib/ # Utility functions
370
+ ├── index.ts # Main entry point
371
+ └── three-elements.d.ts # Three.js type declarations
372
+ ```
373
+
374
+ ## Supported Components
375
+
376
+ ### Layouts
377
+ - `Container` - Responsive container wrapper
378
+ - `Grid` - CSS Grid layout component
379
+ - `Stack` - Flexbox stack layout
380
+ - `Section` - Semantic section component
381
+ - `PageLayout` - Full-page layout template
382
+ - `Stage` - 3D stage container
383
+ - `Scene3D` - 3D scene wrapper
384
+ - `ViewPort` - Custom viewport handler
385
+
386
+ ### 3D Components
387
+ - `Button3D` - 3D-styled button
388
+ - `Card3D` - 3D-enhanced card
389
+ - `Accordion3D` - 3D accordion menu
390
+ - `Badge3D` - 3D badge component
391
+ - `Input3D` - 3D input field
392
+ - `Slider3D` - 3D slider control
393
+ - `Tabs3D` - 3D tab navigation
394
+ - `Toggle3D` - 3D toggle switch
395
+ - `Modal3D` - 3D modal dialog
396
+ - `Menu3D` - 3D context menu
397
+ - `Tooltip3D` - 3D tooltip
398
+ - `Progress3D` - 3D progress bar
399
+ - `Select3D` - 3D select dropdown
400
+ - `Spinner3D` - 3D loading spinner
401
+ - `Stepper3D` - 3D step navigator
402
+ - `NavBar3D` - 3D navigation bar
403
+ - `Timeline3D` - 3D timeline
404
+ - `Bloom` - Bloom post-processing effect
405
+ - `Particles` - Particle system
406
+ - `ImagePlane` - 3D image plane
407
+ - `VideoPlane` - 3D video plane
408
+ - `Gallery3D` - 3D image gallery
409
+ - `Map3D` - 3D interactive map
410
+ - `ModelViewer` - 3D model viewer
411
+ - `Reflection` - Reflection effect
412
+ - `WaveEffect` - Wave animation
413
+ - `GlowEffect` - Glow animation
414
+ - `AudioVisualizer` - Audio-reactive visualizer
415
+
416
+ ### Standard UI Components (from shadcn/ui)
417
+ - `Button` - Standard button
418
+ - `Input` - Text input field
419
+ - `Select` - Dropdown select
420
+ - `Badge` - Badge label
421
+ - `Card` - Card container
422
+ - `Dialog` - Modal dialog
423
+ - `Drawer` - Sliding drawer
424
+ - `Dropdown` - Dropdown menu
425
+ - `Form` - Form wrapper
426
+ - `Tabs` - Tab navigation
427
+ - `Tooltip` - Tooltip overlay
428
+ - `Slider` - Slider control
429
+ - `Toggle` - Toggle switch
430
+ - `Popover` - Popover component
431
+ - `Table` - Data table
432
+ - `Checkbox` - Checkbox input
433
+ - `RadioGroup` - Radio button group
434
+ - `Switch` - Toggle switch
435
+ - `Separator` - Visual divider
436
+ - `Skeleton` - Loading skeleton
437
+ - `Pagination` - Page selector
438
+ - `Calendar` - Date picker
439
+ - `Carousel` - Image carousel
440
+ - `Breadcrumb` - Breadcrumb navigation
441
+ - `Sheet` - Side sheet
442
+ - `Sidebar` - Sidebar navigation
443
+ - `Menubar` - Menu bar
444
+ - `Command Palette` - Command search
445
+ - `Context Menu` - Right-click menu
446
+ - `Alert` - Alert box
447
+ - And more!
448
+
449
+ ## Migration Guide
450
+
451
+ ### From shadcn/ui
452
+
453
+ All m3dui components maintain compatibility with shadcn/ui styling:
454
+
455
+ ```tsx
456
+ // Before
457
+ import { Button } from '@/components/ui/button';
458
+
459
+ // After - with enhanced features
460
+ import { Button3D } from 'm3dui';
461
+ ```
462
+
463
+ ### Variant Changes
464
+
465
+ Button variants are consistent:
466
+
467
+ ```tsx
468
+ // Works the same
469
+ <Button3D variant="outline">Click</Button3D>
470
+ <Button3D variant="ghost">Click</Button3D>
471
+ <Button3D variant="primary">Click</Button3D>
472
+ ```
473
+
474
+ ## Browser Support
475
+
476
+ - Chrome/Edge (latest)
477
+ - Firefox (latest)
478
+ - Safari (latest)
479
+ - Opera (latest)
480
+
481
+ For 3D features, WebGL support is required.
482
+
483
+ ## Performance Tips
484
+
485
+ 1. **Code Splitting**: Import components individually
486
+ ```tsx
487
+ import { Button3D } from 'm3dui'; // Better
488
+ // vs
489
+ import * as M3DUI from 'm3dui'; // Avoids this
490
+ ```
491
+
492
+ 2. **Lazy Load 3D Components**: Use React.lazy for 3D canvas
493
+ ```tsx
494
+ const Scene = React.lazy(() => import('./MyScene'));
495
+ ```
496
+
497
+ 3. **Memoization**: Wrap expensive components
498
+ ```tsx
499
+ const MemoizedGallery = React.memo(Gallery3D);
500
+ ```
501
+
502
+ 4. **SSR Compatibility**: Only render 3D on client
503
+ ```tsx
504
+ if (typeof window === 'undefined') return null;
505
+ ```
506
+
507
+ ## Contributing
508
+
509
+ Contributions are welcome! Please:
510
+
511
+ 1. Fork the repository
512
+ 2. Create a feature branch
513
+ 3. Make your changes
514
+ 4. Write tests
515
+ 5. Submit a pull request
516
+
517
+ ## License
518
+
519
+ MIT License - see LICENSE file for details
520
+
521
+ ## Support
522
+
523
+ - 📖 [Documentation](https://github.com/yourusername/m3dui)
524
+ - 🐛 [Issue Tracker](https://github.com/yourusername/m3dui/issues)
525
+ - 💬 [Discussions](https://github.com/yourusername/m3dui/discussions)
526
+
527
+ ## Changelog
528
+
529
+ ### v0.1.0 (Initial Release)
530
+ - Initial component library release
531
+ - 50+ components included
532
+ - Full TypeScript support
533
+ - 3D component suite
534
+ - Framer Motion integration
535
+ - Tailwind CSS styling
536
+ - shadcn/ui component compatibility