@panneau/core 4.1.0 → 5.0.0-alpha.0
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/README.md +83 -0
- package/dist/definition/abilities.d.ts +21 -0
- package/dist/definition/abilities.d.ts.map +1 -0
- package/dist/definition/abilities.js +47 -0
- package/dist/definition/abilities.js.map +1 -0
- package/dist/definition/form.d.ts +31 -0
- package/dist/definition/form.d.ts.map +1 -0
- package/dist/definition/form.js +54 -0
- package/dist/definition/form.js.map +1 -0
- package/dist/definition/list.d.ts +44 -0
- package/dist/definition/list.d.ts.map +1 -0
- package/dist/definition/list.js +70 -0
- package/dist/definition/list.js.map +1 -0
- package/dist/definition/resource.d.ts +21 -0
- package/dist/definition/resource.d.ts.map +1 -0
- package/dist/definition/resource.js +24 -0
- package/dist/definition/resource.js.map +1 -0
- package/dist/form/form.d.ts +148 -0
- package/dist/form/form.d.ts.map +1 -0
- package/dist/form/form.js +239 -0
- package/dist/form/form.js.map +1 -0
- package/dist/form/messages.d.ts +7 -0
- package/dist/form/messages.d.ts.map +1 -0
- package/dist/form/messages.js +25 -0
- package/dist/form/messages.js.map +1 -0
- package/dist/form/problem.d.ts +16 -0
- package/dist/form/problem.d.ts.map +1 -0
- package/dist/form/problem.js +34 -0
- package/dist/form/problem.js.map +1 -0
- package/dist/form/selectors.d.ts +16 -0
- package/dist/form/selectors.d.ts.map +1 -0
- package/dist/form/selectors.js +27 -0
- package/dist/form/selectors.js.map +1 -0
- package/dist/form/store.d.ts +19 -0
- package/dist/form/store.d.ts.map +1 -0
- package/dist/form/store.js +29 -0
- package/dist/form/store.js.map +1 -0
- package/dist/index.d.ts +17 -651
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -536
- package/dist/list/list.d.ts +68 -0
- package/dist/list/list.d.ts.map +1 -0
- package/dist/list/list.js +191 -0
- package/dist/list/list.js.map +1 -0
- package/dist/list/router.d.ts +26 -0
- package/dist/list/router.d.ts.map +1 -0
- package/dist/list/router.js +54 -0
- package/dist/list/router.js.map +1 -0
- package/dist/plugins.d.ts +73 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +54 -0
- package/dist/plugins.js.map +1 -0
- package/dist/react/provider.d.ts +38 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +63 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/useForm.d.ts +26 -0
- package/dist/react/useForm.d.ts.map +1 -0
- package/dist/react/useForm.js +115 -0
- package/dist/react/useForm.js.map +1 -0
- package/dist/react/useList.d.ts +11 -0
- package/dist/react/useList.d.ts.map +1 -0
- package/dist/react/useList.js +47 -0
- package/dist/react/useList.js.map +1 -0
- package/dist/values.d.ts +12 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +44 -0
- package/dist/values.js.map +1 -0
- package/package.json +19 -81
- package/dist/contexts.d.ts +0 -638
- package/dist/contexts.js +0 -1754
- package/dist/hooks.d.ts +0 -492
- package/dist/hooks.js +0 -2146
- package/dist/utils.d.ts +0 -322
- package/dist/utils.js +0 -530
package/dist/hooks.d.ts
DELETED
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
import { Dayjs } from 'dayjs';
|
|
2
|
-
import { ReactNode, ComponentProps, ElementType, SyntheticEvent, RefObject } from 'react';
|
|
3
|
-
import { MessageDescriptor, FormattedMessage } from 'react-intl';
|
|
4
|
-
|
|
5
|
-
interface UseAnimationFrameOptions {
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare function useAnimationFrame(onFrame: (progress: number) => void, { disabled }?: UseAnimationFrameOptions): void;
|
|
9
|
-
|
|
10
|
-
interface UseFormattedDateOptions {
|
|
11
|
-
format?: Intl.DateTimeFormatOptions | null;
|
|
12
|
-
showToday?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface UseFormattedTimeOptions {
|
|
15
|
-
format?: Intl.DateTimeFormatOptions | null;
|
|
16
|
-
showNow?: boolean;
|
|
17
|
-
timeGap?: number;
|
|
18
|
-
}
|
|
19
|
-
declare function useFormattedDate({ format, showToday, }?: UseFormattedDateOptions): (date: string | Date | Dayjs) => string;
|
|
20
|
-
declare function useFormattedTime({ format, showNow, timeGap, }?: UseFormattedTimeOptions): (date: string | Date | Dayjs) => string;
|
|
21
|
-
|
|
22
|
-
declare const useDocumentEvent: (event: string, callback: (...args: unknown[]) => void, enabled?: boolean) => void;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Core UI Types
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Internationalization message definition
|
|
30
|
-
*/
|
|
31
|
-
type Message = MessageDescriptor;
|
|
32
|
-
/**
|
|
33
|
-
* Values that can be interpolated in an internationalization message
|
|
34
|
-
* (the `values` prop of FormattedMessage)
|
|
35
|
-
*/
|
|
36
|
-
type MessageValues = NonNullable<ComponentProps<typeof FormattedMessage>['values']>;
|
|
37
|
-
type MessageValue = MessageValues[string];
|
|
38
|
-
/**
|
|
39
|
-
* Label can be either a message object or any React node
|
|
40
|
-
*/
|
|
41
|
-
type Label = Message | ReactNode;
|
|
42
|
-
/**
|
|
43
|
-
* Form control size
|
|
44
|
-
*/
|
|
45
|
-
type ControlSize = 'lg' | 'sm' | null;
|
|
46
|
-
interface RouteDefinition {
|
|
47
|
-
path?: string;
|
|
48
|
-
route?: string;
|
|
49
|
-
component: string | ElementType;
|
|
50
|
-
[key: string]: unknown;
|
|
51
|
-
}
|
|
52
|
-
interface PageDefinition {
|
|
53
|
-
component: string | ElementType;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Form Types
|
|
58
|
-
* TypeScript interfaces for form-related components
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Field definition
|
|
63
|
-
*/
|
|
64
|
-
interface Field$1 {
|
|
65
|
-
name?: string;
|
|
66
|
-
type?: string;
|
|
67
|
-
label?: Label;
|
|
68
|
-
component?: string;
|
|
69
|
-
size?: ControlSize;
|
|
70
|
-
[key: string]: unknown;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Form definition
|
|
74
|
-
*/
|
|
75
|
-
interface Form {
|
|
76
|
-
title?: ReactNode;
|
|
77
|
-
fields?: Field$1[];
|
|
78
|
-
method?: string | null;
|
|
79
|
-
action?: string | null;
|
|
80
|
-
submitButtonLabel?: Label | null;
|
|
81
|
-
[key: string]: unknown;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Resource Types
|
|
86
|
-
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Table column definition
|
|
91
|
-
*/
|
|
92
|
-
type TableColumn = string | Column;
|
|
93
|
-
interface Column extends Record<string, unknown> {
|
|
94
|
-
id?: string | null;
|
|
95
|
-
name?: string | null;
|
|
96
|
-
label?: unknown;
|
|
97
|
-
path?: string;
|
|
98
|
-
valueKey?: string;
|
|
99
|
-
component?: string | ElementType | null;
|
|
100
|
-
field?: Field$1 | string | null;
|
|
101
|
-
actions?: ActionDefinition[] | null;
|
|
102
|
-
}
|
|
103
|
-
interface Action {
|
|
104
|
-
id?: string;
|
|
105
|
-
component?: string;
|
|
106
|
-
label?: string | null;
|
|
107
|
-
icon?: string | null;
|
|
108
|
-
href?: string | null;
|
|
109
|
-
external?: boolean;
|
|
110
|
-
theme?: string;
|
|
111
|
-
target?: string;
|
|
112
|
-
onClick?: (() => void) | null;
|
|
113
|
-
endpoint?: string | null;
|
|
114
|
-
withoutConfirmation?: boolean;
|
|
115
|
-
[key: string]: unknown;
|
|
116
|
-
}
|
|
117
|
-
type ActionDefinition = string | Action;
|
|
118
|
-
interface ResourceIntlValues {
|
|
119
|
-
a_singular?: string;
|
|
120
|
-
a_plural?: string;
|
|
121
|
-
[key: string]: MessageValue;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Internationalization configuration
|
|
125
|
-
*/
|
|
126
|
-
interface ResourceIntl {
|
|
127
|
-
messages?: Record<string, string>;
|
|
128
|
-
values?: ResourceIntlValues;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Resource definition
|
|
132
|
-
*/
|
|
133
|
-
interface ResourceIndex {
|
|
134
|
-
filters?: Filter[];
|
|
135
|
-
columns?: TableColumn[];
|
|
136
|
-
actions?: ActionDefinition[];
|
|
137
|
-
fields?: Field$1[];
|
|
138
|
-
[key: string]: unknown;
|
|
139
|
-
}
|
|
140
|
-
interface ResourcePages {
|
|
141
|
-
index?: PageDefinition;
|
|
142
|
-
show?: PageDefinition;
|
|
143
|
-
create?: PageDefinition;
|
|
144
|
-
edit?: PageDefinition;
|
|
145
|
-
delete?: PageDefinition;
|
|
146
|
-
duplicate?: PageDefinition;
|
|
147
|
-
[key: string]: PageDefinition | undefined;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Form definition of a resource (the id is optional, the form is identified by its key)
|
|
151
|
-
*/
|
|
152
|
-
interface ResourceForm extends Form {
|
|
153
|
-
id?: string;
|
|
154
|
-
component?: string | ElementType;
|
|
155
|
-
}
|
|
156
|
-
interface ResourceForms {
|
|
157
|
-
default?: ResourceForm | null;
|
|
158
|
-
create?: ResourceForm | null;
|
|
159
|
-
edit?: ResourceForm | null;
|
|
160
|
-
delete?: ResourceForm | null;
|
|
161
|
-
modal?: ResourceForm | null;
|
|
162
|
-
[key: string]: ResourceForm | null | undefined;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Resource type (sub-type of a resource, ex: page types)
|
|
166
|
-
*/
|
|
167
|
-
interface ResourceType$1 {
|
|
168
|
-
id?: string;
|
|
169
|
-
name?: string;
|
|
170
|
-
fields?: Field$1[];
|
|
171
|
-
settings?: {
|
|
172
|
-
canCreate?: boolean;
|
|
173
|
-
[key: string]: unknown;
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
interface Resource {
|
|
177
|
-
id: string;
|
|
178
|
-
name: string;
|
|
179
|
-
intl?: ResourceIntl;
|
|
180
|
-
fields?: Field$1[];
|
|
181
|
-
index?: ResourceIndex;
|
|
182
|
-
forms?: ResourceForms;
|
|
183
|
-
settings?: Record<string, unknown>;
|
|
184
|
-
extraRoutes?: RouteDefinition[];
|
|
185
|
-
pages?: ResourcePages;
|
|
186
|
-
types?: ResourceType$1[];
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Filter definition
|
|
190
|
-
*/
|
|
191
|
-
interface Filter {
|
|
192
|
-
id?: string;
|
|
193
|
-
component?: string;
|
|
194
|
-
[key: string]: unknown;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
type FieldInput = string | Field$1;
|
|
198
|
-
interface FieldErrors {
|
|
199
|
-
[key: string]: string[] | FieldErrors;
|
|
200
|
-
}
|
|
201
|
-
interface FieldValue {
|
|
202
|
-
[key: string]: unknown;
|
|
203
|
-
}
|
|
204
|
-
interface ProcessedField extends Field$1 {
|
|
205
|
-
name: string | null;
|
|
206
|
-
component: string | null;
|
|
207
|
-
value: unknown;
|
|
208
|
-
errors: string[] | null;
|
|
209
|
-
onChange: (fieldValue: unknown) => void;
|
|
210
|
-
fields?: ProcessedField[] | null;
|
|
211
|
-
}
|
|
212
|
-
interface RequestState {
|
|
213
|
-
success: boolean;
|
|
214
|
-
loading: boolean;
|
|
215
|
-
error: boolean;
|
|
216
|
-
}
|
|
217
|
-
interface UseFormOptions<T extends FieldValue = FieldValue> {
|
|
218
|
-
fields?: FieldInput[];
|
|
219
|
-
action?: string | null;
|
|
220
|
-
postForm?: ((action: string, data: Record<string, unknown>) => Promise<unknown>) | null;
|
|
221
|
-
initialErrors?: FieldErrors | null;
|
|
222
|
-
errors?: FieldErrors | null;
|
|
223
|
-
setErrors?: ((errors: FieldErrors | null) => void) | null;
|
|
224
|
-
initialGeneralError?: string | null;
|
|
225
|
-
generalError?: string | null;
|
|
226
|
-
setGeneralError?: ((error: string | null) => void) | null;
|
|
227
|
-
initialValue?: T | null;
|
|
228
|
-
value?: T | null;
|
|
229
|
-
setValue?: ((value: T) => void) | null;
|
|
230
|
-
withoutDefault?: boolean;
|
|
231
|
-
withoutPropagation?: boolean;
|
|
232
|
-
onComplete?: ((response: unknown) => void) | null;
|
|
233
|
-
onError?: ((error: Error) => void) | null;
|
|
234
|
-
locales?: string[];
|
|
235
|
-
}
|
|
236
|
-
interface UseFormReturn<T extends FieldValue = FieldValue> extends RequestState {
|
|
237
|
-
value: T | null;
|
|
238
|
-
setValue: (value: T) => void;
|
|
239
|
-
csrfToken: string | null;
|
|
240
|
-
submit: (submitValue?: T | null) => void;
|
|
241
|
-
onSubmit: (e: SyntheticEvent) => void;
|
|
242
|
-
status: 'loading' | 'success' | 'error' | null;
|
|
243
|
-
response: unknown;
|
|
244
|
-
fields: ProcessedField[];
|
|
245
|
-
errors: FieldErrors | null;
|
|
246
|
-
generalError: string | null;
|
|
247
|
-
}
|
|
248
|
-
declare function useForm<T extends FieldValue = FieldValue>(opts?: UseFormOptions<T>): UseFormReturn<T>;
|
|
249
|
-
|
|
250
|
-
interface UseIsVisibleOptions {
|
|
251
|
-
rootMargin?: string;
|
|
252
|
-
threshold?: number;
|
|
253
|
-
persist?: boolean;
|
|
254
|
-
}
|
|
255
|
-
interface UseIsVisibleResult {
|
|
256
|
-
ref: RefObject<Element>;
|
|
257
|
-
visible: boolean;
|
|
258
|
-
}
|
|
259
|
-
declare function useIsVisible({ rootMargin, threshold, persist, }?: UseIsVisibleOptions): UseIsVisibleResult;
|
|
260
|
-
|
|
261
|
-
declare const KEYCODES: {
|
|
262
|
-
ARROW_LEFT: number;
|
|
263
|
-
ARROW_UP: number;
|
|
264
|
-
ARROW_RIGHT: number;
|
|
265
|
-
ARROW_DOWN: number;
|
|
266
|
-
ESCAPE: number;
|
|
267
|
-
SPACE: number;
|
|
268
|
-
};
|
|
269
|
-
interface UseKeyboardKeysOptions {
|
|
270
|
-
eventName?: string;
|
|
271
|
-
}
|
|
272
|
-
declare function useKeyboardKeys(keys?: Record<number, (e: KeyboardEvent) => void>, { eventName }?: UseKeyboardKeysOptions): void;
|
|
273
|
-
|
|
274
|
-
interface FontConfig {
|
|
275
|
-
type?: 'google' | 'custom' | 'system';
|
|
276
|
-
name: string;
|
|
277
|
-
}
|
|
278
|
-
declare function useLoadedFonts(fonts: (string | FontConfig)[]): {
|
|
279
|
-
loaded: boolean;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
interface UseMediaApiOptions {
|
|
283
|
-
url?: string | null;
|
|
284
|
-
initialMuted?: boolean;
|
|
285
|
-
onTimeUpdate?: ((time: number) => void) | null;
|
|
286
|
-
onProgressStep?: ((step: number) => void) | null;
|
|
287
|
-
onDurationChanged?: ((duration: number) => void) | null;
|
|
288
|
-
onVolumeChanged?: ((muted: boolean, volume: number) => void) | null;
|
|
289
|
-
onPlay?: ((opts: {
|
|
290
|
-
initial: boolean;
|
|
291
|
-
}) => void) | null;
|
|
292
|
-
onPause?: ((opts: {
|
|
293
|
-
midway: boolean;
|
|
294
|
-
}) => void) | null;
|
|
295
|
-
onEnded?: (() => void) | null;
|
|
296
|
-
onSeeked?: ((time: number) => void) | null;
|
|
297
|
-
onLoadStart?: (() => void) | null;
|
|
298
|
-
onCanPlayThough?: (() => void) | null;
|
|
299
|
-
}
|
|
300
|
-
interface UseMediaApiReturn {
|
|
301
|
-
ref: RefObject<HTMLMediaElement>;
|
|
302
|
-
play: () => void;
|
|
303
|
-
pause: () => void;
|
|
304
|
-
togglePlay: () => void;
|
|
305
|
-
stop: () => void;
|
|
306
|
-
seek: (time: number) => void;
|
|
307
|
-
mute: () => void;
|
|
308
|
-
unMute: () => void;
|
|
309
|
-
toggleMute: () => void;
|
|
310
|
-
muted: boolean;
|
|
311
|
-
currentTime: number | null;
|
|
312
|
-
duration: number | null;
|
|
313
|
-
playing: boolean;
|
|
314
|
-
paused: boolean;
|
|
315
|
-
ready: boolean;
|
|
316
|
-
}
|
|
317
|
-
declare function useMediaApi({ url, initialMuted, onTimeUpdate, onProgressStep, onDurationChanged, onVolumeChanged, onPlay, onPause, onEnded, onSeeked, onLoadStart, onCanPlayThough, }?: UseMediaApiOptions): UseMediaApiReturn;
|
|
318
|
-
|
|
319
|
-
interface Manager {
|
|
320
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
321
|
-
}
|
|
322
|
-
interface MediasParserOptions {
|
|
323
|
-
fieldsManager: Manager;
|
|
324
|
-
screensManager?: Manager | null;
|
|
325
|
-
}
|
|
326
|
-
interface Media$1 {
|
|
327
|
-
id?: string | null;
|
|
328
|
-
[key: string]: unknown;
|
|
329
|
-
}
|
|
330
|
-
interface Field {
|
|
331
|
-
id?: string | null;
|
|
332
|
-
name?: string | null;
|
|
333
|
-
type?: string | null;
|
|
334
|
-
media?: boolean;
|
|
335
|
-
fields?: Field[];
|
|
336
|
-
itemsField?: Field | null;
|
|
337
|
-
settings?: Field[];
|
|
338
|
-
[key: string]: unknown;
|
|
339
|
-
}
|
|
340
|
-
interface Screen$1 {
|
|
341
|
-
type: string;
|
|
342
|
-
[key: string]: unknown;
|
|
343
|
-
}
|
|
344
|
-
interface Story$1 {
|
|
345
|
-
theme?: Story$1 | null;
|
|
346
|
-
components?: Screen$1[];
|
|
347
|
-
medias?: Record<string, Media$1> | null;
|
|
348
|
-
[key: string]: unknown;
|
|
349
|
-
}
|
|
350
|
-
declare class MediasParser {
|
|
351
|
-
fieldsManager: Manager;
|
|
352
|
-
screensManager: Manager | null;
|
|
353
|
-
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
354
|
-
toPath(story: Story$1 | null): Story$1 | null;
|
|
355
|
-
fromPath(story: Story$1 | null, defaultMedias?: Record<string, Media$1> | null): Story$1 | null;
|
|
356
|
-
getMediaFieldsPattern(fields: Field[], namePrefix?: string | null): RegExp[];
|
|
357
|
-
static fieldIsMedia({ media }: Field): boolean;
|
|
358
|
-
static fieldIsFontFamily({ id }: Field): boolean;
|
|
359
|
-
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$1>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
360
|
-
static getMediaPath({ id }: Media$1): string | null;
|
|
361
|
-
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$1> | null, keyPrefix?: string | null): {
|
|
362
|
-
data: unknown;
|
|
363
|
-
medias: Record<string, Media$1> | null;
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
type Story = Parameters<MediasParser['toPath']>[0];
|
|
368
|
-
interface UseMediasParserReturn {
|
|
369
|
-
toPath: (story: Story) => Story;
|
|
370
|
-
fromPath: (story: Story) => Story;
|
|
371
|
-
parser: MediasParser;
|
|
372
|
-
}
|
|
373
|
-
declare function useMediasParser(): UseMediasParserReturn;
|
|
374
|
-
|
|
375
|
-
type ObserverConstructor<T> = (new (callback: (entries: T[]) => void, options?: Record<string, unknown>) => {
|
|
376
|
-
observe: (element: Element) => void;
|
|
377
|
-
unobserve?: (element: Element) => void;
|
|
378
|
-
disconnect: () => void;
|
|
379
|
-
}) | null;
|
|
380
|
-
interface ObserverWrapper<T> {
|
|
381
|
-
subscribe: (element: Element, callback: (entry: T) => void) => void;
|
|
382
|
-
unsubscribe: (element: Element, callback?: ((entry: T) => void) | null) => void;
|
|
383
|
-
observer: InstanceType<NonNullable<ObserverConstructor<T>>>;
|
|
384
|
-
}
|
|
385
|
-
interface ObserverOptions {
|
|
386
|
-
root?: Element | null;
|
|
387
|
-
rootMargin?: string | null;
|
|
388
|
-
threshold?: number | number[] | null;
|
|
389
|
-
disabled?: boolean;
|
|
390
|
-
}
|
|
391
|
-
declare function getObserver<T>(Observer: ObserverConstructor<T>, options?: ObserverOptions): ObserverWrapper<T>;
|
|
392
|
-
interface UseObserverReturn<T> {
|
|
393
|
-
ref: RefObject<Element>;
|
|
394
|
-
entry: T;
|
|
395
|
-
}
|
|
396
|
-
declare function useObserver<T>(Observer: ObserverConstructor<T>, opts?: ObserverOptions, initialEntry?: T): UseObserverReturn<T>;
|
|
397
|
-
interface IntersectionObserverEntry {
|
|
398
|
-
target: Element | null;
|
|
399
|
-
time: number | null;
|
|
400
|
-
isVisible?: boolean;
|
|
401
|
-
isIntersecting: boolean;
|
|
402
|
-
intersectionRatio: number;
|
|
403
|
-
intersectionRect: DOMRectReadOnly | null;
|
|
404
|
-
boundingClientRect: DOMRectReadOnly | null;
|
|
405
|
-
rootBounds: DOMRectReadOnly | null;
|
|
406
|
-
}
|
|
407
|
-
interface UseIntersectionObserverOptions {
|
|
408
|
-
root?: Element | null;
|
|
409
|
-
rootMargin?: string;
|
|
410
|
-
threshold?: number | number[];
|
|
411
|
-
disabled?: boolean;
|
|
412
|
-
}
|
|
413
|
-
declare function useIntersectionObserver({ root, rootMargin, threshold, disabled, }?: UseIntersectionObserverOptions): UseObserverReturn<IntersectionObserverEntry>;
|
|
414
|
-
/**
|
|
415
|
-
* Resize Observer
|
|
416
|
-
*/
|
|
417
|
-
interface ResizeObserverEntry {
|
|
418
|
-
target: Element | null;
|
|
419
|
-
contentRect: DOMRectReadOnly | null;
|
|
420
|
-
contentBoxSize: ReadonlyArray<ResizeObserverSize> | null;
|
|
421
|
-
borderBoxSize: ReadonlyArray<ResizeObserverSize> | null;
|
|
422
|
-
}
|
|
423
|
-
interface UseResizeObserverOptions {
|
|
424
|
-
disabled?: boolean;
|
|
425
|
-
}
|
|
426
|
-
declare function useResizeObserver({ disabled, }?: UseResizeObserverOptions): UseObserverReturn<ResizeObserverEntry>;
|
|
427
|
-
|
|
428
|
-
interface ResourceType {
|
|
429
|
-
id?: string | null;
|
|
430
|
-
name?: string | null;
|
|
431
|
-
}
|
|
432
|
-
interface ResourceWithTypes extends Resource {
|
|
433
|
-
types?: ResourceType[];
|
|
434
|
-
settings?: {
|
|
435
|
-
hideTypeNames?: boolean;
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
declare function useResourceTypeName(resource: ResourceWithTypes | null, type?: string | null): string | null;
|
|
439
|
-
|
|
440
|
-
declare function useResourceUrlGenerator(): (routeResourceId: string | Resource, routeName?: string, params?: Record<string, unknown> | null) => string | null;
|
|
441
|
-
declare function useResourceUrlGenerator(resourceId: string | Resource): (routeName?: string, params?: Record<string, unknown> | null) => string | null;
|
|
442
|
-
|
|
443
|
-
interface QueryParams {
|
|
444
|
-
page?: number;
|
|
445
|
-
count?: number;
|
|
446
|
-
[key: string]: unknown;
|
|
447
|
-
}
|
|
448
|
-
interface UseQueryReturn {
|
|
449
|
-
query: QueryParams | null;
|
|
450
|
-
onPageChange: (newPage: number) => void;
|
|
451
|
-
onQueryChange: (newQuery: QueryParams | null) => void;
|
|
452
|
-
onQueryReset: () => void;
|
|
453
|
-
}
|
|
454
|
-
declare function useQuery(initialBaseQuery?: QueryParams | null, paginated?: boolean): UseQueryReturn;
|
|
455
|
-
|
|
456
|
-
interface Screen {
|
|
457
|
-
name: string;
|
|
458
|
-
mediaQuery?: string | null;
|
|
459
|
-
}
|
|
460
|
-
interface Media {
|
|
461
|
-
type: string;
|
|
462
|
-
width: string;
|
|
463
|
-
height: string;
|
|
464
|
-
}
|
|
465
|
-
interface UseScreenSizeOptions {
|
|
466
|
-
width?: number | null;
|
|
467
|
-
height?: number | null;
|
|
468
|
-
landscape?: boolean;
|
|
469
|
-
screens?: Screen[];
|
|
470
|
-
mediaType?: string;
|
|
471
|
-
media?: Media | null;
|
|
472
|
-
}
|
|
473
|
-
interface ScreenSize {
|
|
474
|
-
screen: string | null;
|
|
475
|
-
screens: string[];
|
|
476
|
-
width: number | null;
|
|
477
|
-
height: number | null;
|
|
478
|
-
landscape: boolean;
|
|
479
|
-
}
|
|
480
|
-
interface UseScreenSizeFromElementOptions extends Omit<UseScreenSizeOptions, 'landscape'> {
|
|
481
|
-
withoutMaxSize?: boolean;
|
|
482
|
-
}
|
|
483
|
-
interface UseScreenSizeFromElementReturn {
|
|
484
|
-
ref: RefObject<Element>;
|
|
485
|
-
screenSize: ScreenSize;
|
|
486
|
-
}
|
|
487
|
-
declare function useScreenSizeFromElement({ width, height, ...opts }?: UseScreenSizeFromElementOptions): UseScreenSizeFromElementReturn;
|
|
488
|
-
declare function useScreenSizeFromWindow(opts?: UseScreenSizeOptions): ScreenSize;
|
|
489
|
-
|
|
490
|
-
declare const useWindowEvent: (event: string, callback: (...args: unknown[]) => void, enabled?: boolean) => void;
|
|
491
|
-
|
|
492
|
-
export { KEYCODES, getObserver, useAnimationFrame, useDocumentEvent, useForm, useFormattedDate, useFormattedTime, useIntersectionObserver, useIsVisible, useKeyboardKeys, useLoadedFonts, useMediaApi, useMediasParser, useObserver, useQuery, useResizeObserver, useResourceTypeName, useResourceUrlGenerator, useScreenSizeFromElement, useScreenSizeFromWindow, useWindowEvent };
|