@istmx/ui 0.1.9 → 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/LICENSE +21 -0
- package/README.md +64 -0
- package/bin/istmx.mjs +50 -11
- package/package.json +1 -1
- package/registry/ai-chat-block/ai-chat-block.tsx +460 -0
- package/registry/ai-chat-block/ai-chat-input.tsx +694 -0
- package/registry/ai-chat-block/attachment.tsx +466 -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 +30 -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/bento-grid.tsx +433 -0
- package/registry/scroll-parallax-hero.tsx +565 -0
- package/registry/streaming-text.tsx +278 -0
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
|
@@ -63,12 +63,30 @@ 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
|
|
69
75
|
npx @istmx/ui add pixel-cat
|
|
70
76
|
```
|
|
71
77
|
|
|
78
|
+
Add the streaming AI response text with:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
npx @istmx/ui add streaming-text
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Add the complete AI chat block with:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npx @istmx/ui add ai-chat-block
|
|
88
|
+
```
|
|
89
|
+
|
|
72
90
|
The CLI detects your package manager, copies the editable component to
|
|
73
91
|
`components/ui/animated-text.tsx`, adds the shared `cn` helper at
|
|
74
92
|
`lib/utils.ts` if it is missing, and installs any missing dependencies:
|
|
@@ -81,6 +99,12 @@ Your project should already use React and have Tailwind CSS configured. After
|
|
|
81
99
|
installation, the component is yours to edit; your app does not need to import
|
|
82
100
|
runtime code from `@istmx/ui`.
|
|
83
101
|
|
|
102
|
+
The `ai-chat-block` command is a multi-file install. It creates
|
|
103
|
+
`components/ai-chat-block/`, including the block, input, sidebar, message,
|
|
104
|
+
attachment, streaming, and local utility files. Its helper stays inside that
|
|
105
|
+
folder, and the CLI installs any missing Motion, Tabler Icons, clsx, and
|
|
106
|
+
tailwind-merge dependencies.
|
|
107
|
+
|
|
84
108
|
## Animated Text
|
|
85
109
|
|
|
86
110
|
Import the copied source into your app:
|
|
@@ -171,17 +195,57 @@ Tune `characterStagger`, `lineStagger`, `duration`, `waveDistance`,
|
|
|
171
195
|
shape the reveal. The component keeps words together across natural line wraps
|
|
172
196
|
and provides a single screen-reader text string.
|
|
173
197
|
|
|
198
|
+
## Streaming Text
|
|
199
|
+
|
|
200
|
+
Install the editable source with:
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
npx @istmx/ui add streaming-text
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`StreamingText` reveals a string character by character, like a model still
|
|
207
|
+
writing its answer. Each new character settles in with a soft micro-interaction
|
|
208
|
+
and an optional blinking caret marks the live cursor.
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
import StreamingText from '@/components/ui/streaming-text'
|
|
212
|
+
|
|
213
|
+
export function Answer({ answer }) {
|
|
214
|
+
return (
|
|
215
|
+
<StreamingText
|
|
216
|
+
text={answer}
|
|
217
|
+
speed={42}
|
|
218
|
+
effect="blur"
|
|
219
|
+
cursor
|
|
220
|
+
onComplete={() => console.log('streamed')}
|
|
221
|
+
/>
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Choose how characters enter with `effect`: `blur`, `fade`, `slide`, or a
|
|
227
|
+
springy `wave`. Tune `speed` (characters per second), `startDelay`,
|
|
228
|
+
`glyphDuration`, `blurAmount`, and `slideDistance`. Set `cursorAfterComplete`
|
|
229
|
+
to keep the caret, or `loop` to re-stream with a `loopDelay` pause. The
|
|
230
|
+
component announces the finished message once through a polite live region and
|
|
231
|
+
renders the full string immediately under reduced motion.
|
|
232
|
+
|
|
174
233
|
## CLI options
|
|
175
234
|
|
|
176
235
|
```sh
|
|
177
236
|
npx @istmx/ui add animated-text --no-install
|
|
178
237
|
npx @istmx/ui add animated-text --overwrite
|
|
238
|
+
npx @istmx/ui add button
|
|
179
239
|
npx @istmx/ui add text-reveal
|
|
240
|
+
npx @istmx/ui add streaming-text
|
|
180
241
|
npx @istmx/ui add image-accordion
|
|
181
242
|
npx @istmx/ui add image-trail
|
|
182
243
|
npx @istmx/ui add infinite-image-canvas
|
|
183
244
|
npx @istmx/ui add dock-navigation
|
|
184
245
|
npx @istmx/ui add mobile-menu-dock
|
|
246
|
+
npx @istmx/ui add pixel-cat
|
|
247
|
+
npx @istmx/ui add ai-chat-block
|
|
248
|
+
npx @istmx/ui add scroll-story-cards
|
|
185
249
|
```
|
|
186
250
|
|
|
187
251
|
- `--no-install` copies the source and prints the dependency command instead
|
package/bin/istmx.mjs
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
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.11'
|
|
10
10
|
const COMPONENTS = {
|
|
11
11
|
button: { fileName: 'button.tsx' },
|
|
12
12
|
'animated-text': { fileName: 'animated-text.tsx' },
|
|
13
13
|
'text-reveal': { fileName: 'text-reveal.tsx' },
|
|
14
|
+
'streaming-text': { fileName: 'streaming-text.tsx' },
|
|
14
15
|
'infinite-image-canvas': { fileName: 'infinite-image-canvas.tsx' },
|
|
15
16
|
'image-trail': { fileName: 'image-trail.tsx' },
|
|
16
17
|
'image-accordion': { fileName: 'image-accordion.tsx' },
|
|
@@ -27,6 +28,16 @@ const COMPONENTS = {
|
|
|
27
28
|
dependencies: ['@tabler/icons-react'],
|
|
28
29
|
},
|
|
29
30
|
'pixel-cat': { fileName: 'pixel-cat.tsx' },
|
|
31
|
+
'bento-grid': {
|
|
32
|
+
fileName: 'bento-grid.tsx',
|
|
33
|
+
dependencies: ['@tabler/icons-react'],
|
|
34
|
+
},
|
|
35
|
+
'scroll-parallax-hero': { fileName: 'scroll-parallax-hero.tsx' },
|
|
36
|
+
'ai-chat-block': {
|
|
37
|
+
directory: 'ai-chat-block',
|
|
38
|
+
dependencies: ['@tabler/icons-react'],
|
|
39
|
+
utility: false,
|
|
40
|
+
},
|
|
30
41
|
}
|
|
31
42
|
const DEPENDENCIES = ['motion', 'clsx', 'tailwind-merge']
|
|
32
43
|
const COMMANDS = {
|
|
@@ -159,6 +170,19 @@ async function writeRegistryFile(sourceName, targetPath, overwrite) {
|
|
|
159
170
|
return true
|
|
160
171
|
}
|
|
161
172
|
|
|
173
|
+
async function writeRegistryDirectory(sourceName, targetPath, overwrite) {
|
|
174
|
+
const sourcePath = path.join(REGISTRY_DIRECTORY, sourceName)
|
|
175
|
+
const files = await readdir(sourcePath, { withFileTypes: true })
|
|
176
|
+
for (const entry of files) {
|
|
177
|
+
if (!entry.isFile()) continue
|
|
178
|
+
await writeRegistryFile(
|
|
179
|
+
path.join(sourceName, entry.name),
|
|
180
|
+
path.join(targetPath, entry.name),
|
|
181
|
+
overwrite,
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
162
186
|
function installDependencies(manager, dependencies) {
|
|
163
187
|
if (dependencies.length === 0) {
|
|
164
188
|
printSuccess('Dependencies are already present.')
|
|
@@ -200,16 +224,31 @@ async function addComponent(component, options) {
|
|
|
200
224
|
`${muted('Adding')} ${cyan(component)} ${muted('to your project')}\n`,
|
|
201
225
|
)
|
|
202
226
|
printStep('Writing editable source files')
|
|
203
|
-
const componentPath =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
227
|
+
const componentPath = definition.directory
|
|
228
|
+
? path.join(
|
|
229
|
+
CURRENT_DIRECTORY,
|
|
230
|
+
'components',
|
|
231
|
+
definition.targetDirectory ?? component,
|
|
232
|
+
)
|
|
233
|
+
: path.join(CURRENT_DIRECTORY, 'components', 'ui', definition.fileName)
|
|
209
234
|
const utilityPath = path.join(CURRENT_DIRECTORY, 'lib', 'utils.ts')
|
|
210
235
|
|
|
211
|
-
|
|
212
|
-
|
|
236
|
+
if (definition.utility !== false) {
|
|
237
|
+
await writeRegistryFile('utils.ts', utilityPath, options.overwrite)
|
|
238
|
+
}
|
|
239
|
+
if (definition.directory) {
|
|
240
|
+
await writeRegistryDirectory(
|
|
241
|
+
definition.directory,
|
|
242
|
+
componentPath,
|
|
243
|
+
options.overwrite,
|
|
244
|
+
)
|
|
245
|
+
} else {
|
|
246
|
+
await writeRegistryFile(
|
|
247
|
+
definition.fileName,
|
|
248
|
+
componentPath,
|
|
249
|
+
options.overwrite,
|
|
250
|
+
)
|
|
251
|
+
}
|
|
213
252
|
|
|
214
253
|
if (options.noInstall) {
|
|
215
254
|
const missing = componentDependencies.filter(
|
|
@@ -236,7 +275,7 @@ async function addComponent(component, options) {
|
|
|
236
275
|
|
|
237
276
|
console.log(`\n${green('Done!')} ${component} is ready to edit.`)
|
|
238
277
|
console.log(
|
|
239
|
-
` ${muted('Import from')} ${cyan(`@/components/ui/${component}`)}`,
|
|
278
|
+
` ${muted('Import from')} ${cyan(definition.importPath ?? (definition.directory ? `@/components/${definition.targetDirectory ?? component}` : `@/components/ui/${component}`))}`,
|
|
240
279
|
)
|
|
241
280
|
console.log(
|
|
242
281
|
` ${muted('Dependencies')} ${cyan(componentDependencies.join(', '))}\n`,
|