{
  "accessibility" : [
    "The role is written above the bubble and read with the text (\"Assistant, …\"): it never depends on colour or side.",
    "The text is selectable (`textSelection(.enabled)`); copy is also in the context menu.",
    "While streaming the element has the \"updates frequently\" trait and the indicator has a text label; its symbol animation stops with Reduce Motion.",
    "Failure is a symbol plus text. The copy button is labelled \"Copy\" / \"Copied\" and has a 44-point target on iOS.",
    "Alignment uses leading and trailing, so the layout mirrors in right-to-left languages; right-to-left text inside a bubble keeps its natural direction."
  ],
  "category" : "ai",
  "changelog" : [
    {
      "changes" : [
        "Release 1.1.0: see the project changelog."
      ],
      "date" : "2026-12-03",
      "version" : "1.1.0"
    },
    {
      "changes" : [
        "Initial release."
      ],
      "date" : "2026-12-02",
      "version" : "1.0.0"
    }
  ],
  "dependencies" : [
    {
      "id" : "glass-foundation",
      "version" : "1.1.0"
    }
  ],
  "description" : "Message bubble with role, streaming state, text selection and copy.",
  "examples" : [
    {
      "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassChatBubbleExample: GlassExample {\n    public static let componentID = \"glass-chat-bubble\"\n\n    /// Fictitious conversation: no model produced these messages.\n    @State private var messages = [\n        GlassChatMessage(id: \"1\", role: .system, text: \"Sample data — this conversation is fictitious.\"),\n        GlassChatMessage(id: \"2\", role: .user, text: \"Can you summarise the sample quarterly note in two sentences? 🙂\"),\n        GlassChatMessage(id: \"3\", role: .assistant, text: \"Certainly. The sample note reports steady demand and a slightly lower margin. It expects the next quarter to look similar, with one new product line.\"),\n        GlassChatMessage(id: \"4\", role: .tool, text: \"{\\n  \\\"tool\\\": \\\"sample_lookup\\\",\\n  \\\"rows\\\": 3,\\n  \\\"a_very_long_key_without_any_space_to_test_wrapping_inside_the_bubble\\\": true\\n}\"),\n        GlassChatMessage(id: \"4b\", role: .assistant, text: \"The note says:\\n> Demand stayed steady over the quarter.\\nAs a filter:\\n```swift\\nlet steady = notes.filter { $0.demand == .steady }\\n```\"),\n        GlassChatMessage(id: \"5\", role: .user, text: \"هل يمكنك كتابة الخلاصة بالعربية؟\"),\n        GlassChatMessage(id: \"6\", role: .assistant, text: \"The sample answer is still being writ\", state: .streaming),\n        GlassChatMessage(id: \"7\", role: .assistant, text: \"\", state: .streaming),\n        GlassChatMessage(id: \"8\", role: .assistant, text: \"A partial sample answer that stopped.\", state: .failed(reason: \"Sample failure: the connection was interrupted.\")),\n    ]\n    @State private var lastCopied = \"Nothing copied yet\"\n    @State private var retryCount = 0\n\n    public init() {}\n\n    public var body: some View {\n        ScrollView {\n            LazyVStack(spacing: 12) {\n                ForEach(messages) { message in\n                    GlassChatBubble(\n                        message,\n                        usesMonospacedFont: message.role == .tool,\n                        onCopy: { text in lastCopied = \"Copied \\(text.count) characters (kept inside the example)\" },\n                        onRetry: { retryCount += 1 }\n                    )\n                }\n                Text(\"\\(lastCopied) · retried \\(retryCount) times\")\n                    .font(.caption)\n                    .foregroundStyle(.secondary)\n            }\n            .padding()\n        }\n    }\n}\n\n#Preview(\"GlassChatBubble\") { GlassChatBubbleExample().glassTheme(.aurora) }\n",
      "title" : "GlassChatBubble example"
    }
  ],
  "files" : [
    {
      "bytes" : 18557,
      "path" : "AI/AI/GlassChatBubble.swift",
      "sha256" : "e3843a61610b922c9fba6bdfa06257893cb8295a335b388c140d57a3f13dd98c"
    }
  ],
  "frameworks" : [

  ],
  "id" : "glass-chat-bubble",
  "kind" : "content-component",
  "license" : "MIT",
  "minimumOS" : {
    "iOS" : "26.0",
    "iPadOS" : "26.0",
    "macOS" : "26.0"
  },
  "name" : "GlassChatBubble",
  "platforms" : [
    "iOS",
    "iPadOS",
    "macOS"
  ],
  "schemaVersion" : 1,
  "sha256" : "fe5aee4fd9804381128477eff44126bf3ee3702820146be5ddb417af778ee647",
  "symbols" : [
    "GlassChatRole",
    "GlassChatMessageState",
    "GlassChatMessage",
    "GlassChatBubbleMetrics",
    "GlassChatBlock",
    "GlassChatBlocks",
    "GlassChatBubble"
  ],
  "version" : "1.1.0"
}
