@samatawy/diagrams
    Preparing search index...

    Class AssetStore

    Stores image asset sources and stable asset identifiers for diagram nodes.

    This cache supports registration, lookup by id, bulk load/snapshot, and deterministic id generation for non-URL sources.

    Index

    Constructors

    Methods

    • Registers an asset source and returns its asset id.

      Parameters

      • source: string

        Asset source URL or serialized value.

      • OptionalpreferredId: string

        Optional preferred id if it is available.

      Returns string

      The assigned asset id, or an empty string for blank input.

    • Resolves an asset id to its source value.

      Parameters

      • OptionalimageId: string

        Asset id to resolve.

      Returns string | undefined

      Asset source when present; otherwise undefined.

    • Merges assets from the given map into the store without clearing existing entries. Existing ids take precedence — an id already in the store is not overwritten.

      Parameters

      • Optionalassets: Record<string, string>

        Assets to merge, keyed by id.

      Returns void

    • Replaces the store contents from a serialized asset map.

      Parameters

      • Optionalassets: Record<string, string>

        Serialized assets keyed by id.

      Returns void

    • Creates a serializable snapshot of the current asset map.

      Returns Record<string, string> | undefined

      Asset map when non-empty; otherwise undefined.