@memori.ai/memori-react 8.10.1 → 8.12.0
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/CHANGELOG.md +66 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +2 -2
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/dist/components/Auth/Auth.js +36 -8
- package/dist/components/Auth/Auth.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/dist/components/Chat/Chat.js +2 -2
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +81 -13
- package/dist/components/ChatBubble/ChatBubble.js +86 -19
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/dist/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/dist/components/ChatInputs/ChatInputs.js +8 -3
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/DateSelector/DateSelector.css +125 -104
- package/dist/components/DateSelector/DateSelector.d.ts +1 -1
- package/dist/components/DateSelector/DateSelector.js +110 -52
- package/dist/components/DateSelector/DateSelector.js.map +1 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.css +37 -5
- package/dist/components/LoginDrawer/LoginDrawer.d.ts +1 -2
- package/dist/components/LoginDrawer/LoginDrawer.js +2 -9
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +40 -5
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaWidget.css +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +3 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +6 -4
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +69 -25
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +2 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadImages/UploadImages.js +2 -2
- package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/dist/components/ui/Drawer.css +8 -0
- package/dist/components/ui/Drawer.d.ts +2 -0
- package/dist/components/ui/Drawer.js +2 -2
- package/dist/components/ui/Drawer.js.map +1 -1
- package/dist/components/ui/Tooltip.css +49 -1
- package/dist/components/ui/Tooltip.d.ts +1 -1
- package/dist/locales/de.json +6 -1
- package/dist/locales/en.json +9 -1
- package/dist/locales/es.json +6 -1
- package/dist/locales/fr.json +5 -1
- package/dist/locales/it.json +8 -1
- package/dist/styles.css +3 -2
- package/esm/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +2 -2
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -1
- package/esm/components/Auth/Auth.js +36 -8
- package/esm/components/Auth/Auth.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/esm/components/Chat/Chat.js +2 -2
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +81 -13
- package/esm/components/ChatBubble/ChatBubble.js +87 -20
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/esm/components/ChatInputs/ChatInputs.d.ts +1 -0
- package/esm/components/ChatInputs/ChatInputs.js +8 -3
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/DateSelector/DateSelector.css +125 -104
- package/esm/components/DateSelector/DateSelector.d.ts +1 -1
- package/esm/components/DateSelector/DateSelector.js +111 -52
- package/esm/components/DateSelector/DateSelector.js.map +1 -1
- package/esm/components/Header/Header.js +1 -1
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.css +37 -5
- package/esm/components/LoginDrawer/LoginDrawer.d.ts +1 -2
- package/esm/components/LoginDrawer/LoginDrawer.js +2 -9
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +40 -5
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaWidget.css +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js +3 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +2 -2
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +6 -4
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +69 -25
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +2 -0
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadImages/UploadImages.js +2 -2
- package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -1
- package/esm/components/ui/Drawer.css +8 -0
- package/esm/components/ui/Drawer.d.ts +2 -0
- package/esm/components/ui/Drawer.js +2 -2
- package/esm/components/ui/Drawer.js.map +1 -1
- package/esm/components/ui/Tooltip.css +49 -1
- package/esm/components/ui/Tooltip.d.ts +1 -1
- package/esm/locales/de.json +6 -1
- package/esm/locales/en.json +9 -1
- package/esm/locales/es.json +6 -1
- package/esm/locales/fr.json +5 -1
- package/esm/locales/it.json +8 -1
- package/esm/styles.css +3 -2
- package/package.json +2 -2
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +41 -14
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +3 -1
- package/src/components/Auth/Auth.tsx +55 -11
- package/src/components/Avatar/Avatar.stories.tsx +3 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +2 -2
- package/src/components/Chat/Chat.stories.tsx +16 -2
- package/src/components/Chat/Chat.tsx +2 -1
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +1036 -36
- package/src/components/ChatBubble/ChatBubble.css +81 -13
- package/src/components/ChatBubble/ChatBubble.stories.tsx +16 -2
- package/src/components/ChatBubble/ChatBubble.test.tsx +17 -0
- package/src/components/ChatBubble/ChatBubble.tsx +144 -31
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +304 -8
- package/src/components/ChatHistoryDrawer/ChatHistory.css +5 -1
- package/src/components/ChatInputs/ChatInputs.tsx +14 -1
- package/src/components/DateSelector/DateSelector.css +125 -104
- package/src/components/DateSelector/DateSelector.stories.tsx +1 -1
- package/src/components/DateSelector/DateSelector.test.tsx +137 -23
- package/src/components/DateSelector/DateSelector.tsx +203 -177
- package/src/components/Header/Header.stories.tsx +5 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +1 -1
- package/src/components/LoginDrawer/LoginDrawer.css +37 -5
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +0 -1
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +0 -1
- package/src/components/LoginDrawer/LoginDrawer.tsx +0 -19
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +69 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +66 -18
- package/src/components/MediaWidget/MediaWidget.css +4 -0
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +10 -10
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +2 -2
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +996 -204
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +2 -2
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +1 -1
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +3 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +56 -54
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +16 -7
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +12 -3
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +6 -3
- package/src/components/MemoriWidget/MemoriWidget.tsx +123 -48
- package/src/components/UploadButton/UploadButton.tsx +2 -0
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +3 -2
- package/src/components/layouts/FullBody/FullBody.stories.tsx +110 -0
- package/src/components/layouts/Totem/Totem.stories.tsx +131 -0
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +131 -0
- package/src/components/layouts/layouts.stories.tsx +55 -508
- package/src/components/ui/Drawer.css +8 -0
- package/src/components/ui/Drawer.tsx +16 -12
- package/src/components/ui/Tooltip.css +49 -1
- package/src/components/ui/Tooltip.tsx +1 -1
- package/src/index.stories.tsx +13 -320
- package/src/locales/de.json +6 -1
- package/src/locales/en.json +9 -1
- package/src/locales/es.json +6 -1
- package/src/locales/fr.json +5 -1
- package/src/locales/it.json +8 -1
- package/src/mocks/data.ts +4 -2
- package/src/styles.css +3 -2
- package/src/components/SignupForm/SignupForm.test.tsx +0 -40
- package/src/components/SignupForm/SignupForm.tsx +0 -457
- package/src/components/SignupForm/__snapshots__/SignupForm.test.tsx.snap +0 -247
|
@@ -99,7 +99,7 @@ Devo:
|
|
|
99
99
|
3. Il tag </output> deve essere DOPO </html>
|
|
100
100
|
4. Mantenerla semplice come richiesto
|
|
101
101
|
5. Includere un po' di stile per renderla gradevole ma non eccessiva</think>Ciao! Ti creo subito una pagina HTML semplice e pulita:
|
|
102
|
-
|
|
102
|
+
</think>
|
|
103
103
|
<output class="memori-artifact" data-mimetype="html">
|
|
104
104
|
<!DOCTYPE html>
|
|
105
105
|
<html lang="it">
|
|
@@ -176,6 +176,593 @@ Ecco una pagina HTML semplice con:
|
|
|
176
176
|
|
|
177
177
|
Puoi vedere l'anteprima nel drawer che si è aperto e modificare il codice come preferisci!`;
|
|
178
178
|
|
|
179
|
+
const htmlArtifactWithScrolling = `<output class="memori-artifact" data-mimetype="html">
|
|
180
|
+
<!DOCTYPE html>
|
|
181
|
+
<html lang="it">
|
|
182
|
+
<head>
|
|
183
|
+
<meta charset="UTF-8">
|
|
184
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
185
|
+
<title>Memori & AIsuru</title>
|
|
186
|
+
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100;300;400;500;600;900&display=swap" rel="stylesheet">
|
|
187
|
+
<style>
|
|
188
|
+
* {
|
|
189
|
+
margin: 0;
|
|
190
|
+
padding: 0;
|
|
191
|
+
box-sizing: border-box;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:root {
|
|
195
|
+
/* Brand Colors dalla palette */
|
|
196
|
+
--color-light-teal: #9CDCD9; /* PMS 324 C */
|
|
197
|
+
--color-bright-cyan: #00AEC7; /* PMS 3125 C */
|
|
198
|
+
--color-purple: #8246AF; /* PMS 2587 C */
|
|
199
|
+
--color-dark-purple: #653165; /* PMS 2622 C */
|
|
200
|
+
--color-navy: #005587; /* PMS 7692 C */
|
|
201
|
+
|
|
202
|
+
/* Typography - Lexend Variable */
|
|
203
|
+
--font-family: 'Lexend', sans-serif;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
body {
|
|
207
|
+
font-family: var(--font-family);
|
|
208
|
+
font-weight: 400;
|
|
209
|
+
line-height: 1.6;
|
|
210
|
+
color: #333;
|
|
211
|
+
overflow-x: hidden;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Hero Section con gradiente brand */
|
|
215
|
+
.hero {
|
|
216
|
+
background: linear-gradient(135deg, var(--color-bright-cyan) 0%, var(--color-purple) 50%, var(--color-dark-purple) 100%);
|
|
217
|
+
min-height: 100vh;
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
text-align: center;
|
|
222
|
+
color: white;
|
|
223
|
+
position: relative;
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.hero::before {
|
|
228
|
+
content: '';
|
|
229
|
+
position: absolute;
|
|
230
|
+
top: 0;
|
|
231
|
+
left: 0;
|
|
232
|
+
right: 0;
|
|
233
|
+
bottom: 0;
|
|
234
|
+
background: radial-gradient(circle at 30% 20%, rgba(156, 220, 217, 0.3) 0%, transparent 50%),
|
|
235
|
+
radial-gradient(circle at 80% 80%, rgba(130, 70, 175, 0.3) 0%, transparent 50%);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.hero-content {
|
|
239
|
+
position: relative;
|
|
240
|
+
z-index: 1;
|
|
241
|
+
max-width: 800px;
|
|
242
|
+
padding: 2rem;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.brand-title {
|
|
246
|
+
font-size: clamp(3rem, 10vw, 6rem);
|
|
247
|
+
font-weight: 900; /* Black weight come da brandbook */
|
|
248
|
+
margin-bottom: 1rem;
|
|
249
|
+
text-shadow: 2px 2px 20px rgba(0, 0, 0, 0.3);
|
|
250
|
+
animation: fadeInUp 1s ease-out;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.brand-subtitle {
|
|
254
|
+
font-size: clamp(1.2rem, 4vw, 2rem);
|
|
255
|
+
font-weight: 300; /* Light weight */
|
|
256
|
+
margin-bottom: 2rem;
|
|
257
|
+
opacity: 0.95;
|
|
258
|
+
animation: fadeInUp 1s ease-out 0.3s both;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.cta-button {
|
|
262
|
+
display: inline-block;
|
|
263
|
+
padding: 1.2rem 2.5rem;
|
|
264
|
+
background: var(--color-light-teal);
|
|
265
|
+
color: var(--color-navy);
|
|
266
|
+
text-decoration: none;
|
|
267
|
+
border-radius: 50px;
|
|
268
|
+
font-weight: 600; /* Semibold */
|
|
269
|
+
font-size: 1.1rem;
|
|
270
|
+
transition: all 0.3s ease;
|
|
271
|
+
animation: fadeInUp 1s ease-out 0.6s both;
|
|
272
|
+
text-transform: uppercase;
|
|
273
|
+
letter-spacing: 0.5px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.cta-button:hover {
|
|
277
|
+
background: white;
|
|
278
|
+
transform: translateY(-3px);
|
|
279
|
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* Features Section con colori del brand */
|
|
283
|
+
.features {
|
|
284
|
+
padding: 5rem 2rem;
|
|
285
|
+
background: linear-gradient(45deg, rgba(156, 220, 217, 0.1) 0%, rgba(0, 174, 199, 0.1) 100%);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.container {
|
|
289
|
+
max-width: 1200px;
|
|
290
|
+
margin: 0 auto;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.section-title {
|
|
294
|
+
text-align: center;
|
|
295
|
+
font-size: 3rem;
|
|
296
|
+
font-weight: 900;
|
|
297
|
+
margin-bottom: 3rem;
|
|
298
|
+
color: var(--color-navy);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.features-grid {
|
|
302
|
+
display: grid;
|
|
303
|
+
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
|
304
|
+
gap: 2.5rem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.feature-card {
|
|
308
|
+
background: white;
|
|
309
|
+
padding: 2.5rem;
|
|
310
|
+
border-radius: 20px;
|
|
311
|
+
box-shadow: 0 10px 40px rgba(0, 85, 135, 0.1);
|
|
312
|
+
text-align: center;
|
|
313
|
+
transition: all 0.3s ease;
|
|
314
|
+
border: 1px solid rgba(0, 174, 199, 0.1);
|
|
315
|
+
position: relative;
|
|
316
|
+
overflow: hidden;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.feature-card::before {
|
|
320
|
+
content: '';
|
|
321
|
+
position: absolute;
|
|
322
|
+
top: 0;
|
|
323
|
+
left: 0;
|
|
324
|
+
right: 0;
|
|
325
|
+
height: 4px;
|
|
326
|
+
background: linear-gradient(90deg, var(--color-bright-cyan), var(--color-purple));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.feature-card:hover {
|
|
330
|
+
transform: translateY(-10px);
|
|
331
|
+
box-shadow: 0 25px 60px rgba(0, 85, 135, 0.2);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.feature-icon {
|
|
335
|
+
font-size: 4rem;
|
|
336
|
+
margin-bottom: 1.5rem;
|
|
337
|
+
background: linear-gradient(135deg, var(--color-bright-cyan), var(--color-purple));
|
|
338
|
+
-webkit-background-clip: text;
|
|
339
|
+
-webkit-text-fill-color: transparent;
|
|
340
|
+
background-clip: text;
|
|
341
|
+
font-weight: 900;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.feature-card h3 {
|
|
345
|
+
font-size: 1.5rem;
|
|
346
|
+
font-weight: 600;
|
|
347
|
+
margin-bottom: 1rem;
|
|
348
|
+
color: var(--color-navy);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.feature-card p {
|
|
352
|
+
color: #666;
|
|
353
|
+
line-height: 1.8;
|
|
354
|
+
font-weight: 400;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* Brand Colors Section */
|
|
358
|
+
.brand-colors {
|
|
359
|
+
padding: 5rem 2rem;
|
|
360
|
+
background: var(--color-navy);
|
|
361
|
+
color: white;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.colors-grid {
|
|
365
|
+
display: grid;
|
|
366
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
367
|
+
gap: 2rem;
|
|
368
|
+
margin-top: 3rem;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.color-swatch {
|
|
372
|
+
text-align: center;
|
|
373
|
+
padding: 1.5rem;
|
|
374
|
+
border-radius: 15px;
|
|
375
|
+
background: rgba(255, 255, 255, 0.1);
|
|
376
|
+
backdrop-filter: blur(10px);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.color-circle {
|
|
380
|
+
width: 100px;
|
|
381
|
+
height: 100px;
|
|
382
|
+
border-radius: 50%;
|
|
383
|
+
margin: 0 auto 1rem;
|
|
384
|
+
border: 3px solid rgba(255, 255, 255, 0.3);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.color-1 { background: var(--color-light-teal); }
|
|
388
|
+
.color-2 { background: var(--color-bright-cyan); }
|
|
389
|
+
.color-3 { background: var(--color-purple); }
|
|
390
|
+
.color-4 { background: var(--color-dark-purple); }
|
|
391
|
+
.color-5 { background: var(--color-navy); }
|
|
392
|
+
|
|
393
|
+
.color-name {
|
|
394
|
+
font-weight: 600;
|
|
395
|
+
margin-bottom: 0.5rem;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.color-hex {
|
|
399
|
+
font-family: 'Courier New', monospace;
|
|
400
|
+
font-size: 0.9rem;
|
|
401
|
+
opacity: 0.8;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Typography Section */
|
|
405
|
+
.typography {
|
|
406
|
+
padding: 5rem 2rem;
|
|
407
|
+
background: linear-gradient(135deg, rgba(130, 70, 175, 0.05), rgba(101, 49, 101, 0.05));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.type-example {
|
|
411
|
+
margin: 2rem 0;
|
|
412
|
+
padding: 2rem;
|
|
413
|
+
background: white;
|
|
414
|
+
border-radius: 15px;
|
|
415
|
+
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.lexend-thin { font-weight: 100; font-size: 2rem; color: var(--color-purple); }
|
|
419
|
+
.lexend-light { font-weight: 300; font-size: 1.8rem; color: var(--color-bright-cyan); }
|
|
420
|
+
.lexend-regular { font-weight: 400; font-size: 1.5rem; color: var(--color-navy); }
|
|
421
|
+
.lexend-medium { font-weight: 500; font-size: 1.3rem; color: var(--color-dark-purple); }
|
|
422
|
+
.lexend-semibold { font-weight: 600; font-size: 1.2rem; color: var(--color-purple); }
|
|
423
|
+
.lexend-black { font-weight: 900; font-size: 2.5rem; color: var(--color-navy); }
|
|
424
|
+
|
|
425
|
+
/* Footer */
|
|
426
|
+
footer {
|
|
427
|
+
background: var(--color-dark-purple);
|
|
428
|
+
color: white;
|
|
429
|
+
text-align: center;
|
|
430
|
+
padding: 3rem 2rem;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.footer-content {
|
|
434
|
+
max-width: 800px;
|
|
435
|
+
margin: 0 auto;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.footer-title {
|
|
439
|
+
font-size: 2rem;
|
|
440
|
+
font-weight: 900;
|
|
441
|
+
margin-bottom: 1rem;
|
|
442
|
+
background: linear-gradient(135deg, var(--color-light-teal), var(--color-bright-cyan));
|
|
443
|
+
-webkit-background-clip: text;
|
|
444
|
+
-webkit-text-fill-color: transparent;
|
|
445
|
+
background-clip: text;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* Animations */
|
|
449
|
+
@keyframes fadeInUp {
|
|
450
|
+
from {
|
|
451
|
+
opacity: 0;
|
|
452
|
+
transform: translateY(30px);
|
|
453
|
+
}
|
|
454
|
+
to {
|
|
455
|
+
opacity: 1;
|
|
456
|
+
transform: translateY(0);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* Responsive */
|
|
461
|
+
@media (max-width: 768px) {
|
|
462
|
+
.features-grid {
|
|
463
|
+
grid-template-columns: 1fr;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.colors-grid {
|
|
467
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
</style>
|
|
471
|
+
</head>
|
|
472
|
+
<body>
|
|
473
|
+
<section class="hero">
|
|
474
|
+
<div class="hero-content">
|
|
475
|
+
<h1 class="brand-title">Memori & AIsuru</h1>
|
|
476
|
+
<p class="brand-subtitle">Dove l'intelligenza artificiale incontra la memoria del futuro</p>
|
|
477
|
+
<a href="#features" class="cta-button">Scopri di più</a>
|
|
478
|
+
</div>
|
|
479
|
+
</section>
|
|
480
|
+
|
|
481
|
+
<section id="features" class="features">
|
|
482
|
+
<div class="container">
|
|
483
|
+
<h2 class="section-title">Caratteristiche Innovative</h2>
|
|
484
|
+
<div class="features-grid">
|
|
485
|
+
<div class="feature-card">
|
|
486
|
+
<div class="feature-icon">🧠</div>
|
|
487
|
+
<h3>Intelligenza Avanzata</h3>
|
|
488
|
+
<p>Sistema di AI all'avanguardia che apprende e si adatta alle tue esigenze specifiche, offrendo soluzioni personalizzate e intelligenti.</p>
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
<div class="feature-card">
|
|
492
|
+
<div class="feature-icon">💾</div>
|
|
493
|
+
<h3>Memoria Infinita</h3>
|
|
494
|
+
<p>Capacità di archiviazione e recupero dati senza limiti, con algoritmi ottimizzati per prestazioni eccezionali.</p>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
<div class="feature-card">
|
|
498
|
+
<div class="feature-icon">⚡</div>
|
|
499
|
+
<h3>Velocità Estrema</h3>
|
|
500
|
+
<p>Elaborazione in tempo reale con latenza minimale, garantendo risposte immediate e fluide in ogni situazione.</p>
|
|
501
|
+
</div>
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
</section>
|
|
505
|
+
|
|
506
|
+
<section class="brand-colors">
|
|
507
|
+
<div class="container">
|
|
508
|
+
<h2 class="section-title">Brand Palette</h2>
|
|
509
|
+
<div class="colors-grid">
|
|
510
|
+
<div class="color-swatch">
|
|
511
|
+
<div class="color-circle color-1"></div>
|
|
512
|
+
<div class="color-name">Light Teal</div>
|
|
513
|
+
<div class="color-hex">#9CDCD9</div>
|
|
514
|
+
</div>
|
|
515
|
+
<div class="color-swatch">
|
|
516
|
+
<div class="color-circle color-2"></div>
|
|
517
|
+
<div class="color-name">Bright Cyan</div>
|
|
518
|
+
<div class="color-hex">#00AEC7</div>
|
|
519
|
+
</div>
|
|
520
|
+
<div class="color-swatch">
|
|
521
|
+
<div class="color-circle color-3"></div>
|
|
522
|
+
<div class="color-name">Purple</div>
|
|
523
|
+
<div class="color-hex">#8246AF</div>
|
|
524
|
+
</div>
|
|
525
|
+
<div class="color-swatch">
|
|
526
|
+
<div class="color-circle color-4"></div>
|
|
527
|
+
<div class="color-name">Dark Purple</div>
|
|
528
|
+
<div class="color-hex">#653165</div>
|
|
529
|
+
</div>
|
|
530
|
+
<div class="color-swatch">
|
|
531
|
+
<div class="color-circle color-5"></div>
|
|
532
|
+
<div class="color-name">Navy</div>
|
|
533
|
+
<div class="color-hex">#005587</div>
|
|
534
|
+
</div>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
537
|
+
</section>
|
|
538
|
+
|
|
539
|
+
<section class="typography">
|
|
540
|
+
<div class="container">
|
|
541
|
+
<h2 class="section-title">Tipografia Lexend</h2>
|
|
542
|
+
<div class="type-example">
|
|
543
|
+
<div class="lexend-thin">Lexend Thin - Eleganza e leggerezza</div>
|
|
544
|
+
</div>
|
|
545
|
+
<div class="type-example">
|
|
546
|
+
<div class="lexend-light">Lexend Light - Chiarezza ottimale</div>
|
|
547
|
+
</div>
|
|
548
|
+
<div class="type-example">
|
|
549
|
+
<div class="lexend-regular">Lexend Regular - Testo standard leggibile</div>
|
|
550
|
+
</div>
|
|
551
|
+
<div class="type-example">
|
|
552
|
+
<div class="lexend-medium">Lexend Medium - Enfasi equilibrata</div>
|
|
553
|
+
</div>
|
|
554
|
+
<div class="type-example">
|
|
555
|
+
<div class="lexend-semibold">Lexend Semibold - Importanza marcata</div>
|
|
556
|
+
</div>
|
|
557
|
+
<div class="type-example">
|
|
558
|
+
<div class="lexend-black">Lexend Black - Impatto Massimo</div>
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
</section>
|
|
562
|
+
|
|
563
|
+
<footer>
|
|
564
|
+
<div class="footer-content">
|
|
565
|
+
<h3 class="footer-title">Memori & AIsuru</h3>
|
|
566
|
+
<p>Innovazione, design e tecnologia in perfetta armonia secondo le linee guida del brand.</p>
|
|
567
|
+
<p style="margin-top: 2rem; opacity: 0.7; font-size: 0.9rem;">
|
|
568
|
+
Rispettando le dimensioni minime (12mm), palette colori PMS, tipografia Lexend e area di rispetto del brandbook.
|
|
569
|
+
</p>
|
|
570
|
+
</div>
|
|
571
|
+
</footer>
|
|
572
|
+
</body>
|
|
573
|
+
</html>
|
|
574
|
+
</output>
|
|
575
|
+
`;
|
|
576
|
+
const htmlArtifactScrollTest = `<output class="memori-artifact" data-mimetype="html" data-title="Tall Content Scroll Test">
|
|
577
|
+
<!DOCTYPE html>
|
|
578
|
+
<html lang="en">
|
|
579
|
+
<head>
|
|
580
|
+
<meta charset="UTF-8" />
|
|
581
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
582
|
+
<title>Scroll Test</title>
|
|
583
|
+
<style>
|
|
584
|
+
body {
|
|
585
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
586
|
+
margin: 0;
|
|
587
|
+
padding: 0;
|
|
588
|
+
background: #f0f4f8;
|
|
589
|
+
color: #1f2933;
|
|
590
|
+
line-height: 1.6;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.hero {
|
|
594
|
+
padding: 32px;
|
|
595
|
+
text-align: center;
|
|
596
|
+
background: linear-gradient(135deg, #2563eb, #7c3aed);
|
|
597
|
+
color: #fff;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.hero h1 {
|
|
601
|
+
margin: 0 0 12px;
|
|
602
|
+
font-size: 2.5rem;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.section {
|
|
606
|
+
padding: 32px;
|
|
607
|
+
background: #fff;
|
|
608
|
+
margin: 16px;
|
|
609
|
+
border-radius: 12px;
|
|
610
|
+
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.section h2 {
|
|
614
|
+
margin-top: 0;
|
|
615
|
+
color: #2563eb;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.cards {
|
|
619
|
+
display: grid;
|
|
620
|
+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
621
|
+
gap: 16px;
|
|
622
|
+
margin-top: 24px;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.card {
|
|
626
|
+
padding: 16px;
|
|
627
|
+
border-radius: 10px;
|
|
628
|
+
background: #eef2ff;
|
|
629
|
+
border: 1px solid #c7d2fe;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
footer {
|
|
633
|
+
text-align: center;
|
|
634
|
+
padding: 32px;
|
|
635
|
+
color: #94a3b8;
|
|
636
|
+
}
|
|
637
|
+
</style>
|
|
638
|
+
</head>
|
|
639
|
+
<body>
|
|
640
|
+
<div class="hero">
|
|
641
|
+
<h1>Scroll Test Page</h1>
|
|
642
|
+
<p>Before the fix this iframe overflow forced the container to scroll.</p>
|
|
643
|
+
</div>
|
|
644
|
+
${Array.from({ length: 6 })
|
|
645
|
+
.map(
|
|
646
|
+
(_, idx) => `
|
|
647
|
+
<section class="section">
|
|
648
|
+
<h2>Section ${idx + 1}</h2>
|
|
649
|
+
<p>
|
|
650
|
+
This is tall content block ${idx + 1}. It exists purely to make the page taller than the
|
|
651
|
+
drawer viewport so we can ensure the iframe owns the scrollable area.
|
|
652
|
+
</p>
|
|
653
|
+
<div class="cards">
|
|
654
|
+
<div class="card">
|
|
655
|
+
<strong>Metric A</strong>
|
|
656
|
+
<p>${(idx + 1) * 120} units</p>
|
|
657
|
+
</div>
|
|
658
|
+
<div class="card">
|
|
659
|
+
<strong>Metric B</strong>
|
|
660
|
+
<p>${(idx + 1) * 45}%</p>
|
|
661
|
+
</div>
|
|
662
|
+
<div class="card">
|
|
663
|
+
<strong>Metric C</strong>
|
|
664
|
+
<p>${(idx + 1) * 300} pts</p>
|
|
665
|
+
</div>
|
|
666
|
+
</div>
|
|
667
|
+
</section>`
|
|
668
|
+
)
|
|
669
|
+
.join('')}
|
|
670
|
+
<footer>End of scroll test content</footer>
|
|
671
|
+
</body>
|
|
672
|
+
</html>
|
|
673
|
+
</output>`;
|
|
674
|
+
|
|
675
|
+
const svgArtifact = `<output class="memori-artifact" data-mimetype="svg">
|
|
676
|
+
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
|
677
|
+
<defs>
|
|
678
|
+
<!-- Gradiente per il quadrato -->
|
|
679
|
+
<linearGradient id="squareGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
680
|
+
<stop offset="0%" style="stop-color:#667eea;stop-opacity:1" />
|
|
681
|
+
<stop offset="100%" style="stop-color:#764ba2;stop-opacity:1" />
|
|
682
|
+
</linearGradient>
|
|
683
|
+
|
|
684
|
+
<!-- Ombra -->
|
|
685
|
+
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
|
|
686
|
+
<feDropShadow dx="3" dy="3" stdDeviation="3" flood-opacity="0.3"/>
|
|
687
|
+
</filter>
|
|
688
|
+
|
|
689
|
+
<!-- Effetto glow -->
|
|
690
|
+
<filter id="glow">
|
|
691
|
+
<feGaussianBlur stdDeviation="3" result="coloredBlur"/>
|
|
692
|
+
<feMerge>
|
|
693
|
+
<feMergeNode in="coloredBlur"/>
|
|
694
|
+
<feMergeNode in="SourceGraphic"/>
|
|
695
|
+
</feMerge>
|
|
696
|
+
</filter>
|
|
697
|
+
</defs>
|
|
698
|
+
|
|
699
|
+
<!-- Sfondo -->
|
|
700
|
+
<rect width="200" height="200" fill="#f8f9fa"/>
|
|
701
|
+
|
|
702
|
+
<!-- Quadrato principale -->
|
|
703
|
+
<rect x="50" y="50" width="100" height="100"
|
|
704
|
+
fill="url(#squareGradient)"
|
|
705
|
+
stroke="rgba(255,255,255,0.3)"
|
|
706
|
+
stroke-width="2"
|
|
707
|
+
rx="8"
|
|
708
|
+
filter="url(#shadow)"
|
|
709
|
+
opacity="0">
|
|
710
|
+
|
|
711
|
+
<!-- Animazione fade in -->
|
|
712
|
+
<animate attributeName="opacity"
|
|
713
|
+
values="0;1"
|
|
714
|
+
dur="1s"
|
|
715
|
+
fill="freeze"/>
|
|
716
|
+
|
|
717
|
+
<!-- Animazione rotazione -->
|
|
718
|
+
<animateTransform
|
|
719
|
+
attributeName="transform"
|
|
720
|
+
attributeType="XML"
|
|
721
|
+
type="rotate"
|
|
722
|
+
values="0 100 100;5 100 100;-5 100 100;0 100 100"
|
|
723
|
+
dur="3s"
|
|
724
|
+
repeatCount="indefinite"/>
|
|
725
|
+
</rect>
|
|
726
|
+
|
|
727
|
+
<!-- Quadrato interno decorativo -->
|
|
728
|
+
<rect x="75" y="75" width="50" height="50"
|
|
729
|
+
fill="rgba(255,255,255,0.2)"
|
|
730
|
+
rx="4"
|
|
731
|
+
opacity="0">
|
|
732
|
+
|
|
733
|
+
<animate attributeName="opacity"
|
|
734
|
+
values="0;0.6;0"
|
|
735
|
+
dur="2s"
|
|
736
|
+
repeatCount="indefinite"/>
|
|
737
|
+
</rect>
|
|
738
|
+
|
|
739
|
+
<!-- Particelle decorative -->
|
|
740
|
+
<circle cx="60" cy="60" r="2" fill="#FFD700" opacity="0">
|
|
741
|
+
<animate attributeName="opacity" values="0;1;0" dur="1.5s" repeatCount="indefinite"/>
|
|
742
|
+
</circle>
|
|
743
|
+
|
|
744
|
+
<circle cx="140" cy="140" r="1.5" fill="#FF6B6B" opacity="0">
|
|
745
|
+
<animate attributeName="opacity" values="0;1;0" dur="2s" repeatCount="indefinite" begin="0.5s"/>
|
|
746
|
+
</circle>
|
|
747
|
+
|
|
748
|
+
<circle cx="140" cy="60" r="1" fill="#4ECDC4" opacity="0">
|
|
749
|
+
<animate attributeName="opacity" values="0;1;0" dur="1.8s" repeatCount="indefinite" begin="1s"/>
|
|
750
|
+
</circle>
|
|
751
|
+
|
|
752
|
+
<!-- Testo centrale -->
|
|
753
|
+
<text x="100" y="105"
|
|
754
|
+
text-anchor="middle"
|
|
755
|
+
fill="white"
|
|
756
|
+
font-family="system-ui, sans-serif"
|
|
757
|
+
font-size="14"
|
|
758
|
+
font-weight="bold"
|
|
759
|
+
opacity="0">
|
|
760
|
+
SVG
|
|
761
|
+
<animate attributeName="opacity" values="0;1" dur="1.5s" fill="freeze" begin="0.5s"/>
|
|
762
|
+
</text>
|
|
763
|
+
</svg>
|
|
764
|
+
</output>`;
|
|
765
|
+
|
|
179
766
|
const markdownArtifact = `<output class="memori-artifact" data-mimetype="markdown">
|
|
180
767
|
# Project Documentation
|
|
181
768
|
|
|
@@ -392,7 +979,7 @@ This page includes modern styling and an interactive button. You can customize t
|
|
|
392
979
|
text: sanitizeText(htmlArtifact),
|
|
393
980
|
fromUser: false,
|
|
394
981
|
timestamp: new Date().toISOString(),
|
|
395
|
-
}
|
|
982
|
+
},
|
|
396
983
|
]}
|
|
397
984
|
pushMessage={mockPushMessage}
|
|
398
985
|
simulateUserPrompt={mockSimulateUserPrompt}
|
|
@@ -411,6 +998,86 @@ This page includes modern styling and an interactive button. You can customize t
|
|
|
411
998
|
),
|
|
412
999
|
};
|
|
413
1000
|
|
|
1001
|
+
export const HTMLArtifactWithScrolling: Story = {
|
|
1002
|
+
args: {},
|
|
1003
|
+
render: () => (
|
|
1004
|
+
<Chat
|
|
1005
|
+
memori={mockMemori}
|
|
1006
|
+
tenant={mockTenant}
|
|
1007
|
+
sessionID="test-session"
|
|
1008
|
+
history={[
|
|
1009
|
+
{
|
|
1010
|
+
text: `Here's a complete HTML page for your landing page:
|
|
1011
|
+
|
|
1012
|
+
${htmlArtifactWithScrolling}
|
|
1013
|
+
|
|
1014
|
+
This page includes modern styling and an interactive button. You can customize the colors and layout as needed.`,
|
|
1015
|
+
fromUser: false,
|
|
1016
|
+
timestamp: new Date().toISOString(),
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
text: 'Try the sanitizeText function',
|
|
1020
|
+
fromUser: false,
|
|
1021
|
+
timestamp: new Date().toISOString(),
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
text: sanitizeText(htmlArtifactWithScrolling),
|
|
1025
|
+
fromUser: false,
|
|
1026
|
+
timestamp: new Date().toISOString(),
|
|
1027
|
+
},
|
|
1028
|
+
]}
|
|
1029
|
+
pushMessage={mockPushMessage}
|
|
1030
|
+
simulateUserPrompt={mockSimulateUserPrompt}
|
|
1031
|
+
onChangeUserMessage={mockOnChangeUserMessage}
|
|
1032
|
+
sendMessage={mockSendMessage}
|
|
1033
|
+
setEnableFocusChatInput={mockSetEnableFocusChatInput}
|
|
1034
|
+
stopAudio={mockStopAudio}
|
|
1035
|
+
startListening={mockStartListening}
|
|
1036
|
+
stopListening={mockStopListening}
|
|
1037
|
+
setSendOnEnter={mockSetSendOnEnter}
|
|
1038
|
+
setAttachmentsMenuOpen={mockSetAttachmentsMenuOpen}
|
|
1039
|
+
showInputs={false}
|
|
1040
|
+
isChatlogPanel={false}
|
|
1041
|
+
showReasoning={true}
|
|
1042
|
+
/>
|
|
1043
|
+
),
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
export const HTMLScrollTest: Story = {
|
|
1047
|
+
args: {},
|
|
1048
|
+
render: () => (
|
|
1049
|
+
<Chat
|
|
1050
|
+
memori={mockMemori}
|
|
1051
|
+
tenant={mockTenant}
|
|
1052
|
+
sessionID="test-session"
|
|
1053
|
+
history={[
|
|
1054
|
+
{
|
|
1055
|
+
text: `Here's a deliberately tall HTML artifact to validate iframe scrolling:
|
|
1056
|
+
|
|
1057
|
+
${htmlArtifactScrollTest}
|
|
1058
|
+
|
|
1059
|
+
Scroll inside the preview to confirm only the iframe scrolls.`,
|
|
1060
|
+
fromUser: false,
|
|
1061
|
+
timestamp: new Date().toISOString(),
|
|
1062
|
+
},
|
|
1063
|
+
]}
|
|
1064
|
+
pushMessage={mockPushMessage}
|
|
1065
|
+
simulateUserPrompt={mockSimulateUserPrompt}
|
|
1066
|
+
onChangeUserMessage={mockOnChangeUserMessage}
|
|
1067
|
+
sendMessage={mockSendMessage}
|
|
1068
|
+
setEnableFocusChatInput={mockSetEnableFocusChatInput}
|
|
1069
|
+
stopAudio={mockStopAudio}
|
|
1070
|
+
startListening={mockStartListening}
|
|
1071
|
+
stopListening={mockStopListening}
|
|
1072
|
+
setSendOnEnter={mockSetSendOnEnter}
|
|
1073
|
+
setAttachmentsMenuOpen={mockSetAttachmentsMenuOpen}
|
|
1074
|
+
showInputs={false}
|
|
1075
|
+
isChatlogPanel={false}
|
|
1076
|
+
showReasoning={false}
|
|
1077
|
+
/>
|
|
1078
|
+
),
|
|
1079
|
+
};
|
|
1080
|
+
|
|
414
1081
|
export const MarkdownDocumentation: Story = {
|
|
415
1082
|
args: {},
|
|
416
1083
|
render: () => (
|
|
@@ -881,6 +1548,40 @@ All files are ready! You now have a complete project structure with HTML, CSS, J
|
|
|
881
1548
|
),
|
|
882
1549
|
};
|
|
883
1550
|
|
|
1551
|
+
export const SVGArtifact: Story = {
|
|
1552
|
+
args: {},
|
|
1553
|
+
render: () => (
|
|
1554
|
+
<Chat
|
|
1555
|
+
memori={mockMemori}
|
|
1556
|
+
tenant={mockTenant}
|
|
1557
|
+
sessionID="test-session"
|
|
1558
|
+
history={[
|
|
1559
|
+
{
|
|
1560
|
+
text: `Here's a complete SVG artifact:
|
|
1561
|
+
|
|
1562
|
+
${svgArtifact}
|
|
1563
|
+
|
|
1564
|
+
This SVG includes a simple circle with a red fill.`,
|
|
1565
|
+
fromUser: false,
|
|
1566
|
+
timestamp: new Date().toISOString(),
|
|
1567
|
+
},
|
|
1568
|
+
]}
|
|
1569
|
+
pushMessage={mockPushMessage}
|
|
1570
|
+
simulateUserPrompt={mockSimulateUserPrompt}
|
|
1571
|
+
onChangeUserMessage={mockOnChangeUserMessage}
|
|
1572
|
+
sendMessage={mockSendMessage}
|
|
1573
|
+
setEnableFocusChatInput={mockSetEnableFocusChatInput}
|
|
1574
|
+
stopAudio={mockStopAudio}
|
|
1575
|
+
startListening={mockStartListening}
|
|
1576
|
+
stopListening={mockStopListening}
|
|
1577
|
+
setSendOnEnter={mockSetSendOnEnter}
|
|
1578
|
+
setAttachmentsMenuOpen={mockSetAttachmentsMenuOpen}
|
|
1579
|
+
showInputs={false}
|
|
1580
|
+
isChatlogPanel={false}
|
|
1581
|
+
/>
|
|
1582
|
+
),
|
|
1583
|
+
};
|
|
1584
|
+
|
|
884
1585
|
export const ConversationFlow: Story = {
|
|
885
1586
|
args: {},
|
|
886
1587
|
render: () => (
|
|
@@ -987,7 +1688,10 @@ export const APIBridge_CreateSimpleArtifact: Story = {
|
|
|
987
1688
|
useEffect(() => {
|
|
988
1689
|
// Wait a bit for the API to be available
|
|
989
1690
|
setTimeout(() => {
|
|
990
|
-
console.log(
|
|
1691
|
+
console.log(
|
|
1692
|
+
'MemoriArtifactAPI available:',
|
|
1693
|
+
!!window.MemoriArtifactAPI
|
|
1694
|
+
);
|
|
991
1695
|
}, 100);
|
|
992
1696
|
}, []);
|
|
993
1697
|
|
|
@@ -1046,111 +1750,133 @@ console.log(message);`,
|
|
|
1046
1750
|
<>
|
|
1047
1751
|
{/* Conditionally render ArtifactDrawer to avoid hooks error */}
|
|
1048
1752
|
{state.isDrawerOpen && <ArtifactDrawer />}
|
|
1049
|
-
|
|
1753
|
+
|
|
1050
1754
|
<div style={{ padding: '20px', maxWidth: '800px', margin: '0 auto' }}>
|
|
1051
1755
|
<h1>🧪 Artifact API Test Lab</h1>
|
|
1052
1756
|
<p>
|
|
1053
|
-
Test the global <code>window.MemoriArtifactAPI</code> by clicking
|
|
1054
|
-
Open the browser console to see the API in
|
|
1757
|
+
Test the global <code>window.MemoriArtifactAPI</code> by clicking
|
|
1758
|
+
the buttons below. Open the browser console to see the API in
|
|
1759
|
+
action.
|
|
1055
1760
|
</p>
|
|
1056
1761
|
|
|
1057
|
-
|
|
1058
|
-
<button
|
|
1059
|
-
onClick={createHTMLArtifact}
|
|
1762
|
+
<div
|
|
1060
1763
|
style={{
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
color: 'white',
|
|
1066
|
-
border: 'none',
|
|
1067
|
-
borderRadius: '8px',
|
|
1068
|
-
}}
|
|
1069
|
-
>
|
|
1070
|
-
📄 Create HTML Artifact
|
|
1071
|
-
</button>
|
|
1072
|
-
|
|
1073
|
-
<button
|
|
1074
|
-
onClick={createMarkdownArtifact}
|
|
1075
|
-
style={{
|
|
1076
|
-
padding: '12px 20px',
|
|
1077
|
-
fontSize: '16px',
|
|
1078
|
-
cursor: 'pointer',
|
|
1079
|
-
backgroundColor: '#7c3aed',
|
|
1080
|
-
color: 'white',
|
|
1081
|
-
border: 'none',
|
|
1082
|
-
borderRadius: '8px',
|
|
1083
|
-
}}
|
|
1084
|
-
>
|
|
1085
|
-
📝 Create Markdown Artifact
|
|
1086
|
-
</button>
|
|
1087
|
-
|
|
1088
|
-
<button
|
|
1089
|
-
onClick={createJavaScriptArtifact}
|
|
1090
|
-
style={{
|
|
1091
|
-
padding: '12px 20px',
|
|
1092
|
-
fontSize: '16px',
|
|
1093
|
-
cursor: 'pointer',
|
|
1094
|
-
backgroundColor: '#6d28d9',
|
|
1095
|
-
color: 'white',
|
|
1096
|
-
border: 'none',
|
|
1097
|
-
borderRadius: '8px',
|
|
1098
|
-
}}
|
|
1099
|
-
>
|
|
1100
|
-
💻 Create JavaScript Artifact
|
|
1101
|
-
</button>
|
|
1102
|
-
|
|
1103
|
-
<button
|
|
1104
|
-
onClick={checkState}
|
|
1105
|
-
style={{
|
|
1106
|
-
padding: '12px 20px',
|
|
1107
|
-
fontSize: '16px',
|
|
1108
|
-
cursor: 'pointer',
|
|
1109
|
-
backgroundColor: '#5b21b6',
|
|
1110
|
-
color: 'white',
|
|
1111
|
-
border: 'none',
|
|
1112
|
-
borderRadius: '8px',
|
|
1764
|
+
display: 'flex',
|
|
1765
|
+
flexDirection: 'column',
|
|
1766
|
+
gap: '12px',
|
|
1767
|
+
marginTop: '20px',
|
|
1113
1768
|
}}
|
|
1114
1769
|
>
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1770
|
+
<button
|
|
1771
|
+
onClick={createHTMLArtifact}
|
|
1772
|
+
style={{
|
|
1773
|
+
padding: '12px 20px',
|
|
1774
|
+
fontSize: '16px',
|
|
1775
|
+
cursor: 'pointer',
|
|
1776
|
+
backgroundColor: '#9333ea',
|
|
1777
|
+
color: 'white',
|
|
1778
|
+
border: 'none',
|
|
1779
|
+
borderRadius: '8px',
|
|
1780
|
+
}}
|
|
1781
|
+
>
|
|
1782
|
+
📄 Create HTML Artifact
|
|
1783
|
+
</button>
|
|
1784
|
+
|
|
1785
|
+
<button
|
|
1786
|
+
onClick={createMarkdownArtifact}
|
|
1787
|
+
style={{
|
|
1788
|
+
padding: '12px 20px',
|
|
1789
|
+
fontSize: '16px',
|
|
1790
|
+
cursor: 'pointer',
|
|
1791
|
+
backgroundColor: '#7c3aed',
|
|
1792
|
+
color: 'white',
|
|
1793
|
+
border: 'none',
|
|
1794
|
+
borderRadius: '8px',
|
|
1795
|
+
}}
|
|
1796
|
+
>
|
|
1797
|
+
📝 Create Markdown Artifact
|
|
1798
|
+
</button>
|
|
1799
|
+
|
|
1800
|
+
<button
|
|
1801
|
+
onClick={createJavaScriptArtifact}
|
|
1802
|
+
style={{
|
|
1803
|
+
padding: '12px 20px',
|
|
1804
|
+
fontSize: '16px',
|
|
1805
|
+
cursor: 'pointer',
|
|
1806
|
+
backgroundColor: '#6d28d9',
|
|
1807
|
+
color: 'white',
|
|
1808
|
+
border: 'none',
|
|
1809
|
+
borderRadius: '8px',
|
|
1810
|
+
}}
|
|
1811
|
+
>
|
|
1812
|
+
💻 Create JavaScript Artifact
|
|
1813
|
+
</button>
|
|
1814
|
+
|
|
1815
|
+
<button
|
|
1816
|
+
onClick={checkState}
|
|
1817
|
+
style={{
|
|
1818
|
+
padding: '12px 20px',
|
|
1819
|
+
fontSize: '16px',
|
|
1820
|
+
cursor: 'pointer',
|
|
1821
|
+
backgroundColor: '#5b21b6',
|
|
1822
|
+
color: 'white',
|
|
1823
|
+
border: 'none',
|
|
1824
|
+
borderRadius: '8px',
|
|
1825
|
+
}}
|
|
1826
|
+
>
|
|
1827
|
+
📊 Check Current State
|
|
1828
|
+
</button>
|
|
1829
|
+
|
|
1830
|
+
<button
|
|
1831
|
+
onClick={() => window.MemoriArtifactAPI?.closeArtifact()}
|
|
1832
|
+
style={{
|
|
1833
|
+
padding: '12px 20px',
|
|
1834
|
+
fontSize: '16px',
|
|
1835
|
+
cursor: 'pointer',
|
|
1836
|
+
backgroundColor: '#ef4444',
|
|
1837
|
+
color: 'white',
|
|
1838
|
+
border: 'none',
|
|
1839
|
+
borderRadius: '8px',
|
|
1840
|
+
}}
|
|
1841
|
+
>
|
|
1842
|
+
❌ Close Artifact
|
|
1843
|
+
</button>
|
|
1844
|
+
|
|
1845
|
+
<button
|
|
1846
|
+
onClick={() => window.MemoriArtifactAPI?.toggleFullscreen()}
|
|
1847
|
+
style={{
|
|
1848
|
+
padding: '12px 20px',
|
|
1849
|
+
fontSize: '16px',
|
|
1850
|
+
cursor: 'pointer',
|
|
1851
|
+
backgroundColor: '#3b82f6',
|
|
1852
|
+
color: 'white',
|
|
1853
|
+
border: 'none',
|
|
1854
|
+
borderRadius: '8px',
|
|
1855
|
+
}}
|
|
1856
|
+
>
|
|
1857
|
+
⛶ Toggle Fullscreen
|
|
1858
|
+
</button>
|
|
1859
|
+
</div>
|
|
1132
1860
|
|
|
1133
|
-
<
|
|
1134
|
-
onClick={() => window.MemoriArtifactAPI?.toggleFullscreen()}
|
|
1861
|
+
<div
|
|
1135
1862
|
style={{
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
backgroundColor: '#3b82f6',
|
|
1140
|
-
color: 'white',
|
|
1141
|
-
border: 'none',
|
|
1863
|
+
marginTop: '30px',
|
|
1864
|
+
padding: '15px',
|
|
1865
|
+
backgroundColor: '#f3f4f6',
|
|
1142
1866
|
borderRadius: '8px',
|
|
1143
1867
|
}}
|
|
1144
1868
|
>
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1869
|
+
<h3>💡 Console Commands</h3>
|
|
1870
|
+
<p>Try these in the browser console:</p>
|
|
1871
|
+
<pre
|
|
1872
|
+
style={{
|
|
1873
|
+
backgroundColor: 'white',
|
|
1874
|
+
padding: '10px',
|
|
1875
|
+
borderRadius: '4px',
|
|
1876
|
+
overflow: 'auto',
|
|
1877
|
+
}}
|
|
1878
|
+
>
|
|
1879
|
+
{`// Create an artifact
|
|
1154
1880
|
window.MemoriArtifactAPI.createAndOpenArtifact(
|
|
1155
1881
|
'<h1>Test</h1>',
|
|
1156
1882
|
'html',
|
|
@@ -1162,8 +1888,8 @@ window.MemoriArtifactAPI.getState();
|
|
|
1162
1888
|
|
|
1163
1889
|
// Close
|
|
1164
1890
|
window.MemoriArtifactAPI.closeArtifact();`}
|
|
1165
|
-
|
|
1166
|
-
|
|
1891
|
+
</pre>
|
|
1892
|
+
</div>
|
|
1167
1893
|
</div>
|
|
1168
1894
|
</>
|
|
1169
1895
|
);
|
|
@@ -1180,9 +1906,13 @@ export const APIBridge_ProcessOutputElements: Story = {
|
|
|
1180
1906
|
const { state } = useArtifact();
|
|
1181
1907
|
|
|
1182
1908
|
const createFromOutput = () => {
|
|
1183
|
-
const outputs = document.querySelectorAll(
|
|
1184
|
-
|
|
1185
|
-
|
|
1909
|
+
const outputs = document.querySelectorAll(
|
|
1910
|
+
'.memori-artifact[data-sample="true"]'
|
|
1911
|
+
);
|
|
1912
|
+
outputs.forEach(output => {
|
|
1913
|
+
const artifactId = window.MemoriArtifactAPI?.createFromOutputElement(
|
|
1914
|
+
output as HTMLOutputElement
|
|
1915
|
+
);
|
|
1186
1916
|
console.log('Created artifact:', artifactId);
|
|
1187
1917
|
});
|
|
1188
1918
|
alert(`Processed ${outputs.length} artifacts. Check console for IDs.`);
|
|
@@ -1211,77 +1941,116 @@ export const APIBridge_ProcessOutputElements: Story = {
|
|
|
1211
1941
|
<>
|
|
1212
1942
|
{/* Conditionally render ArtifactDrawer to avoid hooks error */}
|
|
1213
1943
|
{state.isDrawerOpen && <ArtifactDrawer />}
|
|
1214
|
-
|
|
1944
|
+
|
|
1215
1945
|
<div style={{ padding: '20px', maxWidth: '800px', margin: '0 auto' }}>
|
|
1216
1946
|
<h1>🔄 Process Output Elements</h1>
|
|
1217
1947
|
<p>
|
|
1218
|
-
This story demonstrates processing
|
|
1219
|
-
|
|
1948
|
+
This story demonstrates processing{' '}
|
|
1949
|
+
<code><output class="memori-artifact"></code>{' '}
|
|
1950
|
+
elements using <code>createFromOutputElement</code>.
|
|
1220
1951
|
</p>
|
|
1221
1952
|
|
|
1222
|
-
|
|
1223
|
-
<button
|
|
1224
|
-
onClick={createFromOutput}
|
|
1225
|
-
style={{
|
|
1226
|
-
padding: '12px 20px',
|
|
1227
|
-
fontSize: '16px',
|
|
1228
|
-
cursor: 'pointer',
|
|
1229
|
-
backgroundColor: '#9333ea',
|
|
1230
|
-
color: 'white',
|
|
1231
|
-
border: 'none',
|
|
1232
|
-
borderRadius: '8px',
|
|
1233
|
-
}}
|
|
1234
|
-
>
|
|
1235
|
-
🔍 Create From Output Elements
|
|
1236
|
-
</button>
|
|
1237
|
-
|
|
1238
|
-
<button
|
|
1239
|
-
onClick={addDynamicOutput}
|
|
1953
|
+
<div
|
|
1240
1954
|
style={{
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
color: 'white',
|
|
1246
|
-
border: 'none',
|
|
1247
|
-
borderRadius: '8px',
|
|
1955
|
+
display: 'flex',
|
|
1956
|
+
flexDirection: 'column',
|
|
1957
|
+
gap: '12px',
|
|
1958
|
+
marginTop: '20px',
|
|
1248
1959
|
}}
|
|
1249
1960
|
>
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1961
|
+
<button
|
|
1962
|
+
onClick={createFromOutput}
|
|
1963
|
+
style={{
|
|
1964
|
+
padding: '12px 20px',
|
|
1965
|
+
fontSize: '16px',
|
|
1966
|
+
cursor: 'pointer',
|
|
1967
|
+
backgroundColor: '#9333ea',
|
|
1968
|
+
color: 'white',
|
|
1969
|
+
border: 'none',
|
|
1970
|
+
borderRadius: '8px',
|
|
1971
|
+
}}
|
|
1972
|
+
>
|
|
1973
|
+
🔍 Create From Output Elements
|
|
1974
|
+
</button>
|
|
1975
|
+
|
|
1976
|
+
<button
|
|
1977
|
+
onClick={addDynamicOutput}
|
|
1978
|
+
style={{
|
|
1979
|
+
padding: '12px 20px',
|
|
1980
|
+
fontSize: '16px',
|
|
1981
|
+
cursor: 'pointer',
|
|
1982
|
+
backgroundColor: '#7c3aed',
|
|
1983
|
+
color: 'white',
|
|
1984
|
+
border: 'none',
|
|
1985
|
+
borderRadius: '8px',
|
|
1986
|
+
}}
|
|
1987
|
+
>
|
|
1988
|
+
➕ Add Dynamic Output
|
|
1989
|
+
</button>
|
|
1990
|
+
</div>
|
|
1263
1991
|
|
|
1264
|
-
<
|
|
1265
|
-
|
|
1992
|
+
<div id="dynamic-container" style={{ marginTop: '30px' }}>
|
|
1993
|
+
<h3>Existing Output Elements:</h3>
|
|
1994
|
+
|
|
1995
|
+
<output
|
|
1996
|
+
className="memori-artifact"
|
|
1997
|
+
data-mimetype="html"
|
|
1998
|
+
data-title="Sample HTML"
|
|
1999
|
+
data-sample="true"
|
|
2000
|
+
>
|
|
2001
|
+
<div
|
|
2002
|
+
style={{
|
|
2003
|
+
padding: '15px',
|
|
2004
|
+
border: '2px solid #9333ea',
|
|
2005
|
+
borderRadius: '8px',
|
|
2006
|
+
}}
|
|
2007
|
+
>
|
|
2008
|
+
<h3>Sample Artifact 1</h3>
|
|
2009
|
+
<p>This is a static output element in the DOM.</p>
|
|
2010
|
+
</div>
|
|
2011
|
+
</output>
|
|
2012
|
+
|
|
2013
|
+
<output
|
|
2014
|
+
className="memori-artifact"
|
|
2015
|
+
data-mimetype="markdown"
|
|
2016
|
+
data-title="Sample Markdown"
|
|
2017
|
+
data-sample="true"
|
|
2018
|
+
>
|
|
2019
|
+
{`# Sample Markdown
|
|
1266
2020
|
|
|
1267
2021
|
This is **another** static output element.
|
|
1268
2022
|
|
|
1269
2023
|
- Item 1
|
|
1270
2024
|
- Item 2
|
|
1271
2025
|
- Item 3`}
|
|
1272
|
-
|
|
1273
|
-
|
|
2026
|
+
</output>
|
|
2027
|
+
</div>
|
|
1274
2028
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
2029
|
+
<div
|
|
2030
|
+
style={{
|
|
2031
|
+
marginTop: '30px',
|
|
2032
|
+
padding: '15px',
|
|
2033
|
+
backgroundColor: '#f3f4f6',
|
|
2034
|
+
borderRadius: '8px',
|
|
2035
|
+
}}
|
|
2036
|
+
>
|
|
2037
|
+
<h3>💡 How it works</h3>
|
|
2038
|
+
<ol>
|
|
2039
|
+
<li>
|
|
2040
|
+
Click "Create From Output Elements" to process{' '}
|
|
2041
|
+
<code><output></code> elements
|
|
2042
|
+
</li>
|
|
2043
|
+
<li>
|
|
2044
|
+
Each element gets converted to an artifact and added to
|
|
2045
|
+
history
|
|
2046
|
+
</li>
|
|
2047
|
+
<li>
|
|
2048
|
+
Click "Add Dynamic Output" to inject a new element
|
|
2049
|
+
</li>
|
|
2050
|
+
<li>Process again to handle the new element</li>
|
|
2051
|
+
<li>The artifacts will appear in the chat history</li>
|
|
2052
|
+
</ol>
|
|
2053
|
+
</div>
|
|
1285
2054
|
</div>
|
|
1286
2055
|
</>
|
|
1287
2056
|
);
|
|
@@ -1332,7 +2101,10 @@ export const APIBridge_WebSocketSimulation: Story = {
|
|
|
1332
2101
|
const messageHTML = `
|
|
1333
2102
|
<div style="padding: 10px; margin: 10px 0; background: #f9fafb; border-radius: 8px;">
|
|
1334
2103
|
<p><strong>Bot:</strong> I've created a visualization for you. Click the artifact card to view it.</p>
|
|
1335
|
-
<div style="padding: 10px; margin-top: 10px; background: #e0e7ff; border-radius: 4px; cursor: pointer;" onclick="window.MemoriArtifactAPI?.createAndOpenArtifact(\`${artifactContent.replace(
|
|
2104
|
+
<div style="padding: 10px; margin-top: 10px; background: #e0e7ff; border-radius: 4px; cursor: pointer;" onclick="window.MemoriArtifactAPI?.createAndOpenArtifact(\`${artifactContent.replace(
|
|
2105
|
+
/`/g,
|
|
2106
|
+
'\\`'
|
|
2107
|
+
)}\`, 'html', 'Data Visualization')">
|
|
1336
2108
|
📊 Data Visualization
|
|
1337
2109
|
</div>
|
|
1338
2110
|
</div>
|
|
@@ -1346,7 +2118,8 @@ export const APIBridge_WebSocketSimulation: Story = {
|
|
|
1346
2118
|
const clearChat = () => {
|
|
1347
2119
|
const chatContainer = document.getElementById('chat-simulation');
|
|
1348
2120
|
if (chatContainer) {
|
|
1349
|
-
chatContainer.innerHTML =
|
|
2121
|
+
chatContainer.innerHTML =
|
|
2122
|
+
'<p style="color: #6b7280;">Chat cleared. Click "Simulate WebSocket Message" to add new content.</p>';
|
|
1350
2123
|
}
|
|
1351
2124
|
};
|
|
1352
2125
|
|
|
@@ -1354,64 +2127,83 @@ export const APIBridge_WebSocketSimulation: Story = {
|
|
|
1354
2127
|
<>
|
|
1355
2128
|
{/* Conditionally render ArtifactDrawer to avoid hooks error */}
|
|
1356
2129
|
{state.isDrawerOpen && <ArtifactDrawer />}
|
|
1357
|
-
|
|
2130
|
+
|
|
1358
2131
|
<div style={{ padding: '20px', maxWidth: '900px', margin: '0 auto' }}>
|
|
1359
2132
|
<h1>🌐 WebSocket Integration Simulation</h1>
|
|
1360
2133
|
<p>
|
|
1361
|
-
This demonstrates how <code>createAndOpenArtifact</code> can be
|
|
1362
|
-
to create artifacts from
|
|
2134
|
+
This demonstrates how <code>createAndOpenArtifact</code> can be
|
|
2135
|
+
used with WebSocket or Action Cable to create artifacts from
|
|
2136
|
+
messages received dynamically.
|
|
1363
2137
|
</p>
|
|
1364
2138
|
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
2139
|
+
<div style={{ display: 'flex', gap: '12px', marginTop: '20px' }}>
|
|
2140
|
+
<button
|
|
2141
|
+
onClick={simulateWebSocket}
|
|
2142
|
+
style={{
|
|
2143
|
+
padding: '12px 20px',
|
|
2144
|
+
fontSize: '16px',
|
|
2145
|
+
cursor: 'pointer',
|
|
2146
|
+
backgroundColor: '#9333ea',
|
|
2147
|
+
color: 'white',
|
|
2148
|
+
border: 'none',
|
|
2149
|
+
borderRadius: '8px',
|
|
2150
|
+
}}
|
|
2151
|
+
>
|
|
2152
|
+
📡 Simulate WebSocket Message
|
|
2153
|
+
</button>
|
|
2154
|
+
|
|
2155
|
+
<button
|
|
2156
|
+
onClick={clearChat}
|
|
2157
|
+
style={{
|
|
2158
|
+
padding: '12px 20px',
|
|
2159
|
+
fontSize: '16px',
|
|
2160
|
+
cursor: 'pointer',
|
|
2161
|
+
backgroundColor: '#64748b',
|
|
2162
|
+
color: 'white',
|
|
2163
|
+
border: 'none',
|
|
2164
|
+
borderRadius: '8px',
|
|
2165
|
+
}}
|
|
2166
|
+
>
|
|
2167
|
+
🗑️ Clear Chat
|
|
2168
|
+
</button>
|
|
2169
|
+
</div>
|
|
2170
|
+
|
|
2171
|
+
<div
|
|
2172
|
+
id="chat-simulation"
|
|
1368
2173
|
style={{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
borderRadius: '8px',
|
|
2174
|
+
marginTop: '30px',
|
|
2175
|
+
padding: '20px',
|
|
2176
|
+
backgroundColor: 'white',
|
|
2177
|
+
border: '1px solid #e5e7eb',
|
|
2178
|
+
borderRadius: '12px',
|
|
2179
|
+
minHeight: '200px',
|
|
1376
2180
|
}}
|
|
1377
2181
|
>
|
|
1378
|
-
|
|
1379
|
-
|
|
2182
|
+
<p style={{ color: '#6b7280' }}>
|
|
2183
|
+
Click "Simulate WebSocket Message" to receive a
|
|
2184
|
+
message with an artifact...
|
|
2185
|
+
</p>
|
|
2186
|
+
</div>
|
|
1380
2187
|
|
|
1381
|
-
<
|
|
1382
|
-
onClick={clearChat}
|
|
2188
|
+
<div
|
|
1383
2189
|
style={{
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
backgroundColor: '#64748b',
|
|
1388
|
-
color: 'white',
|
|
1389
|
-
border: 'none',
|
|
2190
|
+
marginTop: '30px',
|
|
2191
|
+
padding: '15px',
|
|
2192
|
+
backgroundColor: '#f3f4f6',
|
|
1390
2193
|
borderRadius: '8px',
|
|
1391
2194
|
}}
|
|
1392
2195
|
>
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
borderRadius: '12px',
|
|
1405
|
-
minHeight: '200px',
|
|
1406
|
-
}}
|
|
1407
|
-
>
|
|
1408
|
-
<p style={{ color: '#6b7280' }}>Click "Simulate WebSocket Message" to receive a message with an artifact...</p>
|
|
1409
|
-
</div>
|
|
1410
|
-
|
|
1411
|
-
<div style={{ marginTop: '30px', padding: '15px', backgroundColor: '#f3f4f6', borderRadius: '8px' }}>
|
|
1412
|
-
<h3>💡 Implementation Example</h3>
|
|
1413
|
-
<pre style={{ backgroundColor: 'white', padding: '10px', borderRadius: '4px', overflow: 'auto', fontSize: '13px' }}>
|
|
1414
|
-
{`// Rails Action Cable
|
|
2196
|
+
<h3>💡 Implementation Example</h3>
|
|
2197
|
+
<pre
|
|
2198
|
+
style={{
|
|
2199
|
+
backgroundColor: 'white',
|
|
2200
|
+
padding: '10px',
|
|
2201
|
+
borderRadius: '4px',
|
|
2202
|
+
overflow: 'auto',
|
|
2203
|
+
fontSize: '13px',
|
|
2204
|
+
}}
|
|
2205
|
+
>
|
|
2206
|
+
{`// Rails Action Cable
|
|
1415
2207
|
consumer.subscriptions.create("ChatChannel", {
|
|
1416
2208
|
received(data) {
|
|
1417
2209
|
if (data.artifact) {
|
|
@@ -1424,8 +2216,8 @@ consumer.subscriptions.create("ChatChannel", {
|
|
|
1424
2216
|
}
|
|
1425
2217
|
}
|
|
1426
2218
|
});`}
|
|
1427
|
-
|
|
1428
|
-
|
|
2219
|
+
</pre>
|
|
2220
|
+
</div>
|
|
1429
2221
|
</div>
|
|
1430
2222
|
</>
|
|
1431
2223
|
);
|