artifactuse 0.2.2 → 0.2.4
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 +1 -0
- package/dist/core/index.d.ts +5 -14
- package/dist/core/state.d.ts +2 -0
- package/dist/{index-INYOxlcg.js → index-C_15PkcN.js} +1215 -1202
- package/dist/index.js +1 -1
- package/dist/react/index.js +392 -389
- package/dist/svelte/index.d.ts +21 -84
- package/dist/svelte/index.js +1436 -1415
- package/dist/vue/index.d.ts +16 -56
- package/dist/vue/index.js +1143 -1129
- package/dist/vue2/composables.d.ts +16 -56
- package/dist/vue2/index.js +289 -166
- package/package.json +1 -1
package/dist/vue2/index.js
CHANGED
|
@@ -6,9 +6,160 @@ import require$$2 from 'events';
|
|
|
6
6
|
import require$$0$1 from 'buffer';
|
|
7
7
|
import require$$1 from 'util';
|
|
8
8
|
|
|
9
|
+
// artifactuse/core/highlight.js
|
|
10
|
+
// Optional Prism.js integration for syntax highlighting
|
|
11
|
+
// Users must provide Prism.js themselves
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Check if Prism is available
|
|
15
|
+
*/
|
|
16
|
+
function isPrismAvailable() {
|
|
17
|
+
return typeof window !== 'undefined' && window.Prism;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Highlight all code blocks in a container
|
|
22
|
+
* @param {HTMLElement|string} container - Container element or selector
|
|
23
|
+
*/
|
|
24
|
+
function highlightAll(container) {
|
|
25
|
+
if (!isPrismAvailable()) {
|
|
26
|
+
console.warn('Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const element = typeof container === 'string'
|
|
31
|
+
? document.querySelector(container)
|
|
32
|
+
: container;
|
|
33
|
+
|
|
34
|
+
if (!element) return;
|
|
35
|
+
|
|
36
|
+
// Find all code blocks
|
|
37
|
+
const codeBlocks = element.querySelectorAll('pre code');
|
|
38
|
+
|
|
39
|
+
codeBlocks.forEach(block => {
|
|
40
|
+
// Skip if already highlighted
|
|
41
|
+
if (block.classList.contains('prism-highlighted')) return;
|
|
42
|
+
|
|
43
|
+
// Detect language from class
|
|
44
|
+
const language = detectLanguage(block);
|
|
45
|
+
|
|
46
|
+
if (language) {
|
|
47
|
+
// Add language class if not present
|
|
48
|
+
if (!block.className.includes(`language-${language}`)) {
|
|
49
|
+
block.classList.add(`language-${language}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Highlight
|
|
53
|
+
window.Prism.highlightElement(block);
|
|
54
|
+
block.classList.add('prism-highlighted');
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Highlight code string and return HTML
|
|
61
|
+
* @param {string} code - Code to highlight
|
|
62
|
+
* @param {string} language - Language identifier
|
|
63
|
+
* @returns {string} - Highlighted HTML
|
|
64
|
+
*/
|
|
65
|
+
function highlightCode(code, language) {
|
|
66
|
+
if (!isPrismAvailable()) return escapeHtml$4(code);
|
|
67
|
+
|
|
68
|
+
const grammar = window.Prism.languages[language];
|
|
69
|
+
|
|
70
|
+
if (!grammar) {
|
|
71
|
+
return escapeHtml$4(code);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return window.Prism.highlight(code, grammar, language);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Detect language from element classes
|
|
79
|
+
* @param {HTMLElement} element - Code element
|
|
80
|
+
* @returns {string|null} - Detected language or null
|
|
81
|
+
*/
|
|
82
|
+
function detectLanguage(element) {
|
|
83
|
+
// Check element classes
|
|
84
|
+
const classes = element.className.split(/\s+/);
|
|
85
|
+
|
|
86
|
+
for (const cls of classes) {
|
|
87
|
+
// Match language-xxx or lang-xxx
|
|
88
|
+
const match = cls.match(/^(?:language-|lang-)(.+)$/);
|
|
89
|
+
if (match) {
|
|
90
|
+
return normalizeLanguage(match[1]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Check parent <pre> classes
|
|
95
|
+
const pre = element.closest('pre');
|
|
96
|
+
if (pre) {
|
|
97
|
+
const preClasses = pre.className.split(/\s+/);
|
|
98
|
+
for (const cls of preClasses) {
|
|
99
|
+
const match = cls.match(/^(?:language-|lang-)(.+)$/);
|
|
100
|
+
if (match) {
|
|
101
|
+
return normalizeLanguage(match[1]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Check data-language attribute
|
|
107
|
+
const dataLang = element.dataset.language || pre?.dataset.language;
|
|
108
|
+
if (dataLang) {
|
|
109
|
+
return normalizeLanguage(dataLang);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Normalize language identifier to Prism-compatible name
|
|
117
|
+
*/
|
|
118
|
+
function normalizeLanguage(lang) {
|
|
119
|
+
const aliases = {
|
|
120
|
+
'js': 'javascript',
|
|
121
|
+
'ts': 'typescript',
|
|
122
|
+
'py': 'python',
|
|
123
|
+
'rb': 'ruby',
|
|
124
|
+
'sh': 'bash',
|
|
125
|
+
'shell': 'bash',
|
|
126
|
+
'zsh': 'bash',
|
|
127
|
+
'yml': 'yaml',
|
|
128
|
+
'md': 'markdown',
|
|
129
|
+
'html': 'markup',
|
|
130
|
+
'xml': 'markup',
|
|
131
|
+
'svg': 'markup',
|
|
132
|
+
'vue': 'markup',
|
|
133
|
+
'jsx': 'jsx',
|
|
134
|
+
'tsx': 'tsx',
|
|
135
|
+
'c++': 'cpp',
|
|
136
|
+
'c#': 'csharp',
|
|
137
|
+
'cs': 'csharp',
|
|
138
|
+
'f#': 'fsharp',
|
|
139
|
+
'objective-c': 'objectivec',
|
|
140
|
+
'objc': 'objectivec',
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const normalized = lang.toLowerCase();
|
|
144
|
+
return aliases[normalized] || normalized;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Escape HTML special characters
|
|
149
|
+
*/
|
|
150
|
+
function escapeHtml$4(str) {
|
|
151
|
+
return str
|
|
152
|
+
.replace(/&/g, '&')
|
|
153
|
+
.replace(/</g, '<')
|
|
154
|
+
.replace(/>/g, '>')
|
|
155
|
+
.replace(/"/g, '"')
|
|
156
|
+
.replace(/'/g, ''');
|
|
157
|
+
}
|
|
158
|
+
|
|
9
159
|
// artifactuse/core/detector.js
|
|
10
160
|
// Artifact detection and extraction from AI responses
|
|
11
161
|
|
|
162
|
+
|
|
12
163
|
/**
|
|
13
164
|
* Artifact type definitions
|
|
14
165
|
*/
|
|
@@ -447,18 +598,6 @@ function decodeHtml(encoded) {
|
|
|
447
598
|
.replace(/ /g, ' ');
|
|
448
599
|
}
|
|
449
600
|
|
|
450
|
-
/**
|
|
451
|
-
* Encode HTML for safe embedding
|
|
452
|
-
*/
|
|
453
|
-
function encodeHtml(code) {
|
|
454
|
-
return code
|
|
455
|
-
.replace(/&/g, '&')
|
|
456
|
-
.replace(/"/g, '"')
|
|
457
|
-
.replace(/'/g, ''')
|
|
458
|
-
.replace(/</g, '<')
|
|
459
|
-
.replace(/>/g, '>');
|
|
460
|
-
}
|
|
461
|
-
|
|
462
601
|
/**
|
|
463
602
|
* Encode JSON for safe embedding in HTML attributes using Base64
|
|
464
603
|
*/
|
|
@@ -624,16 +763,18 @@ function createInlinePreview(artifact, code, langLower, inlinePreview) {
|
|
|
624
763
|
// Separate markers (+/-/space) from code content
|
|
625
764
|
const markers = truncDiffLines.map(l => l[0] || ' ');
|
|
626
765
|
const codeLines = truncDiffLines.map(l => l.slice(1));
|
|
627
|
-
const encoded = encodeHtml(codeLines.join('\n'));
|
|
628
|
-
const isTruncated = allDiffLines.length > maxLines;
|
|
629
766
|
const actualLang = diffData.language || 'plaintext';
|
|
767
|
+
const normalizedActualLang = normalizeLanguage(actualLang);
|
|
768
|
+
const encoded = highlightCode(codeLines.join('\n'), normalizedActualLang);
|
|
769
|
+
const isPreHighlighted = isPrismAvailable() && window.Prism.languages[normalizedActualLang];
|
|
770
|
+
const isTruncated = allDiffLines.length > maxLines;
|
|
630
771
|
const nonClickable = isNonClickable(allDiffLines.length, isTruncated);
|
|
631
772
|
const staticClass = nonClickable ? ' artifactuse-inline-preview--static' : '';
|
|
632
773
|
const staticAttr = nonClickable ? ' data-non-clickable="true"' : '';
|
|
633
774
|
const actionText = getActionLabel('smartdiff', allDiffLines.length);
|
|
634
775
|
|
|
635
776
|
return `<div class="artifactuse-inline-preview${isTruncated ? ' artifactuse-inline-preview--truncated' : ''}${staticClass}" data-artifact-id="${artifact.id}" data-smartdiff="true" data-smartdiff-markers="${markers.join(',')}"${staticAttr}>`
|
|
636
|
-
+ `<pre class="artifactuse-inline-preview__pre"><code class="language-${actualLang}">${encoded}</code></pre>`
|
|
777
|
+
+ `<pre class="artifactuse-inline-preview__pre${isPreHighlighted ? ' language-' + actualLang : ''}"><code class="language-${actualLang}${isPreHighlighted ? ' prism-highlighted' : ''}">${encoded}</code></pre>`
|
|
637
778
|
+ (isTruncated ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${actionText}</span></div>` : '')
|
|
638
779
|
+ `</div>`;
|
|
639
780
|
} catch {
|
|
@@ -647,7 +788,9 @@ function createInlinePreview(artifact, code, langLower, inlinePreview) {
|
|
|
647
788
|
|
|
648
789
|
const lines = previewCode.split('\n');
|
|
649
790
|
const truncated = lines.slice(0, maxLines).join('\n');
|
|
650
|
-
const
|
|
791
|
+
const normalizedLang = normalizeLanguage(previewLang);
|
|
792
|
+
const encoded = highlightCode(truncated, normalizedLang);
|
|
793
|
+
const isPreHighlighted = isPrismAvailable() && window.Prism.languages[normalizedLang];
|
|
651
794
|
const isTruncated = lines.length > maxLines;
|
|
652
795
|
const nonClickable = isNonClickable(lines.length, isTruncated);
|
|
653
796
|
const staticClass = nonClickable ? ' artifactuse-inline-preview--static' : '';
|
|
@@ -655,7 +798,7 @@ function createInlinePreview(artifact, code, langLower, inlinePreview) {
|
|
|
655
798
|
const actionText = getActionLabel(langLower, lines.length);
|
|
656
799
|
|
|
657
800
|
return `<div class="artifactuse-inline-preview${isTruncated ? ' artifactuse-inline-preview--truncated' : ''}${staticClass}" data-artifact-id="${artifact.id}"${staticAttr}>`
|
|
658
|
-
+ `<pre class="artifactuse-inline-preview__pre"><code class="language-${previewLang}">${encoded}</code></pre>`
|
|
801
|
+
+ `<pre class="artifactuse-inline-preview__pre${isPreHighlighted ? ' language-' + previewLang : ''}"><code class="language-${previewLang}${isPreHighlighted ? ' prism-highlighted' : ''}">${encoded}</code></pre>`
|
|
659
802
|
+ (isTruncated ? `<div class="artifactuse-inline-preview__fade"><span class="artifactuse-inline-preview__action">${actionText}</span></div>` : '')
|
|
660
803
|
+ `</div>`;
|
|
661
804
|
}
|
|
@@ -897,6 +1040,8 @@ function createState() {
|
|
|
897
1040
|
// Multi-tab support
|
|
898
1041
|
openTabs: [], // Array of artifact IDs open as tabs (ordered)
|
|
899
1042
|
tabViewModes: {}, // { [artifactId]: 'preview' | 'code' | 'split' | 'edit' }
|
|
1043
|
+
// Panel empty view
|
|
1044
|
+
forceEmptyView: false, // When true, panel shows empty state regardless of artifacts
|
|
900
1045
|
};
|
|
901
1046
|
|
|
902
1047
|
// Subscribers
|
|
@@ -1021,6 +1166,7 @@ function createState() {
|
|
|
1021
1166
|
...state,
|
|
1022
1167
|
activeArtifactId: artifactId,
|
|
1023
1168
|
viewMode,
|
|
1169
|
+
forceEmptyView: false,
|
|
1024
1170
|
};
|
|
1025
1171
|
|
|
1026
1172
|
notify();
|
|
@@ -1086,6 +1232,17 @@ function createState() {
|
|
|
1086
1232
|
notify();
|
|
1087
1233
|
}
|
|
1088
1234
|
|
|
1235
|
+
/**
|
|
1236
|
+
* Set force empty view state
|
|
1237
|
+
*/
|
|
1238
|
+
function setForceEmptyView(value) {
|
|
1239
|
+
state = {
|
|
1240
|
+
...state,
|
|
1241
|
+
forceEmptyView: !!value,
|
|
1242
|
+
};
|
|
1243
|
+
notify();
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1089
1246
|
/**
|
|
1090
1247
|
* Get artifacts by message ID
|
|
1091
1248
|
*/
|
|
@@ -1218,6 +1375,7 @@ function createState() {
|
|
|
1218
1375
|
isFullscreen: false,
|
|
1219
1376
|
openTabs: [],
|
|
1220
1377
|
tabViewModes: {},
|
|
1378
|
+
forceEmptyView: false,
|
|
1221
1379
|
};
|
|
1222
1380
|
|
|
1223
1381
|
notify();
|
|
@@ -1275,6 +1433,7 @@ function createState() {
|
|
|
1275
1433
|
setPanelOpen,
|
|
1276
1434
|
setViewMode,
|
|
1277
1435
|
setFullscreen,
|
|
1436
|
+
setForceEmptyView,
|
|
1278
1437
|
|
|
1279
1438
|
// Multi-tab
|
|
1280
1439
|
openTab,
|
|
@@ -6541,126 +6700,6 @@ function loadKaTeX() {
|
|
|
6541
6700
|
return katexLoadingPromise;
|
|
6542
6701
|
}
|
|
6543
6702
|
|
|
6544
|
-
// artifactuse/core/highlight.js
|
|
6545
|
-
// Optional Prism.js integration for syntax highlighting
|
|
6546
|
-
// Users must provide Prism.js themselves
|
|
6547
|
-
|
|
6548
|
-
/**
|
|
6549
|
-
* Check if Prism is available
|
|
6550
|
-
*/
|
|
6551
|
-
function isPrismAvailable() {
|
|
6552
|
-
return typeof window !== 'undefined' && window.Prism;
|
|
6553
|
-
}
|
|
6554
|
-
|
|
6555
|
-
/**
|
|
6556
|
-
* Highlight all code blocks in a container
|
|
6557
|
-
* @param {HTMLElement|string} container - Container element or selector
|
|
6558
|
-
*/
|
|
6559
|
-
function highlightAll(container) {
|
|
6560
|
-
if (!isPrismAvailable()) {
|
|
6561
|
-
console.warn('Artifactuse: Prism.js not found. Install and include Prism.js for syntax highlighting.');
|
|
6562
|
-
return;
|
|
6563
|
-
}
|
|
6564
|
-
|
|
6565
|
-
const element = typeof container === 'string'
|
|
6566
|
-
? document.querySelector(container)
|
|
6567
|
-
: container;
|
|
6568
|
-
|
|
6569
|
-
if (!element) return;
|
|
6570
|
-
|
|
6571
|
-
// Find all code blocks
|
|
6572
|
-
const codeBlocks = element.querySelectorAll('pre code');
|
|
6573
|
-
|
|
6574
|
-
codeBlocks.forEach(block => {
|
|
6575
|
-
// Skip if already highlighted
|
|
6576
|
-
if (block.classList.contains('prism-highlighted')) return;
|
|
6577
|
-
|
|
6578
|
-
// Detect language from class
|
|
6579
|
-
const language = detectLanguage(block);
|
|
6580
|
-
|
|
6581
|
-
if (language) {
|
|
6582
|
-
// Add language class if not present
|
|
6583
|
-
if (!block.className.includes(`language-${language}`)) {
|
|
6584
|
-
block.classList.add(`language-${language}`);
|
|
6585
|
-
}
|
|
6586
|
-
|
|
6587
|
-
// Highlight
|
|
6588
|
-
window.Prism.highlightElement(block);
|
|
6589
|
-
block.classList.add('prism-highlighted');
|
|
6590
|
-
}
|
|
6591
|
-
});
|
|
6592
|
-
}
|
|
6593
|
-
|
|
6594
|
-
/**
|
|
6595
|
-
* Detect language from element classes
|
|
6596
|
-
* @param {HTMLElement} element - Code element
|
|
6597
|
-
* @returns {string|null} - Detected language or null
|
|
6598
|
-
*/
|
|
6599
|
-
function detectLanguage(element) {
|
|
6600
|
-
// Check element classes
|
|
6601
|
-
const classes = element.className.split(/\s+/);
|
|
6602
|
-
|
|
6603
|
-
for (const cls of classes) {
|
|
6604
|
-
// Match language-xxx or lang-xxx
|
|
6605
|
-
const match = cls.match(/^(?:language-|lang-)(.+)$/);
|
|
6606
|
-
if (match) {
|
|
6607
|
-
return normalizeLanguage(match[1]);
|
|
6608
|
-
}
|
|
6609
|
-
}
|
|
6610
|
-
|
|
6611
|
-
// Check parent <pre> classes
|
|
6612
|
-
const pre = element.closest('pre');
|
|
6613
|
-
if (pre) {
|
|
6614
|
-
const preClasses = pre.className.split(/\s+/);
|
|
6615
|
-
for (const cls of preClasses) {
|
|
6616
|
-
const match = cls.match(/^(?:language-|lang-)(.+)$/);
|
|
6617
|
-
if (match) {
|
|
6618
|
-
return normalizeLanguage(match[1]);
|
|
6619
|
-
}
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
|
|
6623
|
-
// Check data-language attribute
|
|
6624
|
-
const dataLang = element.dataset.language || pre?.dataset.language;
|
|
6625
|
-
if (dataLang) {
|
|
6626
|
-
return normalizeLanguage(dataLang);
|
|
6627
|
-
}
|
|
6628
|
-
|
|
6629
|
-
return null;
|
|
6630
|
-
}
|
|
6631
|
-
|
|
6632
|
-
/**
|
|
6633
|
-
* Normalize language identifier to Prism-compatible name
|
|
6634
|
-
*/
|
|
6635
|
-
function normalizeLanguage(lang) {
|
|
6636
|
-
const aliases = {
|
|
6637
|
-
'js': 'javascript',
|
|
6638
|
-
'ts': 'typescript',
|
|
6639
|
-
'py': 'python',
|
|
6640
|
-
'rb': 'ruby',
|
|
6641
|
-
'sh': 'bash',
|
|
6642
|
-
'shell': 'bash',
|
|
6643
|
-
'zsh': 'bash',
|
|
6644
|
-
'yml': 'yaml',
|
|
6645
|
-
'md': 'markdown',
|
|
6646
|
-
'html': 'markup',
|
|
6647
|
-
'xml': 'markup',
|
|
6648
|
-
'svg': 'markup',
|
|
6649
|
-
'vue': 'markup',
|
|
6650
|
-
'jsx': 'jsx',
|
|
6651
|
-
'tsx': 'tsx',
|
|
6652
|
-
'c++': 'cpp',
|
|
6653
|
-
'c#': 'csharp',
|
|
6654
|
-
'cs': 'csharp',
|
|
6655
|
-
'f#': 'fsharp',
|
|
6656
|
-
'objective-c': 'objectivec',
|
|
6657
|
-
'objc': 'objectivec',
|
|
6658
|
-
};
|
|
6659
|
-
|
|
6660
|
-
const normalized = lang.toLowerCase();
|
|
6661
|
-
return aliases[normalized] || normalized;
|
|
6662
|
-
}
|
|
6663
|
-
|
|
6664
6703
|
// artifactuse/core/index.js
|
|
6665
6704
|
// Main entry point for Artifactuse SDK
|
|
6666
6705
|
|
|
@@ -7337,6 +7376,7 @@ function createArtifactuse(userConfig = {}) {
|
|
|
7337
7376
|
state.setActiveArtifact(artifact.id);
|
|
7338
7377
|
}
|
|
7339
7378
|
|
|
7379
|
+
state.setForceEmptyView(false);
|
|
7340
7380
|
state.setPanelOpen(true);
|
|
7341
7381
|
if (artifact.viewMode) {
|
|
7342
7382
|
state.setViewMode(artifact.viewMode);
|
|
@@ -7352,6 +7392,17 @@ function createArtifactuse(userConfig = {}) {
|
|
|
7352
7392
|
const ext = filename.split('.').pop();
|
|
7353
7393
|
const language = options.language || getLanguageFromExtension(ext) || ext;
|
|
7354
7394
|
const title = options.title || filename;
|
|
7395
|
+
|
|
7396
|
+
// Deduplicate: if an artifact with the same title already exists, update + focus it
|
|
7397
|
+
const existing = state.getState().artifacts.find(a => a.title === title && !a.isInline);
|
|
7398
|
+
if (existing) {
|
|
7399
|
+
updateFile(existing.id, code, { ...options, title });
|
|
7400
|
+
openArtifact(existing);
|
|
7401
|
+
if (options.viewMode) state.setViewMode(options.viewMode);
|
|
7402
|
+
else if (options.tabs) state.setViewMode(options.tabs[0]);
|
|
7403
|
+
return state.getArtifact(existing.id);
|
|
7404
|
+
}
|
|
7405
|
+
|
|
7355
7406
|
return openCode(code, language, { ...options, title });
|
|
7356
7407
|
}
|
|
7357
7408
|
|
|
@@ -7392,6 +7443,17 @@ function createArtifactuse(userConfig = {}) {
|
|
|
7392
7443
|
return state.getArtifact(id);
|
|
7393
7444
|
}
|
|
7394
7445
|
|
|
7446
|
+
/**
|
|
7447
|
+
* Open panel in empty state
|
|
7448
|
+
*/
|
|
7449
|
+
function openPanel() {
|
|
7450
|
+
state.clearActiveArtifact();
|
|
7451
|
+
state.setForceEmptyView(true);
|
|
7452
|
+
state.setPanelOpen(true);
|
|
7453
|
+
|
|
7454
|
+
emit('panel:opened');
|
|
7455
|
+
}
|
|
7456
|
+
|
|
7395
7457
|
/**
|
|
7396
7458
|
* Close panel
|
|
7397
7459
|
*/
|
|
@@ -7629,6 +7691,7 @@ function createArtifactuse(userConfig = {}) {
|
|
|
7629
7691
|
openFile,
|
|
7630
7692
|
openCode,
|
|
7631
7693
|
updateFile,
|
|
7694
|
+
openPanel,
|
|
7632
7695
|
closePanel,
|
|
7633
7696
|
togglePanel,
|
|
7634
7697
|
toggleFullscreen,
|
|
@@ -7768,6 +7831,7 @@ function provideArtifactuse(config = {}) {
|
|
|
7768
7831
|
isFullscreen: false,
|
|
7769
7832
|
openTabs: [],
|
|
7770
7833
|
tabViewModes: {},
|
|
7834
|
+
forceEmptyView: false,
|
|
7771
7835
|
});
|
|
7772
7836
|
|
|
7773
7837
|
// Subscribe to state changes
|
|
@@ -7779,6 +7843,7 @@ function provideArtifactuse(config = {}) {
|
|
|
7779
7843
|
state.isFullscreen = newState.isFullscreen;
|
|
7780
7844
|
state.openTabs = newState.openTabs;
|
|
7781
7845
|
state.tabViewModes = newState.tabViewModes;
|
|
7846
|
+
state.forceEmptyView = newState.forceEmptyView;
|
|
7782
7847
|
});
|
|
7783
7848
|
|
|
7784
7849
|
// Computed
|
|
@@ -7822,6 +7887,7 @@ function provideArtifactuse(config = {}) {
|
|
|
7822
7887
|
openFile: instance.openFile,
|
|
7823
7888
|
openCode: instance.openCode,
|
|
7824
7889
|
updateFile: instance.updateFile,
|
|
7890
|
+
openPanel: instance.openPanel,
|
|
7825
7891
|
closePanel: instance.closePanel,
|
|
7826
7892
|
togglePanel: instance.togglePanel,
|
|
7827
7893
|
toggleFullscreen: instance.toggleFullscreen,
|
|
@@ -7890,6 +7956,7 @@ function createArtifactuseComposable(config = {}) {
|
|
|
7890
7956
|
isFullscreen: false,
|
|
7891
7957
|
openTabs: [],
|
|
7892
7958
|
tabViewModes: {},
|
|
7959
|
+
forceEmptyView: false,
|
|
7893
7960
|
});
|
|
7894
7961
|
|
|
7895
7962
|
// Subscribe to state changes
|
|
@@ -7904,6 +7971,7 @@ function createArtifactuseComposable(config = {}) {
|
|
|
7904
7971
|
state.isFullscreen = newState.isFullscreen;
|
|
7905
7972
|
state.openTabs = newState.openTabs;
|
|
7906
7973
|
state.tabViewModes = newState.tabViewModes;
|
|
7974
|
+
state.forceEmptyView = newState.forceEmptyView;
|
|
7907
7975
|
});
|
|
7908
7976
|
|
|
7909
7977
|
// Apply theme
|
|
@@ -7952,6 +8020,7 @@ function createArtifactuseComposable(config = {}) {
|
|
|
7952
8020
|
openFile: instance.openFile,
|
|
7953
8021
|
openCode: instance.openCode,
|
|
7954
8022
|
updateFile: instance.updateFile,
|
|
8023
|
+
openPanel: instance.openPanel,
|
|
7955
8024
|
closePanel: instance.closePanel,
|
|
7956
8025
|
togglePanel: instance.togglePanel,
|
|
7957
8026
|
toggleFullscreen: instance.toggleFullscreen,
|
|
@@ -27566,6 +27635,10 @@ var JSZip = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
|
27566
27635
|
//
|
|
27567
27636
|
//
|
|
27568
27637
|
//
|
|
27638
|
+
//
|
|
27639
|
+
//
|
|
27640
|
+
//
|
|
27641
|
+
//
|
|
27569
27642
|
|
|
27570
27643
|
|
|
27571
27644
|
var script$1 = defineComponent({
|
|
@@ -27710,7 +27783,7 @@ var script$1 = defineComponent({
|
|
|
27710
27783
|
|
|
27711
27784
|
// Effective panel width - smaller for list/empty views
|
|
27712
27785
|
const effectivePanelWidth = computed(() => {
|
|
27713
|
-
if (!activeArtifact.value) {
|
|
27786
|
+
if (!activeArtifact.value && !state.forceEmptyView) {
|
|
27714
27787
|
return Math.min(panelWidth.value, 30);
|
|
27715
27788
|
}
|
|
27716
27789
|
return panelWidth.value;
|
|
@@ -27719,11 +27792,13 @@ var script$1 = defineComponent({
|
|
|
27719
27792
|
const panelClasses = computed(() => {
|
|
27720
27793
|
return {
|
|
27721
27794
|
'artifactuse-panel--fullscreen': state.isFullscreen,
|
|
27722
|
-
'artifactuse-panel--list': !activeArtifact.value && hasArtifacts.value,
|
|
27723
|
-
'artifactuse-panel--empty': !hasArtifacts.value,
|
|
27795
|
+
'artifactuse-panel--list': !activeArtifact.value && hasArtifacts.value && !state.forceEmptyView,
|
|
27796
|
+
'artifactuse-panel--empty': !hasArtifacts.value && !state.forceEmptyView,
|
|
27724
27797
|
};
|
|
27725
27798
|
});
|
|
27726
|
-
|
|
27799
|
+
|
|
27800
|
+
const forceEmptyView = computed(() => state.forceEmptyView);
|
|
27801
|
+
|
|
27727
27802
|
// Smartdiff: per-line language-aware highlighting
|
|
27728
27803
|
function highlightSmartDiff(artifact) {
|
|
27729
27804
|
if (artifact.language !== 'smartdiff') return null;
|
|
@@ -28382,6 +28457,7 @@ var script$1 = defineComponent({
|
|
|
28382
28457
|
showBranding,
|
|
28383
28458
|
effectivePanelWidth,
|
|
28384
28459
|
panelClasses,
|
|
28460
|
+
forceEmptyView,
|
|
28385
28461
|
sharingEnabled,
|
|
28386
28462
|
isAuthenticated,
|
|
28387
28463
|
isEditorAvailable,
|
|
@@ -28472,7 +28548,7 @@ var __vue_render__$1 = function () {
|
|
|
28472
28548
|
)
|
|
28473
28549
|
: _vm._e(),
|
|
28474
28550
|
_vm._v(" "),
|
|
28475
|
-
!_vm.hasArtifacts
|
|
28551
|
+
!_vm.hasArtifacts || _vm.forceEmptyView
|
|
28476
28552
|
? [
|
|
28477
28553
|
_c(
|
|
28478
28554
|
"header",
|
|
@@ -28489,26 +28565,51 @@ var __vue_render__$1 = function () {
|
|
|
28489
28565
|
"span",
|
|
28490
28566
|
{ staticClass: "artifactuse-panel__icon" },
|
|
28491
28567
|
[
|
|
28492
|
-
|
|
28493
|
-
|
|
28494
|
-
|
|
28495
|
-
|
|
28496
|
-
|
|
28497
|
-
|
|
28498
|
-
|
|
28499
|
-
|
|
28500
|
-
|
|
28501
|
-
|
|
28502
|
-
|
|
28503
|
-
|
|
28504
|
-
|
|
28505
|
-
|
|
28506
|
-
|
|
28507
|
-
|
|
28508
|
-
|
|
28509
|
-
|
|
28510
|
-
|
|
28511
|
-
|
|
28568
|
+
_vm.forceEmptyView
|
|
28569
|
+
? _c(
|
|
28570
|
+
"svg",
|
|
28571
|
+
{
|
|
28572
|
+
attrs: {
|
|
28573
|
+
viewBox: "0 0 24 24",
|
|
28574
|
+
fill: "none",
|
|
28575
|
+
stroke: "currentColor",
|
|
28576
|
+
"stroke-width": "2",
|
|
28577
|
+
},
|
|
28578
|
+
},
|
|
28579
|
+
[
|
|
28580
|
+
_c("path", {
|
|
28581
|
+
attrs: {
|
|
28582
|
+
d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",
|
|
28583
|
+
},
|
|
28584
|
+
}),
|
|
28585
|
+
_vm._v(" "),
|
|
28586
|
+
_c("polyline", {
|
|
28587
|
+
attrs: { points: "14 2 14 8 20 8" },
|
|
28588
|
+
}),
|
|
28589
|
+
]
|
|
28590
|
+
)
|
|
28591
|
+
: _c(
|
|
28592
|
+
"svg",
|
|
28593
|
+
{
|
|
28594
|
+
attrs: {
|
|
28595
|
+
viewBox: "0 0 24 24",
|
|
28596
|
+
fill: "none",
|
|
28597
|
+
stroke: "currentColor",
|
|
28598
|
+
"stroke-width": "2",
|
|
28599
|
+
},
|
|
28600
|
+
},
|
|
28601
|
+
[
|
|
28602
|
+
_c("polyline", {
|
|
28603
|
+
attrs: {
|
|
28604
|
+
points: "16 18 22 12 16 6",
|
|
28605
|
+
},
|
|
28606
|
+
}),
|
|
28607
|
+
_vm._v(" "),
|
|
28608
|
+
_c("polyline", {
|
|
28609
|
+
attrs: { points: "8 6 2 12 8 18" },
|
|
28610
|
+
}),
|
|
28611
|
+
]
|
|
28612
|
+
),
|
|
28512
28613
|
]
|
|
28513
28614
|
),
|
|
28514
28615
|
_vm._v(" "),
|
|
@@ -28522,7 +28623,15 @@ var __vue_render__$1 = function () {
|
|
|
28522
28623
|
_c(
|
|
28523
28624
|
"span",
|
|
28524
28625
|
{ staticClass: "artifactuse-panel__name" },
|
|
28525
|
-
[
|
|
28626
|
+
[
|
|
28627
|
+
_vm._v(
|
|
28628
|
+
_vm._s(
|
|
28629
|
+
_vm.forceEmptyView
|
|
28630
|
+
? "Artifact Viewer"
|
|
28631
|
+
: "Artifacts"
|
|
28632
|
+
)
|
|
28633
|
+
),
|
|
28634
|
+
]
|
|
28526
28635
|
),
|
|
28527
28636
|
]
|
|
28528
28637
|
),
|
|
@@ -28612,7 +28721,15 @@ var __vue_render__$1 = function () {
|
|
|
28612
28721
|
_c(
|
|
28613
28722
|
"h3",
|
|
28614
28723
|
{ staticClass: "artifactuse-panel__empty-title" },
|
|
28615
|
-
[
|
|
28724
|
+
[
|
|
28725
|
+
_vm._v(
|
|
28726
|
+
_vm._s(
|
|
28727
|
+
_vm.forceEmptyView
|
|
28728
|
+
? "No artifact selected"
|
|
28729
|
+
: "No artifacts yet"
|
|
28730
|
+
)
|
|
28731
|
+
),
|
|
28732
|
+
]
|
|
28616
28733
|
),
|
|
28617
28734
|
_vm._v(" "),
|
|
28618
28735
|
_c(
|
|
@@ -28620,7 +28737,13 @@ var __vue_render__$1 = function () {
|
|
|
28620
28737
|
{ staticClass: "artifactuse-panel__empty-text" },
|
|
28621
28738
|
[
|
|
28622
28739
|
_vm._v(
|
|
28623
|
-
"\n
|
|
28740
|
+
"\n " +
|
|
28741
|
+
_vm._s(
|
|
28742
|
+
_vm.forceEmptyView
|
|
28743
|
+
? "Open an artifact to have it appear here"
|
|
28744
|
+
: "Code blocks, forms, and other interactive content will appear here as the AI generates them."
|
|
28745
|
+
) +
|
|
28746
|
+
"\n "
|
|
28624
28747
|
),
|
|
28625
28748
|
]
|
|
28626
28749
|
),
|
|
@@ -28680,7 +28803,7 @@ var __vue_render__$1 = function () {
|
|
|
28680
28803
|
]
|
|
28681
28804
|
),
|
|
28682
28805
|
]
|
|
28683
|
-
: !_vm.activeArtifact
|
|
28806
|
+
: !_vm.activeArtifact && !_vm.forceEmptyView
|
|
28684
28807
|
? [
|
|
28685
28808
|
_c(
|
|
28686
28809
|
"header",
|