artifactuse 0.1.25 → 0.1.28
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 +60 -1
- package/dist/core/detector.d.ts +5 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/{index-Bzk5VnG1.js → index-D56xsAnF.js} +1484 -1411
- package/dist/index.js +1 -1
- package/dist/react/ArtifactuseAgentMessage.d.ts +9 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +863 -803
- package/dist/styles/artifactuse.css +1 -0
- package/dist/styles/components/inline-preview.css +69 -0
- package/dist/styles/components/message.css +7 -1
- package/dist/styles/components/panel.css +18 -0
- package/dist/svelte/index.d.ts +6 -6
- package/dist/svelte/index.js +1909 -1868
- package/dist/vue/index.d.ts +4 -4
- package/dist/vue/index.js +1230 -1169
- package/dist/vue2/composables.d.ts +4 -4
- package/dist/vue2/index.js +265 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Artifactuse is a lightweight SDK that transforms AI-generated content into rich,
|
|
|
8
8
|
|
|
9
9
|
- 🎨 **Rich Content Detection** - Automatically detect and render code blocks, images, videos, maps, embeds, and more
|
|
10
10
|
- 📦 **Artifact Cards** - Beautiful inline cards for code artifacts
|
|
11
|
+
- 👁️ **Inline Code Preview** - Truncated syntax-highlighted code previews with click-to-open panel
|
|
11
12
|
- 🖼️ **Media Lightbox** - Click images and PDFs to view fullscreen with zoom and download
|
|
12
13
|
- 🖥️ **Panel Viewer** - Side panel with preview, code view, and split mode
|
|
13
14
|
- 📝 **Interactive Forms** - Inline and panel forms with 17+ field types, auto-collapse after submission
|
|
@@ -421,11 +422,45 @@ Panel artifacts open in a side panel with preview, code view, and editing capabi
|
|
|
421
422
|
- **HTML/React/Vue** - Live preview with code editing
|
|
422
423
|
- **Mermaid** - Diagrams with live preview
|
|
423
424
|
- **SVG** - SVG graphics with live preview and editing
|
|
424
|
-
- **Diff / Patch** - Code diffs with side-by-side or unified view
|
|
425
|
+
- **Diff / Patch** - Code diffs with side-by-side or unified view (`diff`, `patch`, or `smartdiff` for structured JSON diffs)
|
|
425
426
|
- **Canvas / Whiteboard** - Interactive drawing canvas and whiteboard
|
|
426
427
|
- **Video Editor** - Timeline-based video editing interface
|
|
427
428
|
- **Forms (Panel)** - Complex forms with wizard variant, file uploads, or 4+ fields
|
|
428
429
|
|
|
430
|
+
#### Inline Code Preview (Optional)
|
|
431
|
+
|
|
432
|
+
By default, extracted code blocks render as compact artifact cards. With `inlinePreview` enabled, they show a **truncated syntax-highlighted preview** (first N lines) directly in the message. Click the preview to open the full artifact in the panel.
|
|
433
|
+
|
|
434
|
+
- Configurable per language — unlisted languages still render as cards
|
|
435
|
+
- Requires [Prism.js](https://prismjs.com/) for syntax highlighting (see [Syntax Highlighting](#syntax-highlighting))
|
|
436
|
+
- `smartdiff` artifacts use the actual language for full syntax highlighting with deleted/inserted backgrounds
|
|
437
|
+
- Truncated previews show a fade gradient with "View full code (N lines)" label
|
|
438
|
+
|
|
439
|
+
```js
|
|
440
|
+
provideArtifactuse({
|
|
441
|
+
inlinePreview: {
|
|
442
|
+
maxLines: 15,
|
|
443
|
+
languages: ['smartdiff', 'html', 'javascript'],
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
All config options (`inlinePreview`, `inlineCode`, `tabs`, `viewMode`, `inlineCards`) also work as component props for per-message overrides. Precedence: **component prop → global config → default**.
|
|
449
|
+
|
|
450
|
+
#### Inline Code (Optional)
|
|
451
|
+
|
|
452
|
+
Show full syntax-highlighted code directly in the message without extraction or panel:
|
|
453
|
+
|
|
454
|
+
```js
|
|
455
|
+
provideArtifactuse({
|
|
456
|
+
inlineCode: {
|
|
457
|
+
languages: ['css', 'bash', 'sql'], // or true for all
|
|
458
|
+
},
|
|
459
|
+
});
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
When a language matches both `inlineCode` and `inlinePreview`, `inlineCode` takes priority (no extraction).
|
|
463
|
+
|
|
429
464
|
### Inline Artifacts
|
|
430
465
|
|
|
431
466
|
Inline artifacts render directly within the message.
|
|
@@ -592,6 +627,30 @@ provideArtifactuse({
|
|
|
592
627
|
minLength: 50,
|
|
593
628
|
},
|
|
594
629
|
|
|
630
|
+
// Inline preview: show truncated code inline instead of artifact cards (optional)
|
|
631
|
+
// Default: null (disabled — all extracted code shows as cards)
|
|
632
|
+
inlinePreview: {
|
|
633
|
+
maxLines: 15, // max lines before truncation
|
|
634
|
+
languages: ['smartdiff', 'html', 'javascript', 'jsx'], // or true for all extracted languages
|
|
635
|
+
},
|
|
636
|
+
|
|
637
|
+
// Inline code: show full code inline with Prism highlighting, no extraction (optional)
|
|
638
|
+
// Default: null (disabled). Takes priority over inlinePreview when both match.
|
|
639
|
+
inlineCode: {
|
|
640
|
+
languages: ['css', 'bash', 'sql'], // or true for all
|
|
641
|
+
},
|
|
642
|
+
|
|
643
|
+
// Show clickable artifact cards inline (default: true)
|
|
644
|
+
inlineCards: true,
|
|
645
|
+
|
|
646
|
+
// Visible panel tabs for all extracted artifacts (optional)
|
|
647
|
+
// Default: null (all tabs shown). Options: 'preview', 'code', 'split', 'edit'
|
|
648
|
+
tabs: ['preview', 'code'],
|
|
649
|
+
|
|
650
|
+
// Initial panel view mode for all extracted artifacts (optional)
|
|
651
|
+
// Default: null (first available tab). Options: 'preview', 'code', 'split', 'edit'
|
|
652
|
+
viewMode: 'preview',
|
|
653
|
+
|
|
595
654
|
// Code Editor (Optional) — CodeMirror 6 for the edit tab
|
|
596
655
|
// Requires: @codemirror/state, @codemirror/view, @codemirror/commands,
|
|
597
656
|
// @codemirror/language, @codemirror/autocomplete
|
package/dist/core/detector.d.ts
CHANGED
|
@@ -54,6 +54,11 @@ export function decodeJsonFromAttribute(encoded: any): any;
|
|
|
54
54
|
* Extract title from code content
|
|
55
55
|
*/
|
|
56
56
|
export function extractArtifactTitle(code: any, language: any): any;
|
|
57
|
+
/**
|
|
58
|
+
* Compute a simple line-by-line diff for inline preview display
|
|
59
|
+
* Produces +/- prefixed lines that Prism highlights with language-diff
|
|
60
|
+
*/
|
|
61
|
+
export function computeSimpleDiff(oldCode: any, newCode: any): string;
|
|
57
62
|
/**
|
|
58
63
|
* Determine if form should render inline or in panel
|
|
59
64
|
* Parses JSON from code to check complexity
|
package/dist/core/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function createArtifactuse(userConfig?: {}): {
|
|
|
36
36
|
isFullscreen: boolean;
|
|
37
37
|
};
|
|
38
38
|
subscribe: (callback: any) => () => void;
|
|
39
|
-
processMessage: (content: any, messageId: any) => {
|
|
39
|
+
processMessage: (content: any, messageId: any, overrides?: {}) => {
|
|
40
40
|
html: string | Promise<string>;
|
|
41
41
|
artifacts: any[];
|
|
42
42
|
};
|
|
@@ -160,6 +160,7 @@ export namespace DEFAULT_PANELS {
|
|
|
160
160
|
let svg: string;
|
|
161
161
|
let diff: string;
|
|
162
162
|
let patch: string;
|
|
163
|
+
let smartdiff: string;
|
|
163
164
|
let txt: string;
|
|
164
165
|
let javascript: string;
|
|
165
166
|
let js: string;
|