-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.d.ts
More file actions
119 lines (101 loc) · 3.05 KB
/
Copy pathcore.d.ts
File metadata and controls
119 lines (101 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// core.d.ts
/**
* Module exports interface - standard structure for DOMule modules
*/
export interface ModuleExports {
NAME?: string;
init?: (elements: NodeList | HTMLElement[]) => string | boolean | void;
api?: (action: string, ...args: any[]) => any;
destroy?: () => void;
}
/**
* DOM Scanner - discovers elements with data-requires
*/
export interface DOMScanner {
(callback?: (
modules: Record<string, HTMLElement[]>,
deferred: Record<string, HTMLElement[]>,
stats: { immediate: number; lazy: number; total: number }
) => void): {
modules: Record<string, HTMLElement[]>;
deferred: Record<string, HTMLElement[]>;
stats: { immediate: number; lazy: number; total: number };
};
}
export const domScanner: DOMScanner;
/**
* Module Loader - handles dynamic imports
*/
export function loadModules(
paths?: Record<string, string> | (() => void),
callback?: () => void
): void;
export function cleanup(): void;
/**
* Module Registry - inter-module coordination
*/
export namespace ModuleRegistry {
function register(
name: string,
module: ModuleExports,
elements: HTMLElement[],
state?: 'loaded' | 'error'
): void;
function isLoaded(name: string): boolean;
function get(name: string): ModuleExports | null;
function getElements(name: string): HTMLElement[];
function waitFor(name: string, timeout?: number): Promise<ModuleExports>;
function unregister(name: string): void;
function getAll(): Array<{
name: string;
state: string;
elementCount: number;
}>;
}
/**
* Event Handler - centralized event management
*/
export interface EventHandler {
addListener(event: string, callback: (e?: Event) => void): Function;
removeListener(event: string, callback: Function): boolean;
docLoaded(callback: () => void): Function;
docReady(callback: () => void): Function;
docShift(callback: (e?: Event) => void): Function;
breakPointChange(callback: (e: CustomEvent) => void): Function;
imgsLoaded(callback: () => void): Function;
}
declare const events: EventHandler;
export default events;
/**
* Logger - debug output with color coding
*/
export interface Logger {
log(moduleName: string, message: any): void;
info(moduleName: string, message: any): void;
warn(moduleName: string, message: any): void;
error(moduleName: string, message: any): void;
}
export const logger: Logger;
export const hnlLogger: Logger; // v2.x compat
export function hasUrlParam(name: string, value?: string): boolean;
/**
* Telemetry - performance tracking
*/
export interface Telemetry {
recordModuleLoad(name: string, data: {
size: number;
duration: number;
cached: boolean;
elements: number;
url: string;
}): void;
getReport(): {
session: any;
budget: any;
utilization: { bytes: string; modules: string };
violations: any[];
};
showDashboard(): void;
isEnabled(): boolean;
}
export const telemetry: Telemetry;