@panneau/core 4.0.78 → 4.1.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/dist/contexts.d.ts +237 -168
- package/dist/contexts.js +20 -23
- package/dist/hooks.d.ts +58 -40
- package/dist/hooks.js +780 -338
- package/dist/index.d.ts +258 -201
- package/dist/index.js +23 -29
- package/dist/utils.d.ts +59 -17
- package/dist/utils.js +79 -31
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, MouseEvent, ElementType, ComponentProps } from 'react';
|
|
2
|
+
import { MessageDescriptor, FormattedMessage } from 'react-intl';
|
|
2
3
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
3
|
-
import { MessageDescriptor } from 'react-intl';
|
|
4
4
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
12
|
-
addNamespace(namespace: string | null): this;
|
|
13
|
-
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
14
|
-
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
15
|
-
hasComponent(name: string, namespace?: string | null): boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface Definition$1 {
|
|
19
|
-
id: string;
|
|
20
|
-
component?: unknown;
|
|
6
|
+
/**
|
|
7
|
+
* User definition
|
|
8
|
+
*/
|
|
9
|
+
interface User {
|
|
10
|
+
id?: number | string;
|
|
21
11
|
[key: string]: unknown;
|
|
22
12
|
}
|
|
23
|
-
declare class DefinitionsManager<T extends Definition$1 = Definition$1> {
|
|
24
|
-
definitions: T[];
|
|
25
|
-
constructor(definitions?: T[]);
|
|
26
|
-
addDefinition(definition: T | T[]): this;
|
|
27
|
-
addDefinitions(definitions: T[]): this;
|
|
28
|
-
merge(manager: DefinitionsManager<T>): this;
|
|
29
|
-
getDefinition(id: string | null): T | null;
|
|
30
|
-
getDefinitions(): T[];
|
|
31
|
-
hasDefinition(id: string): boolean;
|
|
32
|
-
getComponent(id: string): unknown;
|
|
33
|
-
getComponents(): Record<string, unknown>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type EventCallback = (...args: unknown[]) => void;
|
|
37
|
-
declare class EventsManager extends EventEmitter {
|
|
38
|
-
element: EventTarget;
|
|
39
|
-
events: Record<string, EventCallback[]>;
|
|
40
|
-
listeners: Record<string, EventListener>;
|
|
41
|
-
constructor(element: EventTarget);
|
|
42
|
-
subscribe(event: string, callback: EventCallback): void;
|
|
43
|
-
unsubscribe(event: string, callback: EventCallback): void;
|
|
44
|
-
addEventListener(event: string): void;
|
|
45
|
-
removeEventListener(event: string): void;
|
|
46
|
-
}
|
|
47
13
|
|
|
48
14
|
/**
|
|
49
15
|
* Core UI Types
|
|
@@ -53,10 +19,22 @@ declare class EventsManager extends EventEmitter {
|
|
|
53
19
|
* Internationalization message definition
|
|
54
20
|
*/
|
|
55
21
|
type Message = MessageDescriptor;
|
|
22
|
+
/**
|
|
23
|
+
* Values that can be interpolated in an internationalization message
|
|
24
|
+
* (the `values` prop of FormattedMessage)
|
|
25
|
+
*/
|
|
26
|
+
type MessageValues = NonNullable<ComponentProps<typeof FormattedMessage>['values']>;
|
|
27
|
+
type MessageValue = MessageValues[string];
|
|
56
28
|
/**
|
|
57
29
|
* Label can be either a message object or any React node
|
|
58
30
|
*/
|
|
59
31
|
type Label = Message | ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Map of components, can be nested by namespace (ex: { fields: { text: TextField } })
|
|
34
|
+
*/
|
|
35
|
+
interface ComponentsMap {
|
|
36
|
+
[name: string]: ElementType | ComponentsMap;
|
|
37
|
+
}
|
|
60
38
|
/**
|
|
61
39
|
* HTTP status code (number or string)
|
|
62
40
|
*/
|
|
@@ -68,8 +46,16 @@ interface MenuItem {
|
|
|
68
46
|
id?: number | string;
|
|
69
47
|
label?: Label;
|
|
70
48
|
url?: string;
|
|
49
|
+
href?: string | null;
|
|
71
50
|
external?: boolean;
|
|
72
51
|
active?: boolean;
|
|
52
|
+
type?: string;
|
|
53
|
+
component?: string;
|
|
54
|
+
className?: string | null;
|
|
55
|
+
linkClassName?: string | null;
|
|
56
|
+
onClick?: ((e: MouseEvent) => void) | null;
|
|
57
|
+
items?: MenuItem[] | null;
|
|
58
|
+
dropdown?: MenuItem[] | null;
|
|
73
59
|
}
|
|
74
60
|
/**
|
|
75
61
|
* Button definition
|
|
@@ -77,6 +63,7 @@ interface MenuItem {
|
|
|
77
63
|
type ButtonElement = HTMLButtonElement | HTMLAnchorElement;
|
|
78
64
|
interface Button {
|
|
79
65
|
id?: string;
|
|
66
|
+
name?: string;
|
|
80
67
|
label?: Label;
|
|
81
68
|
onClick?: (e: MouseEvent<ButtonElement>, button?: Button, index?: number) => void;
|
|
82
69
|
href?: string;
|
|
@@ -171,7 +158,7 @@ interface Item {
|
|
|
171
158
|
/**
|
|
172
159
|
* Generic definition
|
|
173
160
|
*/
|
|
174
|
-
interface Definition {
|
|
161
|
+
interface Definition$1 {
|
|
175
162
|
id: string;
|
|
176
163
|
component?: string | ElementType;
|
|
177
164
|
[key: string]: unknown;
|
|
@@ -216,7 +203,7 @@ interface Field$2 {
|
|
|
216
203
|
size?: ControlSize;
|
|
217
204
|
[key: string]: unknown;
|
|
218
205
|
}
|
|
219
|
-
interface FieldDefinition extends Omit<Field$2, 'component'>, Definition {
|
|
206
|
+
interface FieldDefinition extends Omit<Field$2, 'component'>, Definition$1 {
|
|
220
207
|
}
|
|
221
208
|
/**
|
|
222
209
|
* Form definition
|
|
@@ -229,141 +216,7 @@ interface Form {
|
|
|
229
216
|
submitButtonLabel?: Label | null;
|
|
230
217
|
[key: string]: unknown;
|
|
231
218
|
}
|
|
232
|
-
interface FormDefinition extends Form, Definition {
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
interface Manager$1 {
|
|
239
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
240
|
-
}
|
|
241
|
-
interface FontsParserOptions {
|
|
242
|
-
fieldsManager: Manager$1;
|
|
243
|
-
screensManager: Manager$1;
|
|
244
|
-
}
|
|
245
|
-
interface Font {
|
|
246
|
-
name?: string;
|
|
247
|
-
type?: string;
|
|
248
|
-
[key: string]: unknown;
|
|
249
|
-
}
|
|
250
|
-
interface Field$1 {
|
|
251
|
-
id?: string | null;
|
|
252
|
-
name?: string | null;
|
|
253
|
-
type?: string | null;
|
|
254
|
-
fields?: Field$1[];
|
|
255
|
-
itemsField?: Field$1 | null;
|
|
256
|
-
settings?: Field$1[];
|
|
257
|
-
[key: string]: unknown;
|
|
258
|
-
}
|
|
259
|
-
interface Screen$2 {
|
|
260
|
-
type: string;
|
|
261
|
-
[key: string]: unknown;
|
|
262
|
-
}
|
|
263
|
-
interface Story$1 {
|
|
264
|
-
theme?: Story$1 | null;
|
|
265
|
-
components?: Screen$2[];
|
|
266
|
-
fonts?: Font[];
|
|
267
|
-
[key: string]: unknown;
|
|
268
|
-
}
|
|
269
|
-
declare class FontsParser {
|
|
270
|
-
fieldsManager: Manager$1;
|
|
271
|
-
screensManager: Manager$1;
|
|
272
|
-
constructor({ fieldsManager, screensManager }: FontsParserOptions);
|
|
273
|
-
parse(story: Story$1 | null): Story$1 | null;
|
|
274
|
-
getFieldsPattern(fields: Field$1[], namePrefix?: string | null): RegExp[];
|
|
275
|
-
static fieldIsFontFamily({ id }: Field$1): boolean;
|
|
276
|
-
static valueIsFont({ type }: Record<string, unknown>): boolean;
|
|
277
|
-
static extractFontsWithPaths(data: unknown, patterns: RegExp[], keyPrefix?: string | null): Font[];
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
interface Manager {
|
|
284
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
285
|
-
}
|
|
286
|
-
interface MediasParserOptions {
|
|
287
|
-
fieldsManager: Manager;
|
|
288
|
-
screensManager: Manager;
|
|
289
|
-
}
|
|
290
|
-
interface Media$2 {
|
|
291
|
-
id?: string | null;
|
|
292
|
-
[key: string]: unknown;
|
|
293
|
-
}
|
|
294
|
-
interface Field {
|
|
295
|
-
id?: string | null;
|
|
296
|
-
name?: string | null;
|
|
297
|
-
type?: string | null;
|
|
298
|
-
media?: boolean;
|
|
299
|
-
fields?: Field[];
|
|
300
|
-
itemsField?: Field | null;
|
|
301
|
-
settings?: Field[];
|
|
302
|
-
[key: string]: unknown;
|
|
303
|
-
}
|
|
304
|
-
interface Screen$1 {
|
|
305
|
-
type: string;
|
|
306
|
-
[key: string]: unknown;
|
|
307
|
-
}
|
|
308
|
-
interface Story {
|
|
309
|
-
theme?: Story | null;
|
|
310
|
-
components?: Screen$1[];
|
|
311
|
-
medias?: Record<string, Media$2> | null;
|
|
312
|
-
[key: string]: unknown;
|
|
313
|
-
}
|
|
314
|
-
declare class MediasParser {
|
|
315
|
-
fieldsManager: Manager;
|
|
316
|
-
screensManager: Manager;
|
|
317
|
-
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
318
|
-
toPath(story: Story | null): Story | null;
|
|
319
|
-
fromPath(story: Story | null, defaultMedias?: Record<string, Media$2> | null): Story | null;
|
|
320
|
-
getMediaFieldsPattern(fields: Field[], namePrefix?: string | null): RegExp[];
|
|
321
|
-
static fieldIsMedia({ media }: Field): boolean;
|
|
322
|
-
static fieldIsFontFamily({ id }: Field): boolean;
|
|
323
|
-
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$2>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
324
|
-
static getMediaPath({ id }: Media$2): string | null;
|
|
325
|
-
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$2> | null, keyPrefix?: string | null): {
|
|
326
|
-
data: unknown;
|
|
327
|
-
medias: Record<string, Media$2> | null;
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
interface TrackingOptions {
|
|
332
|
-
variables?: Record<string, unknown> | null;
|
|
333
|
-
[key: string]: unknown;
|
|
334
|
-
}
|
|
335
|
-
interface Screen {
|
|
336
|
-
id?: string | null;
|
|
337
|
-
type?: string | null;
|
|
338
|
-
[key: string]: unknown;
|
|
339
|
-
}
|
|
340
|
-
interface Media$1 {
|
|
341
|
-
id?: string | null;
|
|
342
|
-
name?: string | null;
|
|
343
|
-
duration?: number | null;
|
|
344
|
-
currentTime?: number | null;
|
|
345
|
-
[key: string]: unknown;
|
|
346
|
-
}
|
|
347
|
-
interface TrackingEventOptions {
|
|
348
|
-
value?: number | null;
|
|
349
|
-
[key: string]: unknown;
|
|
350
|
-
}
|
|
351
|
-
declare class Tracking extends Tracking$1 {
|
|
352
|
-
variables: Record<string, unknown> | null;
|
|
353
|
-
constructor(opts?: TrackingOptions);
|
|
354
|
-
setVariables(variables: Record<string, unknown> | null): void;
|
|
355
|
-
getVariables(): Record<string, unknown> | null;
|
|
356
|
-
trackScreenView(screen: Screen | null, screenIndex: number): void;
|
|
357
|
-
trackEvent(category: string, action: string, label: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
358
|
-
trackMedia(type: string, media: Media$1 | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* User definition
|
|
363
|
-
*/
|
|
364
|
-
interface User {
|
|
365
|
-
id?: number | string;
|
|
366
|
-
[key: string]: unknown;
|
|
219
|
+
interface FormDefinition extends Form, Definition$1 {
|
|
367
220
|
}
|
|
368
221
|
|
|
369
222
|
type MediaType = 'audio' | 'image' | 'video' | 'document' | 'font';
|
|
@@ -374,7 +227,7 @@ interface MediaFile {
|
|
|
374
227
|
/**
|
|
375
228
|
* Media file definition
|
|
376
229
|
*/
|
|
377
|
-
interface Media extends Item {
|
|
230
|
+
interface Media$2 extends Item {
|
|
378
231
|
id: string;
|
|
379
232
|
name: string;
|
|
380
233
|
type: string;
|
|
@@ -382,21 +235,22 @@ interface Media extends Item {
|
|
|
382
235
|
thumbnailUrl?: string;
|
|
383
236
|
url?: string;
|
|
384
237
|
provider?: string;
|
|
238
|
+
deletedAt?: string | null;
|
|
385
239
|
[key: string]: unknown;
|
|
386
240
|
files?: Record<string, MediaFile> | null;
|
|
387
241
|
}
|
|
388
|
-
interface VideoMedia extends Media {
|
|
242
|
+
interface VideoMedia extends Media$2 {
|
|
389
243
|
type: 'video';
|
|
390
244
|
iframeUrl?: string;
|
|
391
245
|
width?: number | null;
|
|
392
246
|
height?: number | null;
|
|
393
247
|
duration?: number | null;
|
|
394
248
|
}
|
|
395
|
-
interface AudioMedia extends Media {
|
|
249
|
+
interface AudioMedia extends Media$2 {
|
|
396
250
|
type: 'audio';
|
|
397
251
|
duration?: number | null;
|
|
398
252
|
}
|
|
399
|
-
interface ImageMedia extends Media {
|
|
253
|
+
interface ImageMedia extends Media$2 {
|
|
400
254
|
type: 'image';
|
|
401
255
|
}
|
|
402
256
|
|
|
@@ -411,6 +265,7 @@ interface ImageMedia extends Media {
|
|
|
411
265
|
type TableColumn = string | Column;
|
|
412
266
|
interface Column extends Record<string, unknown> {
|
|
413
267
|
id?: string | null;
|
|
268
|
+
name?: string | null;
|
|
414
269
|
label?: unknown;
|
|
415
270
|
path?: string;
|
|
416
271
|
valueKey?: string;
|
|
@@ -437,7 +292,7 @@ type ActionValue = Item | Item[] | null;
|
|
|
437
292
|
interface ResourceIntlValues {
|
|
438
293
|
a_singular?: string;
|
|
439
294
|
a_plural?: string;
|
|
440
|
-
[key: string]:
|
|
295
|
+
[key: string]: MessageValue;
|
|
441
296
|
}
|
|
442
297
|
/**
|
|
443
298
|
* Internationalization configuration
|
|
@@ -465,13 +320,32 @@ interface ResourcePages {
|
|
|
465
320
|
duplicate?: PageDefinition;
|
|
466
321
|
[key: string]: PageDefinition | undefined;
|
|
467
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Form definition of a resource (the id is optional, the form is identified by its key)
|
|
325
|
+
*/
|
|
326
|
+
interface ResourceForm extends Form {
|
|
327
|
+
id?: string;
|
|
328
|
+
component?: string | ElementType;
|
|
329
|
+
}
|
|
468
330
|
interface ResourceForms {
|
|
469
|
-
default
|
|
470
|
-
create
|
|
471
|
-
edit
|
|
472
|
-
delete
|
|
473
|
-
modal
|
|
474
|
-
[key: string]:
|
|
331
|
+
default?: ResourceForm | null;
|
|
332
|
+
create?: ResourceForm | null;
|
|
333
|
+
edit?: ResourceForm | null;
|
|
334
|
+
delete?: ResourceForm | null;
|
|
335
|
+
modal?: ResourceForm | null;
|
|
336
|
+
[key: string]: ResourceForm | null | undefined;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Resource type (sub-type of a resource, ex: page types)
|
|
340
|
+
*/
|
|
341
|
+
interface ResourceType {
|
|
342
|
+
id?: string;
|
|
343
|
+
name?: string;
|
|
344
|
+
fields?: Field$2[];
|
|
345
|
+
settings?: {
|
|
346
|
+
canCreate?: boolean;
|
|
347
|
+
[key: string]: unknown;
|
|
348
|
+
};
|
|
475
349
|
}
|
|
476
350
|
interface Resource {
|
|
477
351
|
id: string;
|
|
@@ -483,6 +357,7 @@ interface Resource {
|
|
|
483
357
|
settings?: Record<string, unknown>;
|
|
484
358
|
extraRoutes?: RouteDefinition[];
|
|
485
359
|
pages?: ResourcePages;
|
|
360
|
+
types?: ResourceType[];
|
|
486
361
|
}
|
|
487
362
|
interface ResourceItem extends Item {
|
|
488
363
|
type?: string;
|
|
@@ -532,17 +407,17 @@ interface uppy {
|
|
|
532
407
|
* Panneau route configuration
|
|
533
408
|
*/
|
|
534
409
|
interface Routes {
|
|
535
|
-
'resources.index'
|
|
536
|
-
'resources.create'
|
|
537
|
-
'resources.store'
|
|
538
|
-
'resources.show'
|
|
539
|
-
'resources.edit'
|
|
540
|
-
'resources.update'
|
|
541
|
-
'resources.delete'
|
|
542
|
-
'resources.destroy'
|
|
543
|
-
'resources.duplicate'
|
|
544
|
-
'resources.clone'
|
|
545
|
-
'resources.restore'
|
|
410
|
+
'resources.index'?: RouteDefinition | string;
|
|
411
|
+
'resources.create'?: RouteDefinition | string;
|
|
412
|
+
'resources.store'?: RouteDefinition | string;
|
|
413
|
+
'resources.show'?: RouteDefinition | string;
|
|
414
|
+
'resources.edit'?: RouteDefinition | string;
|
|
415
|
+
'resources.update'?: RouteDefinition | string;
|
|
416
|
+
'resources.delete'?: RouteDefinition | string;
|
|
417
|
+
'resources.destroy'?: RouteDefinition | string;
|
|
418
|
+
'resources.duplicate'?: RouteDefinition | string;
|
|
419
|
+
'resources.clone'?: RouteDefinition | string;
|
|
420
|
+
'resources.restore'?: RouteDefinition | string;
|
|
546
421
|
[key: string]: RouteDefinition | string;
|
|
547
422
|
}
|
|
548
423
|
interface PanneauTheme {
|
|
@@ -570,6 +445,21 @@ interface PanneauPages extends ResourcePages {
|
|
|
570
445
|
account?: PageDefinition;
|
|
571
446
|
error?: PageDefinition;
|
|
572
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Menu item in a Panneau menu: a menu item definition or a special item id
|
|
450
|
+
* (ex: 'resources', 'account', 'separator')
|
|
451
|
+
*/
|
|
452
|
+
type PanneauMenuItem = MenuItem | string;
|
|
453
|
+
interface PanneauMenus {
|
|
454
|
+
main?: PanneauMenuItem[] | null;
|
|
455
|
+
guest?: PanneauMenuItem[] | null;
|
|
456
|
+
[key: string]: PanneauMenuItem[] | null | undefined;
|
|
457
|
+
}
|
|
458
|
+
interface PanneauAuth {
|
|
459
|
+
forgotPassword?: boolean;
|
|
460
|
+
register?: boolean;
|
|
461
|
+
[key: string]: unknown;
|
|
462
|
+
}
|
|
573
463
|
/**
|
|
574
464
|
* Panneau definition (main configuration)
|
|
575
465
|
*/
|
|
@@ -584,11 +474,178 @@ interface PanneauDefinition {
|
|
|
584
474
|
settings?: Record<string, unknown>;
|
|
585
475
|
forms?: FormDefinition[];
|
|
586
476
|
fields?: FieldDefinition[];
|
|
477
|
+
menus?: PanneauMenus;
|
|
478
|
+
auth?: PanneauAuth;
|
|
587
479
|
}
|
|
588
480
|
/**
|
|
589
481
|
* Tracking variables
|
|
590
482
|
*/
|
|
591
483
|
type TrackingVariables = Record<string, unknown>;
|
|
592
484
|
|
|
485
|
+
declare class ComponentsManager {
|
|
486
|
+
components: Record<string, ElementType>;
|
|
487
|
+
constructor(components?: ComponentsMap);
|
|
488
|
+
addComponent(name: string, component: ElementType, namespace?: string | null): this;
|
|
489
|
+
addComponents(components: Record<string, ElementType>, namespace?: string | null): this;
|
|
490
|
+
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
491
|
+
addNamespace(namespace: string | null): this;
|
|
492
|
+
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
493
|
+
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
494
|
+
hasComponent(name: string, namespace?: string | null): boolean;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
interface Definition {
|
|
498
|
+
id: string;
|
|
499
|
+
component?: unknown;
|
|
500
|
+
[key: string]: unknown;
|
|
501
|
+
}
|
|
502
|
+
declare class DefinitionsManager<T extends Definition = Definition> {
|
|
503
|
+
definitions: T[];
|
|
504
|
+
constructor(definitions?: T[]);
|
|
505
|
+
addDefinition(definition: T | T[]): this;
|
|
506
|
+
addDefinitions(definitions: T[]): this;
|
|
507
|
+
merge(manager: DefinitionsManager<T>): this;
|
|
508
|
+
getDefinition(id: string | null): T | null;
|
|
509
|
+
getDefinitions(): T[];
|
|
510
|
+
hasDefinition(id: string): boolean;
|
|
511
|
+
getComponent(id: string): unknown;
|
|
512
|
+
getComponents(): Record<string, unknown>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
type EventCallback = (...args: unknown[]) => void;
|
|
516
|
+
declare class EventsManager extends EventEmitter {
|
|
517
|
+
element: EventTarget;
|
|
518
|
+
events: Record<string, EventCallback[]>;
|
|
519
|
+
listeners: Record<string, EventListener>;
|
|
520
|
+
constructor(element: EventTarget);
|
|
521
|
+
subscribe(event: string, callback: EventCallback): void;
|
|
522
|
+
unsubscribe(event: string, callback: EventCallback): void;
|
|
523
|
+
addEventListener(event: string): void;
|
|
524
|
+
removeEventListener(event: string): void;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
interface Manager$1 {
|
|
531
|
+
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
532
|
+
}
|
|
533
|
+
interface FontsParserOptions {
|
|
534
|
+
fieldsManager: Manager$1;
|
|
535
|
+
screensManager: Manager$1;
|
|
536
|
+
}
|
|
537
|
+
interface Font {
|
|
538
|
+
name?: string;
|
|
539
|
+
type?: string;
|
|
540
|
+
[key: string]: unknown;
|
|
541
|
+
}
|
|
542
|
+
interface Field$1 {
|
|
543
|
+
id?: string | null;
|
|
544
|
+
name?: string | null;
|
|
545
|
+
type?: string | null;
|
|
546
|
+
fields?: Field$1[];
|
|
547
|
+
itemsField?: Field$1 | null;
|
|
548
|
+
settings?: Field$1[];
|
|
549
|
+
[key: string]: unknown;
|
|
550
|
+
}
|
|
551
|
+
interface Screen$2 {
|
|
552
|
+
type: string;
|
|
553
|
+
[key: string]: unknown;
|
|
554
|
+
}
|
|
555
|
+
interface Story$1 {
|
|
556
|
+
theme?: Story$1 | null;
|
|
557
|
+
components?: Screen$2[];
|
|
558
|
+
fonts?: Font[];
|
|
559
|
+
[key: string]: unknown;
|
|
560
|
+
}
|
|
561
|
+
declare class FontsParser {
|
|
562
|
+
fieldsManager: Manager$1;
|
|
563
|
+
screensManager: Manager$1;
|
|
564
|
+
constructor({ fieldsManager, screensManager }: FontsParserOptions);
|
|
565
|
+
parse(story: Story$1 | null): Story$1 | null;
|
|
566
|
+
getFieldsPattern(fields: Field$1[], namePrefix?: string | null): RegExp[];
|
|
567
|
+
static fieldIsFontFamily({ id }: Field$1): boolean;
|
|
568
|
+
static valueIsFont({ type }: {
|
|
569
|
+
type?: unknown;
|
|
570
|
+
}): boolean;
|
|
571
|
+
static extractFontsWithPaths(data: unknown, patterns: RegExp[], keyPrefix?: string | null): Font[];
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
interface Manager {
|
|
578
|
+
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
579
|
+
}
|
|
580
|
+
interface MediasParserOptions {
|
|
581
|
+
fieldsManager: Manager;
|
|
582
|
+
screensManager?: Manager | null;
|
|
583
|
+
}
|
|
584
|
+
interface Media$1 {
|
|
585
|
+
id?: string | null;
|
|
586
|
+
[key: string]: unknown;
|
|
587
|
+
}
|
|
588
|
+
interface Field {
|
|
589
|
+
id?: string | null;
|
|
590
|
+
name?: string | null;
|
|
591
|
+
type?: string | null;
|
|
592
|
+
media?: boolean;
|
|
593
|
+
fields?: Field[];
|
|
594
|
+
itemsField?: Field | null;
|
|
595
|
+
settings?: Field[];
|
|
596
|
+
[key: string]: unknown;
|
|
597
|
+
}
|
|
598
|
+
interface Screen$1 {
|
|
599
|
+
type: string;
|
|
600
|
+
[key: string]: unknown;
|
|
601
|
+
}
|
|
602
|
+
interface Story {
|
|
603
|
+
theme?: Story | null;
|
|
604
|
+
components?: Screen$1[];
|
|
605
|
+
medias?: Record<string, Media$1> | null;
|
|
606
|
+
[key: string]: unknown;
|
|
607
|
+
}
|
|
608
|
+
declare class MediasParser {
|
|
609
|
+
fieldsManager: Manager;
|
|
610
|
+
screensManager: Manager | null;
|
|
611
|
+
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
612
|
+
toPath(story: Story | null): Story | null;
|
|
613
|
+
fromPath(story: Story | null, defaultMedias?: Record<string, Media$1> | null): Story | null;
|
|
614
|
+
getMediaFieldsPattern(fields: Field[], namePrefix?: string | null): RegExp[];
|
|
615
|
+
static fieldIsMedia({ media }: Field): boolean;
|
|
616
|
+
static fieldIsFontFamily({ id }: Field): boolean;
|
|
617
|
+
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$1>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
618
|
+
static getMediaPath({ id }: Media$1): string | null;
|
|
619
|
+
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$1> | null, keyPrefix?: string | null): {
|
|
620
|
+
data: unknown;
|
|
621
|
+
medias: Record<string, Media$1> | null;
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
interface Screen {
|
|
626
|
+
id?: string | null;
|
|
627
|
+
type?: string | null;
|
|
628
|
+
[key: string]: unknown;
|
|
629
|
+
}
|
|
630
|
+
interface Media {
|
|
631
|
+
id?: string | null;
|
|
632
|
+
name?: string | null;
|
|
633
|
+
duration?: number | null;
|
|
634
|
+
currentTime?: number | null;
|
|
635
|
+
[key: string]: unknown;
|
|
636
|
+
}
|
|
637
|
+
interface TrackingEventOptions {
|
|
638
|
+
value?: string | number | null;
|
|
639
|
+
[key: string]: unknown;
|
|
640
|
+
}
|
|
641
|
+
declare class Tracking extends Tracking$1 {
|
|
642
|
+
variables: Record<string, unknown> | null;
|
|
643
|
+
setVariables(variables: Record<string, unknown> | null): void;
|
|
644
|
+
getVariables(): Record<string, unknown> | null;
|
|
645
|
+
trackScreenView(screen: Screen | null, screenIndex: number): void;
|
|
646
|
+
trackEvent(category: string, action: string, label?: string | null, options?: TrackingEventOptions | string | number | null): void;
|
|
647
|
+
trackMedia(type: string, media: Media | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
648
|
+
}
|
|
649
|
+
|
|
593
650
|
export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser, Tracking };
|
|
594
|
-
export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, BreakpointsSize, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ControlSize, Definition, DialogSize, DropdownAlign, Feedback, Field$2 as Field, FieldDefinition, FieldOption, Filter, Font$1 as Font, Form, FormDefinition, FormError, FormStatus, ImageMedia, Item, Label, Media, MediaFile, MediaType, MenuItem, Message, Modal, PageDefinition, Pagination, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauPages, PanneauTheme, Preview, Resource, ResourceForms, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, ResourcePages, RouteDefinition, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, VideoMedia, uppy };
|
|
651
|
+
export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, BreakpointsSize, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ComponentsMap, ControlSize, Definition$1 as Definition, DialogSize, DropdownAlign, Feedback, Field$2 as Field, FieldDefinition, FieldOption, Filter, Font$1 as Font, Form, FormDefinition, FormError, FormStatus, ImageMedia, Item, Label, Media$2 as Media, MediaFile, MediaType, MenuItem, Message, MessageValue, MessageValues, Modal, PageDefinition, Pagination, PanneauAuth, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauMenuItem, PanneauMenus, PanneauPages, PanneauTheme, Preview, Resource, ResourceForm, ResourceForms, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, ResourcePages, ResourceType, RouteDefinition, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, VideoMedia, uppy };
|