@memberjunction/ng-shared
Version:
MemberJunction: MJ Explorer Angular Shared Package - utility functions and other reusable elements used across other MJ Angular packages within the MJ Explorer App - do not use outside of MJ Explorer.
88 lines • 3.5 kB
TypeScript
import { BehaviorSubject } from 'rxjs';
import { HomeAppPinnedItem, HomeAppPinInput, HomeAppPinUpdate } from './home-pin.types';
import * as i0 from "@angular/core";
/**
* Service for managing pinned items on the Home dashboard.
*
* All pin state is stored as a JSON blob in UserSettings via UserInfoEngine.
* Uses debounced saving to avoid excessive DB writes during edit mode operations.
*/
export declare class HomeAppPinService {
/** Max time to wait for a thumbnail capture before giving up and pinning without a preview. */
private static readonly THUMBNAIL_CAPTURE_TIMEOUT_MS;
/**
* Max DOM node count we'll attempt to rasterize. Above this, html-to-image's synchronous
* clone/inline step blocks the main thread long enough to freeze the UI, so we skip the
* (decorative) preview instead. Tuned to comfortably allow typical dashboards/forms while
* excluding heavy grid/map views like the Data Explorer.
*/
private static readonly THUMBNAIL_MAX_NODES;
/** Observable of current pins (for reactive UI) */
readonly Pins$: BehaviorSubject<HomeAppPinnedItem[]>;
private loaded;
/**
* Load pins from UserSettings. Safe to call multiple times (loads only once).
*/
LoadPins(): Promise<void>;
/**
* Force reload from UserSettings (e.g. after external changes)
*/
ReloadPins(): Promise<void>;
/**
* Add a new pin. Returns false if a duplicate already exists.
*/
AddPin(input: HomeAppPinInput): boolean;
/**
* Remove a pin by ID
*/
RemovePin(pinId: string): void;
/**
* Update pin properties (name, description, icon, group, thumbnail)
*/
UpdatePin(pinId: string, updates: HomeAppPinUpdate): void;
/**
* Reorder pins. Accepts full reordered array with updated Sequence values.
*/
ReorderPins(pins: HomeAppPinnedItem[]): void;
/**
* Check if a resource is already pinned
*/
IsPinned(resourceType: string, config: Record<string, unknown>): boolean;
/**
* Find the pin for a given resource, if it exists
*/
FindPin(resourceType: string, config: Record<string, unknown>): HomeAppPinnedItem | undefined;
/**
* Get ungrouped pins (Group is null/undefined/empty)
*/
GetUngroupedPins(): HomeAppPinnedItem[];
/**
* Get unique group names in display order (ordered by lowest Sequence in group)
*/
GetGroups(): string[];
/**
* Get pins in a specific group
*/
GetPinsInGroup(groupName: string): HomeAppPinnedItem[];
/**
* Capture a thumbnail of a DOM element using html-to-image.
* Uses SVG foreignObject so the browser's own CSS engine handles
* modern features like color-mix() that html2canvas can't parse.
* Returns a base64 JPEG data URL (~5-15KB) or undefined on failure.
*/
CaptureThumbnail(element: HTMLElement): Promise<string | undefined>;
/**
* Resolve to `undefined` if the given promise hasn't settled within `ms`.
* Note: this does not cancel the underlying work (toJpeg is not cancelable),
* it just stops the pin flow from waiting on it.
*/
private withTimeout;
private matchesResource;
private updateAndSave;
private sortPins;
private resequence;
private generateId;
static ɵfac: i0.ɵɵFactoryDeclaration<HomeAppPinService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<HomeAppPinService>;
}
//# sourceMappingURL=home-pin.service.d.ts.map