UNPKG

2.09 kBTypeScriptView Raw
1import { Emitter, RefObject } from '@mantou/gem/lib/decorators';
2import { GemElement, TemplateResult } from '@mantou/gem/lib/element';
3import { StyleObject } from '@mantou/gem/lib/utils';
4import './reflect';
5export declare type PopoverState = {
6 open: boolean;
7 left: number;
8 right: number;
9 top: number;
10 bottom: number;
11 style: StyleObject;
12 position: Position;
13};
14declare type Position = 'top' | 'bottom' | 'right' | 'left' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
15declare type GhostStyle = {
16 '--bg': string;
17 '--color': string;
18};
19declare type Option = {
20 delay?: number;
21 unreachable?: boolean;
22 content?: string | TemplateResult;
23 position?: Position;
24 ghostStyle?: GhostStyle;
25 trigger?: 'click' | 'hover';
26};
27declare type CloseCallback = {
28 (): void;
29 instance: DuoyunPopoverElement;
30};
31/**
32 * @customElement dy-popover
33 * @attr debug
34 * @attr position
35 * @attr trigger
36 */
37export declare class DuoyunPopoverElement extends GemElement<PopoverState> {
38 #private;
39 debug: boolean;
40 unreachable: boolean;
41 trigger: 'click' | 'hover';
42 position: Position | 'auto';
43 content?: string | TemplateResult;
44 popoverRef: RefObject<DuoyunPopoverGhostElement>;
45 slotRef: RefObject<HTMLSlotElement>;
46 open: Emitter<null>;
47 close: Emitter<null>;
48 static open(e: Element, option: Option): CloseCallback;
49 static open(x: number, y: number, option: Option): CloseCallback;
50 static open(xywh: number[], option: Option): CloseCallback;
51 ghostStyle: GhostStyle;
52 state: PopoverState;
53 constructor({ delay, content, position, ghostStyle, trigger, unreachable }?: Option);
54 get popoverElement(): DuoyunPopoverGhostElement | undefined;
55 mounted: () => void;
56 render: () => TemplateResult;
57}
58export declare const Popover: typeof DuoyunPopoverElement;
59/**
60 * @customElement dy-popover-ghost
61 */
62export declare class DuoyunPopoverGhostElement extends GemElement {
63 #private;
64 close: Emitter;
65 mounted: () => () => void;
66}
67export {};
68//# sourceMappingURL=popover.d.ts.map
\No newline at end of file