sdk.loadingcardapi
Home > @kittl/sdk > LoadingCardAPI
LoadingCardAPI interface
API for creating and managing loading card placeholders in the design.
Signature:
export interface LoadingCardAPI
Methods
Method | Description |
|---|---|
Creates a new loading card placeholder in the design canvas. This method creates a temporary visual placeholder that represents content being loaded, generated, or processed. Loading cards provide visual feedback during asynchronous operations and maintain layout space until the actual content becomes available. They are commonly used for AI-generated images, font loading states, and other time-consuming operations. **Loading Card Features:** - Rectangular placeholder with customizable position and size - Support for viewport scaling to maintain responsive layouts - Optional metadata tracking (generation IDs, timing, model info) - Integration with progress tracking systems - Automatic lifecycle management for async operations **Position and Sizing:** - Absolute positioning for precise placement on canvas - Relative positioning for dynamic layout integration - Viewport scaling support for responsive design workflows - Automatic size calculation based on expected content dimensions **Metadata Tracking:** - Image generation tracking with unique IDs - Performance metrics (start times, generation speeds) - Model identification for AI-generated content - Custom naming for organization and debugging | |
Updates an existing loading card with new properties or progress information. This method modifies the properties of an existing loading card, typically to update progress information, adjust positioning, or modify metadata during an ongoing operation. Loading cards are often updated multiple times during their lifecycle to reflect progress, timing changes, or repositioning needs. **Updatable Properties:** - Position (absolute coordinates or relative positioning) - Size (with automatic scale recalculation and viewport scaling) - Generation metadata (IDs, timing, model information) - Performance metrics and progress tracking data - Custom naming for organization **Common Update Scenarios:** - Progress updates during long-running operations - Position adjustments due to layout changes - Metadata updates when switching between generation models - Performance metric updates for speed tracking - Name changes for better organization during development **Performance Considerations:** - Batch multiple updates using the batchClient option for better performance - Avoid frequent position updates if the loading card will be replaced soon - Use volatile origin for transient updates that don't need history tracking |