- threads: reply counts, ChatThreadPane with replies, live replies and thread mute - channel pins in ChatPinsPanel; a refused pin hides the action for the session - reactions, attachments with upload progress and bearer downloads, inline edits, the delete dialog (moderators also in channels) - link cards with the registerEmbedRenderer registry; linkify for escaped text - slash commands: the command picker over chatbots, dispatch with sender-only answers - slots conversation-actions (DMs only) and sidebar-footer - chat-tokens.css and chat-base.css, EN and PL copy, README
36 lines
1.6 KiB
Vue
36 lines
1.6 KiB
Vue
<script setup lang="ts">
|
|
// The slash command list of the composer (golem15.chatbots): the commands
|
|
// whose trigger starts with what follows the "/" at the start of the
|
|
// composer. Like the mention list, the textarea keeps focus and points at
|
|
// the active option through aria-activedescendant; picking (mousedown, or
|
|
// Enter and Tab in the composer) runs the command through the chatbots
|
|
// dispatch route, so the answer is shown to the sender only.
|
|
import type { ChatCommand } from '../../lib/types'
|
|
|
|
defineProps<{ id: string; options: ChatCommand[]; active: number; query: string; loading: boolean }>()
|
|
const emit = defineEmits<{ pick: [command: ChatCommand]; hover: [index: number] }>()
|
|
const { t } = useI18n()
|
|
</script>
|
|
|
|
<template>
|
|
<ul :id="id" class="chat-pop chat-command-pop" role="listbox" :aria-label="t('chat.commands.label')">
|
|
<li v-if="loading" class="chat-pop-empty" role="option" aria-disabled="true" aria-selected="false">{{ t('chat.loading') }}</li>
|
|
<li v-else-if="!options.length" class="chat-pop-empty" role="option" aria-disabled="true" aria-selected="false">{{ t('chat.commands.none', { q: query }) }}</li>
|
|
<li
|
|
v-for="(c, i) in options"
|
|
:id="`${id}-opt-${i}`"
|
|
:key="c.trigger"
|
|
class="chat-pop-option"
|
|
:class="{ 'is-active': i === active }"
|
|
role="option"
|
|
:aria-selected="i === active ? 'true' : 'false'"
|
|
:data-command="c.trigger"
|
|
@mousedown.prevent="emit('pick', c)"
|
|
@mousemove="i !== active && emit('hover', i)"
|
|
>
|
|
<span class="chat-pop-name">/{{ c.trigger }}</span>
|
|
<span class="chat-pop-meta">{{ c.description }}</span>
|
|
</li>
|
|
</ul>
|
|
</template>
|