@molecule/app-activity-feed-svelte

Feature · activity-feed · App (browser) · v1.1.0 · Apache-2.0

Svelte activity feed rows and date-grouped feed container

npm install @molecule/app-activity-feed-svelte

npm · Source on GitHub

How it works

@molecule/app-activity-feed-svelte is a ready-made activity-feed feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

<script lang="ts">
  import { ActivityFeed, ActivityFeedGroup } from '@molecule/app-activity-feed-svelte'

  const items = [
    { id: '1', actor: 'Alice', verb: 'commented on', target: 'PR #42', timestamp: '2m ago' },
    { id: '2', actor: 'Bob', verb: 'closed', target: 'Issue #7', timestamp: '1h ago' },
  ]
</script>

<!-- Flat feed -->
<ActivityFeed {items}>
  {#snippet emptyState()}<p>No activity yet.</p>{/snippet}
</ActivityFeed>

<!-- Grouped by date -->
<ActivityFeedGroup heading="Today" {items} />

Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte

Reference

Svelte activity-feed primitives — the Svelte counterpart of @molecule/app-activity-feed-react: the same props (React names) and the same DOM for the same input.

Exports:

  • <ActivityFeed> — flat vertical list of activity rows.
  • <ActivityFeedItem> — single row (avatar + actor/verb/target + timestamp + body).
  • <ActivityFeedGroup> — heading + list, compose multiple for "Today / Yesterday" feeds.
  • ActivityFeedItemData type for row data.

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.ts JSDoc, not this file.

Quick Start

<script lang="ts">
  import { ActivityFeed, ActivityFeedGroup } from '@molecule/app-activity-feed-svelte'

  const items = [
    { id: '1', actor: 'Alice', verb: 'commented on', target: 'PR #42', timestamp: '2m ago' },
    { id: '2', actor: 'Bob', verb: 'closed', target: 'Issue #7', timestamp: '1h ago' },
  ]
</script>

<!-- Flat feed -->
<ActivityFeed {items}>
  {#snippet emptyState()}<p>No activity yet.</p>{/snippet}
</ActivityFeed>

<!-- Grouped by date -->
<ActivityFeedGroup heading="Today" {items} />

Type

feature

Installation

npm install @molecule/app-activity-feed-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

ActivityFeedItemData

Per-row activity data.

interface ActivityFeedItemData {
  /** Row id (the render key). */
  id: string
  /** Actor avatar source URL. */
  avatarSrc?: string
  /** Actor display name (a snippet, or plain text). */
  actor: Snippet | string | number
  /** Verb describing the action ("commented on", "assigned", "completed"; a snippet, or plain text). */
  verb: Snippet | string | number
  /** Object of the action ("the ticket", "Project Alpha", etc.; a snippet, or plain text). */
  target?: Snippet | string | number
  /** Optional supporting body (quote, diff, preview; a snippet, or plain text). */
  body?: Snippet | string | number
  /** ISO timestamp or any node to render as "time ago" (a snippet, or plain text). */
  timestamp: Snippet | string | number
  /** Optional leading icon, replacing the avatar (a snippet, or plain text). */
  icon?: Snippet | string | number
}

ActivityFeedProps

Props accepted by the ActivityFeed component.

interface ActivityFeedProps {
  /** Items in display order (usually most-recent first). */
  items: ActivityFeedItemData[]
  /** Rendered when `items` is empty. */
  emptyState?: Snippet
  /** Optional footer (e.g. "Load more"). */
  footer?: Snippet
  /** Extra classes. */
  className?: string
}

ActivityFeedItemProps

Props accepted by the ActivityFeedItem component.

interface ActivityFeedItemProps {
  /** The row to render. */
  item: ActivityFeedItemData
  /** Extra classes on the row wrapper. */
  className?: string
}

ActivityFeedGroupProps

Props accepted by the ActivityFeedGroup component.

interface ActivityFeedGroupProps {
  /**
   * Group heading — typically a formatted date ("Today", "Yesterday", "Mar 12").
   * A snippet, or plain text.
   */
  heading: Snippet | string | number
  /** Items in this group. */
  items: ActivityFeedItemData[]
  /** Extra classes. */
  className?: string
}

Constants

ActivityFeed

const ActivityFeed: LegacyComponentType

ActivityFeedGroup

const ActivityFeedGroup: LegacyComponentType

ActivityFeedItem

const ActivityFeedItem: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.5.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.0.0

Runtime Dependencies

  • @molecule/app-svelte

  • @molecule/app-ui

  • @molecule/app-ui-svelte

  • svelte

  • Requires a bonded ClassMap (getClassMap()); rendering throws otherwise.

  • Node-valued props are snippets (emptyState, footer, heading) or plain text; row fields accept a snippet or plain text.

  • Rows are keyed by their id, so a re-passed or re-ordered list keeps each row's DOM the way React's key does.