@istmx/ui 0.1.8 → 0.1.10
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 +21 -0
- package/README.md +115 -1
- package/bin/istmx.mjs +53 -12
- package/package.json +2 -2
- package/registry/ai-chat-block/ai-chat-block.tsx +460 -0
- package/registry/ai-chat-block/ai-chat-input.tsx +690 -0
- package/registry/ai-chat-block/attachment.tsx +605 -0
- package/registry/ai-chat-block/chat-code-block.tsx +50 -0
- package/registry/ai-chat-block/chat-composer.tsx +51 -0
- package/registry/ai-chat-block/chat-logo.tsx +18 -0
- package/registry/ai-chat-block/chat-message.tsx +161 -0
- package/registry/ai-chat-block/chat-sidebar.tsx +273 -0
- package/registry/ai-chat-block/chat-user-avatar.tsx +9 -0
- package/registry/ai-chat-block/code-highlighter.tsx +357 -0
- package/registry/ai-chat-block/default-attachments.tsx +42 -0
- package/registry/ai-chat-block/index.ts +16 -0
- package/registry/ai-chat-block/message-content.tsx +287 -0
- package/registry/ai-chat-block/message-list.tsx +93 -0
- package/registry/ai-chat-block/send-button.tsx +102 -0
- package/registry/ai-chat-block/types.ts +71 -0
- package/registry/ai-chat-block/utils.ts +6 -0
- package/registry/ai-chat-block/voice-button.tsx +66 -0
- package/registry/ai-chat-input/ai-chat-input.tsx +690 -0
- package/registry/ai-chat-input/attachment.tsx +605 -0
- package/registry/ai-chat-input/send-button.tsx +102 -0
- package/registry/ai-chat-input/types.ts +71 -0
- package/registry/ai-chat-input/utils.ts +6 -0
- package/registry/ai-chat-input/voice-button.tsx +66 -0
- package/registry/button.tsx +4 -7
- package/registry/streaming-text.tsx +278 -0
- package/registry/text-reveal.tsx +307 -0
- package/registry/image-effects-card.tsx +0 -197
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aryan
|
|
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
CHANGED
|
@@ -17,7 +17,6 @@ Add the practical controls:
|
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
npx @istmx/ui add button
|
|
20
|
-
npx @istmx/ui add image-effects-card
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
Or use your preferred package manager:
|
|
@@ -70,6 +69,33 @@ Add the interactive pixel cat with:
|
|
|
70
69
|
npx @istmx/ui add pixel-cat
|
|
71
70
|
```
|
|
72
71
|
|
|
72
|
+
Add the streaming AI response text with:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npx @istmx/ui add streaming-text
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Add the complete AI chat block with:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
npx @istmx/ui add ai-chat-block
|
|
82
|
+
```
|
|
83
|
+
|
|
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
|
+
|
|
73
99
|
The CLI detects your package manager, copies the editable component to
|
|
74
100
|
`components/ui/animated-text.tsx`, adds the shared `cn` helper at
|
|
75
101
|
`lib/utils.ts` if it is missing, and installs any missing dependencies:
|
|
@@ -82,6 +108,12 @@ Your project should already use React and have Tailwind CSS configured. After
|
|
|
82
108
|
installation, the component is yours to edit; your app does not need to import
|
|
83
109
|
runtime code from `@istmx/ui`.
|
|
84
110
|
|
|
111
|
+
The `ai-chat-block` command is a multi-file install. It creates
|
|
112
|
+
`components/ai-chat-block/`, including the block, input, sidebar, message,
|
|
113
|
+
attachment, streaming, and local utility files. Its helper stays inside that
|
|
114
|
+
folder, and the CLI installs any missing Motion, Tabler Icons, clsx, and
|
|
115
|
+
tailwind-merge dependencies.
|
|
116
|
+
|
|
85
117
|
## Animated Text
|
|
86
118
|
|
|
87
119
|
Import the copied source into your app:
|
|
@@ -132,16 +164,98 @@ Other options include `direction`, `interval`, `speed`, `scale`, and effect
|
|
|
132
164
|
settings for blur, fade, slide, and wave. The full component implementation is
|
|
133
165
|
in your `components/ui/animated-text.tsx` file.
|
|
134
166
|
|
|
167
|
+
## Text Reveal
|
|
168
|
+
|
|
169
|
+
Install the editable source with:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
npx @istmx/ui add text-reveal
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`TextReveal` reveals plain text line by line and character by character. It
|
|
176
|
+
supports a viewport-triggered entrance by default, or reversible scroll-linked
|
|
177
|
+
animation by passing a Motion value from `useScroll`.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import TextReveal from '@/components/ui/text-reveal'
|
|
181
|
+
|
|
182
|
+
export function Quote() {
|
|
183
|
+
return (
|
|
184
|
+
<TextReveal
|
|
185
|
+
text={'Every word arrives softly,\none character at a time.'}
|
|
186
|
+
characterStagger={0.028}
|
|
187
|
+
lineStagger={0.2}
|
|
188
|
+
duration={0.65}
|
|
189
|
+
waveDistance={8}
|
|
190
|
+
waveOvershoot={6}
|
|
191
|
+
sidewaysDistance={1.5}
|
|
192
|
+
blurAmount={6}
|
|
193
|
+
opacityFrom={0.08}
|
|
194
|
+
opacityPeak={0.72}
|
|
195
|
+
scaleFrom={0.96}
|
|
196
|
+
scalePeak={1.025}
|
|
197
|
+
/>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Tune `characterStagger`, `lineStagger`, `duration`, `waveDistance`,
|
|
203
|
+
`waveOvershoot`, `sidewaysDistance`, `blurAmount`, opacity, and scale props to
|
|
204
|
+
shape the reveal. The component keeps words together across natural line wraps
|
|
205
|
+
and provides a single screen-reader text string.
|
|
206
|
+
|
|
207
|
+
## Streaming Text
|
|
208
|
+
|
|
209
|
+
Install the editable source with:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npx @istmx/ui add streaming-text
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`StreamingText` reveals a string character by character, like a model still
|
|
216
|
+
writing its answer. Each new character settles in with a soft micro-interaction
|
|
217
|
+
and an optional blinking caret marks the live cursor.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import StreamingText from '@/components/ui/streaming-text'
|
|
221
|
+
|
|
222
|
+
export function Answer({ answer }) {
|
|
223
|
+
return (
|
|
224
|
+
<StreamingText
|
|
225
|
+
text={answer}
|
|
226
|
+
speed={42}
|
|
227
|
+
effect="blur"
|
|
228
|
+
cursor
|
|
229
|
+
onComplete={() => console.log('streamed')}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Choose how characters enter with `effect`: `blur`, `fade`, `slide`, or a
|
|
236
|
+
springy `wave`. Tune `speed` (characters per second), `startDelay`,
|
|
237
|
+
`glyphDuration`, `blurAmount`, and `slideDistance`. Set `cursorAfterComplete`
|
|
238
|
+
to keep the caret, or `loop` to re-stream with a `loopDelay` pause. The
|
|
239
|
+
component announces the finished message once through a polite live region and
|
|
240
|
+
renders the full string immediately under reduced motion.
|
|
241
|
+
|
|
135
242
|
## CLI options
|
|
136
243
|
|
|
137
244
|
```sh
|
|
138
245
|
npx @istmx/ui add animated-text --no-install
|
|
139
246
|
npx @istmx/ui add animated-text --overwrite
|
|
247
|
+
npx @istmx/ui add button
|
|
248
|
+
npx @istmx/ui add text-reveal
|
|
249
|
+
npx @istmx/ui add streaming-text
|
|
140
250
|
npx @istmx/ui add image-accordion
|
|
141
251
|
npx @istmx/ui add image-trail
|
|
142
252
|
npx @istmx/ui add infinite-image-canvas
|
|
143
253
|
npx @istmx/ui add dock-navigation
|
|
144
254
|
npx @istmx/ui add mobile-menu-dock
|
|
255
|
+
npx @istmx/ui add pixel-cat
|
|
256
|
+
npx @istmx/ui add ai-chat-input
|
|
257
|
+
npx @istmx/ui add ai-chat-block
|
|
258
|
+
npx @istmx/ui add scroll-story-cards
|
|
145
259
|
```
|
|
146
260
|
|
|
147
261
|
- `--no-install` copies the source and prints the dependency command instead
|
package/bin/istmx.mjs
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
import { constants, existsSync } from 'node:fs'
|
|
5
|
-
import { access, mkdir, readFile, writeFile } from 'node:fs/promises'
|
|
5
|
+
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.10'
|
|
10
10
|
const COMPONENTS = {
|
|
11
11
|
button: { fileName: 'button.tsx' },
|
|
12
12
|
'animated-text': { fileName: 'animated-text.tsx' },
|
|
13
|
+
'text-reveal': { fileName: 'text-reveal.tsx' },
|
|
14
|
+
'streaming-text': { fileName: 'streaming-text.tsx' },
|
|
13
15
|
'infinite-image-canvas': { fileName: 'infinite-image-canvas.tsx' },
|
|
14
16
|
'image-trail': { fileName: 'image-trail.tsx' },
|
|
15
|
-
'image-effects-card': { fileName: 'image-effects-card.tsx' },
|
|
16
17
|
'image-accordion': { fileName: 'image-accordion.tsx' },
|
|
17
18
|
'dock-navigation': {
|
|
18
19
|
fileName: 'dock-navigation.tsx',
|
|
@@ -27,6 +28,18 @@ const COMPONENTS = {
|
|
|
27
28
|
dependencies: ['@tabler/icons-react'],
|
|
28
29
|
},
|
|
29
30
|
'pixel-cat': { fileName: 'pixel-cat.tsx' },
|
|
31
|
+
'ai-chat-block': {
|
|
32
|
+
directory: 'ai-chat-block',
|
|
33
|
+
dependencies: ['@tabler/icons-react'],
|
|
34
|
+
utility: false,
|
|
35
|
+
},
|
|
36
|
+
'ai-chat-input': {
|
|
37
|
+
directory: 'ai-chat-input',
|
|
38
|
+
targetDirectory: 'ai-chat',
|
|
39
|
+
importPath: '@/components/ai-chat/ai-chat-input',
|
|
40
|
+
dependencies: ['@tabler/icons-react'],
|
|
41
|
+
utility: false,
|
|
42
|
+
},
|
|
30
43
|
}
|
|
31
44
|
const DEPENDENCIES = ['motion', 'clsx', 'tailwind-merge']
|
|
32
45
|
const COMMANDS = {
|
|
@@ -159,6 +172,19 @@ async function writeRegistryFile(sourceName, targetPath, overwrite) {
|
|
|
159
172
|
return true
|
|
160
173
|
}
|
|
161
174
|
|
|
175
|
+
async function writeRegistryDirectory(sourceName, targetPath, overwrite) {
|
|
176
|
+
const sourcePath = path.join(REGISTRY_DIRECTORY, sourceName)
|
|
177
|
+
const files = await readdir(sourcePath, { withFileTypes: true })
|
|
178
|
+
for (const entry of files) {
|
|
179
|
+
if (!entry.isFile()) continue
|
|
180
|
+
await writeRegistryFile(
|
|
181
|
+
path.join(sourceName, entry.name),
|
|
182
|
+
path.join(targetPath, entry.name),
|
|
183
|
+
overwrite,
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
162
188
|
function installDependencies(manager, dependencies) {
|
|
163
189
|
if (dependencies.length === 0) {
|
|
164
190
|
printSuccess('Dependencies are already present.')
|
|
@@ -200,16 +226,31 @@ async function addComponent(component, options) {
|
|
|
200
226
|
`${muted('Adding')} ${cyan(component)} ${muted('to your project')}\n`,
|
|
201
227
|
)
|
|
202
228
|
printStep('Writing editable source files')
|
|
203
|
-
const componentPath =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
229
|
+
const componentPath = definition.directory
|
|
230
|
+
? path.join(
|
|
231
|
+
CURRENT_DIRECTORY,
|
|
232
|
+
'components',
|
|
233
|
+
definition.targetDirectory ?? component,
|
|
234
|
+
)
|
|
235
|
+
: path.join(CURRENT_DIRECTORY, 'components', 'ui', definition.fileName)
|
|
209
236
|
const utilityPath = path.join(CURRENT_DIRECTORY, 'lib', 'utils.ts')
|
|
210
237
|
|
|
211
|
-
|
|
212
|
-
|
|
238
|
+
if (definition.utility !== false) {
|
|
239
|
+
await writeRegistryFile('utils.ts', utilityPath, options.overwrite)
|
|
240
|
+
}
|
|
241
|
+
if (definition.directory) {
|
|
242
|
+
await writeRegistryDirectory(
|
|
243
|
+
definition.directory,
|
|
244
|
+
componentPath,
|
|
245
|
+
options.overwrite,
|
|
246
|
+
)
|
|
247
|
+
} else {
|
|
248
|
+
await writeRegistryFile(
|
|
249
|
+
definition.fileName,
|
|
250
|
+
componentPath,
|
|
251
|
+
options.overwrite,
|
|
252
|
+
)
|
|
253
|
+
}
|
|
213
254
|
|
|
214
255
|
if (options.noInstall) {
|
|
215
256
|
const missing = componentDependencies.filter(
|
|
@@ -236,7 +277,7 @@ async function addComponent(component, options) {
|
|
|
236
277
|
|
|
237
278
|
console.log(`\n${green('Done!')} ${component} is ready to edit.`)
|
|
238
279
|
console.log(
|
|
239
|
-
` ${muted('Import from')} ${cyan(`@/components/ui/${component}`)}`,
|
|
280
|
+
` ${muted('Import from')} ${cyan(definition.importPath ?? (definition.directory ? `@/components/${definition.targetDirectory ?? component}` : `@/components/ui/${component}`))}`,
|
|
240
281
|
)
|
|
241
282
|
console.log(
|
|
242
283
|
` ${muted('Dependencies')} ${cyan(componentDependencies.join(', '))}\n`,
|
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 to your project.",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "Add editable ISTMX UI components and ui blocks to your project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"istmx": "bin/istmx.mjs"
|