phoenix_duskmoon 9.9.8 → 9.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/js/hooks/index.d.ts +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type HookEventPayload = unknown;
|
|
2
|
+
|
|
3
|
+
export type HookEventCallback = (reply: unknown, ref: number) => void;
|
|
4
|
+
|
|
5
|
+
/** The LiveView-owned context supplied as `this` to hook callbacks. */
|
|
6
|
+
export interface LiveViewHookContext<ElementType extends HTMLElement = HTMLElement> {
|
|
7
|
+
readonly el: ElementType;
|
|
8
|
+
handleEvent(
|
|
9
|
+
event: string,
|
|
10
|
+
callback: (payload: HookEventPayload) => void,
|
|
11
|
+
): unknown;
|
|
12
|
+
pushEvent(
|
|
13
|
+
event: string,
|
|
14
|
+
payload?: HookEventPayload,
|
|
15
|
+
callback?: HookEventCallback,
|
|
16
|
+
): unknown;
|
|
17
|
+
pushEventTo(
|
|
18
|
+
target: string | number | HTMLElement,
|
|
19
|
+
event: string,
|
|
20
|
+
payload?: HookEventPayload,
|
|
21
|
+
callback?: HookEventCallback,
|
|
22
|
+
): unknown;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A Phoenix LiveView hook definition object. */
|
|
26
|
+
export interface LiveViewHook<ElementType extends HTMLElement = HTMLElement> {
|
|
27
|
+
mounted?(this: LiveViewHookContext<ElementType>): void;
|
|
28
|
+
updated?(this: LiveViewHookContext<ElementType>): void;
|
|
29
|
+
destroyed?(this: LiveViewHookContext<ElementType>): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Universal LiveView to custom-element event bridge. */
|
|
33
|
+
export declare const WebComponentHook: LiveViewHook;
|
|
34
|
+
|
|
35
|
+
/** WebComponentHook with Phoenix form-feedback integration. */
|
|
36
|
+
export declare const FormElementHook: LiveViewHook;
|
|
37
|
+
|
|
38
|
+
/** Theme toggle with localStorage persistence. */
|
|
39
|
+
export declare const ThemeSwitcher: LiveViewHook<HTMLDetailsElement>;
|
|
40
|
+
|
|
41
|
+
/** Cmd/Ctrl+K spotlight dialog keyboard handler. */
|
|
42
|
+
export declare const Spotlight: LiveViewHook<HTMLDialogElement>;
|
|
43
|
+
|
|
44
|
+
/** Page-header visibility observer. */
|
|
45
|
+
export declare const PageHeader: LiveViewHook;
|