SPB Git

Repository Public MIT

manifest.json 4.2 KB 67 lines json

1{2  "accessibility" : [3    "The role is written above the bubble and read with the text (\"Assistant, …\"): it never depends on colour or side.",4    "The text is selectable (`textSelection(.enabled)`); copy is also in the context menu.",5    "While streaming the element has the \"updates frequently\" trait and the indicator has a text label; its symbol animation stops with Reduce Motion.",6    "Failure is a symbol plus text. The copy button is labelled \"Copy\" / \"Copied\" and has a 44-point target on iOS.",7    "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."8  ],9  "category" : "ai",10  "changelog" : [11    {12      "changes" : [13        "Initial release."14      ],15      "date" : "2026-12-02",16      "version" : "1.0.0"17    }18  ],19  "dependencies" : [20    {21      "id" : "glass-foundation",22      "version" : "1.0.0"23    }24  ],25  "description" : "Message bubble with role, streaming state, text selection and copy.",26  "examples" : [27    {28      "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: \"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",29      "title" : "GlassChatBubble example"30    }31  ],32  "files" : [33    {34      "bytes" : 11491,35      "path" : "AI/AI/GlassChatBubble.swift",36      "sha256" : "9d0191528911ec7299949f4abd56bb1a433a9c81d3f4d9403aabef262ec030f1"37    }38  ],39  "frameworks" : [4041  ],42  "id" : "glass-chat-bubble",43  "kind" : "content-component",44  "license" : "MIT",45  "minimumOS" : {46    "iOS" : "26.0",47    "iPadOS" : "26.0",48    "macOS" : "26.0"49  },50  "name" : "GlassChatBubble",51  "platforms" : [52    "iOS",53    "iPadOS",54    "macOS"55  ],56  "schemaVersion" : 1,57  "sha256" : "a5c6e7e14b1b49b6402657e0cece67e8d1af501fc194ee79837f0651560583cb",58  "symbols" : [59    "GlassChatRole",60    "GlassChatMessageState",61    "GlassChatMessage",62    "GlassChatBubbleMetrics",63    "GlassChatBubble"64  ],65  "version" : "1.0.0"66}67
Files main
Menu

Theme