@atmo-dev/kit 0.19.1 → 0.19.2
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.
|
@@ -70,6 +70,11 @@
|
|
|
70
70
|
notice?: string;
|
|
71
71
|
/** More toolbar buttons, after the built-in ones. */
|
|
72
72
|
actions?: Snippet<[{ post: Post; insert: (text: string) => void; disabled: boolean }]>;
|
|
73
|
+
/**
|
|
74
|
+
* `inline` sits in the page, e.g. a reply field under a post: no header or dividers,
|
|
75
|
+
* with Cancel and the submit button at the end of the toolbar.
|
|
76
|
+
*/
|
|
77
|
+
layout?: 'default' | 'inline';
|
|
73
78
|
class?: string;
|
|
74
79
|
};
|
|
75
80
|
</script>
|
|
@@ -134,8 +139,10 @@
|
|
|
134
139
|
notice,
|
|
135
140
|
drafts: draftStore,
|
|
136
141
|
actions,
|
|
142
|
+
layout = 'default',
|
|
137
143
|
class: className
|
|
138
144
|
}: PostComposerProps = $props();
|
|
145
|
+
const inline = untrack(() => layout === 'inline');
|
|
139
146
|
|
|
140
147
|
let limits = $derived({ ...defaultComposerLimits, ...limitOverrides });
|
|
141
148
|
const on = (feature: keyof ComposerFeatures) => features[feature] !== false;
|
|
@@ -395,6 +402,26 @@
|
|
|
395
402
|
}
|
|
396
403
|
</script>
|
|
397
404
|
|
|
405
|
+
{#snippet controls()}
|
|
406
|
+
{#if oncancel}
|
|
407
|
+
<Button variant="ghost" size="sm" onclick={cancel} disabled={busy}>
|
|
408
|
+
{labels.cancel ?? 'Cancel'}
|
|
409
|
+
</Button>
|
|
410
|
+
{/if}
|
|
411
|
+
<span class="min-w-0 flex-1 truncate text-right text-xs {muted}" aria-live="polite">{status}</span
|
|
412
|
+
>
|
|
413
|
+
{#if canDraft}
|
|
414
|
+
<Button variant="ghost" size="sm" onclick={() => (draftsOpen = true)} disabled={busy}>
|
|
415
|
+
Drafts
|
|
416
|
+
</Button>
|
|
417
|
+
{/if}
|
|
418
|
+
<Button size="sm" class="min-w-16" onclick={submit} disabled={!canPost} loading={busy}>
|
|
419
|
+
{posts.length > 1
|
|
420
|
+
? (labels.submitAll ?? 'Post all')
|
|
421
|
+
: (labels.submit ?? (reply ? 'Reply' : 'Post'))}
|
|
422
|
+
</Button>
|
|
423
|
+
{/snippet}
|
|
424
|
+
|
|
398
425
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
399
426
|
<div
|
|
400
427
|
class={cn('relative flex min-h-0 flex-1 flex-col', className)}
|
|
@@ -406,28 +433,13 @@
|
|
|
406
433
|
ondragover={(e) => hasFiles(e) && e.preventDefault()}
|
|
407
434
|
ondrop={drop}
|
|
408
435
|
>
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
{/if}
|
|
415
|
-
<span class="min-w-0 flex-1 truncate text-right text-xs {muted}" aria-live="polite"
|
|
416
|
-
>{status}</span
|
|
417
|
-
>
|
|
418
|
-
{#if canDraft}
|
|
419
|
-
<Button variant="ghost" size="sm" onclick={() => (draftsOpen = true)} disabled={busy}>
|
|
420
|
-
Drafts
|
|
421
|
-
</Button>
|
|
422
|
-
{/if}
|
|
423
|
-
<Button size="sm" class="min-w-16" onclick={submit} disabled={!canPost} loading={busy}>
|
|
424
|
-
{posts.length > 1
|
|
425
|
-
? (labels.submitAll ?? 'Post all')
|
|
426
|
-
: (labels.submit ?? (reply ? 'Reply' : 'Post'))}
|
|
427
|
-
</Button>
|
|
428
|
-
</div>
|
|
436
|
+
{#if !inline}
|
|
437
|
+
<div class="flex shrink-0 items-center gap-2 px-3 py-2.5">
|
|
438
|
+
{@render controls()}
|
|
439
|
+
</div>
|
|
440
|
+
{/if}
|
|
429
441
|
|
|
430
|
-
<div class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-2">
|
|
442
|
+
<div class="min-h-0 flex-1 overflow-y-auto overscroll-contain {inline ? 'pt-1' : 'px-4 pt-2'}">
|
|
431
443
|
{#if replyTo}
|
|
432
444
|
<div class="mb-3 flex gap-3 border-b pb-3 {line}">
|
|
433
445
|
{#if author}<span class="w-10 shrink-0"></span>{/if}
|
|
@@ -466,10 +478,10 @@
|
|
|
466
478
|
{/if}
|
|
467
479
|
</div>
|
|
468
480
|
|
|
469
|
-
{#if notice}<p class="shrink-0
|
|
481
|
+
{#if notice}<p class="shrink-0 pb-2 text-xs {inline ? '' : 'px-4'} {muted}">{notice}</p>{/if}
|
|
470
482
|
|
|
471
483
|
{#if on('interactions') || (on('contentWarnings') && contentWarnings.length && hasMedia(current))}
|
|
472
|
-
<div class="flex shrink-0 flex-wrap items-center gap-2
|
|
484
|
+
<div class="flex shrink-0 flex-wrap items-center gap-2 pb-1.5 {inline ? '' : 'px-4'}">
|
|
473
485
|
{#if on('interactions')}
|
|
474
486
|
<Button
|
|
475
487
|
variant="secondary"
|
|
@@ -498,7 +510,11 @@
|
|
|
498
510
|
</div>
|
|
499
511
|
{/if}
|
|
500
512
|
|
|
501
|
-
<div
|
|
513
|
+
<div
|
|
514
|
+
class="flex shrink-0 items-center gap-0.5 {inline
|
|
515
|
+
? '-ml-2 pb-1'
|
|
516
|
+
: `border-t px-2 py-1.5 ${line}`}"
|
|
517
|
+
>
|
|
502
518
|
{#if on('images')}
|
|
503
519
|
<input
|
|
504
520
|
bind:this={imageInput}
|
|
@@ -592,6 +608,7 @@
|
|
|
592
608
|
onclick={addPost}><Icon img={Plus} /></IconButton
|
|
593
609
|
>
|
|
594
610
|
{/if}
|
|
611
|
+
{#if inline}<span class="ml-1.5 flex items-center gap-2">{@render controls()}</span>{/if}
|
|
595
612
|
</div>
|
|
596
613
|
|
|
597
614
|
{#if dragging}
|
|
@@ -72,6 +72,11 @@ export type PostComposerProps = {
|
|
|
72
72
|
insert: (text: string) => void;
|
|
73
73
|
disabled: boolean;
|
|
74
74
|
}]>;
|
|
75
|
+
/**
|
|
76
|
+
* `inline` sits in the page, e.g. a reply field under a post: no header or dividers,
|
|
77
|
+
* with Cancel and the submit button at the end of the toolbar.
|
|
78
|
+
*/
|
|
79
|
+
layout?: 'default' | 'inline';
|
|
75
80
|
class?: string;
|
|
76
81
|
};
|
|
77
82
|
declare const PostComposer: import("svelte").Component<PostComposerProps, {
|