import { WeavyType } from "../contexts"; import { WeavyComponentSettingsType } from "../contexts/settings-context"; import { WyActionEventDetailType } from "./action.events"; import { AppListType, AppType, AppUidType, LinkType } from "./app.types"; import { ContextDataBlobsType, ContextIdType } from "./context.types"; import { EnterToSend } from "./editor.types"; import { ComponentFeaturePolicy } from "./features.types"; import { AnnotationsAppearanceType } from "./msg.types"; import { UserType } from "./users.types"; import type { LitElement } from "lit"; export interface WeavyComponentSettingProps { /** * Appearance of annotations. * * @type {"none" | "buttons-inline"} * @default "buttons-inline" */ annotations: AnnotationsAppearanceType; /** * Enter-to-send keymap in the editor. * * - `never` - No keymap * - `modifier` - Mod+Enter * - `auto` - Mod+Enter on mobile. Enter on desktop. * - `always` - Mod+Enter and Enter for all. */ enterToSend: EnterToSend; /** * A space separated string of available reaction emojis in unicode. */ reactions: string; } export interface WeavyComponentActionProps { /** * Dispatch a `wy-action` event on the component. * * @fires {WyActionEventType} wy-action - Emitted when an action takes place. */ dispatchAction: (detail: WyActionEventDetailType) => boolean; } export interface WeavyComponentContextProps { /** * Contextual guid that is unique for the component instance. */ contextId: ContextIdType | undefined; /** * Resolves when a contextual id is available. * * @internal * @returns {Promise} */ whenContextId(): Promise; /** * The current user. */ user: UserType | undefined; /** * Resolves when current user data is available. * * @returns {Promise} */ whenUser(): Promise; /** * The consumed weavy context. * */ weavy: WeavyType | undefined; /** * Resolves when a weavy context is available. * * @returns {Promise} */ whenWeavy(): Promise; /** * Resolves when the component has rendered first time. * * @returns {Promise} */ whenReady(): Promise; } export interface WeavyTypeComponentContextProps { // /** // * The current agent. // */ // agentUser: AgentType | undefined; // /** // * Resolves when current agent user data is available. // */ // whenAgentUser: () => Promise; /** * Uploaded context data blob ids. * @internal */ contextDataBlobs: ContextDataBlobsType | undefined; /** * Resolves when context data blob uploads has finished. * * @internal * @returns {Promise} */ whenContextDataBlobs(): Promise; /** * Policy for checking which features are available. * @internal */ componentFeatures: ComponentFeaturePolicy | undefined; /** * Resolves when weavy component features config is available. * * @internal * @returns {Promise} */ whenComponentFeatures(): Promise; /** * Any provided link that should be loaded, shown and highlighted. */ link: LinkType | undefined; /** * Resolves when a provided link is available. * * @internal * @returns {Promise} */ whenLink(): Promise; /** * The weavy component settings provided as a context on the component. */ settings: WeavyComponentSettingsType | undefined; /** * Resolves when weavy component settings are available. * * @internal * @returns {Promise} */ whenSettings(): Promise; } export interface WeavyAppComponentProps { /** * One or multiple unique app identifiers or app id:s. When a single uid is provided, the app gets automatically created on the server upon first request. */ uid: string | number | null | undefined; /** * An array of parsed uids from the `uid` property. */ readonly uids: AppUidType[] /** * The currently selected app uid when multiple `uid` is provided. Defaults to the first uid from the `uid` property. */ currentUid: AppUidType | null | undefined; /** * Optional directory identifier (`id` or `name`) used when a single uid initializes an app. */ directory?: string | number } export interface WeavyAppComponentContextProps { /** * The current app data. */ app: AppType | undefined; /** * Resolves when app data is available. * * @returns {Promise} */ whenApp(): Promise; /** * A list of data for all the apps specified by the `uid` property. */ apps: AppListType | undefined; /** * Resolves when apps data is available. * * @returns {Promise} */ whenApps(): Promise; } /** * Props for focusable handling. */ export interface FocusProps { setFocus?: () => void; }