SPB Git

Repository Public MIT

manifest.json 3.6 KB 74 lines json

1{2  "accessibility" : [3    "A loaded card is one element: title aside, VoiceOver reads the value, the unit and \"Up 4.2 %, vs last month\".",4    "The direction is carried by the symbol's shape and by a word; colour (`tone`) is an addition, never the only signal.",5    "Loading and missing states have explicit labels instead of a silent placeholder.",6    "Text follows Dynamic Type and wraps; the value uses monospaced digits.",7    "Values and percentages are formatted with `FormatStyle` in the environment's locale."8  ],9  "category" : "data",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-button",22      "version" : "1.0.0"23    },24    {25      "id" : "glass-data-support",26      "version" : "1.0.0"27    },28    {29      "id" : "glass-foundation",30      "version" : "1.0.0"31    }32  ],33  "description" : "A value with unit, change and period, and states for missing, loading and failed data.",34  "examples" : [35    {36      "code" : "import SwiftUI\nimport SPGlassKit\n\npublic struct GlassMetricCardExample: GlassExample {\n    public static let componentID = \"glass-metric-card\"\n\n    // Fictitious figures.\n    @State private var latency: GlassLoadState<GlassMetric> = .loaded(\n        GlassMetric(value: 182, unit: \"ms\", change: -0.062, period: \"vs last week\", tone: .negativeIsGood)\n    )\n\n    public init() {}\n\n    public var body: some View {\n        ScrollView {\n            LazyVGrid(columns: [GridItem(.adaptive(minimum: 220), spacing: 12)], spacing: 12) {\n                GlassMetricCard(\"Response time\", state: latency) {\n                    latency = .loaded(GlassMetric(value: 175, unit: \"ms\", change: -0.098, period: \"vs last week\", tone: .negativeIsGood))\n                }\n                GlassMetricCard(\"Monthly revenue\", state: .loaded(\n                    GlassMetric(value: 48_250.5, unit: \"$\", change: 0.042, period: \"vs last month\", fractionDigits: 2...2, tone: .positiveIsGood)\n                ))\n                GlassMetricCard(\"Open tickets\", state: .loaded(GlassMetric(value: 37, change: 0, period: \"since yesterday\")))\n                GlassMetricCard(\"Active sessions\", state: .loading)\n                GlassMetricCard(\"Conversion\", state: .empty)\n                GlassMetricCard(\"Forecast\", state: .idle)\n                GlassMetricCard(\"Churn\", state: .failed(message: \"The report could not be loaded.\")) {}\n            }\n            .padding()\n\n            HStack {\n                GlassButton(\"Simulate a failure\", size: .small) { latency = .failed(message: \"The probe did not answer.\") }\n                GlassButton(\"Reload\", size: .small) { latency = .loading }\n            }\n            .padding(.bottom)\n        }\n    }\n}\n\n#Preview(\"GlassMetricCard\") { GlassMetricCardExample().glassTheme(.emerald) }\n",37      "title" : "GlassMetricCard example"38    }39  ],40  "files" : [41    {42      "bytes" : 11016,43      "path" : "Data/Data/GlassMetricCard.swift",44      "sha256" : "8c59f18cbb6a768bbc9d0d5842a2cf2e7420018cfd54872cfa56c29c1b66566e"45    }46  ],47  "frameworks" : [4849  ],50  "id" : "glass-metric-card",51  "kind" : "content-component",52  "license" : "MIT",53  "minimumOS" : {54    "iOS" : "26.0",55    "iPadOS" : "26.0",56    "macOS" : "26.0"57  },58  "name" : "GlassMetricCard",59  "platforms" : [60    "iOS",61    "iPadOS",62    "macOS"63  ],64  "schemaVersion" : 1,65  "sha256" : "375b961bf24c91532498edb03a58cb633f01a251232fe00824395f90f7edbe85",66  "symbols" : [67    "GlassMetric",68    "GlassMetricTone",69    "GlassMetricFormatter",70    "GlassMetricCard"71  ],72  "version" : "1.0.0"73}74
Files main
Menu

Theme