@istmx/ui 0.1.10 → 0.1.11
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 +6 -16
- package/bin/istmx.mjs +6 -8
- package/package.json +2 -2
- package/registry/ai-chat-block/ai-chat-input.tsx +8 -4
- package/registry/ai-chat-block/attachment.tsx +1 -140
- package/registry/ai-chat-block/chat-composer.tsx +1 -1
- package/registry/ai-chat-block/index.ts +15 -1
- package/registry/bento-grid.tsx +433 -0
- package/registry/scroll-parallax-hero.tsx +565 -0
- package/registry/ai-chat-input/ai-chat-input.tsx +0 -690
- package/registry/ai-chat-input/attachment.tsx +0 -605
- package/registry/ai-chat-input/send-button.tsx +0 -102
- package/registry/ai-chat-input/types.ts +0 -71
- package/registry/ai-chat-input/utils.ts +0 -6
- package/registry/ai-chat-input/voice-button.tsx +0 -66
package/README.md
CHANGED
|
@@ -63,6 +63,12 @@ Add the scroll-scrubbed image story with:
|
|
|
63
63
|
npx @istmx/ui add scroll-story-cards
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
Add the scroll parallax hero with:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npx @istmx/ui add scroll-parallax-hero
|
|
70
|
+
```
|
|
71
|
+
|
|
66
72
|
Add the interactive pixel cat with:
|
|
67
73
|
|
|
68
74
|
```sh
|
|
@@ -81,21 +87,6 @@ Add the complete AI chat block with:
|
|
|
81
87
|
npx @istmx/ui add ai-chat-block
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
Add only the reusable chat input with:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
npx @istmx/ui add ai-chat-input
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
This command copies the input and its attachment, voice, send, type, and class
|
|
91
|
-
helper files into `components/ai-chat/`. The composer and upload menu each
|
|
92
|
-
contain their own accent-border effect, so there is no extra effect file to
|
|
93
|
-
install. Import the input from
|
|
94
|
-
`@/components/ai-chat/ai-chat-input`. It installs Motion, Tabler Icons, clsx,
|
|
95
|
-
and tailwind-merge when they are missing. React and Tailwind CSS are expected
|
|
96
|
-
to be configured by your app. The input uses Tailwind utility classes and does
|
|
97
|
-
not need a stylesheet.
|
|
98
|
-
|
|
99
90
|
The CLI detects your package manager, copies the editable component to
|
|
100
91
|
`components/ui/animated-text.tsx`, adds the shared `cn` helper at
|
|
101
92
|
`lib/utils.ts` if it is missing, and installs any missing dependencies:
|
|
@@ -253,7 +244,6 @@ npx @istmx/ui add infinite-image-canvas
|
|
|
253
244
|
npx @istmx/ui add dock-navigation
|
|
254
245
|
npx @istmx/ui add mobile-menu-dock
|
|
255
246
|
npx @istmx/ui add pixel-cat
|
|
256
|
-
npx @istmx/ui add ai-chat-input
|
|
257
247
|
npx @istmx/ui add ai-chat-block
|
|
258
248
|
npx @istmx/ui add scroll-story-cards
|
|
259
249
|
```
|
package/bin/istmx.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { access, mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
|
|
|
6
6
|
import path from 'node:path'
|
|
7
7
|
import { fileURLToPath } from 'node:url'
|
|
8
8
|
|
|
9
|
-
const VERSION = '0.1.
|
|
9
|
+
const VERSION = '0.1.11'
|
|
10
10
|
const COMPONENTS = {
|
|
11
11
|
button: { fileName: 'button.tsx' },
|
|
12
12
|
'animated-text': { fileName: 'animated-text.tsx' },
|
|
@@ -28,15 +28,13 @@ const COMPONENTS = {
|
|
|
28
28
|
dependencies: ['@tabler/icons-react'],
|
|
29
29
|
},
|
|
30
30
|
'pixel-cat': { fileName: 'pixel-cat.tsx' },
|
|
31
|
-
'
|
|
32
|
-
|
|
31
|
+
'bento-grid': {
|
|
32
|
+
fileName: 'bento-grid.tsx',
|
|
33
33
|
dependencies: ['@tabler/icons-react'],
|
|
34
|
-
utility: false,
|
|
35
34
|
},
|
|
36
|
-
'
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
importPath: '@/components/ai-chat/ai-chat-input',
|
|
35
|
+
'scroll-parallax-hero': { fileName: 'scroll-parallax-hero.tsx' },
|
|
36
|
+
'ai-chat-block': {
|
|
37
|
+
directory: 'ai-chat-block',
|
|
40
38
|
dependencies: ['@tabler/icons-react'],
|
|
41
39
|
utility: false,
|
|
42
40
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@istmx/ui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Add editable ISTMX UI components
|
|
3
|
+
"version": "0.1.11",
|
|
4
|
+
"description": "Add editable ISTMX UI components to your project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"istmx": "bin/istmx.mjs"
|
|
@@ -182,6 +182,7 @@ export type AiChatInputProps = {
|
|
|
182
182
|
disabled?: boolean
|
|
183
183
|
className?: string
|
|
184
184
|
textareaClassName?: string
|
|
185
|
+
accentColor?: string
|
|
185
186
|
|
|
186
187
|
glow?: false | AiChatInputGlow
|
|
187
188
|
onAttachmentError?: (message: string) => void
|
|
@@ -289,7 +290,8 @@ export function AiChatInput({
|
|
|
289
290
|
disabled = false,
|
|
290
291
|
className,
|
|
291
292
|
textareaClassName,
|
|
292
|
-
|
|
293
|
+
accentColor,
|
|
294
|
+
glow = false,
|
|
293
295
|
onAttachmentError,
|
|
294
296
|
}: AiChatInputProps) {
|
|
295
297
|
const rootId = useId().replace(/:/g, '')
|
|
@@ -314,7 +316,7 @@ export function AiChatInput({
|
|
|
314
316
|
!disabled && !busy && (value.trim().length > 0 || attachments.length > 0)
|
|
315
317
|
const sendState = busy ? 'busy' : canSend ? 'ready' : sent ? 'sent' : 'idle'
|
|
316
318
|
const glowOptions = typeof glow === 'object' ? glow : {}
|
|
317
|
-
const glowColor = glowOptions.color ?? '#0369a1'
|
|
319
|
+
const glowColor = accentColor ?? glowOptions.color ?? '#0369a1'
|
|
318
320
|
function updateValue(next: string) {
|
|
319
321
|
const bounded = next.slice(0, maxLength)
|
|
320
322
|
setValue(bounded)
|
|
@@ -471,7 +473,7 @@ export function AiChatInput({
|
|
|
471
473
|
<div
|
|
472
474
|
style={{ '--chat-accent': glowColor } as CSSProperties}
|
|
473
475
|
className={cn(
|
|
474
|
-
'bg-background/85 relative rounded-2xl border
|
|
476
|
+
'bg-background/85 border-border/70 focus-within:border-foreground/40 relative rounded-2xl border shadow-sm backdrop-blur-xl transition-[border-color] duration-300',
|
|
475
477
|
disabled && 'opacity-60',
|
|
476
478
|
className,
|
|
477
479
|
)}
|
|
@@ -681,7 +683,9 @@ export function AiChatInput({
|
|
|
681
683
|
}
|
|
682
684
|
onSelect={runAction}
|
|
683
685
|
onClose={() => closeMenu(true)}
|
|
684
|
-
accentColor={
|
|
686
|
+
accentColor={
|
|
687
|
+
accentColor ?? (typeof glow === 'object' ? glow.color : undefined)
|
|
688
|
+
}
|
|
685
689
|
/>
|
|
686
690
|
</div>
|
|
687
691
|
)
|
|
@@ -17,144 +17,6 @@ import {
|
|
|
17
17
|
import { cn } from './utils'
|
|
18
18
|
import type { AttachmentOption, ChatAttachmentKind } from './types'
|
|
19
19
|
|
|
20
|
-
type AnimatedAccentBorderProps = {
|
|
21
|
-
color: string
|
|
22
|
-
duration?: number
|
|
23
|
-
intensity?: number
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function AnimatedAccentBorder({
|
|
27
|
-
color,
|
|
28
|
-
duration = 5,
|
|
29
|
-
intensity = 1,
|
|
30
|
-
}: AnimatedAccentBorderProps) {
|
|
31
|
-
const borderRef = useRef<SVGSVGElement>(null)
|
|
32
|
-
const glowFilterId = `${useId().replace(/:/g, '')}-organic-glow`
|
|
33
|
-
const [size, setSize] = useState({ width: 0, height: 0 })
|
|
34
|
-
const reduceMotion = useReducedMotion()
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
const border = borderRef.current
|
|
38
|
-
if (!border) return
|
|
39
|
-
|
|
40
|
-
const observer = new ResizeObserver(() => {
|
|
41
|
-
const { width, height } = border.getBoundingClientRect()
|
|
42
|
-
setSize((current) =>
|
|
43
|
-
Math.abs(current.width - width) < 0.5 &&
|
|
44
|
-
Math.abs(current.height - height) < 0.5
|
|
45
|
-
? current
|
|
46
|
-
: { width, height },
|
|
47
|
-
)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
observer.observe(border)
|
|
51
|
-
return () => observer.disconnect()
|
|
52
|
-
}, [])
|
|
53
|
-
|
|
54
|
-
const measuredWidth = Math.max(1, size.width)
|
|
55
|
-
const measuredHeight = Math.max(1, size.height)
|
|
56
|
-
const width = Math.max(0, measuredWidth - 1)
|
|
57
|
-
const height = Math.max(0, measuredHeight - 1)
|
|
58
|
-
const radius = Math.min(15.5, width / 2, height / 2)
|
|
59
|
-
const pathLength = Math.max(
|
|
60
|
-
0,
|
|
61
|
-
2 * (width + height - 4 * radius) + 2 * Math.PI * radius,
|
|
62
|
-
)
|
|
63
|
-
const dashLength = pathLength * 0.22
|
|
64
|
-
const highlightColor = `color-mix(in srgb, ${color} 62%, white)`
|
|
65
|
-
const animate = reduceMotion ? undefined : { strokeDashoffset: -pathLength }
|
|
66
|
-
const transition = {
|
|
67
|
-
duration: Math.max(1, duration),
|
|
68
|
-
ease: 'linear' as const,
|
|
69
|
-
repeat: Infinity,
|
|
70
|
-
}
|
|
71
|
-
const shape = {
|
|
72
|
-
x: 0.5,
|
|
73
|
-
y: 0.5,
|
|
74
|
-
width,
|
|
75
|
-
height,
|
|
76
|
-
rx: radius,
|
|
77
|
-
fill: 'none',
|
|
78
|
-
}
|
|
79
|
-
const animatedShape = {
|
|
80
|
-
...shape,
|
|
81
|
-
strokeDasharray: `${dashLength} ${pathLength - dashLength}`,
|
|
82
|
-
strokeLinecap: 'round' as const,
|
|
83
|
-
initial: { strokeDashoffset: 0 },
|
|
84
|
-
animate,
|
|
85
|
-
transition,
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<svg
|
|
90
|
-
ref={borderRef}
|
|
91
|
-
aria-hidden="true"
|
|
92
|
-
viewBox={`0 0 ${measuredWidth} ${measuredHeight}`}
|
|
93
|
-
className="pointer-events-none absolute -top-px -left-px z-20 overflow-visible"
|
|
94
|
-
style={{
|
|
95
|
-
width: 'calc(100% + 2px)',
|
|
96
|
-
height: 'calc(100% + 2px)',
|
|
97
|
-
opacity: Math.min(1, Math.max(0, intensity)),
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
<defs>
|
|
101
|
-
<filter
|
|
102
|
-
id={glowFilterId}
|
|
103
|
-
x="-35%"
|
|
104
|
-
y="-60%"
|
|
105
|
-
width="170%"
|
|
106
|
-
height="220%"
|
|
107
|
-
colorInterpolationFilters="sRGB"
|
|
108
|
-
>
|
|
109
|
-
<feTurbulence
|
|
110
|
-
type="fractalNoise"
|
|
111
|
-
baseFrequency="0.01 0.08"
|
|
112
|
-
numOctaves="2"
|
|
113
|
-
seed="7"
|
|
114
|
-
result="edgeNoise"
|
|
115
|
-
/>
|
|
116
|
-
<feDisplacementMap
|
|
117
|
-
in="SourceGraphic"
|
|
118
|
-
in2="edgeNoise"
|
|
119
|
-
scale="18"
|
|
120
|
-
xChannelSelector="R"
|
|
121
|
-
yChannelSelector="G"
|
|
122
|
-
result="unevenEdge"
|
|
123
|
-
/>
|
|
124
|
-
<feGaussianBlur in="unevenEdge" stdDeviation="10" />
|
|
125
|
-
</filter>
|
|
126
|
-
</defs>
|
|
127
|
-
<rect {...shape} stroke={color} strokeWidth="1.5" opacity="0.38" />
|
|
128
|
-
<rect
|
|
129
|
-
{...shape}
|
|
130
|
-
stroke={color}
|
|
131
|
-
strokeWidth="8"
|
|
132
|
-
filter={`url(#${glowFilterId})`}
|
|
133
|
-
opacity="0.55"
|
|
134
|
-
/>
|
|
135
|
-
<motion.rect
|
|
136
|
-
{...animatedShape}
|
|
137
|
-
stroke={color}
|
|
138
|
-
strokeWidth="14"
|
|
139
|
-
filter={`url(#${glowFilterId})`}
|
|
140
|
-
opacity="0.7"
|
|
141
|
-
/>
|
|
142
|
-
<motion.rect
|
|
143
|
-
{...animatedShape}
|
|
144
|
-
stroke={color}
|
|
145
|
-
strokeWidth="8"
|
|
146
|
-
filter={`url(#${glowFilterId})`}
|
|
147
|
-
opacity="0.9"
|
|
148
|
-
/>
|
|
149
|
-
<motion.rect
|
|
150
|
-
{...animatedShape}
|
|
151
|
-
stroke={highlightColor}
|
|
152
|
-
strokeWidth="3.5"
|
|
153
|
-
/>
|
|
154
|
-
</svg>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
20
|
const subscribeToNothing = () => () => {}
|
|
159
21
|
const getClientSnapshot = () => true
|
|
160
22
|
const getServerSnapshot = () => false
|
|
@@ -325,7 +187,7 @@ export default function AttachmentDialog({
|
|
|
325
187
|
style={
|
|
326
188
|
{ '--chat-accent': accentColor ?? '#0369a1' } as CSSProperties
|
|
327
189
|
}
|
|
328
|
-
className="text-foreground relative flex max-h-[min(50vh,18rem)] w-[min(19rem,calc(100vw-1.5rem))] flex-col rounded-2xl border
|
|
190
|
+
className="text-foreground border-border/70 relative flex max-h-[min(50vh,18rem)] w-[min(19rem,calc(100vw-1.5rem))] flex-col rounded-2xl border shadow-sm"
|
|
329
191
|
>
|
|
330
192
|
<div className="bg-background text-foreground relative z-10 flex max-h-[min(50vh,18rem)] w-full flex-col overflow-hidden rounded-2xl">
|
|
331
193
|
<div className="border-border/60 flex items-start gap-2.5 border-b px-3 py-3 sm:px-4">
|
|
@@ -396,7 +258,6 @@ export default function AttachmentDialog({
|
|
|
396
258
|
{options.length === 1 ? 'option' : 'options'}
|
|
397
259
|
</div>
|
|
398
260
|
</div>
|
|
399
|
-
<AnimatedAccentBorder color={accentColor ?? '#0369a1'} />
|
|
400
261
|
</motion.div>
|
|
401
262
|
</motion.div>
|
|
402
263
|
) : null}
|
|
@@ -41,7 +41,7 @@ export default function ChatComposer({
|
|
|
41
41
|
maxFileSizeBytes={maxFileSizeBytes}
|
|
42
42
|
showVoice={showVoice}
|
|
43
43
|
placeholder={placeholder}
|
|
44
|
-
|
|
44
|
+
accentColor={accentColor}
|
|
45
45
|
onSubmit={onSubmit}
|
|
46
46
|
onStop={onStop}
|
|
47
47
|
onListeningChange={onListeningChange}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
export { default as AiChatBlock } from './ai-chat-block'
|
|
4
|
-
export
|
|
4
|
+
export { default as ChatMessage } from './chat-message'
|
|
5
|
+
export { default as ChatComposer } from './chat-composer'
|
|
6
|
+
export { default as MessageList } from './message-list'
|
|
7
|
+
export { default as ChatSidebar } from './chat-sidebar'
|
|
8
|
+
export { default as ChatUserAvatar } from './chat-user-avatar'
|
|
9
|
+
export { default as ChatLogo } from './chat-logo'
|
|
10
|
+
export { default as AttachmentDialog, AttachmentPreview } from './attachment'
|
|
5
11
|
export { DEFAULT_ATTACHMENT_OPTIONS } from './default-attachments'
|
|
6
12
|
export type {
|
|
7
13
|
AttachmentOption,
|
|
@@ -14,3 +20,11 @@ export type {
|
|
|
14
20
|
ChatThread,
|
|
15
21
|
ChatTurn,
|
|
16
22
|
} from './types'
|
|
23
|
+
export type { AiChatBlockProps } from './ai-chat-block'
|
|
24
|
+
export { default as AiChatInput } from './ai-chat-input'
|
|
25
|
+
export type {
|
|
26
|
+
AiChatInputAction,
|
|
27
|
+
AiChatInputAttachment,
|
|
28
|
+
AiChatInputGlow,
|
|
29
|
+
AiChatInputProps,
|
|
30
|
+
} from './ai-chat-input'
|