GlanceWidgets.ApiSdk 1.0.0

dotnet add package GlanceWidgets.ApiSdk --version 1.0.0
                    
NuGet\Install-Package GlanceWidgets.ApiSdk -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GlanceWidgets.ApiSdk" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GlanceWidgets.ApiSdk" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="GlanceWidgets.ApiSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GlanceWidgets.ApiSdk --version 1.0.0
                    
#r "nuget: GlanceWidgets.ApiSdk, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GlanceWidgets.ApiSdk@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GlanceWidgets.ApiSdk&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=GlanceWidgets.ApiSdk&version=1.0.0
                    
Install as a Cake Tool

C# SDK

SDK for generating Glance Widgets API responses

Install the package with .NET 8 or later:

dotnet add package GlanceWidgets.ApiSdk --version 1.0.0

Handwritten .NET 8 implementation of the complete TypeScript SDK. The library uses the .NET standard library and has no runtime dependency on Node.js, Python or repository files. Fonts, icons, text advances and validation schemas are embedded in the assembly.

using GlanceWidgets.Sdk;

var grid = new Matrix(12, 5).Text("OK", 0, 0);
var placed = Glance.Place(grid.ToPart(), new Dictionary<string, object?> {
    ["id"] = "status", ["path"] = "data.status",
    ["frame"] = new Box(0, 0, 1, 1)
});
string json = Json.Stringify(Glance.ToResponse(placed));

Glance exposes PascalCase counterparts of the TypeScript functions, including every semantic component, color helper, layer constructor, composition function, geometry operation, font, pixelation, icon, theme and signature helper. Constants also use PascalCase. JSON inputs and outputs use Dictionary<string, object?>, arrays and lists; option keys retain their protocol spelling. Object insertion order is deterministic. Empty dictionaries, empty arrays, explicit null and absent keys remain distinct.

Matrix uses (x, y) coordinates and chainable drawing methods. FlipX, FlipY, Rotate90, Crop and Clone return independent grids. Box uses canvas ratios; ToPt, InsetPt and point gaps require a canvas. Native Box and PixelFont objects work in option dictionaries. Built-in fonts are Glance.Font3X5 and Glance.Font5X7; use Glance.DefineFont or an inline definition for custom Unicode fonts.

Glance.Merge returns a deep copy, combines data recursively and replaces duplicate layer ids in place. Matrix parts must first be positioned with Glance.Place. Glance.ToResponse finalizes and validates. Invalid responses throw GlanceValidationException with the offending Path. Signatures use standard HMAC-SHA256 and constant-time comparison.

Layer constructors return a Composite containing layers and data. Each declaration has only id, type and dataPath; its addressed object contains layout, content and style. Use the standard merge function to combine individual layers and chart components, then finalize the response. Glance.LayerPath(id) gives the default node path; an explicit dataPath selects another location. Matrix.ToPart() returns {content: matrixData} and Glance.Place adds node layout. Editor layers can bind to partial nodes in data without a remote declaration. Glance.ValidateLayerNode(node, type) validates such a node; Glance.Validate checks a complete response. Omitted or null fields retain editor values, objects merge recursively and arrays replace whole. A supplied frame replaces the entire saved frame and requires width and height. All matrix fields live in content, with an empty matrix style. Images and image-backed icons use content.url; glyph icons use icon, iconCodePoint and iconFont.

dotnet build sdks/dotnet/GlanceWidgets.Sdk/GlanceWidgets.Sdk.csproj
bash integration/run-sdk-tests.sh dotnet
# Or directly:
bash sdks/dotnet/test.sh

Tests replay all shared golden cases from the 22 fixture files, 14 public API checks and 30 exact numeric formatting checks. The script also runs API and numeric checks from a temporary directory to verify embedded resources. Build outputs are created and removed in a unique temporary directory. dotnet is found on PATH, with /tmp/glance-dotnet/dotnet as a development fallback.

Shared data comes from spec/fonts/*.json, spec/icons.json, TypeScript protocol schema constants and the SF Pro advances measured by spec/tools/measure-text-advances.py. After an intentional source-data update, synchronize the embedded copies with:

node sdks/dotnet/scripts/sync_data.cjs

This data-only script needs the TypeScript SDK's development dependency installed. It does not generate algorithms or public API code. Installed applications need only the compiled assembly.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 51 11/7/2026