@alkimi.org/ui-kit 0.1.11 → 0.1.13
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.github.md +45 -74
- package/README.md +45 -43
- package/README.npm.md +45 -43
- package/dist/components/GlitchLink.d.mts +5 -3
- package/dist/components/GlitchLink.d.ts +5 -3
- package/dist/components/GlitchLink.js +29 -14
- package/dist/components/GlitchLink.js.map +1 -1
- package/dist/components/GlitchLink.mjs +30 -15
- package/dist/components/GlitchLink.mjs.map +1 -1
- package/dist/components/TextDecoder.d.mts +1 -5
- package/dist/components/TextDecoder.d.ts +1 -5
- package/dist/components/TextDecoder.js +31 -39
- package/dist/components/TextDecoder.js.map +1 -1
- package/dist/components/TextDecoder.mjs +38 -44
- package/dist/components/TextDecoder.mjs.map +1 -1
- package/dist/components/button.d.mts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/button.mjs +3 -3
- package/dist/components/button.mjs.map +1 -1
- package/dist/index.css +64 -63
- package/dist/index.css.map +1 -1
- package/dist/index.js +68 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -56
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +64 -63
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/README.github.md
CHANGED
|
@@ -32,6 +32,21 @@ module.exports = {
|
|
|
32
32
|
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
33
33
|
],
|
|
34
34
|
theme: {
|
|
35
|
+
fontSize: {
|
|
36
|
+
xs: ["0.75rem", "1rem"],
|
|
37
|
+
sm: ["12px", "1.25rem"],
|
|
38
|
+
base: ["14px", "1.5rem"],
|
|
39
|
+
lg: ["1.125rem", "1.75rem"],
|
|
40
|
+
xl: ["1.25rem", "1.75rem"],
|
|
41
|
+
"2xl": ["1.5rem", "2rem"],
|
|
42
|
+
"3xl": ["1.875rem", "2.25rem"],
|
|
43
|
+
"4xl": ["2.25rem", "2.5rem"],
|
|
44
|
+
"5xl": ["3rem", "1"],
|
|
45
|
+
"6xl": ["3.75rem", "1"],
|
|
46
|
+
"7xl": ["4.5rem", "1"],
|
|
47
|
+
"8xl": ["6rem", "1"],
|
|
48
|
+
"9xl": ["8rem", "1"],
|
|
49
|
+
},
|
|
35
50
|
extend: {
|
|
36
51
|
colors: {
|
|
37
52
|
border: "hsl(var(--border))",
|
|
@@ -69,9 +84,13 @@ module.exports = {
|
|
|
69
84
|
},
|
|
70
85
|
},
|
|
71
86
|
borderRadius: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
DEFAULT: "var(--radius)",
|
|
88
|
+
lg: "calc(var(--radius) + 2px)",
|
|
89
|
+
md: "var(--radius)",
|
|
90
|
+
sm: "calc(var(--radius) - 2px)",
|
|
91
|
+
xl: "calc(var(--radius) + 4px)",
|
|
92
|
+
"2xl": "calc(var(--radius) + 6px)",
|
|
93
|
+
"3xl": "3.75rem",
|
|
75
94
|
},
|
|
76
95
|
},
|
|
77
96
|
},
|
|
@@ -92,48 +111,31 @@ Or if you prefer, add the CSS variables to your own CSS file:
|
|
|
92
111
|
```css
|
|
93
112
|
@layer base {
|
|
94
113
|
:root {
|
|
95
|
-
|
|
96
|
-
--
|
|
97
|
-
--
|
|
98
|
-
--card
|
|
99
|
-
--
|
|
100
|
-
--popover
|
|
101
|
-
--
|
|
102
|
-
--primary
|
|
103
|
-
--
|
|
104
|
-
--secondary
|
|
105
|
-
--
|
|
106
|
-
--muted
|
|
107
|
-
--
|
|
108
|
-
--accent
|
|
109
|
-
--
|
|
110
|
-
--destructive
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--
|
|
114
|
-
--
|
|
114
|
+
/* Dark Mode Theme (Default) */
|
|
115
|
+
--background: 240 10% 4%;
|
|
116
|
+
--foreground: 144 100% 97%;
|
|
117
|
+
--card: 0 0% 3.5%;
|
|
118
|
+
--card-foreground: 140 100% 97.1%;
|
|
119
|
+
--popover: 0 0% 3.5%;
|
|
120
|
+
--popover-foreground: 140 100% 97.1%;
|
|
121
|
+
--primary: 140 100% 97.1%;
|
|
122
|
+
--primary-foreground: 240 6% 10%;
|
|
123
|
+
--secondary: 240 4% 16%;
|
|
124
|
+
--secondary-foreground: 140 100% 97.1%;
|
|
125
|
+
--muted: 240 4% 16%;
|
|
126
|
+
--muted-foreground: 144 4.3% 54.9%;
|
|
127
|
+
--accent: 0 0% 15.3%;
|
|
128
|
+
--accent-foreground: 140 100% 97.1%;
|
|
129
|
+
--destructive: 0 62.8% 30.6%;
|
|
130
|
+
--destructive-foreground: 140 100% 97.1%;
|
|
131
|
+
--border: 240 3.7% 27.6%;
|
|
132
|
+
--input: 240 3.7% 27.6%;
|
|
133
|
+
--ring: 140 100% 97.1%;
|
|
134
|
+
--radius: 0.625rem;
|
|
115
135
|
}
|
|
116
136
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--foreground: 210 40% 98%;
|
|
120
|
-
--card: 222.2 84% 4.9%;
|
|
121
|
-
--card-foreground: 210 40% 98%;
|
|
122
|
-
--popover: 222.2 84% 4.9%;
|
|
123
|
-
--popover-foreground: 210 40% 98%;
|
|
124
|
-
--primary: 210 40% 98%;
|
|
125
|
-
--primary-foreground: 222.2 47.4% 11.2%;
|
|
126
|
-
--secondary: 217.2 32.6% 17.5%;
|
|
127
|
-
--secondary-foreground: 210 40% 98%;
|
|
128
|
-
--muted: 217.2 32.6% 17.5%;
|
|
129
|
-
--muted-foreground: 215 20.2% 65.1%;
|
|
130
|
-
--accent: 217.2 32.6% 17.5%;
|
|
131
|
-
--accent-foreground: 210 40% 98%;
|
|
132
|
-
--destructive: 0 62.8% 30.6%;
|
|
133
|
-
--destructive-foreground: 210 40% 98%;
|
|
134
|
-
--border: 217.2 32.6% 17.5%;
|
|
135
|
-
--input: 217.2 32.6% 17.5%;
|
|
136
|
-
--ring: 212.7 26.8% 83.9%;
|
|
137
|
+
body {
|
|
138
|
+
font-size: 14px;
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
```
|
|
@@ -210,37 +212,6 @@ function App() {
|
|
|
210
212
|
}
|
|
211
213
|
```
|
|
212
214
|
|
|
213
|
-
### Card Component
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
import {
|
|
217
|
-
Card,
|
|
218
|
-
CardHeader,
|
|
219
|
-
CardTitle,
|
|
220
|
-
CardDescription,
|
|
221
|
-
CardContent,
|
|
222
|
-
CardFooter,
|
|
223
|
-
} from "@alkimi.org/ui-kit/card"
|
|
224
|
-
import { Button } from "@alkimi.org/ui-kit/button"
|
|
225
|
-
|
|
226
|
-
function App() {
|
|
227
|
-
return (
|
|
228
|
-
<Card>
|
|
229
|
-
<CardHeader>
|
|
230
|
-
<CardTitle>Card Title</CardTitle>
|
|
231
|
-
<CardDescription>Card Description</CardDescription>
|
|
232
|
-
</CardHeader>
|
|
233
|
-
<CardContent>
|
|
234
|
-
<p>Card Content</p>
|
|
235
|
-
</CardContent>
|
|
236
|
-
<CardFooter>
|
|
237
|
-
<Button>Action</Button>
|
|
238
|
-
</CardFooter>
|
|
239
|
-
</Card>
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
```
|
|
243
|
-
|
|
244
215
|
## Adding More Components
|
|
245
216
|
|
|
246
217
|
To add more shadcn/ui components to this library:
|
package/README.md
CHANGED
|
@@ -32,6 +32,21 @@ module.exports = {
|
|
|
32
32
|
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
33
33
|
],
|
|
34
34
|
theme: {
|
|
35
|
+
fontSize: {
|
|
36
|
+
xs: ['0.75rem', '1rem'],
|
|
37
|
+
sm: ['12px', '1.25rem'],
|
|
38
|
+
base: ['14px', '1.5rem'],
|
|
39
|
+
lg: ['1.125rem', '1.75rem'],
|
|
40
|
+
xl: ['1.25rem', '1.75rem'],
|
|
41
|
+
'2xl': ['1.5rem', '2rem'],
|
|
42
|
+
'3xl': ['1.875rem', '2.25rem'],
|
|
43
|
+
'4xl': ['2.25rem', '2.5rem'],
|
|
44
|
+
'5xl': ['3rem', '1'],
|
|
45
|
+
'6xl': ['3.75rem', '1'],
|
|
46
|
+
'7xl': ['4.5rem', '1'],
|
|
47
|
+
'8xl': ['6rem', '1'],
|
|
48
|
+
'9xl': ['8rem', '1'],
|
|
49
|
+
},
|
|
35
50
|
extend: {
|
|
36
51
|
colors: {
|
|
37
52
|
border: "hsl(var(--border))",
|
|
@@ -69,9 +84,13 @@ module.exports = {
|
|
|
69
84
|
},
|
|
70
85
|
},
|
|
71
86
|
borderRadius: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
DEFAULT: "var(--radius)",
|
|
88
|
+
lg: "calc(var(--radius) + 2px)",
|
|
89
|
+
md: "var(--radius)",
|
|
90
|
+
sm: "calc(var(--radius) - 2px)",
|
|
91
|
+
xl: "calc(var(--radius) + 4px)",
|
|
92
|
+
"2xl": "calc(var(--radius) + 6px)",
|
|
93
|
+
"3xl": "3.75rem",
|
|
75
94
|
},
|
|
76
95
|
},
|
|
77
96
|
},
|
|
@@ -92,48 +111,31 @@ Or if you prefer, add the CSS variables to your own CSS file:
|
|
|
92
111
|
```css
|
|
93
112
|
@layer base {
|
|
94
113
|
:root {
|
|
95
|
-
|
|
96
|
-
--
|
|
97
|
-
--
|
|
98
|
-
--card
|
|
99
|
-
--
|
|
100
|
-
--popover
|
|
101
|
-
--
|
|
102
|
-
--primary
|
|
103
|
-
--
|
|
104
|
-
--secondary
|
|
105
|
-
--
|
|
106
|
-
--muted
|
|
107
|
-
--
|
|
108
|
-
--accent
|
|
109
|
-
--
|
|
110
|
-
--destructive
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--
|
|
114
|
-
--
|
|
114
|
+
/* Dark Mode Theme (Default) */
|
|
115
|
+
--background: 240 10% 4%;
|
|
116
|
+
--foreground: 144 100% 97%;
|
|
117
|
+
--card: 0 0% 3.5%;
|
|
118
|
+
--card-foreground: 140 100% 97.1%;
|
|
119
|
+
--popover: 0 0% 3.5%;
|
|
120
|
+
--popover-foreground: 140 100% 97.1%;
|
|
121
|
+
--primary: 140 100% 97.1%;
|
|
122
|
+
--primary-foreground: 240 6% 10%;
|
|
123
|
+
--secondary: 240 4% 16%;
|
|
124
|
+
--secondary-foreground: 140 100% 97.1%;
|
|
125
|
+
--muted: 240 4% 16%;
|
|
126
|
+
--muted-foreground: 144 4.3% 54.9%;
|
|
127
|
+
--accent: 0 0% 15.3%;
|
|
128
|
+
--accent-foreground: 140 100% 97.1%;
|
|
129
|
+
--destructive: 0 62.8% 30.6%;
|
|
130
|
+
--destructive-foreground: 140 100% 97.1%;
|
|
131
|
+
--border: 240 3.7% 27.6%;
|
|
132
|
+
--input: 240 3.7% 27.6%;
|
|
133
|
+
--ring: 140 100% 97.1%;
|
|
134
|
+
--radius: 0.625rem;
|
|
115
135
|
}
|
|
116
136
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--foreground: 210 40% 98%;
|
|
120
|
-
--card: 222.2 84% 4.9%;
|
|
121
|
-
--card-foreground: 210 40% 98%;
|
|
122
|
-
--popover: 222.2 84% 4.9%;
|
|
123
|
-
--popover-foreground: 210 40% 98%;
|
|
124
|
-
--primary: 210 40% 98%;
|
|
125
|
-
--primary-foreground: 222.2 47.4% 11.2%;
|
|
126
|
-
--secondary: 217.2 32.6% 17.5%;
|
|
127
|
-
--secondary-foreground: 210 40% 98%;
|
|
128
|
-
--muted: 217.2 32.6% 17.5%;
|
|
129
|
-
--muted-foreground: 215 20.2% 65.1%;
|
|
130
|
-
--accent: 217.2 32.6% 17.5%;
|
|
131
|
-
--accent-foreground: 210 40% 98%;
|
|
132
|
-
--destructive: 0 62.8% 30.6%;
|
|
133
|
-
--destructive-foreground: 210 40% 98%;
|
|
134
|
-
--border: 217.2 32.6% 17.5%;
|
|
135
|
-
--input: 217.2 32.6% 17.5%;
|
|
136
|
-
--ring: 212.7 26.8% 83.9%;
|
|
137
|
+
body {
|
|
138
|
+
font-size: 14px;
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
```
|
package/README.npm.md
CHANGED
|
@@ -32,6 +32,21 @@ module.exports = {
|
|
|
32
32
|
"./node_modules/@alkimi.org/ui-kit/dist/**/*.{js,mjs}",
|
|
33
33
|
],
|
|
34
34
|
theme: {
|
|
35
|
+
fontSize: {
|
|
36
|
+
xs: ['0.75rem', '1rem'],
|
|
37
|
+
sm: ['12px', '1.25rem'],
|
|
38
|
+
base: ['14px', '1.5rem'],
|
|
39
|
+
lg: ['1.125rem', '1.75rem'],
|
|
40
|
+
xl: ['1.25rem', '1.75rem'],
|
|
41
|
+
'2xl': ['1.5rem', '2rem'],
|
|
42
|
+
'3xl': ['1.875rem', '2.25rem'],
|
|
43
|
+
'4xl': ['2.25rem', '2.5rem'],
|
|
44
|
+
'5xl': ['3rem', '1'],
|
|
45
|
+
'6xl': ['3.75rem', '1'],
|
|
46
|
+
'7xl': ['4.5rem', '1'],
|
|
47
|
+
'8xl': ['6rem', '1'],
|
|
48
|
+
'9xl': ['8rem', '1'],
|
|
49
|
+
},
|
|
35
50
|
extend: {
|
|
36
51
|
colors: {
|
|
37
52
|
border: "hsl(var(--border))",
|
|
@@ -69,9 +84,13 @@ module.exports = {
|
|
|
69
84
|
},
|
|
70
85
|
},
|
|
71
86
|
borderRadius: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
DEFAULT: "var(--radius)",
|
|
88
|
+
lg: "calc(var(--radius) + 2px)",
|
|
89
|
+
md: "var(--radius)",
|
|
90
|
+
sm: "calc(var(--radius) - 2px)",
|
|
91
|
+
xl: "calc(var(--radius) + 4px)",
|
|
92
|
+
"2xl": "calc(var(--radius) + 6px)",
|
|
93
|
+
"3xl": "3.75rem",
|
|
75
94
|
},
|
|
76
95
|
},
|
|
77
96
|
},
|
|
@@ -92,48 +111,31 @@ Or if you prefer, add the CSS variables to your own CSS file:
|
|
|
92
111
|
```css
|
|
93
112
|
@layer base {
|
|
94
113
|
:root {
|
|
95
|
-
|
|
96
|
-
--
|
|
97
|
-
--
|
|
98
|
-
--card
|
|
99
|
-
--
|
|
100
|
-
--popover
|
|
101
|
-
--
|
|
102
|
-
--primary
|
|
103
|
-
--
|
|
104
|
-
--secondary
|
|
105
|
-
--
|
|
106
|
-
--muted
|
|
107
|
-
--
|
|
108
|
-
--accent
|
|
109
|
-
--
|
|
110
|
-
--destructive
|
|
111
|
-
--
|
|
112
|
-
--
|
|
113
|
-
--
|
|
114
|
-
--
|
|
114
|
+
/* Dark Mode Theme (Default) */
|
|
115
|
+
--background: 240 10% 4%;
|
|
116
|
+
--foreground: 144 100% 97%;
|
|
117
|
+
--card: 0 0% 3.5%;
|
|
118
|
+
--card-foreground: 140 100% 97.1%;
|
|
119
|
+
--popover: 0 0% 3.5%;
|
|
120
|
+
--popover-foreground: 140 100% 97.1%;
|
|
121
|
+
--primary: 140 100% 97.1%;
|
|
122
|
+
--primary-foreground: 240 6% 10%;
|
|
123
|
+
--secondary: 240 4% 16%;
|
|
124
|
+
--secondary-foreground: 140 100% 97.1%;
|
|
125
|
+
--muted: 240 4% 16%;
|
|
126
|
+
--muted-foreground: 144 4.3% 54.9%;
|
|
127
|
+
--accent: 0 0% 15.3%;
|
|
128
|
+
--accent-foreground: 140 100% 97.1%;
|
|
129
|
+
--destructive: 0 62.8% 30.6%;
|
|
130
|
+
--destructive-foreground: 140 100% 97.1%;
|
|
131
|
+
--border: 240 3.7% 27.6%;
|
|
132
|
+
--input: 240 3.7% 27.6%;
|
|
133
|
+
--ring: 140 100% 97.1%;
|
|
134
|
+
--radius: 0.625rem;
|
|
115
135
|
}
|
|
116
136
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--foreground: 210 40% 98%;
|
|
120
|
-
--card: 222.2 84% 4.9%;
|
|
121
|
-
--card-foreground: 210 40% 98%;
|
|
122
|
-
--popover: 222.2 84% 4.9%;
|
|
123
|
-
--popover-foreground: 210 40% 98%;
|
|
124
|
-
--primary: 210 40% 98%;
|
|
125
|
-
--primary-foreground: 222.2 47.4% 11.2%;
|
|
126
|
-
--secondary: 217.2 32.6% 17.5%;
|
|
127
|
-
--secondary-foreground: 210 40% 98%;
|
|
128
|
-
--muted: 217.2 32.6% 17.5%;
|
|
129
|
-
--muted-foreground: 215 20.2% 65.1%;
|
|
130
|
-
--accent: 217.2 32.6% 17.5%;
|
|
131
|
-
--accent-foreground: 210 40% 98%;
|
|
132
|
-
--destructive: 0 62.8% 30.6%;
|
|
133
|
-
--destructive-foreground: 210 40% 98%;
|
|
134
|
-
--border: 217.2 32.6% 17.5%;
|
|
135
|
-
--input: 217.2 32.6% 17.5%;
|
|
136
|
-
--ring: 212.7 26.8% 83.9%;
|
|
137
|
+
body {
|
|
138
|
+
font-size: 14px;
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
```
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { RefAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
declare const DEFAULT_SYMBOLS: string[];
|
|
4
5
|
type GlitchLinkProps = RefAttributes<HTMLAnchorElement> & {
|
|
5
|
-
href
|
|
6
|
+
href?: string;
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
symbols?: string[];
|
|
8
9
|
className?: string;
|
|
10
|
+
asChild?: boolean;
|
|
9
11
|
};
|
|
10
|
-
declare const GlitchLink: ({ href, children, symbols, className, ...props }: GlitchLinkProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare const GlitchLink: ({ href, children, symbols, className, asChild, ...props }: GlitchLinkProps) => react_jsx_runtime.JSX.Element;
|
|
11
13
|
|
|
12
|
-
export { GlitchLink as default };
|
|
14
|
+
export { DEFAULT_SYMBOLS, GlitchLink as default };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { RefAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
declare const DEFAULT_SYMBOLS: string[];
|
|
4
5
|
type GlitchLinkProps = RefAttributes<HTMLAnchorElement> & {
|
|
5
|
-
href
|
|
6
|
+
href?: string;
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
symbols?: string[];
|
|
8
9
|
className?: string;
|
|
10
|
+
asChild?: boolean;
|
|
9
11
|
};
|
|
10
|
-
declare const GlitchLink: ({ href, children, symbols, className, ...props }: GlitchLinkProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare const GlitchLink: ({ href, children, symbols, className, asChild, ...props }: GlitchLinkProps) => react_jsx_runtime.JSX.Element;
|
|
11
13
|
|
|
12
|
-
export { GlitchLink as default };
|
|
14
|
+
export { DEFAULT_SYMBOLS, GlitchLink as default };
|
|
@@ -32,24 +32,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
// src/components/GlitchLink.tsx
|
|
33
33
|
var GlitchLink_exports = {};
|
|
34
34
|
__export(GlitchLink_exports, {
|
|
35
|
+
DEFAULT_SYMBOLS: () => DEFAULT_SYMBOLS,
|
|
35
36
|
default: () => GlitchLink_default
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(GlitchLink_exports);
|
|
38
39
|
var import_link = __toESM(require("next/link"));
|
|
39
40
|
var import_react = require("react");
|
|
41
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
40
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
43
|
var DEFAULT_SYMBOLS = ["/", "#", "*"];
|
|
42
44
|
var GlitchLink = ({
|
|
43
45
|
href,
|
|
44
46
|
children,
|
|
45
47
|
symbols = DEFAULT_SYMBOLS,
|
|
46
|
-
className
|
|
48
|
+
className,
|
|
49
|
+
asChild = false,
|
|
47
50
|
...props
|
|
48
51
|
}) => {
|
|
49
52
|
const [isHovering, setIsHovering] = (0, import_react.useState)(false);
|
|
50
|
-
const
|
|
53
|
+
const getTextContent = (node) => {
|
|
54
|
+
if (typeof node === "string") return node;
|
|
55
|
+
if ((0, import_react.isValidElement)(node) && node.props.children) {
|
|
56
|
+
return getTextContent(node.props.children);
|
|
57
|
+
}
|
|
58
|
+
return "";
|
|
59
|
+
};
|
|
60
|
+
const text = getTextContent(children);
|
|
51
61
|
const getRandomGlitch = () => {
|
|
52
|
-
if (!isHovering || !text) return
|
|
62
|
+
if (!isHovering || !text) return text;
|
|
53
63
|
return text.split(" ").map((word) => {
|
|
54
64
|
const randomLetterIndex = Math.floor(Math.random() * word.length);
|
|
55
65
|
return word.replace(
|
|
@@ -58,17 +68,22 @@ var GlitchLink = ({
|
|
|
58
68
|
);
|
|
59
69
|
}).join(" ");
|
|
60
70
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
);
|
|
71
|
+
const commonProps = {
|
|
72
|
+
className,
|
|
73
|
+
onMouseEnter: () => setIsHovering(true),
|
|
74
|
+
onMouseLeave: () => setIsHovering(false),
|
|
75
|
+
...props
|
|
76
|
+
};
|
|
77
|
+
if (asChild && (0, import_react.isValidElement)(children)) {
|
|
78
|
+
const content2 = text ? isHovering ? getRandomGlitch() : text : children;
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slot, { ...commonProps, children: (0, import_react.cloneElement)(children, {}, content2) });
|
|
80
|
+
}
|
|
81
|
+
const content = text ? isHovering ? getRandomGlitch() : children : children;
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: href || "#", ...commonProps, children: content });
|
|
72
83
|
};
|
|
73
84
|
var GlitchLink_default = GlitchLink;
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
DEFAULT_SYMBOLS
|
|
88
|
+
});
|
|
74
89
|
//# sourceMappingURL=GlitchLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/GlitchLink.tsx"],"sourcesContent":["\"use client\"\nimport Link from \"next/link\"\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlitchLink.tsx"],"sourcesContent":["\"use client\"\nimport Link from \"next/link\"\nimport {\n RefAttributes,\n useState,\n ReactNode,\n cloneElement,\n isValidElement,\n} from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nexport const DEFAULT_SYMBOLS = [\"/\", \"#\", \"*\"]\n\ntype GlitchLinkProps = RefAttributes<HTMLAnchorElement> & {\n href?: string\n children: ReactNode\n symbols?: string[]\n className?: string\n asChild?: boolean\n}\n\nconst GlitchLink = ({\n href,\n children,\n symbols = DEFAULT_SYMBOLS,\n className,\n asChild = false,\n ...props\n}: GlitchLinkProps) => {\n const [isHovering, setIsHovering] = useState(false)\n\n // Extract text from children - either direct string or from child element\n const getTextContent = (node: ReactNode): string => {\n if (typeof node === \"string\") return node\n if (isValidElement(node) && node.props.children) {\n return getTextContent(node.props.children)\n }\n return \"\"\n }\n\n const text = getTextContent(children)\n\n const getRandomGlitch = () => {\n if (!isHovering || !text) return text\n return text\n .split(\" \")\n .map((word: string) => {\n // take one random letter from the word\n const randomLetterIndex = Math.floor(Math.random() * word.length)\n\n // replace the letter with a random symbol\n return word.replace(\n word[randomLetterIndex],\n symbols[Math.floor(Math.random() * symbols.length)]\n )\n })\n .join(\" \")\n }\n\n const commonProps = {\n className,\n onMouseEnter: () => setIsHovering(true),\n onMouseLeave: () => setIsHovering(false),\n ...props,\n }\n\n if (asChild && isValidElement(children)) {\n const content = text ? (isHovering ? getRandomGlitch() : text) : children\n return (\n <Slot {...commonProps}>\n {cloneElement(children as React.ReactElement, {}, content)}\n </Slot>\n )\n }\n\n const content = text ? (isHovering ? getRandomGlitch() : children) : children\n\n return (\n <Link href={href || \"#\"} {...commonProps}>\n {content}\n </Link>\n )\n}\n\nexport default GlitchLink\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAiB;AACjB,mBAMO;AACP,wBAAqB;AA4Df;AA1DC,IAAM,kBAAkB,CAAC,KAAK,KAAK,GAAG;AAU7C,IAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MAAuB;AACrB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAGlD,QAAM,iBAAiB,CAAC,SAA4B;AAClD,QAAI,OAAO,SAAS,SAAU,QAAO;AACrC,YAAI,6BAAe,IAAI,KAAK,KAAK,MAAM,UAAU;AAC/C,aAAO,eAAe,KAAK,MAAM,QAAQ;AAAA,IAC3C;AACA,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,eAAe,QAAQ;AAEpC,QAAM,kBAAkB,MAAM;AAC5B,QAAI,CAAC,cAAc,CAAC,KAAM,QAAO;AACjC,WAAO,KACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAiB;AAErB,YAAM,oBAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,KAAK,MAAM;AAGhE,aAAO,KAAK;AAAA,QACV,KAAK,iBAAiB;AAAA,QACtB,QAAQ,KAAK,MAAM,KAAK,OAAO,IAAI,QAAQ,MAAM,CAAC;AAAA,MACpD;AAAA,IACF,CAAC,EACA,KAAK,GAAG;AAAA,EACb;AAEA,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,cAAc,MAAM,cAAc,IAAI;AAAA,IACtC,cAAc,MAAM,cAAc,KAAK;AAAA,IACvC,GAAG;AAAA,EACL;AAEA,MAAI,eAAW,6BAAe,QAAQ,GAAG;AACvC,UAAMA,WAAU,OAAQ,aAAa,gBAAgB,IAAI,OAAQ;AACjE,WACE,4CAAC,0BAAM,GAAG,aACP,yCAAa,UAAgC,CAAC,GAAGA,QAAO,GAC3D;AAAA,EAEJ;AAEA,QAAM,UAAU,OAAQ,aAAa,gBAAgB,IAAI,WAAY;AAErE,SACE,4CAAC,YAAAC,SAAA,EAAK,MAAM,QAAQ,KAAM,GAAG,aAC1B,mBACH;AAEJ;AAEA,IAAO,qBAAQ;","names":["content","Link"]}
|
|
@@ -3,20 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
// src/components/GlitchLink.tsx
|
|
5
5
|
import Link from "next/link";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useState,
|
|
8
|
+
cloneElement,
|
|
9
|
+
isValidElement
|
|
10
|
+
} from "react";
|
|
11
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
12
|
import { jsx } from "react/jsx-runtime";
|
|
8
13
|
var DEFAULT_SYMBOLS = ["/", "#", "*"];
|
|
9
14
|
var GlitchLink = ({
|
|
10
15
|
href,
|
|
11
16
|
children,
|
|
12
17
|
symbols = DEFAULT_SYMBOLS,
|
|
13
|
-
className
|
|
18
|
+
className,
|
|
19
|
+
asChild = false,
|
|
14
20
|
...props
|
|
15
21
|
}) => {
|
|
16
22
|
const [isHovering, setIsHovering] = useState(false);
|
|
17
|
-
const
|
|
23
|
+
const getTextContent = (node) => {
|
|
24
|
+
if (typeof node === "string") return node;
|
|
25
|
+
if (isValidElement(node) && node.props.children) {
|
|
26
|
+
return getTextContent(node.props.children);
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
};
|
|
30
|
+
const text = getTextContent(children);
|
|
18
31
|
const getRandomGlitch = () => {
|
|
19
|
-
if (!isHovering || !text) return
|
|
32
|
+
if (!isHovering || !text) return text;
|
|
20
33
|
return text.split(" ").map((word) => {
|
|
21
34
|
const randomLetterIndex = Math.floor(Math.random() * word.length);
|
|
22
35
|
return word.replace(
|
|
@@ -25,20 +38,22 @@ var GlitchLink = ({
|
|
|
25
38
|
);
|
|
26
39
|
}).join(" ");
|
|
27
40
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
41
|
+
const commonProps = {
|
|
42
|
+
className,
|
|
43
|
+
onMouseEnter: () => setIsHovering(true),
|
|
44
|
+
onMouseLeave: () => setIsHovering(false),
|
|
45
|
+
...props
|
|
46
|
+
};
|
|
47
|
+
if (asChild && isValidElement(children)) {
|
|
48
|
+
const content2 = text ? isHovering ? getRandomGlitch() : text : children;
|
|
49
|
+
return /* @__PURE__ */ jsx(Slot, { ...commonProps, children: cloneElement(children, {}, content2) });
|
|
50
|
+
}
|
|
51
|
+
const content = text ? isHovering ? getRandomGlitch() : children : children;
|
|
52
|
+
return /* @__PURE__ */ jsx(Link, { href: href || "#", ...commonProps, children: content });
|
|
39
53
|
};
|
|
40
54
|
var GlitchLink_default = GlitchLink;
|
|
41
55
|
export {
|
|
56
|
+
DEFAULT_SYMBOLS,
|
|
42
57
|
GlitchLink_default as default
|
|
43
58
|
};
|
|
44
59
|
//# sourceMappingURL=GlitchLink.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/GlitchLink.tsx"],"sourcesContent":["\"use client\"\nimport Link from \"next/link\"\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlitchLink.tsx"],"sourcesContent":["\"use client\"\nimport Link from \"next/link\"\nimport {\n RefAttributes,\n useState,\n ReactNode,\n cloneElement,\n isValidElement,\n} from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nexport const DEFAULT_SYMBOLS = [\"/\", \"#\", \"*\"]\n\ntype GlitchLinkProps = RefAttributes<HTMLAnchorElement> & {\n href?: string\n children: ReactNode\n symbols?: string[]\n className?: string\n asChild?: boolean\n}\n\nconst GlitchLink = ({\n href,\n children,\n symbols = DEFAULT_SYMBOLS,\n className,\n asChild = false,\n ...props\n}: GlitchLinkProps) => {\n const [isHovering, setIsHovering] = useState(false)\n\n // Extract text from children - either direct string or from child element\n const getTextContent = (node: ReactNode): string => {\n if (typeof node === \"string\") return node\n if (isValidElement(node) && node.props.children) {\n return getTextContent(node.props.children)\n }\n return \"\"\n }\n\n const text = getTextContent(children)\n\n const getRandomGlitch = () => {\n if (!isHovering || !text) return text\n return text\n .split(\" \")\n .map((word: string) => {\n // take one random letter from the word\n const randomLetterIndex = Math.floor(Math.random() * word.length)\n\n // replace the letter with a random symbol\n return word.replace(\n word[randomLetterIndex],\n symbols[Math.floor(Math.random() * symbols.length)]\n )\n })\n .join(\" \")\n }\n\n const commonProps = {\n className,\n onMouseEnter: () => setIsHovering(true),\n onMouseLeave: () => setIsHovering(false),\n ...props,\n }\n\n if (asChild && isValidElement(children)) {\n const content = text ? (isHovering ? getRandomGlitch() : text) : children\n return (\n <Slot {...commonProps}>\n {cloneElement(children as React.ReactElement, {}, content)}\n </Slot>\n )\n }\n\n const content = text ? (isHovering ? getRandomGlitch() : children) : children\n\n return (\n <Link href={href || \"#\"} {...commonProps}>\n {content}\n </Link>\n )\n}\n\nexport default GlitchLink\n"],"mappings":";;;;AACA,OAAO,UAAU;AACjB;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AA4Df;AA1DC,IAAM,kBAAkB,CAAC,KAAK,KAAK,GAAG;AAU7C,IAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,MAAuB;AACrB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAGlD,QAAM,iBAAiB,CAAC,SAA4B;AAClD,QAAI,OAAO,SAAS,SAAU,QAAO;AACrC,QAAI,eAAe,IAAI,KAAK,KAAK,MAAM,UAAU;AAC/C,aAAO,eAAe,KAAK,MAAM,QAAQ;AAAA,IAC3C;AACA,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,eAAe,QAAQ;AAEpC,QAAM,kBAAkB,MAAM;AAC5B,QAAI,CAAC,cAAc,CAAC,KAAM,QAAO;AACjC,WAAO,KACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAiB;AAErB,YAAM,oBAAoB,KAAK,MAAM,KAAK,OAAO,IAAI,KAAK,MAAM;AAGhE,aAAO,KAAK;AAAA,QACV,KAAK,iBAAiB;AAAA,QACtB,QAAQ,KAAK,MAAM,KAAK,OAAO,IAAI,QAAQ,MAAM,CAAC;AAAA,MACpD;AAAA,IACF,CAAC,EACA,KAAK,GAAG;AAAA,EACb;AAEA,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,cAAc,MAAM,cAAc,IAAI;AAAA,IACtC,cAAc,MAAM,cAAc,KAAK;AAAA,IACvC,GAAG;AAAA,EACL;AAEA,MAAI,WAAW,eAAe,QAAQ,GAAG;AACvC,UAAMA,WAAU,OAAQ,aAAa,gBAAgB,IAAI,OAAQ;AACjE,WACE,oBAAC,QAAM,GAAG,aACP,uBAAa,UAAgC,CAAC,GAAGA,QAAO,GAC3D;AAAA,EAEJ;AAEA,QAAM,UAAU,OAAQ,aAAa,gBAAgB,IAAI,WAAY;AAErE,SACE,oBAAC,QAAK,MAAM,QAAQ,KAAM,GAAG,aAC1B,mBACH;AAEJ;AAEA,IAAO,qBAAQ;","names":["content"]}
|
|
@@ -5,11 +5,7 @@ interface TextDecoderProps {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
delay?: number;
|
|
8
|
-
symbols?: string[];
|
|
9
|
-
maxIterations?: number;
|
|
10
|
-
speed?: number;
|
|
11
8
|
}
|
|
12
|
-
declare const TextDecoder: ({ children, className, delay, symbols, maxIterations, speed, }: TextDecoderProps) => react_jsx_runtime.JSX.Element;
|
|
13
9
|
declare const SuspenseDecodedText: (props: TextDecoderProps) => react_jsx_runtime.JSX.Element;
|
|
14
10
|
|
|
15
|
-
export {
|
|
11
|
+
export { type TextDecoderProps, SuspenseDecodedText as default };
|
|
@@ -5,11 +5,7 @@ interface TextDecoderProps {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
delay?: number;
|
|
8
|
-
symbols?: string[];
|
|
9
|
-
maxIterations?: number;
|
|
10
|
-
speed?: number;
|
|
11
8
|
}
|
|
12
|
-
declare const TextDecoder: ({ children, className, delay, symbols, maxIterations, speed, }: TextDecoderProps) => react_jsx_runtime.JSX.Element;
|
|
13
9
|
declare const SuspenseDecodedText: (props: TextDecoderProps) => react_jsx_runtime.JSX.Element;
|
|
14
10
|
|
|
15
|
-
export {
|
|
11
|
+
export { type TextDecoderProps, SuspenseDecodedText as default };
|