SPB Git

Repository Public MIT

manifest.json 4.7 KB 72 lines json

1{2  "accessibility" : [3    "The editor is labelled \"Message\"; the buttons are labelled \"Attach\", \"Send\" and \"Stop\" with tooltips on macOS and 44-point targets on iOS.",4    "Chips sit in a container labelled \"Attachments\"; each remove button reads \"Remove <name>\".",5    "The text follows Dynamic Type and the bar grows with the number of lines up to the limit.",6    "With Reduce Transparency the bar is an opaque themed surface."7  ],8  "category" : "ai",9  "changelog" : [10    {11      "changes" : [12        "Release 1.1.0: see the project changelog."13      ],14      "date" : "2026-12-03",15      "version" : "1.1.0"16    },17    {18      "changes" : [19        "Initial release."20      ],21      "date" : "2026-12-02",22      "version" : "1.0.0"23    }24  ],25  "dependencies" : [26    {27      "id" : "glass-foundation",28      "version" : "1.1.0"29    }30  ],31  "description" : "Multiline prompt editor with send and stop, attachments through callbacks and keyboard shortcuts.",32  "examples" : [33    {34      "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassPromptBarExample: GlassExample {\n    public static let componentID = \"glass-prompt-bar\"\n    @State private var draft = \"\"\n    @State private var isResponding = false\n    @State private var sent: [String] = []\n    @State private var attachments = [\n        GlassPromptAttachment(id: \"a1\", name: \"sample-report.pdf\", systemImage: \"doc.richtext\"),\n        GlassPromptAttachment(id: \"a2\", name: \"a-sample-image-with-a-rather-long-file-name.png\", systemImage: \"photo\"),\n    ]\n    @State private var nextAttachment = 3\n    @State private var modelID: String? = \"sample-large\"\n    /// Fictitious models.\n    private let models = [\n        GlassModelInfo(id: \"sample-large\", name: \"Sample Large\", provider: \"Example Cloud (sample)\", capabilities: [.text, .tools], availability: .remote),\n        GlassModelInfo(id: \"sample-nano\", name: \"Sample Nano\", provider: \"On this device (sample)\", availability: .local),\n    ]\n\n    public init() {}\n\n    public var body: some View {\n        VStack(alignment: .leading, spacing: 12) {\n            Text(\"Sample data · nothing is sent anywhere; prompts are only listed below.\")\n                .font(.caption)\n                .foregroundStyle(.secondary)\n            ScrollView {\n                VStack(alignment: .leading, spacing: 8) {\n                    ForEach(Array(sent.enumerated()), id: \\.offset) { _, prompt in\n                        Text(prompt)\n                            .frame(maxWidth: .infinity, alignment: .leading)\n                    }\n                    if isResponding {\n                        GlassThinkingIndicator(.writing, label: \"Simulating a response\")\n                    }\n                }\n            }\n            GlassPromptBar(text: $draft, placeholder: \"Ask the sample assistant\", isResponding: isResponding, attachments: attachments) { prompt in\n                sent.append(prompt)\n                isResponding = true\n            } onStop: {\n                isResponding = false\n            } onAttach: {\n                // A real host presents its own file importer or photo picker here.\n                attachments.append(GlassPromptAttachment(id: \"a\\(nextAttachment)\", name: \"sample-\\(nextAttachment).txt\"))\n                nextAttachment += 1\n            } onRemoveAttachment: { attachment in\n                attachments.removeAll { $0.id == attachment.id }\n            } accessory: {\n                // Any small control fits here: a model picker, a context chip.\n                GlassModelPicker(models: models, selection: $modelID)\n            }\n        }\n        .padding()\n        .task(id: isResponding) {\n            guard isResponding else { return }\n            try? await Task.sleep(for: .seconds(3))\n            if !Task.isCancelled { isResponding = false }\n        }\n    }\n}\n\n#Preview(\"GlassPromptBar\") { GlassPromptBarExample().glassTheme(.aurora) }\n",35      "title" : "GlassPromptBar example"36    }37  ],38  "files" : [39    {40      "bytes" : 16083,41      "path" : "AI/AI/GlassPromptBar.swift",42      "sha256" : "4ad7395d95196b7f619b87847d2bf0a4100b0fb02fff27db5234f2282739e6aa"43    }44  ],45  "frameworks" : [4647  ],48  "id" : "glass-prompt-bar",49  "kind" : "custom-glass",50  "license" : "MIT",51  "minimumOS" : {52    "iOS" : "26.0",53    "iPadOS" : "26.0",54    "macOS" : "26.0"55  },56  "name" : "GlassPromptBar",57  "platforms" : [58    "iOS",59    "iPadOS",60    "macOS"61  ],62  "schemaVersion" : 1,63  "sha256" : "4a63a97bbe6e9bc5517320dfc064e4e9daa0ce6f51a0f2f7a535c25b3597f61c",64  "symbols" : [65    "GlassPromptAttachment",66    "GlassPromptInput",67    "ReturnKeyAction",68    "GlassPromptBar"69  ],70  "version" : "1.1.0"71}72
Files main
Menu

Theme