@aparte/svelte 0.3.0-alpha.0 → 0.4.0-alpha.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/dist/index.js +289 -201
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponent, init, safe_not_equal, compute_slots, ensure_array_like, create_slot, detach, transition_out, transition_in, group_outros, check_outros, update_keyed_each, outro_and_destroy_block, set_custom_element_data, update_slot_base, get_all_dirty_from_scope, get_slot_changes, attr, toggle_class, insert, append, listen, element, space, binding_callbacks, empty, noop, set_style } from "svelte/internal";
|
|
2
2
|
import "svelte/internal/disclose-version";
|
|
3
3
|
import { createEventDispatcher, onMount, onDestroy, tick } from "svelte";
|
|
4
|
-
import { AparteChatHost, AparteClient, ConversationManager, AparteConfig, DEFAULT_UI_EVENTS, applyElementProps } from "@aparte/core";
|
|
4
|
+
import { AparteChatHost, isAwaitingReply, AparteClient, ConversationManager, AparteConfig, DEFAULT_UI_EVENTS, applyElementProps } from "@aparte/core";
|
|
5
5
|
import { writable, derived } from "svelte/store";
|
|
6
6
|
const get_footer_right_slot_changes = (dirty) => ({});
|
|
7
7
|
const get_footer_right_slot_context = (ctx) => ({});
|
|
@@ -15,30 +15,30 @@ const get_above_composer_slot_changes = (dirty) => ({});
|
|
|
15
15
|
const get_above_composer_slot_context = (ctx) => ({});
|
|
16
16
|
function get_each_context(ctx, list, i) {
|
|
17
17
|
const child_ctx = ctx.slice();
|
|
18
|
-
child_ctx[
|
|
18
|
+
child_ctx[52] = list[i];
|
|
19
19
|
return child_ctx;
|
|
20
20
|
}
|
|
21
21
|
const get_bubble_slot_changes = (dirty) => ({
|
|
22
22
|
message: dirty[0] & /*internalMessages*/
|
|
23
|
-
|
|
23
|
+
32
|
|
24
24
|
});
|
|
25
25
|
const get_bubble_slot_context = (ctx) => ({ message: (
|
|
26
26
|
/*m*/
|
|
27
|
-
ctx[
|
|
27
|
+
ctx[52]
|
|
28
28
|
) });
|
|
29
29
|
const get_empty_state_slot_changes = (dirty) => ({});
|
|
30
30
|
const get_empty_state_slot_context = (ctx) => ({});
|
|
31
|
-
function
|
|
31
|
+
function create_if_block_3(ctx) {
|
|
32
32
|
let current;
|
|
33
33
|
const empty_state_slot_template = (
|
|
34
34
|
/*#slots*/
|
|
35
|
-
ctx[
|
|
35
|
+
ctx[44]["empty-state"]
|
|
36
36
|
);
|
|
37
37
|
const empty_state_slot = create_slot(
|
|
38
38
|
empty_state_slot_template,
|
|
39
39
|
ctx,
|
|
40
40
|
/*$$scope*/
|
|
41
|
-
ctx[
|
|
41
|
+
ctx[43],
|
|
42
42
|
get_empty_state_slot_context
|
|
43
43
|
);
|
|
44
44
|
return {
|
|
@@ -54,20 +54,20 @@ function create_if_block_1(ctx) {
|
|
|
54
54
|
p(ctx2, dirty) {
|
|
55
55
|
if (empty_state_slot) {
|
|
56
56
|
if (empty_state_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
57
|
-
|
|
57
|
+
4096)) {
|
|
58
58
|
update_slot_base(
|
|
59
59
|
empty_state_slot,
|
|
60
60
|
empty_state_slot_template,
|
|
61
61
|
ctx2,
|
|
62
62
|
/*$$scope*/
|
|
63
|
-
ctx2[
|
|
63
|
+
ctx2[43],
|
|
64
64
|
!current ? get_all_dirty_from_scope(
|
|
65
65
|
/*$$scope*/
|
|
66
|
-
ctx2[
|
|
66
|
+
ctx2[43]
|
|
67
67
|
) : get_slot_changes(
|
|
68
68
|
empty_state_slot_template,
|
|
69
69
|
/*$$scope*/
|
|
70
|
-
ctx2[
|
|
70
|
+
ctx2[43],
|
|
71
71
|
dirty,
|
|
72
72
|
get_empty_state_slot_changes
|
|
73
73
|
),
|
|
@@ -101,45 +101,47 @@ function fallback_block_1(ctx) {
|
|
|
101
101
|
c() {
|
|
102
102
|
aparte_chat_bubble = element("aparte-chat-bubble");
|
|
103
103
|
set_custom_element_data(aparte_chat_bubble, "message-id", aparte_chat_bubble_message_id_value = /*m*/
|
|
104
|
-
ctx[
|
|
104
|
+
ctx[52].id);
|
|
105
105
|
set_custom_element_data(aparte_chat_bubble, "data-role", aparte_chat_bubble_data_role_value = /*m*/
|
|
106
|
-
ctx[
|
|
106
|
+
ctx[52].role);
|
|
107
107
|
set_custom_element_data(aparte_chat_bubble, "timestamp", aparte_chat_bubble_timestamp_value = /*m*/
|
|
108
|
-
ctx[
|
|
108
|
+
ctx[52].timestamp);
|
|
109
109
|
set_custom_element_data(aparte_chat_bubble, "content", aparte_chat_bubble_content_value = /*m*/
|
|
110
|
-
ctx[
|
|
111
|
-
set_custom_element_data(aparte_chat_bubble, "streaming", aparte_chat_bubble_streaming_value =
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
ctx[52].content);
|
|
111
|
+
set_custom_element_data(aparte_chat_bubble, "streaming", aparte_chat_bubble_streaming_value = isAwaitingReply(
|
|
112
|
+
/*m*/
|
|
113
|
+
ctx[52]
|
|
114
|
+
) ? "" : null);
|
|
114
115
|
},
|
|
115
116
|
m(target, anchor) {
|
|
116
117
|
insert(target, aparte_chat_bubble, anchor);
|
|
117
118
|
},
|
|
118
119
|
p(ctx2, dirty) {
|
|
119
120
|
if (dirty[0] & /*internalMessages*/
|
|
120
|
-
|
|
121
|
-
ctx2[
|
|
121
|
+
32 && aparte_chat_bubble_message_id_value !== (aparte_chat_bubble_message_id_value = /*m*/
|
|
122
|
+
ctx2[52].id)) {
|
|
122
123
|
set_custom_element_data(aparte_chat_bubble, "message-id", aparte_chat_bubble_message_id_value);
|
|
123
124
|
}
|
|
124
125
|
if (dirty[0] & /*internalMessages*/
|
|
125
|
-
|
|
126
|
-
ctx2[
|
|
126
|
+
32 && aparte_chat_bubble_data_role_value !== (aparte_chat_bubble_data_role_value = /*m*/
|
|
127
|
+
ctx2[52].role)) {
|
|
127
128
|
set_custom_element_data(aparte_chat_bubble, "data-role", aparte_chat_bubble_data_role_value);
|
|
128
129
|
}
|
|
129
130
|
if (dirty[0] & /*internalMessages*/
|
|
130
|
-
|
|
131
|
-
ctx2[
|
|
131
|
+
32 && aparte_chat_bubble_timestamp_value !== (aparte_chat_bubble_timestamp_value = /*m*/
|
|
132
|
+
ctx2[52].timestamp)) {
|
|
132
133
|
set_custom_element_data(aparte_chat_bubble, "timestamp", aparte_chat_bubble_timestamp_value);
|
|
133
134
|
}
|
|
134
135
|
if (dirty[0] & /*internalMessages*/
|
|
135
|
-
|
|
136
|
-
ctx2[
|
|
136
|
+
32 && aparte_chat_bubble_content_value !== (aparte_chat_bubble_content_value = /*m*/
|
|
137
|
+
ctx2[52].content)) {
|
|
137
138
|
set_custom_element_data(aparte_chat_bubble, "content", aparte_chat_bubble_content_value);
|
|
138
139
|
}
|
|
139
140
|
if (dirty[0] & /*internalMessages*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
32 && aparte_chat_bubble_streaming_value !== (aparte_chat_bubble_streaming_value = isAwaitingReply(
|
|
142
|
+
/*m*/
|
|
143
|
+
ctx2[52]
|
|
144
|
+
) ? "" : null)) {
|
|
143
145
|
set_custom_element_data(aparte_chat_bubble, "streaming", aparte_chat_bubble_streaming_value);
|
|
144
146
|
}
|
|
145
147
|
},
|
|
@@ -155,13 +157,13 @@ function create_each_block(key_1, ctx) {
|
|
|
155
157
|
let current;
|
|
156
158
|
const bubble_slot_template = (
|
|
157
159
|
/*#slots*/
|
|
158
|
-
ctx[
|
|
160
|
+
ctx[44].bubble
|
|
159
161
|
);
|
|
160
162
|
const bubble_slot = create_slot(
|
|
161
163
|
bubble_slot_template,
|
|
162
164
|
ctx,
|
|
163
165
|
/*$$scope*/
|
|
164
|
-
ctx[
|
|
166
|
+
ctx[43],
|
|
165
167
|
get_bubble_slot_context
|
|
166
168
|
);
|
|
167
169
|
const bubble_slot_or_fallback = bubble_slot || fallback_block_1(ctx);
|
|
@@ -184,21 +186,21 @@ function create_each_block(key_1, ctx) {
|
|
|
184
186
|
ctx = new_ctx;
|
|
185
187
|
if (bubble_slot) {
|
|
186
188
|
if (bubble_slot.p && (!current || dirty[0] & /*internalMessages*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
32 | dirty[1] & /*$$scope*/
|
|
190
|
+
4096)) {
|
|
189
191
|
update_slot_base(
|
|
190
192
|
bubble_slot,
|
|
191
193
|
bubble_slot_template,
|
|
192
194
|
ctx,
|
|
193
195
|
/*$$scope*/
|
|
194
|
-
ctx[
|
|
196
|
+
ctx[43],
|
|
195
197
|
!current ? get_all_dirty_from_scope(
|
|
196
198
|
/*$$scope*/
|
|
197
|
-
ctx[
|
|
199
|
+
ctx[43]
|
|
198
200
|
) : get_slot_changes(
|
|
199
201
|
bubble_slot_template,
|
|
200
202
|
/*$$scope*/
|
|
201
|
-
ctx[
|
|
203
|
+
ctx[43],
|
|
202
204
|
dirty,
|
|
203
205
|
get_bubble_slot_changes
|
|
204
206
|
),
|
|
@@ -207,7 +209,7 @@ function create_each_block(key_1, ctx) {
|
|
|
207
209
|
}
|
|
208
210
|
} else {
|
|
209
211
|
if (bubble_slot_or_fallback && bubble_slot_or_fallback.p && (!current || dirty[0] & /*internalMessages*/
|
|
210
|
-
|
|
212
|
+
32)) {
|
|
211
213
|
bubble_slot_or_fallback.p(ctx, !current ? [-1, -1] : dirty);
|
|
212
214
|
}
|
|
213
215
|
}
|
|
@@ -229,6 +231,38 @@ function create_each_block(key_1, ctx) {
|
|
|
229
231
|
}
|
|
230
232
|
};
|
|
231
233
|
}
|
|
234
|
+
function create_if_block_2(ctx) {
|
|
235
|
+
let aparte_composer_attachments;
|
|
236
|
+
return {
|
|
237
|
+
c() {
|
|
238
|
+
aparte_composer_attachments = element("aparte-composer-attachments");
|
|
239
|
+
},
|
|
240
|
+
m(target, anchor) {
|
|
241
|
+
insert(target, aparte_composer_attachments, anchor);
|
|
242
|
+
},
|
|
243
|
+
d(detaching) {
|
|
244
|
+
if (detaching) {
|
|
245
|
+
detach(aparte_composer_attachments);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function create_if_block_1(ctx) {
|
|
251
|
+
let aparte_composer_add_attachment;
|
|
252
|
+
return {
|
|
253
|
+
c() {
|
|
254
|
+
aparte_composer_add_attachment = element("aparte-composer-add-attachment");
|
|
255
|
+
},
|
|
256
|
+
m(target, anchor) {
|
|
257
|
+
insert(target, aparte_composer_add_attachment, anchor);
|
|
258
|
+
},
|
|
259
|
+
d(detaching) {
|
|
260
|
+
if (detaching) {
|
|
261
|
+
detach(aparte_composer_add_attachment);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
}
|
|
232
266
|
function create_if_block(ctx) {
|
|
233
267
|
let div;
|
|
234
268
|
let t0;
|
|
@@ -236,35 +270,35 @@ function create_if_block(ctx) {
|
|
|
236
270
|
let current;
|
|
237
271
|
const footer_left_slot_template = (
|
|
238
272
|
/*#slots*/
|
|
239
|
-
ctx[
|
|
273
|
+
ctx[44]["footer-left"]
|
|
240
274
|
);
|
|
241
275
|
const footer_left_slot = create_slot(
|
|
242
276
|
footer_left_slot_template,
|
|
243
277
|
ctx,
|
|
244
278
|
/*$$scope*/
|
|
245
|
-
ctx[
|
|
279
|
+
ctx[43],
|
|
246
280
|
get_footer_left_slot_context
|
|
247
281
|
);
|
|
248
282
|
const footer_center_slot_template = (
|
|
249
283
|
/*#slots*/
|
|
250
|
-
ctx[
|
|
284
|
+
ctx[44]["footer-center"]
|
|
251
285
|
);
|
|
252
286
|
const footer_center_slot = create_slot(
|
|
253
287
|
footer_center_slot_template,
|
|
254
288
|
ctx,
|
|
255
289
|
/*$$scope*/
|
|
256
|
-
ctx[
|
|
290
|
+
ctx[43],
|
|
257
291
|
get_footer_center_slot_context
|
|
258
292
|
);
|
|
259
293
|
const footer_right_slot_template = (
|
|
260
294
|
/*#slots*/
|
|
261
|
-
ctx[
|
|
295
|
+
ctx[44]["footer-right"]
|
|
262
296
|
);
|
|
263
297
|
const footer_right_slot = create_slot(
|
|
264
298
|
footer_right_slot_template,
|
|
265
299
|
ctx,
|
|
266
300
|
/*$$scope*/
|
|
267
|
-
ctx[
|
|
301
|
+
ctx[43],
|
|
268
302
|
get_footer_right_slot_context
|
|
269
303
|
);
|
|
270
304
|
return {
|
|
@@ -295,20 +329,20 @@ function create_if_block(ctx) {
|
|
|
295
329
|
p(ctx2, dirty) {
|
|
296
330
|
if (footer_left_slot) {
|
|
297
331
|
if (footer_left_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
298
|
-
|
|
332
|
+
4096)) {
|
|
299
333
|
update_slot_base(
|
|
300
334
|
footer_left_slot,
|
|
301
335
|
footer_left_slot_template,
|
|
302
336
|
ctx2,
|
|
303
337
|
/*$$scope*/
|
|
304
|
-
ctx2[
|
|
338
|
+
ctx2[43],
|
|
305
339
|
!current ? get_all_dirty_from_scope(
|
|
306
340
|
/*$$scope*/
|
|
307
|
-
ctx2[
|
|
341
|
+
ctx2[43]
|
|
308
342
|
) : get_slot_changes(
|
|
309
343
|
footer_left_slot_template,
|
|
310
344
|
/*$$scope*/
|
|
311
|
-
ctx2[
|
|
345
|
+
ctx2[43],
|
|
312
346
|
dirty,
|
|
313
347
|
get_footer_left_slot_changes
|
|
314
348
|
),
|
|
@@ -318,20 +352,20 @@ function create_if_block(ctx) {
|
|
|
318
352
|
}
|
|
319
353
|
if (footer_center_slot) {
|
|
320
354
|
if (footer_center_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
321
|
-
|
|
355
|
+
4096)) {
|
|
322
356
|
update_slot_base(
|
|
323
357
|
footer_center_slot,
|
|
324
358
|
footer_center_slot_template,
|
|
325
359
|
ctx2,
|
|
326
360
|
/*$$scope*/
|
|
327
|
-
ctx2[
|
|
361
|
+
ctx2[43],
|
|
328
362
|
!current ? get_all_dirty_from_scope(
|
|
329
363
|
/*$$scope*/
|
|
330
|
-
ctx2[
|
|
364
|
+
ctx2[43]
|
|
331
365
|
) : get_slot_changes(
|
|
332
366
|
footer_center_slot_template,
|
|
333
367
|
/*$$scope*/
|
|
334
|
-
ctx2[
|
|
368
|
+
ctx2[43],
|
|
335
369
|
dirty,
|
|
336
370
|
get_footer_center_slot_changes
|
|
337
371
|
),
|
|
@@ -341,20 +375,20 @@ function create_if_block(ctx) {
|
|
|
341
375
|
}
|
|
342
376
|
if (footer_right_slot) {
|
|
343
377
|
if (footer_right_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
344
|
-
|
|
378
|
+
4096)) {
|
|
345
379
|
update_slot_base(
|
|
346
380
|
footer_right_slot,
|
|
347
381
|
footer_right_slot_template,
|
|
348
382
|
ctx2,
|
|
349
383
|
/*$$scope*/
|
|
350
|
-
ctx2[
|
|
384
|
+
ctx2[43],
|
|
351
385
|
!current ? get_all_dirty_from_scope(
|
|
352
386
|
/*$$scope*/
|
|
353
|
-
ctx2[
|
|
387
|
+
ctx2[43]
|
|
354
388
|
) : get_slot_changes(
|
|
355
389
|
footer_right_slot_template,
|
|
356
390
|
/*$$scope*/
|
|
357
|
-
ctx2[
|
|
391
|
+
ctx2[43],
|
|
358
392
|
dirty,
|
|
359
393
|
get_footer_right_slot_changes
|
|
360
394
|
),
|
|
@@ -388,79 +422,129 @@ function create_if_block(ctx) {
|
|
|
388
422
|
}
|
|
389
423
|
function fallback_block(ctx) {
|
|
390
424
|
let div1;
|
|
391
|
-
let aparte_composer_attachments;
|
|
392
425
|
let t0;
|
|
393
426
|
let div0;
|
|
427
|
+
let t1;
|
|
428
|
+
let aparte_composer_input;
|
|
429
|
+
let t2;
|
|
430
|
+
let aparte_composer_send;
|
|
394
431
|
let t3;
|
|
395
432
|
let current;
|
|
396
|
-
let
|
|
433
|
+
let if_block0 = (
|
|
434
|
+
/*attachments*/
|
|
435
|
+
ctx[2] && create_if_block_2()
|
|
436
|
+
);
|
|
437
|
+
let if_block1 = (
|
|
438
|
+
/*attachments*/
|
|
439
|
+
ctx[2] && create_if_block_1()
|
|
440
|
+
);
|
|
441
|
+
let if_block2 = (
|
|
397
442
|
/*$$slots*/
|
|
398
|
-
(ctx[
|
|
399
|
-
ctx[
|
|
400
|
-
ctx[
|
|
443
|
+
(ctx[10]["footer-left"] || /*$$slots*/
|
|
444
|
+
ctx[10]["footer-center"] || /*$$slots*/
|
|
445
|
+
ctx[10]["footer-right"]) && create_if_block(ctx)
|
|
401
446
|
);
|
|
402
447
|
return {
|
|
403
448
|
c() {
|
|
404
449
|
div1 = element("div");
|
|
405
|
-
|
|
450
|
+
if (if_block0) if_block0.c();
|
|
406
451
|
t0 = space();
|
|
407
452
|
div0 = element("div");
|
|
408
|
-
|
|
453
|
+
if (if_block1) if_block1.c();
|
|
454
|
+
t1 = space();
|
|
455
|
+
aparte_composer_input = element("aparte-composer-input");
|
|
456
|
+
t2 = space();
|
|
457
|
+
aparte_composer_send = element("aparte-composer-send");
|
|
409
458
|
t3 = space();
|
|
410
|
-
if (
|
|
459
|
+
if (if_block2) if_block2.c();
|
|
411
460
|
attr(div0, "class", "aparte-composer-row");
|
|
412
461
|
attr(div1, "class", "aparte-composer-shell");
|
|
413
462
|
},
|
|
414
463
|
m(target, anchor) {
|
|
415
464
|
insert(target, div1, anchor);
|
|
416
|
-
|
|
465
|
+
if (if_block0) if_block0.m(div1, null);
|
|
417
466
|
append(div1, t0);
|
|
418
467
|
append(div1, div0);
|
|
468
|
+
if (if_block1) if_block1.m(div0, null);
|
|
469
|
+
append(div0, t1);
|
|
470
|
+
append(div0, aparte_composer_input);
|
|
471
|
+
append(div0, t2);
|
|
472
|
+
append(div0, aparte_composer_send);
|
|
419
473
|
append(div1, t3);
|
|
420
|
-
if (
|
|
474
|
+
if (if_block2) if_block2.m(div1, null);
|
|
421
475
|
current = true;
|
|
422
476
|
},
|
|
423
477
|
p(ctx2, dirty) {
|
|
478
|
+
if (
|
|
479
|
+
/*attachments*/
|
|
480
|
+
ctx2[2]
|
|
481
|
+
) {
|
|
482
|
+
if (if_block0) ;
|
|
483
|
+
else {
|
|
484
|
+
if_block0 = create_if_block_2();
|
|
485
|
+
if_block0.c();
|
|
486
|
+
if_block0.m(div1, t0);
|
|
487
|
+
}
|
|
488
|
+
} else if (if_block0) {
|
|
489
|
+
if_block0.d(1);
|
|
490
|
+
if_block0 = null;
|
|
491
|
+
}
|
|
492
|
+
if (
|
|
493
|
+
/*attachments*/
|
|
494
|
+
ctx2[2]
|
|
495
|
+
) {
|
|
496
|
+
if (if_block1) ;
|
|
497
|
+
else {
|
|
498
|
+
if_block1 = create_if_block_1();
|
|
499
|
+
if_block1.c();
|
|
500
|
+
if_block1.m(div0, t1);
|
|
501
|
+
}
|
|
502
|
+
} else if (if_block1) {
|
|
503
|
+
if_block1.d(1);
|
|
504
|
+
if_block1 = null;
|
|
505
|
+
}
|
|
424
506
|
if (
|
|
425
507
|
/*$$slots*/
|
|
426
|
-
ctx2[
|
|
427
|
-
ctx2[
|
|
428
|
-
ctx2[
|
|
508
|
+
ctx2[10]["footer-left"] || /*$$slots*/
|
|
509
|
+
ctx2[10]["footer-center"] || /*$$slots*/
|
|
510
|
+
ctx2[10]["footer-right"]
|
|
429
511
|
) {
|
|
430
|
-
if (
|
|
431
|
-
|
|
512
|
+
if (if_block2) {
|
|
513
|
+
if_block2.p(ctx2, dirty);
|
|
432
514
|
if (dirty[0] & /*$$slots*/
|
|
433
|
-
|
|
434
|
-
transition_in(
|
|
515
|
+
1024) {
|
|
516
|
+
transition_in(if_block2, 1);
|
|
435
517
|
}
|
|
436
518
|
} else {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
transition_in(
|
|
440
|
-
|
|
519
|
+
if_block2 = create_if_block(ctx2);
|
|
520
|
+
if_block2.c();
|
|
521
|
+
transition_in(if_block2, 1);
|
|
522
|
+
if_block2.m(div1, null);
|
|
441
523
|
}
|
|
442
|
-
} else if (
|
|
524
|
+
} else if (if_block2) {
|
|
443
525
|
group_outros();
|
|
444
|
-
transition_out(
|
|
445
|
-
|
|
526
|
+
transition_out(if_block2, 1, 1, () => {
|
|
527
|
+
if_block2 = null;
|
|
446
528
|
});
|
|
447
529
|
check_outros();
|
|
448
530
|
}
|
|
449
531
|
},
|
|
450
532
|
i(local) {
|
|
451
533
|
if (current) return;
|
|
452
|
-
transition_in(
|
|
534
|
+
transition_in(if_block2);
|
|
453
535
|
current = true;
|
|
454
536
|
},
|
|
455
537
|
o(local) {
|
|
456
|
-
transition_out(
|
|
538
|
+
transition_out(if_block2);
|
|
457
539
|
current = false;
|
|
458
540
|
},
|
|
459
541
|
d(detaching) {
|
|
460
542
|
if (detaching) {
|
|
461
543
|
detach(div1);
|
|
462
544
|
}
|
|
463
|
-
if (
|
|
545
|
+
if (if_block0) if_block0.d();
|
|
546
|
+
if (if_block1) if_block1.d();
|
|
547
|
+
if (if_block2) if_block2.d();
|
|
464
548
|
}
|
|
465
549
|
};
|
|
466
550
|
}
|
|
@@ -482,15 +566,15 @@ function create_fragment$1(ctx) {
|
|
|
482
566
|
let dispose;
|
|
483
567
|
let if_block = (
|
|
484
568
|
/*internalMessages*/
|
|
485
|
-
ctx[
|
|
569
|
+
ctx[5].length === 0 && create_if_block_3(ctx)
|
|
486
570
|
);
|
|
487
571
|
let each_value = ensure_array_like(
|
|
488
572
|
/*internalMessages*/
|
|
489
|
-
ctx[
|
|
573
|
+
ctx[5]
|
|
490
574
|
);
|
|
491
575
|
const get_key = (ctx2) => (
|
|
492
576
|
/*m*/
|
|
493
|
-
ctx2[
|
|
577
|
+
ctx2[52].id
|
|
494
578
|
);
|
|
495
579
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
496
580
|
let child_ctx = get_each_context(ctx, each_value, i);
|
|
@@ -499,24 +583,24 @@ function create_fragment$1(ctx) {
|
|
|
499
583
|
}
|
|
500
584
|
const above_composer_slot_template = (
|
|
501
585
|
/*#slots*/
|
|
502
|
-
ctx[
|
|
586
|
+
ctx[44]["above-composer"]
|
|
503
587
|
);
|
|
504
588
|
const above_composer_slot = create_slot(
|
|
505
589
|
above_composer_slot_template,
|
|
506
590
|
ctx,
|
|
507
591
|
/*$$scope*/
|
|
508
|
-
ctx[
|
|
592
|
+
ctx[43],
|
|
509
593
|
get_above_composer_slot_context
|
|
510
594
|
);
|
|
511
595
|
const composer_slot_template = (
|
|
512
596
|
/*#slots*/
|
|
513
|
-
ctx[
|
|
597
|
+
ctx[44].composer
|
|
514
598
|
);
|
|
515
599
|
const composer_slot = create_slot(
|
|
516
600
|
composer_slot_template,
|
|
517
601
|
ctx,
|
|
518
602
|
/*$$scope*/
|
|
519
|
-
ctx[
|
|
603
|
+
ctx[43],
|
|
520
604
|
get_composer_slot_context
|
|
521
605
|
);
|
|
522
606
|
const composer_slot_or_fallback = composer_slot || fallback_block(ctx);
|
|
@@ -537,7 +621,7 @@ function create_fragment$1(ctx) {
|
|
|
537
621
|
aparte_composer = element("aparte-composer");
|
|
538
622
|
if (composer_slot_or_fallback) composer_slot_or_fallback.c();
|
|
539
623
|
set_custom_element_data(aparte_chat_status, "visible", aparte_chat_status_visible_value = /*typingActive*/
|
|
540
|
-
ctx[
|
|
624
|
+
ctx[8] ? "" : null);
|
|
541
625
|
set_custom_element_data(
|
|
542
626
|
aparte_chat_status,
|
|
543
627
|
"text",
|
|
@@ -549,12 +633,12 @@ function create_fragment$1(ctx) {
|
|
|
549
633
|
attr(div, "data-aparte-chat", "");
|
|
550
634
|
attr(div, "data-aparte-empty", div_data_aparte_empty_value = /*centerWhenEmpty*/
|
|
551
635
|
ctx[1] && /*internalMessages*/
|
|
552
|
-
ctx[
|
|
636
|
+
ctx[5].length === 0 ? "" : null);
|
|
553
637
|
attr(
|
|
554
638
|
div,
|
|
555
639
|
"id",
|
|
556
640
|
/*hostId*/
|
|
557
|
-
ctx[
|
|
641
|
+
ctx[3]
|
|
558
642
|
);
|
|
559
643
|
toggle_class(
|
|
560
644
|
div,
|
|
@@ -575,7 +659,7 @@ function create_fragment$1(ctx) {
|
|
|
575
659
|
}
|
|
576
660
|
append(aparte_chat_viewport, t1);
|
|
577
661
|
append(aparte_chat_viewport, aparte_chat_status);
|
|
578
|
-
ctx[
|
|
662
|
+
ctx[45](aparte_chat_viewport);
|
|
579
663
|
append(div, t2);
|
|
580
664
|
if (above_composer_slot) {
|
|
581
665
|
above_composer_slot.m(div, null);
|
|
@@ -585,15 +669,15 @@ function create_fragment$1(ctx) {
|
|
|
585
669
|
if (composer_slot_or_fallback) {
|
|
586
670
|
composer_slot_or_fallback.m(aparte_composer, null);
|
|
587
671
|
}
|
|
588
|
-
ctx[
|
|
589
|
-
ctx[
|
|
672
|
+
ctx[46](aparte_composer);
|
|
673
|
+
ctx[47](div);
|
|
590
674
|
current = true;
|
|
591
675
|
if (!mounted) {
|
|
592
676
|
dispose = listen(
|
|
593
677
|
aparte_composer,
|
|
594
678
|
"aparte-send",
|
|
595
679
|
/*handleSend*/
|
|
596
|
-
ctx[
|
|
680
|
+
ctx[9]
|
|
597
681
|
);
|
|
598
682
|
mounted = true;
|
|
599
683
|
}
|
|
@@ -601,16 +685,16 @@ function create_fragment$1(ctx) {
|
|
|
601
685
|
p(ctx2, dirty) {
|
|
602
686
|
if (
|
|
603
687
|
/*internalMessages*/
|
|
604
|
-
ctx2[
|
|
688
|
+
ctx2[5].length === 0
|
|
605
689
|
) {
|
|
606
690
|
if (if_block) {
|
|
607
691
|
if_block.p(ctx2, dirty);
|
|
608
692
|
if (dirty[0] & /*internalMessages*/
|
|
609
|
-
|
|
693
|
+
32) {
|
|
610
694
|
transition_in(if_block, 1);
|
|
611
695
|
}
|
|
612
696
|
} else {
|
|
613
|
-
if_block =
|
|
697
|
+
if_block = create_if_block_3(ctx2);
|
|
614
698
|
if_block.c();
|
|
615
699
|
transition_in(if_block, 1);
|
|
616
700
|
if_block.m(aparte_chat_viewport, t0);
|
|
@@ -623,19 +707,19 @@ function create_fragment$1(ctx) {
|
|
|
623
707
|
check_outros();
|
|
624
708
|
}
|
|
625
709
|
if (dirty[0] & /*internalMessages*/
|
|
626
|
-
|
|
627
|
-
|
|
710
|
+
32 | dirty[1] & /*$$scope*/
|
|
711
|
+
4096) {
|
|
628
712
|
each_value = ensure_array_like(
|
|
629
713
|
/*internalMessages*/
|
|
630
|
-
ctx2[
|
|
714
|
+
ctx2[5]
|
|
631
715
|
);
|
|
632
716
|
group_outros();
|
|
633
717
|
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, aparte_chat_viewport, outro_and_destroy_block, create_each_block, t1, get_each_context);
|
|
634
718
|
check_outros();
|
|
635
719
|
}
|
|
636
720
|
if (!current || dirty[0] & /*typingActive*/
|
|
637
|
-
|
|
638
|
-
ctx2[
|
|
721
|
+
256 && aparte_chat_status_visible_value !== (aparte_chat_status_visible_value = /*typingActive*/
|
|
722
|
+
ctx2[8] ? "" : null)) {
|
|
639
723
|
set_custom_element_data(aparte_chat_status, "visible", aparte_chat_status_visible_value);
|
|
640
724
|
}
|
|
641
725
|
if (!current || dirty[0] & /*typingText*/
|
|
@@ -649,20 +733,20 @@ function create_fragment$1(ctx) {
|
|
|
649
733
|
}
|
|
650
734
|
if (above_composer_slot) {
|
|
651
735
|
if (above_composer_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
652
|
-
|
|
736
|
+
4096)) {
|
|
653
737
|
update_slot_base(
|
|
654
738
|
above_composer_slot,
|
|
655
739
|
above_composer_slot_template,
|
|
656
740
|
ctx2,
|
|
657
741
|
/*$$scope*/
|
|
658
|
-
ctx2[
|
|
742
|
+
ctx2[43],
|
|
659
743
|
!current ? get_all_dirty_from_scope(
|
|
660
744
|
/*$$scope*/
|
|
661
|
-
ctx2[
|
|
745
|
+
ctx2[43]
|
|
662
746
|
) : get_slot_changes(
|
|
663
747
|
above_composer_slot_template,
|
|
664
748
|
/*$$scope*/
|
|
665
|
-
ctx2[
|
|
749
|
+
ctx2[43],
|
|
666
750
|
dirty,
|
|
667
751
|
get_above_composer_slot_changes
|
|
668
752
|
),
|
|
@@ -672,20 +756,20 @@ function create_fragment$1(ctx) {
|
|
|
672
756
|
}
|
|
673
757
|
if (composer_slot) {
|
|
674
758
|
if (composer_slot.p && (!current || dirty[1] & /*$$scope*/
|
|
675
|
-
|
|
759
|
+
4096)) {
|
|
676
760
|
update_slot_base(
|
|
677
761
|
composer_slot,
|
|
678
762
|
composer_slot_template,
|
|
679
763
|
ctx2,
|
|
680
764
|
/*$$scope*/
|
|
681
|
-
ctx2[
|
|
765
|
+
ctx2[43],
|
|
682
766
|
!current ? get_all_dirty_from_scope(
|
|
683
767
|
/*$$scope*/
|
|
684
|
-
ctx2[
|
|
768
|
+
ctx2[43]
|
|
685
769
|
) : get_slot_changes(
|
|
686
770
|
composer_slot_template,
|
|
687
771
|
/*$$scope*/
|
|
688
|
-
ctx2[
|
|
772
|
+
ctx2[43],
|
|
689
773
|
dirty,
|
|
690
774
|
get_composer_slot_changes
|
|
691
775
|
),
|
|
@@ -693,25 +777,25 @@ function create_fragment$1(ctx) {
|
|
|
693
777
|
);
|
|
694
778
|
}
|
|
695
779
|
} else {
|
|
696
|
-
if (composer_slot_or_fallback && composer_slot_or_fallback.p && (!current || dirty[0] & /*$$slots*/
|
|
697
|
-
|
|
698
|
-
|
|
780
|
+
if (composer_slot_or_fallback && composer_slot_or_fallback.p && (!current || dirty[0] & /*$$slots, attachments*/
|
|
781
|
+
1028 | dirty[1] & /*$$scope*/
|
|
782
|
+
4096)) {
|
|
699
783
|
composer_slot_or_fallback.p(ctx2, !current ? [-1, -1] : dirty);
|
|
700
784
|
}
|
|
701
785
|
}
|
|
702
786
|
if (!current || dirty[0] & /*centerWhenEmpty, internalMessages*/
|
|
703
|
-
|
|
787
|
+
34 && div_data_aparte_empty_value !== (div_data_aparte_empty_value = /*centerWhenEmpty*/
|
|
704
788
|
ctx2[1] && /*internalMessages*/
|
|
705
|
-
ctx2[
|
|
789
|
+
ctx2[5].length === 0 ? "" : null)) {
|
|
706
790
|
attr(div, "data-aparte-empty", div_data_aparte_empty_value);
|
|
707
791
|
}
|
|
708
792
|
if (!current || dirty[0] & /*hostId*/
|
|
709
|
-
|
|
793
|
+
8) {
|
|
710
794
|
attr(
|
|
711
795
|
div,
|
|
712
796
|
"id",
|
|
713
797
|
/*hostId*/
|
|
714
|
-
ctx2[
|
|
798
|
+
ctx2[3]
|
|
715
799
|
);
|
|
716
800
|
}
|
|
717
801
|
if (!current || dirty[0] & /*centerWhenEmpty*/
|
|
@@ -751,11 +835,11 @@ function create_fragment$1(ctx) {
|
|
|
751
835
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
752
836
|
each_blocks[i].d();
|
|
753
837
|
}
|
|
754
|
-
ctx[
|
|
838
|
+
ctx[45](null);
|
|
755
839
|
if (above_composer_slot) above_composer_slot.d(detaching);
|
|
756
840
|
if (composer_slot_or_fallback) composer_slot_or_fallback.d(detaching);
|
|
757
|
-
ctx[45](null);
|
|
758
841
|
ctx[46](null);
|
|
842
|
+
ctx[47](null);
|
|
759
843
|
mounted = false;
|
|
760
844
|
dispose();
|
|
761
845
|
}
|
|
@@ -776,6 +860,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
776
860
|
let { submitOnEnter = true } = $$props;
|
|
777
861
|
let { layoutTransitionMs = 0 } = $$props;
|
|
778
862
|
let { centerWhenEmpty = false } = $$props;
|
|
863
|
+
let { attachments = false } = $$props;
|
|
779
864
|
let { conversationId = null } = $$props;
|
|
780
865
|
let { config = void 0 } = $$props;
|
|
781
866
|
const dispatch = createEventDispatcher();
|
|
@@ -798,20 +883,20 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
798
883
|
dispatch("action", event.detail);
|
|
799
884
|
}
|
|
800
885
|
onMount(() => {
|
|
801
|
-
$$invalidate(
|
|
802
|
-
if (rootRef) $$invalidate(
|
|
886
|
+
$$invalidate(3, hostId = `aparte-chat-${crypto.randomUUID()}`);
|
|
887
|
+
if (rootRef) $$invalidate(6, rootRef.id = hostId, rootRef);
|
|
803
888
|
const binding = {
|
|
804
889
|
hostId,
|
|
805
890
|
host: rootRef,
|
|
806
891
|
viewport: viewportRef,
|
|
807
892
|
getMessages: () => internalMessages,
|
|
808
893
|
setMessages: (m) => {
|
|
809
|
-
$$invalidate(
|
|
894
|
+
$$invalidate(5, internalMessages = m);
|
|
810
895
|
},
|
|
811
896
|
onMessagesChange: (m) => dispatch("messagesChange", m),
|
|
812
897
|
onMessageAppended: (m) => dispatch("messageAppended", m),
|
|
813
898
|
onTypingChange: (t) => {
|
|
814
|
-
$$invalidate(
|
|
899
|
+
$$invalidate(8, typingActive = t);
|
|
815
900
|
dispatch("typingChange", t);
|
|
816
901
|
},
|
|
817
902
|
onStreamingChange: () => {
|
|
@@ -821,7 +906,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
821
906
|
},
|
|
822
907
|
resetComposer: () => composerRef?.reset?.()
|
|
823
908
|
};
|
|
824
|
-
$$invalidate(
|
|
909
|
+
$$invalidate(39, host = new AparteChatHost(
|
|
825
910
|
binding,
|
|
826
911
|
{
|
|
827
912
|
layoutTransitionMs,
|
|
@@ -838,7 +923,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
838
923
|
rootRef?.removeEventListener("aparte-action", handleAction);
|
|
839
924
|
teardown?.();
|
|
840
925
|
teardown = null;
|
|
841
|
-
$$invalidate(
|
|
926
|
+
$$invalidate(39, host = null);
|
|
842
927
|
});
|
|
843
928
|
function appendMessage(m) {
|
|
844
929
|
host?.appendMessage(m);
|
|
@@ -903,69 +988,70 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
903
988
|
function aparte_chat_viewport_binding($$value) {
|
|
904
989
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
905
990
|
viewportRef = $$value;
|
|
906
|
-
$$invalidate(
|
|
991
|
+
$$invalidate(7, viewportRef);
|
|
907
992
|
});
|
|
908
993
|
}
|
|
909
994
|
function aparte_composer_binding($$value) {
|
|
910
995
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
911
996
|
composerRef = $$value;
|
|
912
|
-
$$invalidate(
|
|
997
|
+
$$invalidate(4, composerRef);
|
|
913
998
|
});
|
|
914
999
|
}
|
|
915
1000
|
function div_binding($$value) {
|
|
916
1001
|
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
917
1002
|
rootRef = $$value;
|
|
918
|
-
$$invalidate(
|
|
1003
|
+
$$invalidate(6, rootRef);
|
|
919
1004
|
});
|
|
920
1005
|
}
|
|
921
1006
|
$$self.$$set = ($$props2) => {
|
|
922
|
-
if ("messages" in $$props2) $$invalidate(
|
|
923
|
-
if ("placeholder" in $$props2) $$invalidate(
|
|
924
|
-
if ("disabled" in $$props2) $$invalidate(
|
|
925
|
-
if ("isTyping" in $$props2) $$invalidate(
|
|
1007
|
+
if ("messages" in $$props2) $$invalidate(11, messages = $$props2.messages);
|
|
1008
|
+
if ("placeholder" in $$props2) $$invalidate(12, placeholder = $$props2.placeholder);
|
|
1009
|
+
if ("disabled" in $$props2) $$invalidate(13, disabled = $$props2.disabled);
|
|
1010
|
+
if ("isTyping" in $$props2) $$invalidate(14, isTyping = $$props2.isTyping);
|
|
926
1011
|
if ("typingText" in $$props2) $$invalidate(0, typingText = $$props2.typingText);
|
|
927
|
-
if ("submitOnEnter" in $$props2) $$invalidate(
|
|
928
|
-
if ("layoutTransitionMs" in $$props2) $$invalidate(
|
|
1012
|
+
if ("submitOnEnter" in $$props2) $$invalidate(15, submitOnEnter = $$props2.submitOnEnter);
|
|
1013
|
+
if ("layoutTransitionMs" in $$props2) $$invalidate(16, layoutTransitionMs = $$props2.layoutTransitionMs);
|
|
929
1014
|
if ("centerWhenEmpty" in $$props2) $$invalidate(1, centerWhenEmpty = $$props2.centerWhenEmpty);
|
|
930
|
-
if ("
|
|
931
|
-
if ("
|
|
932
|
-
if ("
|
|
1015
|
+
if ("attachments" in $$props2) $$invalidate(2, attachments = $$props2.attachments);
|
|
1016
|
+
if ("conversationId" in $$props2) $$invalidate(17, conversationId = $$props2.conversationId);
|
|
1017
|
+
if ("config" in $$props2) $$invalidate(18, config = $$props2.config);
|
|
1018
|
+
if ("$$scope" in $$props2) $$invalidate(43, $$scope = $$props2.$$scope);
|
|
933
1019
|
};
|
|
934
1020
|
$$self.$$.update = () => {
|
|
935
1021
|
if ($$self.$$.dirty[0] & /*messages*/
|
|
936
|
-
|
|
937
|
-
|
|
1022
|
+
2048 | $$self.$$.dirty[1] & /*lastProp, host*/
|
|
1023
|
+
768) {
|
|
938
1024
|
if (messages !== lastProp) {
|
|
939
|
-
$$invalidate(
|
|
940
|
-
$$invalidate(
|
|
1025
|
+
$$invalidate(40, lastProp = messages);
|
|
1026
|
+
$$invalidate(5, internalMessages = [...messages]);
|
|
941
1027
|
if (messages.length === 0) host?.clearRenderCache();
|
|
942
1028
|
}
|
|
943
1029
|
}
|
|
944
1030
|
if ($$self.$$.dirty[0] & /*isTyping*/
|
|
945
|
-
|
|
946
|
-
|
|
1031
|
+
16384 | $$self.$$.dirty[1] & /*lastTyping*/
|
|
1032
|
+
1024) {
|
|
947
1033
|
if (isTyping !== lastTyping) {
|
|
948
|
-
$$invalidate(
|
|
949
|
-
$$invalidate(
|
|
1034
|
+
$$invalidate(41, lastTyping = isTyping);
|
|
1035
|
+
$$invalidate(8, typingActive = isTyping);
|
|
950
1036
|
}
|
|
951
1037
|
}
|
|
952
1038
|
if ($$self.$$.dirty[0] & /*conversationId*/
|
|
953
|
-
|
|
954
|
-
|
|
1039
|
+
131072 | $$self.$$.dirty[1] & /*lastConv, host*/
|
|
1040
|
+
2304) {
|
|
955
1041
|
if (conversationId !== lastConv) {
|
|
956
|
-
$$invalidate(
|
|
1042
|
+
$$invalidate(42, lastConv = conversationId);
|
|
957
1043
|
void host?.setConversationId(conversationId ?? null);
|
|
958
1044
|
}
|
|
959
1045
|
}
|
|
960
1046
|
if ($$self.$$.dirty[0] & /*internalMessages*/
|
|
961
|
-
|
|
962
|
-
|
|
1047
|
+
32 | $$self.$$.dirty[1] & /*host*/
|
|
1048
|
+
256) {
|
|
963
1049
|
if (host && internalMessages) {
|
|
964
1050
|
void tick().then(() => host?.syncBubbles());
|
|
965
1051
|
}
|
|
966
1052
|
}
|
|
967
1053
|
if ($$self.$$.dirty[0] & /*composerRef, hostId, placeholder, disabled, submitOnEnter*/
|
|
968
|
-
|
|
1054
|
+
45080) {
|
|
969
1055
|
if (composerRef) {
|
|
970
1056
|
composerRef.setAttribute("target", hostId);
|
|
971
1057
|
composerRef.setAttribute("placeholder", placeholder);
|
|
@@ -977,6 +1063,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
977
1063
|
return [
|
|
978
1064
|
typingText,
|
|
979
1065
|
centerWhenEmpty,
|
|
1066
|
+
attachments,
|
|
980
1067
|
hostId,
|
|
981
1068
|
composerRef,
|
|
982
1069
|
internalMessages,
|
|
@@ -1034,100 +1121,101 @@ class AparteChat extends SvelteComponent {
|
|
|
1034
1121
|
create_fragment$1,
|
|
1035
1122
|
safe_not_equal,
|
|
1036
1123
|
{
|
|
1037
|
-
messages:
|
|
1038
|
-
placeholder:
|
|
1039
|
-
disabled:
|
|
1040
|
-
isTyping:
|
|
1124
|
+
messages: 11,
|
|
1125
|
+
placeholder: 12,
|
|
1126
|
+
disabled: 13,
|
|
1127
|
+
isTyping: 14,
|
|
1041
1128
|
typingText: 0,
|
|
1042
|
-
submitOnEnter:
|
|
1043
|
-
layoutTransitionMs:
|
|
1129
|
+
submitOnEnter: 15,
|
|
1130
|
+
layoutTransitionMs: 16,
|
|
1044
1131
|
centerWhenEmpty: 1,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1132
|
+
attachments: 2,
|
|
1133
|
+
conversationId: 17,
|
|
1134
|
+
config: 18,
|
|
1135
|
+
appendMessage: 19,
|
|
1136
|
+
updateMessage: 20,
|
|
1137
|
+
updateLastMessage: 21,
|
|
1138
|
+
addSegment: 22,
|
|
1139
|
+
updateSegment: 23,
|
|
1140
|
+
removeSegment: 24,
|
|
1141
|
+
appendToSegment: 25,
|
|
1142
|
+
getMessages: 26,
|
|
1143
|
+
clearMessages: 27,
|
|
1144
|
+
addBranch: 28,
|
|
1145
|
+
addSiblingOf: 29,
|
|
1146
|
+
truncateFrom: 30,
|
|
1147
|
+
truncateResponsesAfter: 31,
|
|
1148
|
+
injectTokenStream: 32,
|
|
1149
|
+
stopTokenStream: 33,
|
|
1150
|
+
setConversationId: 34,
|
|
1151
|
+
scrollToBottom: 35,
|
|
1152
|
+
getViewport: 36,
|
|
1153
|
+
focusInput: 37,
|
|
1154
|
+
isStreaming: 38
|
|
1067
1155
|
},
|
|
1068
1156
|
null,
|
|
1069
1157
|
[-1, -1]
|
|
1070
1158
|
);
|
|
1071
1159
|
}
|
|
1072
1160
|
get appendMessage() {
|
|
1073
|
-
return this.$$.ctx[
|
|
1161
|
+
return this.$$.ctx[19];
|
|
1074
1162
|
}
|
|
1075
1163
|
get updateMessage() {
|
|
1076
|
-
return this.$$.ctx[
|
|
1164
|
+
return this.$$.ctx[20];
|
|
1077
1165
|
}
|
|
1078
1166
|
get updateLastMessage() {
|
|
1079
|
-
return this.$$.ctx[
|
|
1167
|
+
return this.$$.ctx[21];
|
|
1080
1168
|
}
|
|
1081
1169
|
get addSegment() {
|
|
1082
|
-
return this.$$.ctx[
|
|
1170
|
+
return this.$$.ctx[22];
|
|
1083
1171
|
}
|
|
1084
1172
|
get updateSegment() {
|
|
1085
|
-
return this.$$.ctx[
|
|
1173
|
+
return this.$$.ctx[23];
|
|
1086
1174
|
}
|
|
1087
1175
|
get removeSegment() {
|
|
1088
|
-
return this.$$.ctx[
|
|
1176
|
+
return this.$$.ctx[24];
|
|
1089
1177
|
}
|
|
1090
1178
|
get appendToSegment() {
|
|
1091
|
-
return this.$$.ctx[
|
|
1179
|
+
return this.$$.ctx[25];
|
|
1092
1180
|
}
|
|
1093
1181
|
get getMessages() {
|
|
1094
|
-
return this.$$.ctx[
|
|
1182
|
+
return this.$$.ctx[26];
|
|
1095
1183
|
}
|
|
1096
1184
|
get clearMessages() {
|
|
1097
|
-
return this.$$.ctx[
|
|
1185
|
+
return this.$$.ctx[27];
|
|
1098
1186
|
}
|
|
1099
1187
|
get addBranch() {
|
|
1100
|
-
return this.$$.ctx[
|
|
1188
|
+
return this.$$.ctx[28];
|
|
1101
1189
|
}
|
|
1102
1190
|
get addSiblingOf() {
|
|
1103
|
-
return this.$$.ctx[
|
|
1191
|
+
return this.$$.ctx[29];
|
|
1104
1192
|
}
|
|
1105
1193
|
get truncateFrom() {
|
|
1106
|
-
return this.$$.ctx[
|
|
1194
|
+
return this.$$.ctx[30];
|
|
1107
1195
|
}
|
|
1108
1196
|
get truncateResponsesAfter() {
|
|
1109
|
-
return this.$$.ctx[
|
|
1197
|
+
return this.$$.ctx[31];
|
|
1110
1198
|
}
|
|
1111
1199
|
get injectTokenStream() {
|
|
1112
|
-
return this.$$.ctx[
|
|
1200
|
+
return this.$$.ctx[32];
|
|
1113
1201
|
}
|
|
1114
1202
|
get stopTokenStream() {
|
|
1115
|
-
return this.$$.ctx[
|
|
1203
|
+
return this.$$.ctx[33];
|
|
1116
1204
|
}
|
|
1117
1205
|
get setConversationId() {
|
|
1118
|
-
return this.$$.ctx[
|
|
1206
|
+
return this.$$.ctx[34];
|
|
1119
1207
|
}
|
|
1120
1208
|
get scrollToBottom() {
|
|
1121
|
-
return this.$$.ctx[
|
|
1209
|
+
return this.$$.ctx[35];
|
|
1122
1210
|
}
|
|
1123
1211
|
get getViewport() {
|
|
1124
|
-
return this.$$.ctx[
|
|
1212
|
+
return this.$$.ctx[36];
|
|
1125
1213
|
}
|
|
1126
1214
|
get focusInput() {
|
|
1127
|
-
return this.$$.ctx[
|
|
1215
|
+
return this.$$.ctx[37];
|
|
1128
1216
|
}
|
|
1129
1217
|
get isStreaming() {
|
|
1130
|
-
return this.$$.ctx[
|
|
1218
|
+
return this.$$.ctx[38];
|
|
1131
1219
|
}
|
|
1132
1220
|
}
|
|
1133
1221
|
function createAparteChat(initial = []) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/AparteChat.svelte","../src/lib/stores/aparteChat.ts","../src/lib/stores/aparteClient.ts","../src/lib/stores/conversationManager.ts","../src/lib/AparteUi.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { onMount, onDestroy, tick, createEventDispatcher } from 'svelte';\n import { AparteChatHost, type AparteChatHostBinding, type AparteConfigClass, type AparteChatImperativeApi } from '@aparte/core';\n import type { AparteMessage, AparteSegment, AparteSendEventDetail, AparteActionEventDetail } from './types';\n\n export let messages: AparteMessage[] = [];\n export let placeholder = 'Type a message...';\n export let disabled = false;\n export let isTyping = false;\n export let typingText = 'Assistant is thinking...';\n /** When false, Shift+Enter submits and a bare Enter inserts a newline. */\n export let submitOnEnter = true;\n /** Freeze viewport spacer recalculation for this many ms after a conv swap. */\n export let layoutTransitionMs = 0;\n /**\n * Opt in to the \"centered composer when empty\" layout: the composer sits\n * vertically centered with the `empty-state` slot above it while the list is\n * empty, then slides to the bottom on the first message (~0.3s). Off by\n * default — additive.\n */\n export let centerWhenEmpty = false;\n /** Active conversation id (loads/persists via the registered ConversationManager). */\n export let conversationId: string | null = null;\n /**\n * Instance {@link AparteConfigClass} for this chat. When set, aparté components\n * inside resolve THIS config instead of the global `AparteConfig` singleton, so\n * several independently-configured chats can coexist on one page. Omit for the\n * global config. Read once when the host mounts.\n */\n export let config: AparteConfigClass | undefined = undefined;\n\n const dispatch = createEventDispatcher<{\n /**\n * User submitted a message from the composer. It is **appended to the\n * thread automatically** (optimistic UI) before this fires — do NOT add it\n * again (uncontrolled → duplicates; controlled → mirror into your own\n * `messages`). For side-effects: scroll, analytics, send.\n */\n messageSent: AparteSendEventDetail;\n /** A custom bubble action (registerBubbleAction) was clicked — typed aparte-action. */\n action: AparteActionEventDetail;\n /** Active path changed (branch nav/edit/retry/streaming) — bind back to `messages`. */\n messagesChange: AparteMessage[];\n messageAppended: AparteMessage;\n /** The typing/\"thinking\" indicator toggled (the host flips it off on the first streamed token). */\n typingChange: boolean;\n conversationCreated: string;\n }>();\n\n // Generated client-side in onMount (below): during SSR this stays empty so the\n // server and first client render agree on the id — no hydration mismatch.\n let hostId = '';\n\n let rootRef: HTMLElement;\n let viewportRef: HTMLElement;\n let composerRef: HTMLElement;\n let internalMessages: AparteMessage[] = [...messages];\n let typingActive = isTyping;\n let host: AparteChatHost | null = null;\n let teardown: (() => void) | null = null;\n\n // Parent push → internal list (guarded against the host's own emit round-trip).\n let lastProp = messages;\n $: if (messages !== lastProp) {\n lastProp = messages;\n internalMessages = [...messages];\n if (messages.length === 0) host?.clearRenderCache();\n }\n\n // Controlled typing indicator (host may flip it off on the first token).\n let lastTyping = isTyping;\n $: if (isTyping !== lastTyping) { lastTyping = isTyping; typingActive = isTyping; }\n\n // Conversation id changes (initial value loaded by the host on bind).\n let lastConv = conversationId;\n $: if (conversationId !== lastConv) {\n lastConv = conversationId;\n void host?.setConversationId(conversationId ?? null);\n }\n\n // Reconcile bubbles after the rendered list changes (host queries the DOM).\n $: if (host && internalMessages) { void tick().then(() => host?.syncBubbles()); }\n\n // Composer attributes set imperatively (like Angular's `[attr.x]`): Svelte's\n // custom-element binding assigns to *properties*, but aparte-composer exposes\n // some of these (e.g. `placeholder`) as getter-only — assigning throws.\n function toggleAttr(el: HTMLElement, name: string, on: boolean, value: string) {\n if (on) el.setAttribute(name, value); else el.removeAttribute(name);\n }\n $: if (composerRef) {\n composerRef.setAttribute('target', hostId);\n composerRef.setAttribute('placeholder', placeholder);\n toggleAttr(composerRef, 'disabled', disabled, '');\n toggleAttr(composerRef, 'submit-on-enter', !submitOnEnter, 'false');\n }\n\n function handleSend(event: Event) {\n (viewportRef as unknown as { requestSmoothScroll?: () => void })?.requestSmoothScroll?.();\n dispatch('messageSent', (event as CustomEvent<AparteSendEventDetail>).detail);\n }\n\n // Custom bubble actions bubble to the root as `aparte-action` — dispatch typed.\n function handleAction(event: Event) {\n dispatch('action', (event as CustomEvent<AparteActionEventDetail>).detail);\n }\n\n onMount(() => {\n hostId = `aparte-chat-${crypto.randomUUID()}`;\n // Set the id imperatively (deterministic, like Angular's ngAfterViewInit) rather\n // than waiting on a reactive re-render of `id={hostId}`; the composer target\n // reactive block below picks up the same hostId.\n if (rootRef) rootRef.id = hostId;\n const binding: AparteChatHostBinding = {\n hostId,\n host: rootRef,\n viewport: viewportRef,\n getMessages: () => internalMessages,\n setMessages: (m) => { internalMessages = m as AparteMessage[]; },\n onMessagesChange: (m) => dispatch('messagesChange', m as AparteMessage[]),\n onMessageAppended: (m) => dispatch('messageAppended', m as AparteMessage),\n onTypingChange: (t) => { typingActive = t; dispatch('typingChange', t); },\n onStreamingChange: () => { /* exposed via isStreaming() */ },\n afterRender: (cb) => { void tick().then(cb); },\n resetComposer: () => (composerRef as unknown as { reset?: () => void })?.reset?.(),\n };\n host = new AparteChatHost(binding, {\n layoutTransitionMs,\n conversationId: conversationId ?? null,\n onConversationCreated: (id) => dispatch('conversationCreated', id),\n config,\n });\n teardown = host.bind();\n host.syncBubbles();\n rootRef?.addEventListener('aparte-action', handleAction);\n });\n\n onDestroy(() => {\n rootRef?.removeEventListener('aparte-action', handleAction);\n teardown?.();\n teardown = null;\n host = null;\n });\n\n // ── Imperative API (bind:this on the component) ──\n export function appendMessage(m: AparteMessage) { host?.appendMessage(m); }\n export function updateMessage(id: string, u: Partial<AparteMessage>) { host?.updateMessage(id, u); }\n export function updateLastMessage(content: string, options?: { append?: boolean }) {\n host?.updateLastMessage(content, options);\n }\n export function addSegment(segment: AparteSegment) { host?.addSegment(segment); }\n export function updateSegment(segmentId: string, updates: Partial<AparteSegment>) {\n host?.updateSegment(segmentId, updates);\n }\n export function removeSegment(segmentId: string) { host?.removeSegment(segmentId); }\n export function appendToSegment(segmentId: string, content: string) {\n host?.appendToSegment(segmentId, content);\n }\n export function getMessages(): AparteMessage[] { return host?.getMessages() ?? internalMessages; }\n export function clearMessages() { host?.clearMessages(); }\n export function addBranch(messageId: string): number { return host?.addBranch(messageId) ?? 0; }\n export function addSiblingOf(existingId: string, message: AparteMessage): string | null {\n return host?.addSiblingOf(existingId, message) ?? null;\n }\n export function truncateFrom(messageId: string) { host?.truncateFrom(messageId); }\n export function truncateResponsesAfter(userMessageId: string) {\n host?.truncateResponsesAfter(userMessageId);\n }\n export function injectTokenStream(messageId: string, tokens: AsyncIterable<string>): Promise<void> {\n return host?.streamTokens(messageId, tokens) ?? Promise.resolve();\n }\n export function stopTokenStream() { host?.stopTokenStream(); }\n export function setConversationId(id: string | null): Promise<void> {\n return host?.setConversationId(id) ?? Promise.resolve();\n }\n export function scrollToBottom() {\n (viewportRef as unknown as { scrollToBottom?: () => void })?.scrollToBottom?.();\n }\n /**\n * The `<aparte-chat-viewport>` element — for custom scroll handling, an\n * IntersectionObserver, etc. Same `getViewport()` accessor on all four\n * wrappers.\n */\n export function getViewport(): HTMLElement | null { return viewportRef ?? null; }\n export function focusInput() {\n (composerRef as unknown as { focus?: () => void })?.focus?.();\n }\n export function isStreaming(): boolean { return host?.isStreaming ?? false; }\n\n // Compile-time parity check: Svelte 4 can't generic-annotate `export function`s,\n // so this never-called factory type-checks that the exported surface matches the\n // canonical AparteChatImperativeApi. A dropped/mistyped method is a build error.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n function _assertImperativeParity(): AparteChatImperativeApi {\n return {\n appendMessage, updateMessage, updateLastMessage, addSegment, updateSegment, removeSegment,\n appendToSegment, getMessages, clearMessages, addBranch, addSiblingOf, truncateFrom,\n truncateResponsesAfter, injectTokenStream, stopTokenStream, setConversationId,\n scrollToBottom, focusInput, isStreaming, getViewport,\n };\n }\n</script>\n\n<div\n class=\"aparte-chat-container\"\n class:aparte-chat-container--auto-center={centerWhenEmpty}\n data-aparte-chat\n data-aparte-empty={centerWhenEmpty && internalMessages.length === 0 ? '' : null}\n id={hostId}\n bind:this={rootRef}\n>\n <aparte-chat-viewport bind:this={viewportRef} framework-managed=\"\">\n <!-- Welcome / placeholder shown inside the viewport while empty. -->\n {#if internalMessages.length === 0}\n <slot name=\"empty-state\" />\n {/if}\n <!-- `bubble` slot renders your OWN element per message in place of\n <aparte-chat-bubble>; driven by the reactive list so it streams live. -->\n {#each internalMessages as m (m.id)}\n <slot name=\"bubble\" message={m}>\n <aparte-chat-bubble\n message-id={m.id}\n data-role={m.role}\n timestamp={m.timestamp}\n content={m.content}\n streaming={(m.status === 'streaming' || m.status === 'pending') ? '' : null}\n />\n </slot>\n {/each}\n <aparte-chat-status visible={typingActive ? '' : null} text={typingText} />\n </aparte-chat-viewport>\n\n <!-- Content above the composer (banner, disclaimer, context chip). -->\n <slot name=\"above-composer\" />\n\n <aparte-composer\n bind:this={composerRef}\n on:aparte-send={handleSend}\n >\n <!-- Custom composer via the `composer` slot; falls back to the default\n shell (add-attachment · input · send). Compose the headless\n aparte-composer-* primitives freely for a skin-specific layout. -->\n <slot name=\"composer\">\n <div class=\"aparte-composer-shell\">\n <aparte-composer-attachments></aparte-composer-attachments>\n <div class=\"aparte-composer-row\">\n <aparte-composer-add-attachment></aparte-composer-add-attachment>\n <aparte-composer-input></aparte-composer-input>\n <aparte-composer-send></aparte-composer-send>\n </div>\n <!-- Footer slots (model selector, token counter…). The row is\n removed from view by .aparte-composer-footer:empty when unused. -->\n {#if $$slots['footer-left'] || $$slots['footer-center'] || $$slots['footer-right']}\n <div class=\"aparte-composer-footer\">\n <slot name=\"footer-left\" />\n <slot name=\"footer-center\" />\n <slot name=\"footer-right\" />\n </div>\n {/if}\n </div>\n </slot>\n </aparte-composer>\n</div>\n","import { writable, type Writable } from 'svelte/store';\nimport type { AparteChatImperativeApi } from '@aparte/core';\nimport type { AparteMessage, AparteSegment } from '../types.js';\n\n/**\n * The imperative surface `<AparteChat>` exposes (its `export function`s) — the\n * canonical contract shared by all four wrappers (`AparteChatImperativeApi`).\n */\nexport type AparteChatInstance = AparteChatImperativeApi;\n\nexport interface AparteChatStore {\n /** Subscribe with `$messages` and bind to `<AparteChat messages={$messages}>`. */\n messages: Writable<AparteMessage[]>;\n /** Register the component instance via `bind:this`. */\n connect(component: AparteChatInstance | null): void;\n /** Wire to `on:messagesChange={(e) => chat.onMessagesChange(e.detail)}`. */\n onMessagesChange(messages: AparteMessage[]): void;\n appendMessage(message: AparteMessage): void;\n updateMessage(messageId: string, updates: Partial<AparteMessage>): void;\n updateLastMessage(content: string, options?: { append?: boolean }): void;\n addSegment(segment: AparteSegment): void;\n updateSegment(segmentId: string, updates: Partial<AparteSegment>): void;\n removeSegment(segmentId: string): void;\n appendToSegment(segmentId: string, content: string): void;\n clearMessages(): void;\n addBranch(messageId: string): number;\n addSiblingOf(existingId: string, message: AparteMessage): string | null;\n truncateFrom(messageId: string): void;\n truncateResponsesAfter(userMessageId: string): void;\n injectTokenStream(messageId: string, tokens: AsyncIterable<string>): Promise<void>;\n stopTokenStream(): void;\n setConversationId(id: string | null): Promise<void>;\n isStreaming(): boolean;\n}\n\n/**\n * Idiomatic Svelte ergonomics for `<AparteChat>`. Owns the `messages` store so the\n * consumer skips the manual `on:messagesChange` → `messages` round-trip.\n *\n * @example\n * const chat = createAparteChat();\n * const { messages } = chat;\n * let comp;\n * $: chat.connect(comp);\n * // <AparteChat bind:this={comp} messages={$messages}\n * // on:messagesChange={(e) => chat.onMessagesChange(e.detail)} />\n */\nexport function createAparteChat(initial: AparteMessage[] = []): AparteChatStore {\n const messages = writable<AparteMessage[]>([...initial]);\n let comp: AparteChatInstance | null = null;\n return {\n messages,\n connect: (component) => { comp = component; },\n onMessagesChange: (m) => messages.set(m),\n appendMessage: (m) => comp?.appendMessage(m),\n updateMessage: (id, u) => comp?.updateMessage(id, u),\n updateLastMessage: (c, o) => comp?.updateLastMessage(c, o),\n addSegment: (s) => comp?.addSegment(s),\n updateSegment: (id, u) => comp?.updateSegment(id, u),\n removeSegment: (id) => comp?.removeSegment(id),\n appendToSegment: (id, c) => comp?.appendToSegment(id, c),\n clearMessages: () => comp?.clearMessages(),\n addBranch: (id) => comp?.addBranch(id) ?? 0,\n addSiblingOf: (id, m) => comp?.addSiblingOf(id, m) ?? null,\n truncateFrom: (id) => comp?.truncateFrom(id),\n truncateResponsesAfter: (id) => comp?.truncateResponsesAfter(id),\n injectTokenStream: (id, tokens) => comp?.injectTokenStream(id, tokens) ?? Promise.resolve(),\n stopTokenStream: () => comp?.stopTokenStream(),\n setConversationId: (id) => comp?.setConversationId(id) ?? Promise.resolve(),\n isStreaming: () => comp?.isStreaming() ?? false,\n };\n}\n","import { onMount, onDestroy } from 'svelte';\nimport { AparteClient, type AparteClientOptions } from '@aparte/core';\n\n/**\n * Mounts an `AparteClient` that bridges `aparte-send` events to the configured AI\n * providers. Starts on mount, stops on destroy. Call from a component's script.\n * Svelte equivalent of Angular's `AparteAiService`.\n */\nexport function createAparteClient(options?: AparteClientOptions) {\n const client = new AparteClient(options ?? {});\n onMount(() => { client.start(); });\n onDestroy(() => client.stop());\n return { client, abort: () => client.abort() };\n}\n","import { writable, derived } from 'svelte/store';\nimport { onDestroy } from 'svelte';\nimport {\n AparteConfig,\n ConversationManager,\n type AparteConversation,\n type AparteStorageAdapter,\n} from '@aparte/core';\nimport type { AparteMessage } from '../types.js';\n\n/**\n * Svelte-store wrapper around the core `ConversationManager`. The active\n * conversation is owned by the chat component's controller; switch by binding\n * `conversationId` on `<AparteChat>`. Call from a component's script. Svelte\n * equivalent of Angular's `ConversationManagerService`.\n */\nexport function createConversationManager() {\n let manager: ConversationManager | null = null;\n let unsub: (() => void) | null = null;\n\n const conversations = writable<AparteConversation[]>([]);\n const activeId = writable<string | null>(null);\n const activeConversations = derived(conversations, ($c) =>\n $c.filter((c) => !c.archivedAt).sort((a, b) => b.updatedAt - a.updatedAt),\n );\n const archivedConversations = derived(conversations, ($c) =>\n $c.filter((c) => !!c.archivedAt).sort((a, b) => b.updatedAt - a.updatedAt),\n );\n const activeConversation = derived([conversations, activeId], ([$c, $id]) =>\n $id ? $c.find((c) => c.id === $id) ?? null : null,\n );\n\n onDestroy(() => unsub?.());\n\n const assert = (): ConversationManager => {\n if (!manager) throw new Error('[createConversationManager] Not initialised. Call init(adapter) first.');\n return manager;\n };\n\n async function init(adapter: AparteStorageAdapter): Promise<void> {\n const m = new ConversationManager(adapter);\n manager = m;\n unsub = m.subscribe((convs) => {\n conversations.set([...convs]);\n activeId.set(m.activeId);\n });\n await m.init();\n activeId.set(m.activeId);\n AparteConfig.setConversationManager(m);\n }\n\n return {\n conversations,\n activeConversations,\n archivedConversations,\n activeId,\n activeConversation,\n init,\n createNew: (title?: string) => assert().createNew(title),\n addMessage: (convId: string, message: AparteMessage) => assert().addMessage(convId, message),\n updateMessages: (convId: string, messages: AparteMessage[]) => assert().updateMessages(convId, messages),\n delete: (id: string) => assert().delete(id),\n archive: (id: string) => assert().archive(id),\n unarchive: (id: string) => assert().unarchive(id),\n };\n}\n","<script lang=\"ts\">\n import { onMount, onDestroy, createEventDispatcher } from 'svelte';\n import { applyElementProps, DEFAULT_UI_EVENTS } from '@aparte/core';\n\n /** The custom element tag name (e.g. 'aparte-model-selector'). */\n export let name: string;\n /** Props to apply. Keys starting with `--` become CSS variables. */\n export let props: Record<string, unknown> = {};\n /**\n * Which custom events to forward through `elementEvent`. Defaults to the\n * interactive aparté surface (DEFAULT_UI_EVENTS); pass your own list to listen to\n * other events (e.g. ['aparte-composer-change'] for attachments).\n */\n export let events: string[] | undefined = undefined;\n\n const dispatch = createEventDispatcher<{ elementEvent: CustomEvent }>();\n\n let host: HTMLElement;\n let el: HTMLElement | null = null;\n let cleanups: Array<() => void> = [];\n\n function applyProps() {\n if (el) applyElementProps(el, props);\n }\n\n function create() {\n if (!host) return;\n el = document.createElement(name);\n applyProps();\n for (const ev of events ?? DEFAULT_UI_EVENTS) {\n const listener = (e: Event) => dispatch('elementEvent', e as CustomEvent);\n el.addEventListener(ev, listener);\n cleanups.push(() => el?.removeEventListener(ev, listener));\n }\n host.appendChild(el);\n }\n\n function destroy() {\n for (const c of cleanups) c();\n cleanups = [];\n el?.remove();\n el = null;\n }\n\n onMount(create);\n onDestroy(destroy);\n\n // Recreate the element when `name` (or the forwarded event set) changes. A\n // joined key so a fresh inline `events` array doesn't thrash the element.\n let lastName = name;\n let lastEvtsKey = (events ?? DEFAULT_UI_EVENTS).join('|');\n $: {\n const evtsKey = (events ?? DEFAULT_UI_EVENTS).join('|');\n if (el && (name !== lastName || evtsKey !== lastEvtsKey)) {\n lastName = name;\n lastEvtsKey = evtsKey;\n destroy();\n create();\n }\n }\n $: if (el && props) applyProps();\n\n export function getElement() { return el; }\n export function callMethod(methodName: string, ...args: unknown[]) {\n const fn = (el as unknown as Record<string, unknown>)?.[methodName];\n return typeof fn === 'function' ? (fn as (...a: unknown[]) => unknown).apply(el, args) : undefined;\n }\n</script>\n\n<span bind:this={host} style=\"display: contents\"></span>\n"],"names":["ctx","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EA0NmC,IAAC,EAAA;AAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,8BAAA,oBAAA,cAAA;AAAA,MAAA,QAAE,EAAE;AACL,8BAAA,oBAAA,aAAA;AAAA,MAAA,QAAE,IAAI;AACN,8BAAA,oBAAA,aAAA;AAAA,MAAA,QAAE,SAAS;AACb,8BAAA,oBAAA,WAAA;AAAA,MAAA,QAAE,OAAO;;MACN,IAAC,EAAA,EAAC,WAAW;AAAA,MAAe,IAAC,EAAA,EAAC,WAAW,YAAa,KAAK,IAAI;AAAA;;AAL7E,aAMC,QAAA,oBAAA,MAAA;AAAA;;AALa,UAAA,MAAA,CAAA;AAAA,MAAA,MAAA,yCAAA;AAAA,MAAAA,SAAE,KAAE;;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AAA;0BAC1C,WAAW,IAAA;0BACX,cAAc,OAAA;AACd,kBAAA;AACA,iBAAA;AAAA;;;;;AAGJ,UAAO,MAAM,MAAO,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/AparteChat.svelte","../src/lib/stores/aparteChat.ts","../src/lib/stores/aparteClient.ts","../src/lib/stores/conversationManager.ts","../src/lib/AparteUi.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { onMount, onDestroy, tick, createEventDispatcher } from 'svelte';\n import { AparteChatHost, isAwaitingReply, type AparteChatHostBinding, type AparteConfigClass, type AparteChatImperativeApi } from '@aparte/core';\n import type { AparteMessage, AparteSegment, AparteSendEventDetail, AparteActionEventDetail } from './types';\n\n export let messages: AparteMessage[] = [];\n export let placeholder = 'Type a message...';\n export let disabled = false;\n export let isTyping = false;\n export let typingText = 'Assistant is thinking...';\n /** When false, Shift+Enter submits and a bare Enter inserts a newline. */\n export let submitOnEnter = true;\n /** Freeze viewport spacer recalculation for this many ms after a conv swap. */\n export let layoutTransitionMs = 0;\n /**\n * Opt in to the \"centered composer when empty\" layout: the composer sits\n * vertically centered with the `empty-state` slot above it while the list is\n * empty, then slides to the bottom on the first message (~0.3s). Off by\n * default — additive.\n */\n export let centerWhenEmpty = false;\n /**\n * Add the file picker + chips strip to the default composer shell. **Off by\n * default**, because the capability needs a host that consumes the files: an\n * `AparteClient` inlines them per its `rawFileInject` option, but if you drive\n * your own loop you must read `event.files` on `messageSent` — otherwise the file\n * the user deliberately attached is dropped in silence. No effect when you fill\n * the `composer` slot (drop `<aparte-composer-add-attachment>` and\n * `<aparte-composer-attachments>` in it yourself).\n */\n export let attachments = false;\n /** Active conversation id (loads/persists via the registered ConversationManager). */\n export let conversationId: string | null = null;\n /**\n * Instance {@link AparteConfigClass} for this chat. When set, aparté components\n * inside resolve THIS config instead of the global `AparteConfig` singleton, so\n * several independently-configured chats can coexist on one page. Omit for the\n * global config. Read once when the host mounts.\n */\n export let config: AparteConfigClass | undefined = undefined;\n\n const dispatch = createEventDispatcher<{\n /**\n * User submitted a message from the composer. It is **appended to the\n * thread automatically** (optimistic UI) before this fires — do NOT add it\n * again (uncontrolled → duplicates; controlled → mirror into your own\n * `messages`). For side-effects: scroll, analytics, send.\n */\n messageSent: AparteSendEventDetail;\n /** A custom bubble action (registerBubbleAction) was clicked — typed aparte-action. */\n action: AparteActionEventDetail;\n /** Active path changed (branch nav/edit/retry/streaming) — bind back to `messages`. */\n messagesChange: AparteMessage[];\n messageAppended: AparteMessage;\n /** The typing/\"thinking\" indicator toggled (the host flips it off on the first streamed token). */\n typingChange: boolean;\n conversationCreated: string;\n }>();\n\n // Generated client-side in onMount (below): during SSR this stays empty so the\n // server and first client render agree on the id — no hydration mismatch.\n let hostId = '';\n\n let rootRef: HTMLElement;\n let viewportRef: HTMLElement;\n let composerRef: HTMLElement;\n let internalMessages: AparteMessage[] = [...messages];\n let typingActive = isTyping;\n let host: AparteChatHost | null = null;\n let teardown: (() => void) | null = null;\n\n // Parent push → internal list (guarded against the host's own emit round-trip).\n let lastProp = messages;\n $: if (messages !== lastProp) {\n lastProp = messages;\n internalMessages = [...messages];\n if (messages.length === 0) host?.clearRenderCache();\n }\n\n // Controlled typing indicator (host may flip it off on the first token).\n let lastTyping = isTyping;\n $: if (isTyping !== lastTyping) { lastTyping = isTyping; typingActive = isTyping; }\n\n // Conversation id changes (initial value loaded by the host on bind).\n let lastConv = conversationId;\n $: if (conversationId !== lastConv) {\n lastConv = conversationId;\n void host?.setConversationId(conversationId ?? null);\n }\n\n // Reconcile bubbles after the rendered list changes (host queries the DOM).\n $: if (host && internalMessages) { void tick().then(() => host?.syncBubbles()); }\n\n // Composer attributes set imperatively (like Angular's `[attr.x]`): Svelte's\n // custom-element binding assigns to *properties*, but aparte-composer exposes\n // some of these (e.g. `placeholder`) as getter-only — assigning throws.\n function toggleAttr(el: HTMLElement, name: string, on: boolean, value: string) {\n if (on) el.setAttribute(name, value); else el.removeAttribute(name);\n }\n $: if (composerRef) {\n composerRef.setAttribute('target', hostId);\n composerRef.setAttribute('placeholder', placeholder);\n toggleAttr(composerRef, 'disabled', disabled, '');\n toggleAttr(composerRef, 'submit-on-enter', !submitOnEnter, 'false');\n }\n\n function handleSend(event: Event) {\n (viewportRef as unknown as { requestSmoothScroll?: () => void })?.requestSmoothScroll?.();\n dispatch('messageSent', (event as CustomEvent<AparteSendEventDetail>).detail);\n }\n\n // Custom bubble actions bubble to the root as `aparte-action` — dispatch typed.\n function handleAction(event: Event) {\n dispatch('action', (event as CustomEvent<AparteActionEventDetail>).detail);\n }\n\n onMount(() => {\n hostId = `aparte-chat-${crypto.randomUUID()}`;\n // Set the id imperatively (deterministic, like Angular's ngAfterViewInit) rather\n // than waiting on a reactive re-render of `id={hostId}`; the composer target\n // reactive block below picks up the same hostId.\n if (rootRef) rootRef.id = hostId;\n const binding: AparteChatHostBinding = {\n hostId,\n host: rootRef,\n viewport: viewportRef,\n getMessages: () => internalMessages,\n setMessages: (m) => { internalMessages = m as AparteMessage[]; },\n onMessagesChange: (m) => dispatch('messagesChange', m as AparteMessage[]),\n onMessageAppended: (m) => dispatch('messageAppended', m as AparteMessage),\n onTypingChange: (t) => { typingActive = t; dispatch('typingChange', t); },\n onStreamingChange: () => { /* exposed via isStreaming() */ },\n afterRender: (cb) => { void tick().then(cb); },\n resetComposer: () => (composerRef as unknown as { reset?: () => void })?.reset?.(),\n };\n host = new AparteChatHost(binding, {\n layoutTransitionMs,\n conversationId: conversationId ?? null,\n onConversationCreated: (id) => dispatch('conversationCreated', id),\n config,\n });\n teardown = host.bind();\n host.syncBubbles();\n rootRef?.addEventListener('aparte-action', handleAction);\n });\n\n onDestroy(() => {\n rootRef?.removeEventListener('aparte-action', handleAction);\n teardown?.();\n teardown = null;\n host = null;\n });\n\n // ── Imperative API (bind:this on the component) ──\n export function appendMessage(m: AparteMessage) { host?.appendMessage(m); }\n export function updateMessage(id: string, u: Partial<AparteMessage>) { host?.updateMessage(id, u); }\n export function updateLastMessage(content: string, options?: { append?: boolean }) {\n host?.updateLastMessage(content, options);\n }\n export function addSegment(segment: AparteSegment) { host?.addSegment(segment); }\n export function updateSegment(segmentId: string, updates: Partial<AparteSegment>) {\n host?.updateSegment(segmentId, updates);\n }\n export function removeSegment(segmentId: string) { host?.removeSegment(segmentId); }\n export function appendToSegment(segmentId: string, content: string) {\n host?.appendToSegment(segmentId, content);\n }\n export function getMessages(): AparteMessage[] { return host?.getMessages() ?? internalMessages; }\n export function clearMessages() { host?.clearMessages(); }\n export function addBranch(messageId: string): number { return host?.addBranch(messageId) ?? 0; }\n export function addSiblingOf(existingId: string, message: AparteMessage): string | null {\n return host?.addSiblingOf(existingId, message) ?? null;\n }\n export function truncateFrom(messageId: string) { host?.truncateFrom(messageId); }\n export function truncateResponsesAfter(userMessageId: string) {\n host?.truncateResponsesAfter(userMessageId);\n }\n export function injectTokenStream(messageId: string, tokens: AsyncIterable<string>): Promise<void> {\n return host?.streamTokens(messageId, tokens) ?? Promise.resolve();\n }\n export function stopTokenStream() { host?.stopTokenStream(); }\n export function setConversationId(id: string | null): Promise<void> {\n return host?.setConversationId(id) ?? Promise.resolve();\n }\n export function scrollToBottom() {\n (viewportRef as unknown as { scrollToBottom?: () => void })?.scrollToBottom?.();\n }\n /**\n * The `<aparte-chat-viewport>` element — for custom scroll handling, an\n * IntersectionObserver, etc. Same `getViewport()` accessor on all four\n * wrappers.\n */\n export function getViewport(): HTMLElement | null { return viewportRef ?? null; }\n export function focusInput() {\n (composerRef as unknown as { focus?: () => void })?.focus?.();\n }\n export function isStreaming(): boolean { return host?.isStreaming ?? false; }\n\n // Compile-time parity check: Svelte 4 can't generic-annotate `export function`s,\n // so this never-called factory type-checks that the exported surface matches the\n // canonical AparteChatImperativeApi. A dropped/mistyped method is a build error.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n function _assertImperativeParity(): AparteChatImperativeApi {\n return {\n appendMessage, updateMessage, updateLastMessage, addSegment, updateSegment, removeSegment,\n appendToSegment, getMessages, clearMessages, addBranch, addSiblingOf, truncateFrom,\n truncateResponsesAfter, injectTokenStream, stopTokenStream, setConversationId,\n scrollToBottom, focusInput, isStreaming, getViewport,\n };\n }\n</script>\n\n<div\n class=\"aparte-chat-container\"\n class:aparte-chat-container--auto-center={centerWhenEmpty}\n data-aparte-chat\n data-aparte-empty={centerWhenEmpty && internalMessages.length === 0 ? '' : null}\n id={hostId}\n bind:this={rootRef}\n>\n <aparte-chat-viewport bind:this={viewportRef} framework-managed=\"\">\n <!-- Welcome / placeholder shown inside the viewport while empty. -->\n {#if internalMessages.length === 0}\n <slot name=\"empty-state\" />\n {/if}\n <!-- `bubble` slot renders your OWN element per message in place of\n <aparte-chat-bubble>; driven by the reactive list so it streams live. -->\n {#each internalMessages as m (m.id)}\n <slot name=\"bubble\" message={m}>\n <aparte-chat-bubble\n message-id={m.id}\n data-role={m.role}\n timestamp={m.timestamp}\n content={m.content}\n streaming={isAwaitingReply(m) ? '' : null}\n />\n </slot>\n {/each}\n <aparte-chat-status visible={typingActive ? '' : null} text={typingText} />\n </aparte-chat-viewport>\n\n <!-- Content above the composer (banner, disclaimer, context chip). -->\n <slot name=\"above-composer\" />\n\n <aparte-composer\n bind:this={composerRef}\n on:aparte-send={handleSend}\n >\n <!-- Custom composer via the `composer` slot; falls back to the default\n shell (input · send, plus the attachment primitives when `attachments` is\n set). Compose the headless aparte-composer-* primitives freely for a\n skin-specific layout. -->\n <slot name=\"composer\">\n <div class=\"aparte-composer-shell\">\n {#if attachments}<aparte-composer-attachments></aparte-composer-attachments>{/if}\n <div class=\"aparte-composer-row\">\n {#if attachments}<aparte-composer-add-attachment></aparte-composer-add-attachment>{/if}\n <aparte-composer-input></aparte-composer-input>\n <aparte-composer-send></aparte-composer-send>\n </div>\n <!-- Footer slots (model selector, token counter…). The row is\n removed from view by .aparte-composer-footer:empty when unused. -->\n {#if $$slots['footer-left'] || $$slots['footer-center'] || $$slots['footer-right']}\n <div class=\"aparte-composer-footer\">\n <slot name=\"footer-left\" />\n <slot name=\"footer-center\" />\n <slot name=\"footer-right\" />\n </div>\n {/if}\n </div>\n </slot>\n </aparte-composer>\n</div>\n","import { writable, type Writable } from 'svelte/store';\nimport type { AparteChatImperativeApi } from '@aparte/core';\nimport type { AparteMessage, AparteSegment } from '../types.js';\n\n/**\n * The imperative surface `<AparteChat>` exposes (its `export function`s) — the\n * canonical contract shared by all four wrappers (`AparteChatImperativeApi`).\n */\nexport type AparteChatInstance = AparteChatImperativeApi;\n\nexport interface AparteChatStore {\n /** Subscribe with `$messages` and bind to `<AparteChat messages={$messages}>`. */\n messages: Writable<AparteMessage[]>;\n /** Register the component instance via `bind:this`. */\n connect(component: AparteChatInstance | null): void;\n /** Wire to `on:messagesChange={(e) => chat.onMessagesChange(e.detail)}`. */\n onMessagesChange(messages: AparteMessage[]): void;\n appendMessage(message: AparteMessage): void;\n updateMessage(messageId: string, updates: Partial<AparteMessage>): void;\n updateLastMessage(content: string, options?: { append?: boolean }): void;\n addSegment(segment: AparteSegment): void;\n updateSegment(segmentId: string, updates: Partial<AparteSegment>): void;\n removeSegment(segmentId: string): void;\n appendToSegment(segmentId: string, content: string): void;\n clearMessages(): void;\n addBranch(messageId: string): number;\n addSiblingOf(existingId: string, message: AparteMessage): string | null;\n truncateFrom(messageId: string): void;\n truncateResponsesAfter(userMessageId: string): void;\n injectTokenStream(messageId: string, tokens: AsyncIterable<string>): Promise<void>;\n stopTokenStream(): void;\n setConversationId(id: string | null): Promise<void>;\n isStreaming(): boolean;\n}\n\n/**\n * Idiomatic Svelte ergonomics for `<AparteChat>`. Owns the `messages` store so the\n * consumer skips the manual `on:messagesChange` → `messages` round-trip.\n *\n * @example\n * const chat = createAparteChat();\n * const { messages } = chat;\n * let comp;\n * $: chat.connect(comp);\n * // <AparteChat bind:this={comp} messages={$messages}\n * // on:messagesChange={(e) => chat.onMessagesChange(e.detail)} />\n */\nexport function createAparteChat(initial: AparteMessage[] = []): AparteChatStore {\n const messages = writable<AparteMessage[]>([...initial]);\n let comp: AparteChatInstance | null = null;\n return {\n messages,\n connect: (component) => { comp = component; },\n onMessagesChange: (m) => messages.set(m),\n appendMessage: (m) => comp?.appendMessage(m),\n updateMessage: (id, u) => comp?.updateMessage(id, u),\n updateLastMessage: (c, o) => comp?.updateLastMessage(c, o),\n addSegment: (s) => comp?.addSegment(s),\n updateSegment: (id, u) => comp?.updateSegment(id, u),\n removeSegment: (id) => comp?.removeSegment(id),\n appendToSegment: (id, c) => comp?.appendToSegment(id, c),\n clearMessages: () => comp?.clearMessages(),\n addBranch: (id) => comp?.addBranch(id) ?? 0,\n addSiblingOf: (id, m) => comp?.addSiblingOf(id, m) ?? null,\n truncateFrom: (id) => comp?.truncateFrom(id),\n truncateResponsesAfter: (id) => comp?.truncateResponsesAfter(id),\n injectTokenStream: (id, tokens) => comp?.injectTokenStream(id, tokens) ?? Promise.resolve(),\n stopTokenStream: () => comp?.stopTokenStream(),\n setConversationId: (id) => comp?.setConversationId(id) ?? Promise.resolve(),\n isStreaming: () => comp?.isStreaming() ?? false,\n };\n}\n","import { onMount, onDestroy } from 'svelte';\nimport { AparteClient, type AparteClientOptions } from '@aparte/core';\n\n/**\n * Mounts an `AparteClient` that bridges `aparte-send` events to the configured AI\n * providers. Starts on mount, stops on destroy. Call from a component's script.\n * Svelte equivalent of Angular's `AparteAiService`.\n */\nexport function createAparteClient(options?: AparteClientOptions) {\n const client = new AparteClient(options ?? {});\n onMount(() => { client.start(); });\n onDestroy(() => client.stop());\n return { client, abort: () => client.abort() };\n}\n","import { writable, derived } from 'svelte/store';\nimport { onDestroy } from 'svelte';\nimport {\n AparteConfig,\n ConversationManager,\n type AparteConversation,\n type AparteStorageAdapter,\n} from '@aparte/core';\nimport type { AparteMessage } from '../types.js';\n\n/**\n * Svelte-store wrapper around the core `ConversationManager`. The active\n * conversation is owned by the chat component's controller; switch by binding\n * `conversationId` on `<AparteChat>`. Call from a component's script. Svelte\n * equivalent of Angular's `ConversationManagerService`.\n */\nexport function createConversationManager() {\n let manager: ConversationManager | null = null;\n let unsub: (() => void) | null = null;\n\n const conversations = writable<AparteConversation[]>([]);\n const activeId = writable<string | null>(null);\n const activeConversations = derived(conversations, ($c) =>\n $c.filter((c) => !c.archivedAt).sort((a, b) => b.updatedAt - a.updatedAt),\n );\n const archivedConversations = derived(conversations, ($c) =>\n $c.filter((c) => !!c.archivedAt).sort((a, b) => b.updatedAt - a.updatedAt),\n );\n const activeConversation = derived([conversations, activeId], ([$c, $id]) =>\n $id ? $c.find((c) => c.id === $id) ?? null : null,\n );\n\n onDestroy(() => unsub?.());\n\n const assert = (): ConversationManager => {\n if (!manager) throw new Error('[createConversationManager] Not initialised. Call init(adapter) first.');\n return manager;\n };\n\n async function init(adapter: AparteStorageAdapter): Promise<void> {\n const m = new ConversationManager(adapter);\n manager = m;\n unsub = m.subscribe((convs) => {\n conversations.set([...convs]);\n activeId.set(m.activeId);\n });\n await m.init();\n activeId.set(m.activeId);\n AparteConfig.setConversationManager(m);\n }\n\n return {\n conversations,\n activeConversations,\n archivedConversations,\n activeId,\n activeConversation,\n init,\n createNew: (title?: string) => assert().createNew(title),\n addMessage: (convId: string, message: AparteMessage) => assert().addMessage(convId, message),\n updateMessages: (convId: string, messages: AparteMessage[]) => assert().updateMessages(convId, messages),\n delete: (id: string) => assert().delete(id),\n archive: (id: string) => assert().archive(id),\n unarchive: (id: string) => assert().unarchive(id),\n };\n}\n","<script lang=\"ts\">\n import { onMount, onDestroy, createEventDispatcher } from 'svelte';\n import { applyElementProps, DEFAULT_UI_EVENTS } from '@aparte/core';\n\n /** The custom element tag name (e.g. 'aparte-model-selector'). */\n export let name: string;\n /** Props to apply. Keys starting with `--` become CSS variables. */\n export let props: Record<string, unknown> = {};\n /**\n * Which custom events to forward through `elementEvent`. Defaults to the\n * interactive aparté surface (DEFAULT_UI_EVENTS); pass your own list to listen to\n * other events (e.g. ['aparte-composer-change'] for attachments).\n */\n export let events: string[] | undefined = undefined;\n\n const dispatch = createEventDispatcher<{ elementEvent: CustomEvent }>();\n\n let host: HTMLElement;\n let el: HTMLElement | null = null;\n let cleanups: Array<() => void> = [];\n\n function applyProps() {\n if (el) applyElementProps(el, props);\n }\n\n function create() {\n if (!host) return;\n el = document.createElement(name);\n applyProps();\n for (const ev of events ?? DEFAULT_UI_EVENTS) {\n const listener = (e: Event) => dispatch('elementEvent', e as CustomEvent);\n el.addEventListener(ev, listener);\n cleanups.push(() => el?.removeEventListener(ev, listener));\n }\n host.appendChild(el);\n }\n\n function destroy() {\n for (const c of cleanups) c();\n cleanups = [];\n el?.remove();\n el = null;\n }\n\n onMount(create);\n onDestroy(destroy);\n\n // Recreate the element when `name` (or the forwarded event set) changes. A\n // joined key so a fresh inline `events` array doesn't thrash the element.\n let lastName = name;\n let lastEvtsKey = (events ?? DEFAULT_UI_EVENTS).join('|');\n $: {\n const evtsKey = (events ?? DEFAULT_UI_EVENTS).join('|');\n if (el && (name !== lastName || evtsKey !== lastEvtsKey)) {\n lastName = name;\n lastEvtsKey = evtsKey;\n destroy();\n create();\n }\n }\n $: if (el && props) applyProps();\n\n export function getElement() { return el; }\n export function callMethod(methodName: string, ...args: unknown[]) {\n const fn = (el as unknown as Record<string, unknown>)?.[methodName];\n return typeof fn === 'function' ? (fn as (...a: unknown[]) => unknown).apply(el, args) : undefined;\n }\n</script>\n\n<span bind:this={host} style=\"display: contents\"></span>\n"],"names":["ctx","init"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAoOmC,IAAC,EAAA;AAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,8BAAA,oBAAA,cAAA;AAAA,MAAA,QAAE,EAAE;AACL,8BAAA,oBAAA,aAAA;AAAA,MAAA,QAAE,IAAI;AACN,8BAAA,oBAAA,aAAA;AAAA,MAAA,QAAE,SAAS;AACb,8BAAA,oBA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AAY,OAAa,SAAS,gBAAgB,CAAgB;AACxE,SAAG,iBAAiB,IAAI,QAAQ;AAChC,eAAS,KAAA,MAAW,IAAI,oBAAoB,IAAI,QAAQ,CAAA;AAAA;AAE1D,SAAK,YAAY,EAAE;AAAA;AAGZ,WAAA,UAAA;AACI,eAAA,KAAK,SAAU,GAAA;AAC1B,eAAA,CAAA;AACA,QAAI,OAAA;oBACJ,KAAK,IAAA;AAAA;AAGP,UAAQ,MAAM;AACd,YAAU,OAAO;MAIb,WAAW;MACX,eAAe,UAAU,mBAAmB,KAAK,GAAG;AAYxC,WAAA,aAAA;AAAsB,WAAA;AAAA;AACtB,WAAA,WAAW,eAAuB,MAAA;AAC1C,UAAA,KAAM,KAA4C,UAAU;AACpD,WAAA,OAAA,OAAO,aAAc,GAAoC,MAAM,IAAI,IAAI,IAAA;AAAA;;;AAIxE,aAAI;;;;;;;;;;;;AAlBnB;cACQ,WAAW,UAAU,mBAAmB,KAAK,GAAG;YAClD,OAAO,SAAS,YAAY,YAAY,cAAA;0BAC1C,WAAW,IAAA;0BACX,cAAc,OAAA;AACd,kBAAA;AACA,iBAAA;AAAA;;;;;AAGJ,UAAO,MAAM,MAAO,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparte/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-alpha.0",
|
|
4
4
|
"description": "Svelte 4 wrapper for aparté — an ergonomic <AparteChat> component plus stores over the framework-agnostic web components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -25,16 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"svelte": "^4.0.0",
|
|
28
|
-
"@aparte/core": "0.
|
|
28
|
+
"@aparte/core": "0.4.0-alpha.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
|
32
32
|
"@testing-library/svelte": "^5.2.0",
|
|
33
33
|
"jsdom": "^22.1.0",
|
|
34
34
|
"svelte": "^4.2.0",
|
|
35
|
+
"svelte-check": "^3.8.0",
|
|
35
36
|
"typescript": "^5.4.0",
|
|
36
37
|
"vite": "^6.0.0",
|
|
37
|
-
"@aparte/core": "0.
|
|
38
|
+
"@aparte/core": "0.4.0-alpha.0"
|
|
38
39
|
},
|
|
39
40
|
"keywords": [
|
|
40
41
|
"svelte",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"url": "https://github.com/apartejs/aparte/issues"
|
|
54
55
|
},
|
|
55
56
|
"scripts": {
|
|
57
|
+
"typecheck:tests": "svelte-check --tsconfig ./tsconfig.check.json --threshold error --output human",
|
|
56
58
|
"dev": "vite",
|
|
57
59
|
"build": "vite build && tsc -b --emitDeclarationOnly --force",
|
|
58
60
|
"preview": "vite preview",
|