UNPKG

@kontent-ai/smart-link

Version:

Kontent.ai Smart Link SDK allowing to automatically inject [smart links](https://docs.kontent.ai/tutorials/develop-apps/build-strong-foundation/set-up-editing-from-preview#a-using-smart-links) to Kontent.ai according to manually specified [HTML data attri

52 lines (51 loc) 2.24 kB
import { KSLPositionedElement } from './abstract/KSLPositionedElement'; import { AddButtonAction, IAddButtonPermissionsServerModel } from '../lib/IFrameCommunicatorTypes'; import { AsyncCustomEvent } from '../utils/events'; import { ParseResult } from '../utils/dataAttributes/parser'; interface IKSLAddButtonElementEventData<TMessageData = object> { readonly data: ParseResult & TMessageData; readonly targetNode: HTMLElement; } interface IKSLAddButtonElementInitialEventReason { readonly message: string; } type KSLAddButtonElementInitialEventData = IKSLAddButtonElementEventData; type KSLAddButtonElementActionEventData = IKSLAddButtonElementEventData<{ action: AddButtonAction; }>; export type KSLAddButtonElementActionEvent = CustomEvent<KSLAddButtonElementActionEventData>; export type KSLAddButtonElementInitialAsyncEvent = AsyncCustomEvent<KSLAddButtonElementInitialEventData, IAddButtonPermissionsServerModel, IKSLAddButtonElementInitialEventReason>; declare global { interface WindowEventMap { 'ksl:add-button:action': KSLAddButtonElementActionEvent; 'ksl:add-button:initial': KSLAddButtonElementInitialAsyncEvent; } interface HTMLElementEventMap { 'ksl:add-button:action': KSLAddButtonElementActionEvent; 'ksl:add-button:initial': KSLAddButtonElementInitialAsyncEvent; } } export declare class KSLAddButtonElement extends KSLPositionedElement { static get is(): "ksl-add-button"; get position(): string; private readonly buttonRef; private popoverRef; constructor(); static initializeTemplate(): HTMLTemplateElement; connectedCallback(): void; disconnectedCallback(): void; adjustPosition: () => void; protected calculateTopOffset(thisRect: DOMRect, targetRect: DOMRect): number; protected calculateLeftOffset(thisRect: DOMRect, targetRect: DOMRect): number; private handleClick; private handleClickOutside; private displayPopover; private dismissPopover; private addPopoverEventListeners; private removePopoverEventListeners; private handleCreateComponentClick; private handleCreateLinkedItemClick; private handleInsertLinkedItemClick; private handleAddActionClick; } export {};