-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathaltcha.d.ts
147 lines (128 loc) · 3.86 KB
/
altcha.d.ts
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
export {};
declare module 'altcha';
declare global {
var altchaCreateWorker: (url?: string) => Worker;
var altchaPlugins: any[];
type AltchaState = 'error' | 'expired' | 'verified' | 'verifying' | 'unverified';
interface AltchaStateChangeEvent extends CustomEvent<{
payload?: string;
state: AltchaState;
}> {}
interface AltchaVerifiedEvent extends CustomEvent<{
payload: string;
}> {}
interface AltchaServerVerificationEvent extends CustomEvent<Record<string, unknown>> {}
interface AltchaWidgetOptions {
auto?: 'off' | 'onfocus' | 'onload' | 'onsubmit';
blockspam?: boolean;
challengeurl?: string;
challengejson?: string;
customfetch?: string | ((url: string, init?: RequestInit) => Promise<Response>);
debug?: boolean;
delay?: number;
expire?: number;
floating?: 'auto' | 'top' | 'bottom' | 'false' | '' | boolean;
floatinganchor?: string;
floatingoffset?: number;
floatingpersist?: 'focus' | boolean;
hidefooter?: boolean;
hidelogo?: boolean;
id?: string;
maxnumber?: number;
mockerror?: boolean;
name?: string;
obfuscated?: string;
oncleartext?: (ev: CustomEvent) => void;
onload?: (ev: CustomEvent) => void;
onstatechange?: (ev: CustomEvent) => void;
onverified?: (ev: CustomEvent) => void;
onserververification?: (ev: CustomEvent) => void;
onupload?: (ev: CustomEvent) => void;
onuploadprogress?: (ev: CustomEvent) => void;
plugins?: string;
refetchonexpire?: boolean;
spamfilter?: boolean | 'ipAddress';
strings?: string;
test?: boolean | number;
verifyurl?: string;
workers?: number;
workerurl?: string;
}
interface AltchaWidgetMethods {
configure: (options: AltchaWidgetOptions) => void;
clarify: () => Promise<void>;
getConfiguration: () => AltchaWidgetOptions;
getFloatingAnchor: () => HTMLElement | null;
getPlugin: <T = unknown>(name: string) => T;
getState: () => AltchaState;
hide: () => void;
repositionFloating: (viewportOffset?: number) => void;
reset: (newState?: AltchaState, err?: string | null) => void;
setFloatingAnchor: (el: HTMLElement) => void;
setState: (newState: AltchaState, err?: string | null) => void;
show: () => void;
verify: () => Promise<void>;
}
interface AltchaWidget extends AltchaWidgetOptions {
}
interface AltchaWidgetCSSProperties extends Partial<CSSStyleDeclaration> {
'--altcha-border-width'?: string;
'--altcha-border-radius'?: string;
'--altcha-color-base'?: string;
'--altcha-color-border'?: string;
'--altcha-color-text'?: string;
'--altcha-color-border-focus'?: string;
'--altcha-color-error-text'?: string;
'--altcha-color-footer-bg'?: string;
'--altcha-max-width'?: string;
}
interface AltchaWidgetReactRefObject<T> {
current: T | null;
}
interface AltchaWidgetReact extends AltchaWidget {
children?: string | number | Node | DocumentFragment;
ref?: AltchaWidgetReactRefObject<HTMLElement>;
style?: AltchaWidgetCSSProperties;
}
namespace JSX {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetReact;
}
}
namespace React {
namespace JSX {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetReact;
}
}
}
namespace svelteHTML {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetSvelte;
}
interface AltchaWidgetSvelte extends AltchaWidget {
style?: string;
}
}
}
declare module "react" {
namespace JSX {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetReact;
}
}
}
declare module "react/jsx-runtime" {
namespace JSX {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetReact;
}
}
}
declare module "react/jsx-dev-runtime" {
namespace JSX {
interface IntrinsicElements {
'altcha-widget': AltchaWidgetReact;
}
}
}