@ghatak/slash-ui 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghatak/slash-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "./dist/src/index.js",
5
5
  "types": "./dist/src/index.d.ts",
6
6
  "private": false,
@@ -8,11 +8,11 @@
8
8
  "access": "public"
9
9
  },
10
10
  "bin": {
11
- "slash-ui": "./dist/bin/init.js"
11
+ "slash-ui": "./dist/bin/index.js"
12
12
  },
13
13
  "files": [
14
- "dist",
15
- "__registry__"
14
+ "dist"
15
+
16
16
  ],
17
17
  "scripts": {
18
18
  "dev": "next dev",
@@ -1,493 +0,0 @@
1
- // @ts-nocheck
2
- // This file is autogenerated by scripts/build-registry.ts
3
- import * as React from "react"
4
-
5
- export const Index: Record<string, any> = {
6
- "default": {
7
- "neubrutal-button": {
8
- name: "neubrutal-button",
9
- type: "ui",
10
- component: React.lazy(() => import("../registry/ui/buttons/neubrutal-button")),
11
- details: null,
12
- files: ["ui/buttons/neubrutal-button.tsx"],
13
- category: "buttons",
14
- content: `import React from 'react';
15
- import { cn } from '@/lib/utils';
16
-
17
- interface NeubrutalButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
18
- children: React.ReactNode;
19
- }
20
-
21
- // 1. CHANGE THIS TO DEFAULT EXPORT
22
- export default function NeubrutalButton({
23
- children = 'Click Me!',
24
- className,
25
- ...props
26
- }: NeubrutalButtonProps) {
27
- return (
28
- <button
29
- {...props}
30
- className={cn(
31
- 'group relative w-[140px] h-[50px] bg-none outline-none border-none p-0 cursor-pointer active:translate-y-[2px] transition-transform',
32
- className,
33
- )}
34
- >
35
- <div className='absolute top-[14px] -left-[1px] w-[calc(100%+2px)] h-full bg-[#8c8c8c] rounded-[7mm] outline outline-2 outline-[#242622] -z-10' />
36
- <div className='absolute top-[10px] left-0 w-full h-full bg-[#e5e5c7] rounded-[7mm] outline outline-2 outline-[#242622] -z-10'>
37
- <div className='absolute bottom-0 left-[15%] w-[2px] h-[9px] bg-[#242622]' />
38
- <div className='absolute bottom-0 left-[85%] w-[2px] h-[9px] bg-[#242622]' />
39
- </div>
40
- <div className='relative w-full h-full flex items-center justify-center bg-[#ffffee] rounded-[7mm] outline outline-2 outline-[#242622] text-[#242622] font-semibold text-base overflow-hidden transition-all duration-200 group-active:translate-y-[10px]'>
41
- <div className='absolute top-0 -left-[20px] w-[15px] h-full bg-black/10 skew-x-[30deg] transition-all duration-300 group-active:left-[calc(100%+20px)]' />
42
- {children}
43
- </div>
44
- </button>
45
- );
46
- }
47
- `,
48
- description: ``,
49
- install: "npm install framer-motion lucide-react",
50
- },
51
- "dot-cursor": {
52
- name: "dot-cursor",
53
- type: "ui",
54
- component: React.lazy(() => import("../registry/ui/cursors/dot-cursor")),
55
- details: null,
56
- files: ["ui/cursors/dot-cursor.tsx"],
57
- category: "cursors",
58
- content: `'use client';
59
-
60
- import React, { useState, useEffect } from 'react';
61
-
62
- const CustomCursor = () => {
63
- const [position, setPosition] = useState({ x: 0, y: 0 });
64
- const [isHovering, setIsHovering] = useState(false);
65
- const [isDarkBackground, setIsDarkBackground] = useState(false);
66
-
67
- useEffect(() => {
68
-
69
- // document.body.style.cursor = 'none';
70
-
71
- const updatePosition = (e: MouseEvent) => {
72
- setPosition({ x: e.clientX, y: e.clientY });
73
-
74
- const element = document.elementFromPoint(e.clientX, e.clientY);
75
- if (element) {
76
- const bgColor = window.getComputedStyle(element).backgroundColor;
77
- const brightness = getBrightness(bgColor);
78
- setIsDarkBackground(brightness < 128);
79
- }
80
- };
81
-
82
- const handleMouseOver = (e: MouseEvent) => {
83
- const target = e.target as HTMLElement;
84
- if (
85
- target.tagName === 'A' ||
86
- target.tagName === 'BUTTON' ||
87
- target.onclick !== null ||
88
- window.getComputedStyle(target).cursor === 'pointer'
89
- ) {
90
- setIsHovering(true);
91
- }
92
- };
93
-
94
- const handleMouseOut = () => {
95
- setIsHovering(false);
96
- };
97
-
98
- window.addEventListener('mousemove', updatePosition);
99
- document.addEventListener('mouseover', handleMouseOver);
100
- document.addEventListener('mouseout', handleMouseOut);
101
-
102
- return () => {
103
- window.removeEventListener('mousemove', updatePosition);
104
- document.removeEventListener('mouseover', handleMouseOver);
105
- document.removeEventListener('mouseout', handleMouseOut);
106
-
107
-
108
- };
109
- }, []);
110
-
111
- const getBrightness = (color: string) => {
112
- const rgb = color.match(/\d+/g);
113
- if (!rgb) return 255;
114
- const r = parseInt(rgb[0]);
115
- const g = parseInt(rgb[1]);
116
- const b = parseInt(rgb[2]);
117
- return (r * 299 + g * 587 + b * 114) / 1000;
118
- };
119
-
120
- return (
121
- <div
122
- style={{
123
- cursor: 'none',
124
- width: '100vw',
125
- height: '100vh',
126
- position: 'fixed',
127
- top: 0,
128
- left: 0,
129
- pointerEvents: 'none'
130
- }}>
131
-
132
- <div
133
- style={{
134
- position: 'fixed',
135
- left: \`\${position.x}px\`,
136
- top: \`\${position.y}px\`,
137
- pointerEvents: 'none',
138
- transform: \`translate(-50%, -50%) scale(\${isHovering ? 1.5 : 1})\`,
139
- transition: 'transform 0.2s ease',
140
- zIndex: 9999,
141
- }}
142
- >
143
- <svg
144
- xmlns="http://www.w3.org/2000/svg"
145
- width="24"
146
- height="24"
147
- viewBox="0 0 24 24"
148
- style={{
149
- display: 'block',
150
- transition: 'all 0.2s ease',
151
- }}
152
- >
153
- <path
154
- fill={isDarkBackground ? '#ffffff' : '#000000'}
155
- stroke={isDarkBackground ? '#000000' : '#ffffff'}
156
- strokeWidth="2"
157
- d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z"
158
- />
159
- </svg>
160
- </div>
161
- </div>
162
- );
163
- };
164
-
165
- export default CustomCursor;`,
166
- description: ``,
167
- install: "npm install framer-motion",
168
- },
169
- "flaoting-navbar": {
170
- name: "flaoting-navbar",
171
- type: "ui",
172
- component: React.lazy(() => import("../registry/ui/navbars/floating-navbar")),
173
- details: null,
174
- files: ["ui/navbars/floating-navbar.tsx"],
175
- category: "navbars",
176
- content: `'use client';
177
-
178
- import React, { useState, useEffect } from 'react';
179
- import Link from 'next/link';
180
- import { motion, AnimatePresence } from 'framer-motion';
181
- import { Sun, Moon } from 'lucide-react';
182
-
183
- const Navbar = () => {
184
- const [mounted, setMounted] = useState(false);
185
- const [isDark, setIsDark] = useState(true);
186
- const [scrolled, setScrolled] = useState(false);
187
-
188
- useEffect(() => {
189
- setMounted(true);
190
- const handleScroll = () => setScrolled(window.scrollY > 20);
191
- window.addEventListener('scroll', handleScroll);
192
- return () => window.removeEventListener('scroll', handleScroll);
193
- }, []);
194
-
195
- const toggleTheme = () => {
196
- setIsDark(!isDark);
197
- document.documentElement.classList.toggle('dark');
198
- };
199
-
200
- const navLinks = [
201
- { name: 'Archives', slug: 'work' },
202
- { name: 'Capabilities', slug: 'service' },
203
- { name: 'Ethos', slug: 'about' },
204
- ];
205
-
206
- if (!mounted) return null;
207
-
208
- return (
209
- <nav className='fixed top-0 left-0 w-full z-[100] flex justify-center pt-6 px-6 pointer-events-none mt-10'>
210
- <motion.div
211
- initial={{ y: -100 }}
212
- animate={{ y: 0 }}
213
- className={\`
214
- flex items-center justify-between px-6 transition-all duration-500 pointer-events-auto
215
- \${
216
- scrolled
217
- ? 'w-full md:w-[800px] h-14 bg-white/5 backdrop-blur-md border border-white/10 rounded-full shadow-2xl'
218
- : 'w-full h-20 bg-transparent border-transparent'
219
- }
220
- \`}
221
- >
222
- <Link href='/' className='group flex items-center'>
223
- <span className=' text-3xl uppercase tracking-wide font-bold'>
224
- Renoh
225
- </span>
226
- </Link>
227
-
228
- <div className='hidden md:flex items-center space-x-8'>
229
- {navLinks.map((link) => (
230
- <Link
231
- key={link.slug}
232
- href={\`/\${link.slug}\`}
233
- className='text-[10px] font-plex uppercase tracking-[0.2em] text-zinc-400 hover:text-white transition-colors relative group'
234
- >
235
- {link.name}
236
- <span className='absolute -bottom-1 left-0 w-0 h-px bg-white transition-all duration-500 group-hover:w-full' />
237
- </Link>
238
- ))}
239
- </div>
240
-
241
- <div className='flex items-center space-x-4'>
242
- <button
243
- onClick={toggleTheme}
244
- className='p-2 hover:bg-white/10 rounded-full transition-colors text-white'
245
- >
246
- <AnimatePresence mode='wait'>
247
- <motion.div
248
- key={isDark ? 'dark' : 'light'}
249
- initial={{ opacity: 0, rotate: -90 }}
250
- animate={{ opacity: 1, rotate: 0 }}
251
- exit={{ opacity: 0, rotate: 90 }}
252
- transition={{ duration: 0.2 }}
253
- >
254
- {isDark ? <Sun size={16} /> : <Moon size={16} />}
255
- </motion.div>
256
- </AnimatePresence>
257
- </button>
258
-
259
- <Link href='/contact'>
260
- <motion.div
261
- whileHover={{ scale: 1.05 }}
262
- whileTap={{ scale: 0.95 }}
263
- className='px-4 py-2 bg-white text-black text-[10px] font-plex uppercase tracking-widest rounded-full'
264
- >
265
- Inquire
266
- </motion.div>
267
- </Link>
268
- </div>
269
- </motion.div>
270
- </nav>
271
- );
272
- };
273
-
274
- export default Navbar;
275
- `,
276
- description: ``,
277
- install: "npm install lucide-react framer-motion gsap",
278
- },
279
- "minimal-scrollbar": {
280
- name: "minimal-scrollbar",
281
- type: "ui",
282
- component: React.lazy(() => import("../registry/ui/scrollbars/minimal-scrollbar")),
283
- details: null,
284
- files: ["ui/scrollbars/minimal-scrollbar.tsx"],
285
- category: "scrollbars",
286
- content: `'use client';
287
-
288
- import React, { useState, useEffect, useRef, useCallback } from 'react';
289
- import { usePathname } from 'next/navigation';
290
-
291
- const VisualScrollbar = () => {
292
- const [thumbTop, setThumbTop] = useState(0);
293
- const channelRef = useRef<HTMLDivElement>(null);
294
- const thumbRef = useRef<HTMLDivElement>(null);
295
- const tickingRef = useRef(false);
296
- const measurementsRef = useRef({
297
- height: 0,
298
- thumbH: 0,
299
- paddingTop: 0,
300
- paddingBottom: 0,
301
- available: 0,
302
- });
303
-
304
- // Hide scrollbar on contact page
305
- const pathname = usePathname();
306
- const shouldHide = pathname === '/contact';
307
-
308
- const measure = useCallback(() => {
309
- if (!channelRef.current || !thumbRef.current) return;
310
-
311
- const chRect = channelRef.current.getBoundingClientRect();
312
- const thumbRect = thumbRef.current.getBoundingClientRect();
313
- const style = window.getComputedStyle(channelRef.current);
314
-
315
- const height = chRect.height;
316
- const thumbH = thumbRect.height;
317
- const paddingTop = parseFloat(style.paddingTop) || 0;
318
- const paddingBottom = parseFloat(style.paddingBottom) || 0;
319
- const available = Math.max(
320
- height - thumbH - (paddingTop + paddingBottom),
321
- 0
322
- );
323
-
324
- measurementsRef.current = {
325
- height,
326
- thumbH,
327
- paddingTop,
328
- paddingBottom,
329
- available,
330
- };
331
- }, []);
332
-
333
- const updateThumb = useCallback(() => {
334
- const scrollTop = window.scrollY;
335
- const scrollHeight = document.documentElement.scrollHeight;
336
- const clientHeight = document.documentElement.clientHeight;
337
- const maxScroll = Math.max(scrollHeight - clientHeight, 1);
338
- const scrollPercent = Math.min(Math.max(scrollTop / maxScroll, 0), 1);
339
- const topPx =
340
- measurementsRef.current.paddingTop +
341
- scrollPercent * measurementsRef.current.available;
342
-
343
- setThumbTop(topPx);
344
- }, []);
345
-
346
- useEffect(() => {
347
- const handleScroll = () => {
348
- if (!tickingRef.current) {
349
- tickingRef.current = true;
350
- requestAnimationFrame(() => {
351
- updateThumb();
352
- tickingRef.current = false;
353
- });
354
- }
355
- };
356
-
357
- let resizeTimeout: ReturnType<typeof setTimeout> | null = null;
358
- const handleResize = () => {
359
- if (resizeTimeout) clearTimeout(resizeTimeout);
360
- resizeTimeout = setTimeout(() => {
361
- measure();
362
- updateThumb();
363
- }, 150);
364
- };
365
-
366
- // Initial setup with small delay to ensure DOM is ready
367
- const initTimeout = setTimeout(() => {
368
- measure();
369
- updateThumb();
370
- }, 100);
371
-
372
- window.addEventListener('scroll', handleScroll, { passive: true });
373
- window.addEventListener('resize', handleResize, { passive: true });
374
-
375
- return () => {
376
- clearTimeout(initTimeout);
377
- if (resizeTimeout) clearTimeout(resizeTimeout);
378
- window.removeEventListener('scroll', handleScroll);
379
- window.removeEventListener('resize', handleResize);
380
- };
381
- }, [measure, updateThumb]);
382
-
383
- // Return null if on contact page
384
- if (shouldHide) return null;
385
-
386
- return (
387
- <>
388
- <style>{\`
389
- :root {
390
- --left-offset: 20px;
391
- --track-h: 50vh;
392
- --track-w: 3px;
393
- --thumb-w: 2px;
394
- --thumb-h: 50px;
395
- --track-bg: #212121;
396
- --channel-bg: rgba(255,255,255,0.15);
397
- --thumb-gradient: linear-gradient(180deg,#ffffff,#d7d7d7);
398
- --track-radius: 0px;
399
- --thumb-radius: 0px;
400
- --transition-speed: 1ms;
401
- }
402
-
403
- * {
404
- box-sizing: border-box;
405
- }
406
-
407
- body {
408
- background: #0a0a0a;
409
- color: #e6e6e6;
410
- margin: 0;
411
- padding: 0;
412
- }
413
-
414
- .vs {
415
- position: fixed;
416
- left: var(--left-offset);
417
- top: 50%;
418
- transform: translateY(-50%);
419
- width: var(--track-w);
420
- height: var(--track-h);
421
- background: var(--track-bg);
422
- border-radius: var(--track-radius);
423
- overflow: hidden;
424
- box-shadow:
425
- inset 0 1px 0 rgba(255,255,255,0.08),
426
- 0 10px 24px rgba(0,0,0,0.6);
427
- backdrop-filter: blur(6px);
428
- pointer-events: none;
429
- z-index: 9999;
430
- display: flex;
431
- justify-content: center;
432
- will-change: transform;
433
- }
434
-
435
- .vs__channel {
436
- position: relative;
437
- width: 100%;
438
- height: 100%;
439
- background: var(--channel-bg);
440
- border-radius: var(--track-radius);
441
- overflow: hidden;
442
- }
443
-
444
- .vs__thumb {
445
- position: absolute;
446
- left: 50%;
447
- transform: translateX(-50%) translateZ(0);
448
- width: var(--thumb-w);
449
- height: var(--thumb-h);
450
- border-radius: var(--thumb-radius);
451
- background: var(--thumb-gradient);
452
- box-shadow:
453
- 0 4px 14px rgba(0,0,0,0.6),
454
- inset 0 1px 0 rgba(255,255,255,0.4);
455
- will-change: top;
456
- }
457
-
458
- .vs:hover .vs__thumb {
459
- transform: translateX(-50%) translateZ(0) scaleY(1.05);
460
- transition: transform 180ms ease;
461
- }
462
-
463
- @media (max-width:720px) {
464
- :root {
465
- --left-offset: 10px;
466
- --thumb-h: 30px;
467
- --track-w: 3px;
468
- --track-h: 30vh;
469
- }
470
- }
471
- \`}</style>
472
-
473
- {/* Visual Scrollbar */}
474
- <div className='vs'>
475
- <div className='vs__channel' ref={channelRef}>
476
- <div
477
- className='vs__thumb'
478
- ref={thumbRef}
479
- style={{ top: \`\${thumbTop}px\` }}
480
- aria-hidden='true'
481
- />
482
- </div>
483
- </div>
484
- </>
485
- );
486
- };
487
-
488
- export default VisualScrollbar;`,
489
- description: ``,
490
- install: "",
491
- },
492
- }
493
- };