@molecule/app-moderation-queue-svelte
v1.1.2
Published
Moderation queue UI: flagged items list with approve/reject/escalate/mute actions, severity, and bulk-select
Maintainers
Readme
@molecule/app-moderation-queue-svelte
Svelte moderation queue UI.
Exports ModerationQueue — a list of flagged items with kind icon, content
preview, reason chip, severity color, per-row action buttons (approve /
reject / escalate / mute), and a bulk-select toolbar (select-all checkbox +
apply-to-selected action buttons) — and the severityColor helper. It is the
Svelte counterpart of @molecule/app-moderation-queue-react: same props
(React names), same DOM for the same input.
All user-visible text is i18n'd via the companion locale bond
@molecule/app-locales-moderation-queue.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { ModerationQueue } from '@molecule/app-moderation-queue-svelte'
const items = [
{
id: 'r-1',
kind: 'comment',
preview: 'Some flagged comment',
reason: 'Hate speech',
reportedBy: '@alice',
reportedAt: '2 min ago',
severity: 'high',
},
]
</script>
<ModerationQueue
{items}
onApprove={(id) => api.approve(id)}
onReject={(id) => api.reject(id)}
onEscalate={(id) => api.escalate(id)}
onMute={(id) => api.mute(id)}
onBulkAction={(action, ids) => api.bulk(action, ids)}
/>Type
feature
Installation
npm install @molecule/app-moderation-queue-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelteAPI
Interfaces
ModerationItem
One flagged item awaiting moderator review.
interface ModerationItem {
/** Unique id used for selection + action callbacks (the row's render key). */
id: string
/** Content kind, drives icon + kind label. */
kind: ModerationItemKind
/** Pre-rendered preview slot (usually the offending content). */
preview: Snippet | string
/** Reason the item was flagged. Free-form string or pre-rendered snippet. */
reason: Snippet | string
/** Display name / id of the reporter, optional. */
reportedBy?: Snippet | string
/** When the report was filed (string or pre-formatted snippet). */
reportedAt: Snippet | string
/** Severity — colors the severity chip. */
severity?: ModerationItemSeverity
}ModerationQueueProps
Props accepted by the {@link ModerationQueue} component — the same props
@molecule/app-moderation-queue-react accepts.
interface ModerationQueueProps {
/** Flagged items to display. */
items: ModerationItem[]
/** Approve the item — content is allowed / kept. */
onApprove: (id: string) => void
/** Reject the item — content is removed / hidden. */
onReject: (id: string) => void
/** Escalate to a senior moderator / human review. Optional. */
onEscalate?: (id: string) => void
/** Mute the reporter / poster. Optional. */
onMute?: (id: string) => void
/** Apply an action to the currently-selected ids, if bulk select is in use. */
onBulkAction?: (action: ModerationBulkAction, ids: string[]) => void
/** Loading state — replaces the list with a spinner row. */
loading?: boolean
/** Empty-state slot rendered when `items` is empty and `loading` is false. */
emptyState?: Snippet | string
/** Extra classes for the outer container. */
className?: string
}Types
ModerationItemKind
Kind of content awaiting moderation. Drives the leading icon glyph
and the row's data-mol-kind attribute used by tests + AI agents.
type ModerationItemKind = 'post' | 'comment' | 'image' | 'message' | 'profile'ModerationItemSeverity
Severity assigned to a flagged item, used to color the severity chip.
Maps to ColorVariant: low→info, medium→warning, high→error.
type ModerationItemSeverity = 'low' | 'medium' | 'high'ModerationBulkAction
Bulk action a moderator can apply to selected ids.
type ModerationBulkAction = 'approve' | 'reject' | 'escalate' | 'mute'Functions
severityColor(severity)
Translates a severity to its ColorVariant. Exported for tests and
downstream consumers (chips, badges, summary tiles).
function severityColor(severity: ModerationItemSeverity | undefined): ColorVariantseverity— Severity bucket ('low','medium','high') or undefined.
Returns: Mapped ColorVariant, defaulting to 'info' when severity is omitted.
Constants
ModerationQueue
const ModerationQueue: LegacyComponentTypeInjection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.1.0svelte^5.0.0
Runtime Dependencies
@molecule/app-svelte@molecule/app-ui@molecule/app-ui-sveltesvelteRequires a bonded ClassMap — rendering throws otherwise.
Selection state is internal: the component reports a bulk action through
onBulkActionand clears the selection afterwards.Rows are keyed by
item.id(React'skey={item.id}), so a row keeps its DOM node while its id is unchanged and moves with it on a reorder.Node-valued props (
preview,reason,reportedBy,reportedAt,emptyState) are snippets or plain strings.
Translations
Translation strings are provided by @molecule/app-locales-moderation-queue.
