@micromag/core 0.4.86 → 0.4.90-alpha.1
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/css/styles.css +4 -15
- package/assets/css/vendor.css +1 -1
- package/es/components.d.ts +106 -118
- package/es/components.js +1627 -1437
- package/es/contexts.d.ts +129 -90
- package/es/contexts.js +2 -136
- package/es/hooks.d.ts +80 -80
- package/es/hooks.js +18 -28
- package/es/index.d.ts +62 -46
- package/es/styles.css +4 -15
- package/es/utils.d.ts +85 -84
- package/es/utils.js +4 -4
- package/package.json +23 -20
package/es/contexts.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import * as React from 'react';
|
|
|
3
3
|
import React__default, { ReactNode, ElementType, ComponentType } from 'react';
|
|
4
4
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
5
5
|
import { MessageDescriptor } from 'react-intl';
|
|
6
|
+
export { ModalContext, ModalProvider as ModalsProvider } from '@panneau/core/contexts';
|
|
6
7
|
import * as _folklore_tracking from '@folklore/tracking';
|
|
7
8
|
export { TrackingContext } from '@folklore/tracking';
|
|
8
9
|
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
9
10
|
|
|
10
|
-
type
|
|
11
|
+
type Message = MessageDescriptor;
|
|
12
|
+
type Text = Message | ReactNode;
|
|
11
13
|
|
|
12
14
|
type MediaElement = HTMLVideoElement | HTMLAudioElement | HTMLMediaElement;
|
|
13
15
|
/**
|
|
@@ -27,7 +29,7 @@ interface MediaFile {
|
|
|
27
29
|
}
|
|
28
30
|
interface Media {
|
|
29
31
|
id?: string;
|
|
30
|
-
type
|
|
32
|
+
type?: string;
|
|
31
33
|
url: string;
|
|
32
34
|
thumbnail_url?: string;
|
|
33
35
|
name?: string;
|
|
@@ -35,17 +37,17 @@ interface Media {
|
|
|
35
37
|
files?: Record<string, MediaFile>;
|
|
36
38
|
}
|
|
37
39
|
interface ImageMedia extends Omit<Media, 'type' | 'metadata'> {
|
|
38
|
-
type
|
|
40
|
+
type: 'image' | 'video';
|
|
39
41
|
metadata?: MediaMetadata & {
|
|
40
42
|
width?: number;
|
|
41
43
|
height?: number;
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
interface FontMedia extends Omit<Media, 'type'> {
|
|
45
|
-
type
|
|
47
|
+
type: 'font';
|
|
46
48
|
}
|
|
47
49
|
interface VideoMedia extends Omit<Media, 'type' | 'metadata'> {
|
|
48
|
-
type
|
|
50
|
+
type: 'video';
|
|
49
51
|
metadata?: MediaMetadata & {
|
|
50
52
|
width?: number;
|
|
51
53
|
height?: number;
|
|
@@ -64,7 +66,10 @@ interface Field {
|
|
|
64
66
|
type: string;
|
|
65
67
|
label?: Text;
|
|
66
68
|
isSection?: boolean;
|
|
69
|
+
component?: Component;
|
|
70
|
+
defaultValue?: (() => unknown) | unknown;
|
|
67
71
|
fields?: Field[];
|
|
72
|
+
[key: string]: unknown;
|
|
68
73
|
}
|
|
69
74
|
interface ScreenDefinition extends Definition {
|
|
70
75
|
type: 'screen';
|
|
@@ -105,6 +110,14 @@ interface FontStyle {
|
|
|
105
110
|
underline?: boolean;
|
|
106
111
|
upperCase?: boolean;
|
|
107
112
|
}
|
|
113
|
+
interface HighlightStyle {
|
|
114
|
+
color?: Color;
|
|
115
|
+
textColor?: Color;
|
|
116
|
+
}
|
|
117
|
+
interface LinkStyle {
|
|
118
|
+
color?: Color;
|
|
119
|
+
fontStyle?: FontStyle;
|
|
120
|
+
}
|
|
108
121
|
interface TextStyle {
|
|
109
122
|
fontFamily?: Font;
|
|
110
123
|
fontSize?: number;
|
|
@@ -113,6 +126,8 @@ interface TextStyle {
|
|
|
113
126
|
color?: Color;
|
|
114
127
|
letterSpacing?: number;
|
|
115
128
|
lineHeight?: number;
|
|
129
|
+
link?: LinkStyle;
|
|
130
|
+
highlight?: HighlightStyle;
|
|
116
131
|
}
|
|
117
132
|
|
|
118
133
|
interface BackgroundElement {
|
|
@@ -186,9 +201,9 @@ declare class ComponentsManager extends EventEmitter {
|
|
|
186
201
|
constructor(components?: {});
|
|
187
202
|
addComponent(name: string, component: ComponentType, namespace?: string | null): this;
|
|
188
203
|
addComponents(components: ComponentsMap, namespace?: string | null): this;
|
|
189
|
-
merge(manager: ComponentsManager, namespace?:
|
|
204
|
+
merge(manager: ComponentsManager, namespace?: null): this;
|
|
190
205
|
addNamespace(namespace: string | null): this;
|
|
191
|
-
getComponent(name: string, namespace?: string | null): React.ElementType;
|
|
206
|
+
getComponent(name: string, namespace?: string | null): React.ElementType | null;
|
|
192
207
|
getComponents(namespace?: string | null): ComponentsMap;
|
|
193
208
|
hasComponent(name: string, namespace?: string | null): boolean;
|
|
194
209
|
}
|
|
@@ -201,10 +216,10 @@ declare class DefinitionsManager<T extends Definition = Definition> extends Even
|
|
|
201
216
|
addDefinitions(definitions: T[]): this;
|
|
202
217
|
merge(manager: DefinitionsManager<T>): this;
|
|
203
218
|
filter(filter: (definition: T) => boolean): DefinitionsManager<T>;
|
|
204
|
-
getDefinition(id: string): T;
|
|
219
|
+
getDefinition(id: string): T | null;
|
|
205
220
|
getDefinitions(): T[];
|
|
206
221
|
hasDefinition(id: string): boolean;
|
|
207
|
-
getComponent(id: string): Component;
|
|
222
|
+
getComponent(id: string): Component | null;
|
|
208
223
|
getComponents(): Record<string, Component>;
|
|
209
224
|
}
|
|
210
225
|
|
|
@@ -218,10 +233,10 @@ type ScreensFieldsPattern = {
|
|
|
218
233
|
};
|
|
219
234
|
declare class ScreensManager extends DefinitionsManager<ScreenDefinition> {
|
|
220
235
|
fieldsPattern: ScreensFieldsPattern | null;
|
|
221
|
-
constructor(definitions?:
|
|
222
|
-
getFields(id: string): Field[];
|
|
223
|
-
getLayouts(id: string): string[];
|
|
224
|
-
getFieldsPattern(): ScreensFieldsPattern;
|
|
236
|
+
constructor(definitions?: never[]);
|
|
237
|
+
getFields(id: string): Field[] | null;
|
|
238
|
+
getLayouts(id: string): string[] | null;
|
|
239
|
+
getFieldsPattern(): ScreensFieldsPattern | null;
|
|
225
240
|
setFieldsPattern(fieldsPattern: ScreensFieldsPattern): void;
|
|
226
241
|
filter(filter: (definition: ScreenDefinition) => boolean): ScreensManager;
|
|
227
242
|
merge(manager: ScreensManager): this;
|
|
@@ -232,7 +247,7 @@ declare const FIELDS_NAMESPACE = "fields";
|
|
|
232
247
|
declare const FORMS_NAMESPACE = "forms";
|
|
233
248
|
declare const SCREENS_NAMESPACE = "screens";
|
|
234
249
|
declare const ELEMENTS_NAMESPACE = "elements";
|
|
235
|
-
declare const ComponentsContext:
|
|
250
|
+
declare const ComponentsContext: React__default.Context<ComponentsManager | null>;
|
|
236
251
|
/**
|
|
237
252
|
* Hooks
|
|
238
253
|
*/
|
|
@@ -242,33 +257,33 @@ declare const useComponent: (name: string | ElementType | null, defaultComponent
|
|
|
242
257
|
/**
|
|
243
258
|
* Fields hooks
|
|
244
259
|
*/
|
|
245
|
-
declare const useFieldsComponentsManager: () => ComponentsManager;
|
|
246
|
-
declare const useFieldsComponents: (defaultComponents?: {}) => Record<string, ElementType>;
|
|
247
|
-
declare const useFieldComponent: (name: string | ElementType | null, defaultComponent?:
|
|
260
|
+
declare const useFieldsComponentsManager: () => ComponentsManager | null;
|
|
261
|
+
declare const useFieldsComponents: (defaultComponents?: {}) => Record<string, React__default.ElementType>;
|
|
262
|
+
declare const useFieldComponent: (name: string | ElementType | null, defaultComponent?: null) => React__default.ElementType | null;
|
|
248
263
|
/**
|
|
249
264
|
* Screens hooks
|
|
250
265
|
*/
|
|
251
|
-
declare const useScreensComponentsManager: () => ComponentsManager;
|
|
252
|
-
declare const useScreensComponents: (defaultComponents?: {}) => Record<string, ElementType>;
|
|
253
|
-
declare const useScreenComponent: (name: string | ElementType | null, defaultComponent?:
|
|
266
|
+
declare const useScreensComponentsManager: () => ComponentsManager | null;
|
|
267
|
+
declare const useScreensComponents: (defaultComponents?: {}) => Record<string, React__default.ElementType>;
|
|
268
|
+
declare const useScreenComponent: (name: string | ElementType | null, defaultComponent?: null) => React__default.ElementType | null;
|
|
254
269
|
/**
|
|
255
270
|
* Forms hooks
|
|
256
271
|
*/
|
|
257
|
-
declare const useFormsComponentsManager: () => ComponentsManager;
|
|
258
|
-
declare const useFormsComponents: (defaultComponents?: {}) => Record<string, ElementType>;
|
|
259
|
-
declare const useFormComponent: (name: string | ElementType | null, defaultComponent?:
|
|
272
|
+
declare const useFormsComponentsManager: () => ComponentsManager | null;
|
|
273
|
+
declare const useFormsComponents: (defaultComponents?: {}) => Record<string, React__default.ElementType>;
|
|
274
|
+
declare const useFormComponent: (name: string | ElementType | null, defaultComponent?: null) => React__default.ElementType | null;
|
|
260
275
|
/**
|
|
261
276
|
* Modals hooks
|
|
262
277
|
*/
|
|
263
|
-
declare const useModalsComponentsManager: () => ComponentsManager;
|
|
264
|
-
declare const useModalsComponents: (defaultComponents?: {}) => Record<string, ElementType>;
|
|
265
|
-
declare const useModalComponent: (name: string | ElementType | null, defaultComponent?:
|
|
278
|
+
declare const useModalsComponentsManager: () => ComponentsManager | null;
|
|
279
|
+
declare const useModalsComponents: (defaultComponents?: {}) => Record<string, React__default.ElementType>;
|
|
280
|
+
declare const useModalComponent: (name: string | ElementType | null, defaultComponent?: null) => React__default.ElementType | null;
|
|
266
281
|
/**
|
|
267
282
|
* Elements hooks
|
|
268
283
|
*/
|
|
269
|
-
declare const useElementsComponentsManager: () => ComponentsManager;
|
|
270
|
-
declare const useElementsComponents: (defaultComponents?: {}) => Record<string, ElementType>;
|
|
271
|
-
declare const useElementComponent: (name: string | ElementType | null, defaultComponent?:
|
|
284
|
+
declare const useElementsComponentsManager: () => ComponentsManager | null;
|
|
285
|
+
declare const useElementsComponents: (defaultComponents?: {}) => Record<string, React__default.ElementType>;
|
|
286
|
+
declare const useElementComponent: (name: string | ElementType | null, defaultComponent?: null) => React__default.ElementType | null;
|
|
272
287
|
/**
|
|
273
288
|
* Provider
|
|
274
289
|
*/
|
|
@@ -280,8 +295,14 @@ interface ComponentsProviderProps {
|
|
|
280
295
|
}
|
|
281
296
|
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
282
297
|
|
|
283
|
-
declare const ConsentContext:
|
|
284
|
-
|
|
298
|
+
declare const ConsentContext: React__default.Context<{
|
|
299
|
+
consent: null;
|
|
300
|
+
setConsent: () => void;
|
|
301
|
+
}>;
|
|
302
|
+
declare const useConsent: () => {
|
|
303
|
+
consent: null;
|
|
304
|
+
setConsent: () => void;
|
|
305
|
+
};
|
|
285
306
|
interface ConsentProviderProps {
|
|
286
307
|
children: React__default.ReactNode;
|
|
287
308
|
consent?: Record<string, unknown>[];
|
|
@@ -291,17 +312,17 @@ interface ConsentProviderProps {
|
|
|
291
312
|
}
|
|
292
313
|
declare function ConsentProvider({ consent: providedConsent, consented: initialConsented, expiration, children, }: ConsentProviderProps): react_jsx_runtime.JSX.Element;
|
|
293
314
|
|
|
294
|
-
declare const EditorContext:
|
|
295
|
-
declare const useEditor: () =>
|
|
296
|
-
declare const useGetColors: () =>
|
|
315
|
+
declare const EditorContext: React__default.Context<null>;
|
|
316
|
+
declare const useEditor: () => null;
|
|
317
|
+
declare const useGetColors: () => () => never[];
|
|
297
318
|
interface EditorProviderProps {
|
|
298
319
|
children: React__default.ReactNode;
|
|
299
320
|
}
|
|
300
321
|
declare function EditorProvider({ children }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
301
322
|
|
|
302
|
-
declare const FieldsContext: React.Context<FieldsManager>;
|
|
303
|
-
declare const useFieldsManager: () => FieldsManager;
|
|
304
|
-
declare const useFieldDefinition: (id: string) => FieldDefinition;
|
|
323
|
+
declare const FieldsContext: React.Context<FieldsManager | null>;
|
|
324
|
+
declare const useFieldsManager: () => FieldsManager | null;
|
|
325
|
+
declare const useFieldDefinition: (id: string) => FieldDefinition | null | undefined;
|
|
305
326
|
interface FieldsProviderProps {
|
|
306
327
|
fields?: FieldDefinition[] | null;
|
|
307
328
|
manager?: FieldsManager | null;
|
|
@@ -309,28 +330,32 @@ interface FieldsProviderProps {
|
|
|
309
330
|
}
|
|
310
331
|
declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react_jsx_runtime.JSX.Element;
|
|
311
332
|
|
|
312
|
-
declare const FieldsValueContext:
|
|
313
|
-
declare const useFieldsValue: () =>
|
|
333
|
+
declare const FieldsValueContext: React__default.Context<null>;
|
|
334
|
+
declare const useFieldsValue: () => null;
|
|
314
335
|
interface FieldsValueContextProviderProps {
|
|
315
336
|
value?: unknown;
|
|
316
337
|
children: React__default.ReactNode;
|
|
317
338
|
}
|
|
318
339
|
declare function FieldsValueContextProvider({ value, children }: FieldsValueContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
319
340
|
|
|
320
|
-
declare const FieldContext:
|
|
321
|
-
declare const useFieldContext: () =>
|
|
341
|
+
declare const FieldContext: React__default.Context<null>;
|
|
342
|
+
declare const useFieldContext: () => null;
|
|
322
343
|
interface FieldContextProviderProps {
|
|
323
344
|
context?: unknown;
|
|
324
345
|
children: React__default.ReactNode;
|
|
325
346
|
}
|
|
326
347
|
declare function FieldContextProvider({ context, children }: FieldContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
327
348
|
|
|
328
|
-
declare const FontsContext:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
349
|
+
declare const FontsContext: React__default.Context<{
|
|
350
|
+
systemFonts: null;
|
|
351
|
+
googleFonts: null;
|
|
352
|
+
customFonts: null;
|
|
353
|
+
}>;
|
|
354
|
+
declare const useGoogleFonts: (options?: null) => null;
|
|
355
|
+
declare const useFonts: (options?: null) => {
|
|
356
|
+
systemFonts: null;
|
|
357
|
+
googleFonts: null;
|
|
358
|
+
customFonts: null;
|
|
334
359
|
};
|
|
335
360
|
interface FontsProviderProps {
|
|
336
361
|
children: React__default.ReactNode;
|
|
@@ -339,8 +364,8 @@ interface FontsProviderProps {
|
|
|
339
364
|
}
|
|
340
365
|
declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): react_jsx_runtime.JSX.Element;
|
|
341
366
|
|
|
342
|
-
declare const GoogleApiClientContext:
|
|
343
|
-
declare const useGoogleApiClient: () =>
|
|
367
|
+
declare const GoogleApiClientContext: React__default.Context<null>;
|
|
368
|
+
declare const useGoogleApiClient: () => null;
|
|
344
369
|
declare const withGoogleApiClient: (WrappedComponent: any) => {
|
|
345
370
|
(props: any): react_jsx_runtime.JSX.Element;
|
|
346
371
|
displayName: string;
|
|
@@ -351,10 +376,10 @@ interface GoogleApiClientProviderProps {
|
|
|
351
376
|
declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
352
377
|
|
|
353
378
|
declare const GoogleKeysContext: React.Context<{
|
|
354
|
-
apiKey:
|
|
379
|
+
apiKey: null;
|
|
355
380
|
}>;
|
|
356
381
|
declare const useGoogleKeys: () => {
|
|
357
|
-
apiKey:
|
|
382
|
+
apiKey: null;
|
|
358
383
|
};
|
|
359
384
|
interface GoogleKeysProviderProps {
|
|
360
385
|
children: ReactNode;
|
|
@@ -362,8 +387,8 @@ interface GoogleKeysProviderProps {
|
|
|
362
387
|
}
|
|
363
388
|
declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): react_jsx_runtime.JSX.Element;
|
|
364
389
|
|
|
365
|
-
declare const GoogleMapsClientContext:
|
|
366
|
-
declare const useGoogleMapsClient: () =>
|
|
390
|
+
declare const GoogleMapsClientContext: React__default.Context<null>;
|
|
391
|
+
declare const useGoogleMapsClient: () => null;
|
|
367
392
|
declare const withGoogleMapsClient: (WrappedComponent: any) => {
|
|
368
393
|
(props: any): react_jsx_runtime.JSX.Element;
|
|
369
394
|
displayName: string;
|
|
@@ -375,20 +400,12 @@ interface GoogleMapsClientProviderProps {
|
|
|
375
400
|
}
|
|
376
401
|
declare function GoogleMapsClientProvider({ children, locale, libraries }: GoogleMapsClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
377
402
|
|
|
378
|
-
declare const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
403
|
+
declare const PanelsContext: React__default.Context<{
|
|
404
|
+
container: null;
|
|
405
|
+
}>;
|
|
406
|
+
declare const usePanels: () => {
|
|
407
|
+
container: null;
|
|
383
408
|
};
|
|
384
|
-
interface ModalsProviderProps {
|
|
385
|
-
children: React__default.ReactNode;
|
|
386
|
-
container?: Record<string, unknown>;
|
|
387
|
-
}
|
|
388
|
-
declare function ModalsProvider({ children, container: initialContainer }: ModalsProviderProps): react_jsx_runtime.JSX.Element;
|
|
389
|
-
|
|
390
|
-
declare const PanelsContext: any;
|
|
391
|
-
declare const usePanels: () => unknown;
|
|
392
409
|
declare const withPanels: (WrappedComponent: any) => {
|
|
393
410
|
(props: any): react_jsx_runtime.JSX.Element;
|
|
394
411
|
displayName: string;
|
|
@@ -432,8 +449,8 @@ interface PlaybackContext {
|
|
|
432
449
|
}
|
|
433
450
|
declare const PlaybackContext: React.Context<PlaybackContext>;
|
|
434
451
|
declare const usePlaybackContext: () => PlaybackContext;
|
|
435
|
-
declare const usePlaybackMediaRef: (active?: boolean, background?: boolean, updateKey?:
|
|
436
|
-
ref: React.RefObject<HTMLMediaElement>;
|
|
452
|
+
declare const usePlaybackMediaRef: (active?: boolean, background?: boolean, updateKey?: null) => {
|
|
453
|
+
ref: React.RefObject<HTMLMediaElement | null>;
|
|
437
454
|
isCurrent: boolean;
|
|
438
455
|
};
|
|
439
456
|
interface PlaybackProviderProps {
|
|
@@ -456,21 +473,29 @@ declare function PlaybackProvider({ muted: initialMuted, playing: initialPlaying
|
|
|
456
473
|
declare const useRoutePush: () => (route: any, data: any, ...args: any[]) => void;
|
|
457
474
|
declare const useRouteBack: () => () => void;
|
|
458
475
|
|
|
459
|
-
declare const SettingsContext:
|
|
460
|
-
declare const useSettings: () =>
|
|
461
|
-
declare const useSetting: (key: any, defaultValue?:
|
|
476
|
+
declare const SettingsContext: React__default.Context<{}>;
|
|
477
|
+
declare const useSettings: () => {};
|
|
478
|
+
declare const useSetting: (key: any, defaultValue?: null) => any;
|
|
462
479
|
interface SettingsProviderProps {
|
|
463
480
|
children: React__default.ReactNode;
|
|
464
481
|
settings?: Record<string, unknown>;
|
|
465
482
|
}
|
|
466
483
|
declare function SettingsProvider({ children, settings }: SettingsProviderProps): react_jsx_runtime.JSX.Element;
|
|
467
484
|
|
|
468
|
-
declare const ScreenContext:
|
|
469
|
-
|
|
485
|
+
declare const ScreenContext: React__default.Context<{
|
|
486
|
+
data: null;
|
|
487
|
+
definition: null;
|
|
488
|
+
renderContext: null;
|
|
489
|
+
}>;
|
|
490
|
+
declare const useScreen: () => {
|
|
491
|
+
data: null;
|
|
492
|
+
definition: null;
|
|
493
|
+
renderContext: null;
|
|
494
|
+
};
|
|
470
495
|
declare const useScreenDefinition: () => any;
|
|
471
|
-
declare const useScreenData: () =>
|
|
496
|
+
declare const useScreenData: () => null;
|
|
472
497
|
declare const useScreenRenderContext: () => {
|
|
473
|
-
renderContext:
|
|
498
|
+
renderContext: string | null;
|
|
474
499
|
isPlaceholder: boolean;
|
|
475
500
|
isPreview: boolean;
|
|
476
501
|
isEdit: boolean;
|
|
@@ -488,8 +513,8 @@ interface ScreenProviderProps {
|
|
|
488
513
|
}
|
|
489
514
|
declare function ScreenProvider({ data, definition, renderContext, screenState, children, }: ScreenProviderProps): react_jsx_runtime.JSX.Element;
|
|
490
515
|
|
|
491
|
-
declare const ScreensContext: React.Context<
|
|
492
|
-
declare const useScreensManager: () =>
|
|
516
|
+
declare const ScreensContext: React.Context<null>;
|
|
517
|
+
declare const useScreensManager: () => null;
|
|
493
518
|
interface ScreensProviderProps {
|
|
494
519
|
screens?: ScreenDefinition[] | null;
|
|
495
520
|
namespaces?: string[] | null;
|
|
@@ -499,17 +524,31 @@ interface ScreensProviderProps {
|
|
|
499
524
|
}
|
|
500
525
|
declare function ScreensProvider({ screens, namespaces, filterNamespaces, manager, children, }: ScreensProviderProps): react_jsx_runtime.JSX.Element;
|
|
501
526
|
|
|
502
|
-
declare const ScreenSizeContext:
|
|
503
|
-
|
|
527
|
+
declare const ScreenSizeContext: React__default.Context<{
|
|
528
|
+
screen: null;
|
|
529
|
+
screens: never[];
|
|
530
|
+
width: number;
|
|
531
|
+
height: number;
|
|
532
|
+
resolution: number;
|
|
533
|
+
landscape: boolean;
|
|
534
|
+
}>;
|
|
535
|
+
declare const useScreenSize: () => {
|
|
536
|
+
screen: null;
|
|
537
|
+
screens: never[];
|
|
538
|
+
width: number;
|
|
539
|
+
height: number;
|
|
540
|
+
resolution: number;
|
|
541
|
+
landscape: boolean;
|
|
542
|
+
};
|
|
504
543
|
interface ScreenSizeProviderProps {
|
|
505
544
|
children: React__default.ReactNode;
|
|
506
545
|
size?: ScreenSize;
|
|
507
546
|
}
|
|
508
547
|
declare function ScreenSizeProvider({ size, children }: ScreenSizeProviderProps): react_jsx_runtime.JSX.Element;
|
|
509
548
|
|
|
510
|
-
declare const StoryContext:
|
|
511
|
-
declare const useStoryContext: () => Story;
|
|
512
|
-
declare const useStory: () => Story;
|
|
549
|
+
declare const StoryContext: React__default.Context<Story | null>;
|
|
550
|
+
declare const useStoryContext: () => Story | null;
|
|
551
|
+
declare const useStory: () => Story | null;
|
|
513
552
|
interface StoryProviderProps {
|
|
514
553
|
story?: Story | null;
|
|
515
554
|
children: ReactNode;
|
|
@@ -517,7 +556,7 @@ interface StoryProviderProps {
|
|
|
517
556
|
declare function StoryProvider({ story, children }: StoryProviderProps): react_jsx_runtime.JSX.Element;
|
|
518
557
|
|
|
519
558
|
declare const useTracking: () => _folklore_tracking.Tracking;
|
|
520
|
-
declare function TrackingProvider(options?:
|
|
559
|
+
declare function TrackingProvider(options?: null): react_jsx_runtime.JSX.Element;
|
|
521
560
|
|
|
522
561
|
interface ViewerContextType {
|
|
523
562
|
events: EventEmitter;
|
|
@@ -545,8 +584,8 @@ interface ViewerContextType {
|
|
|
545
584
|
declare const ViewerContext: React.Context<ViewerContextType>;
|
|
546
585
|
declare const useViewerContext: () => ViewerContextType;
|
|
547
586
|
declare const useViewerSize: () => {
|
|
548
|
-
width: number;
|
|
549
|
-
height: number;
|
|
587
|
+
width: number | null;
|
|
588
|
+
height: number | null;
|
|
550
589
|
};
|
|
551
590
|
declare const useViewerNavigation: () => {
|
|
552
591
|
gotoNextScreen: () => void;
|
|
@@ -563,7 +602,7 @@ declare const useViewerWebView: () => {
|
|
|
563
602
|
open: (newWebView: any) => void;
|
|
564
603
|
close: () => void;
|
|
565
604
|
update: (newWebView: any) => void;
|
|
566
|
-
url
|
|
605
|
+
url?: string | undefined;
|
|
567
606
|
};
|
|
568
607
|
interface ViewerProviderProps {
|
|
569
608
|
children: ReactNode;
|
|
@@ -587,12 +626,12 @@ type VisitorContextType = {
|
|
|
587
626
|
visitor: Visitor | null;
|
|
588
627
|
setVisitor: (visitor: Visitor | string | null) => void;
|
|
589
628
|
};
|
|
590
|
-
declare const VisitorContext:
|
|
629
|
+
declare const VisitorContext: React__default.Context<VisitorContextType>;
|
|
591
630
|
declare function useVisitorContext(): {
|
|
592
|
-
visitor: Visitor;
|
|
631
|
+
visitor: Visitor | null;
|
|
593
632
|
setVisitor: (visitor: Visitor | string | null) => void;
|
|
594
633
|
};
|
|
595
|
-
declare function useVisitor(): Visitor;
|
|
634
|
+
declare function useVisitor(): Visitor | null;
|
|
596
635
|
declare function useSetVisitor(): (visitor: Visitor | string | null) => void;
|
|
597
636
|
interface VisitorProviderProps {
|
|
598
637
|
children: React__default.ReactNode;
|
|
@@ -600,4 +639,4 @@ interface VisitorProviderProps {
|
|
|
600
639
|
}
|
|
601
640
|
declare function VisitorProvider({ visitor: providedVisitor, children, }: VisitorProviderProps): react_jsx_runtime.JSX.Element;
|
|
602
641
|
|
|
603
|
-
export { ComponentsContext, ComponentsProvider, ConsentContext, ConsentProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE,
|
|
642
|
+
export { ComponentsContext, ComponentsProvider, ConsentContext, ConsentProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE, PanelsContext, PanelsProvider, PlaybackContext, PlaybackProvider, SCREENS_NAMESPACE, ScreenContext, ScreenProvider, ScreenSizeContext, ScreenSizeProvider, ScreensContext, ScreensProvider, SettingsContext, SettingsProvider, StoryContext, StoryProvider, TrackingProvider, ViewerContext, ViewerProvider, VisitorContext, VisitorProvider, useComponent, useComponents, useComponentsManager, useConsent, useEditor, useElementComponent, useElementsComponents, useElementsComponentsManager, useFieldComponent, useFieldContext, useFieldDefinition, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFieldsValue, useFonts, useFormComponent, useFormsComponents, useFormsComponentsManager, useGetColors, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useModalComponent, useModalsComponents, useModalsComponentsManager, usePanels, usePlaybackContext, usePlaybackMediaRef, useRouteBack, useRoutePush, useScreen, useScreenComponent, useScreenData, useScreenDefinition, useScreenRenderContext, useScreenSize, useScreenState, useScreensComponents, useScreensComponentsManager, useScreensManager, useSetVisitor, useSetting, useSettings, useStory, useStoryContext, useTracking, useViewerActivityDetected, useViewerContext, useViewerEvents, useViewerInteraction, useViewerNavigation, useViewerSize, useViewerWebView, useVisitor, useVisitorContext, withGoogleApiClient, withGoogleMapsClient, withPanels };
|
package/es/contexts.js
CHANGED
|
@@ -9,6 +9,7 @@ import uniqBy from 'lodash/uniqBy';
|
|
|
9
9
|
import { getJSON } from '@folklore/fetch';
|
|
10
10
|
import isObject from 'lodash/isObject';
|
|
11
11
|
import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
|
|
12
|
+
export { ModalContext, ModalProvider as ModalsProvider } from '@panneau/core/contexts';
|
|
12
13
|
import { getDisplayName, getMediaSrc, getMediaHasAudio, getMediaFilename, getMediaDuration, getScreenExtraField } from '@micromag/core/utils';
|
|
13
14
|
import createDebug from 'debug';
|
|
14
15
|
import { useUrlGenerator } from '@folklore/routes';
|
|
@@ -1262,141 +1263,6 @@ function GoogleMapsClientProvider(t0) {
|
|
|
1262
1263
|
return t5;
|
|
1263
1264
|
}
|
|
1264
1265
|
|
|
1265
|
-
const ModalsContext = /*#__PURE__*/React.createContext({
|
|
1266
|
-
container: null
|
|
1267
|
-
});
|
|
1268
|
-
const useModals = () => {
|
|
1269
|
-
return useContext(ModalsContext) || {};
|
|
1270
|
-
};
|
|
1271
|
-
const withModals = WrappedComponent => {
|
|
1272
|
-
function WithModalsComponent(props) {
|
|
1273
|
-
const $ = c(2);
|
|
1274
|
-
let t0;
|
|
1275
|
-
if ($[0] !== props) {
|
|
1276
|
-
t0 = /*#__PURE__*/jsx(ModalsContext.Consumer, {
|
|
1277
|
-
children: t1 => {
|
|
1278
|
-
const {
|
|
1279
|
-
modals,
|
|
1280
|
-
container,
|
|
1281
|
-
setContainer,
|
|
1282
|
-
register,
|
|
1283
|
-
unregister
|
|
1284
|
-
} = t1;
|
|
1285
|
-
return /*#__PURE__*/jsx(WrappedComponent, {
|
|
1286
|
-
modalsContainer: container,
|
|
1287
|
-
setModalsContainer: setContainer,
|
|
1288
|
-
modals: modals,
|
|
1289
|
-
registerModal: register,
|
|
1290
|
-
unregisterModal: unregister,
|
|
1291
|
-
...props
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
$[0] = props;
|
|
1296
|
-
$[1] = t0;
|
|
1297
|
-
} else {
|
|
1298
|
-
t0 = $[1];
|
|
1299
|
-
}
|
|
1300
|
-
return t0;
|
|
1301
|
-
}
|
|
1302
|
-
WithModalsComponent.displayName = `WithModals(${getDisplayName(WrappedComponent)})`;
|
|
1303
|
-
return WithModalsComponent;
|
|
1304
|
-
};
|
|
1305
|
-
function ModalsProvider(t0) {
|
|
1306
|
-
const $ = c(9);
|
|
1307
|
-
const {
|
|
1308
|
-
children,
|
|
1309
|
-
container: t1
|
|
1310
|
-
} = t0;
|
|
1311
|
-
const initialContainer = t1 === undefined ? null : t1;
|
|
1312
|
-
const [container, setContainer] = useState(initialContainer);
|
|
1313
|
-
let t2;
|
|
1314
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1315
|
-
t2 = [];
|
|
1316
|
-
$[0] = t2;
|
|
1317
|
-
} else {
|
|
1318
|
-
t2 = $[0];
|
|
1319
|
-
}
|
|
1320
|
-
const [modals, setModals] = useState(t2);
|
|
1321
|
-
const modalsRef = useRef(modals);
|
|
1322
|
-
let t3;
|
|
1323
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1324
|
-
t3 = (id, t4) => {
|
|
1325
|
-
const data = t4 === undefined ? null : t4;
|
|
1326
|
-
const {
|
|
1327
|
-
current: currentModals
|
|
1328
|
-
} = modalsRef;
|
|
1329
|
-
const newModals = [...currentModals, {
|
|
1330
|
-
id,
|
|
1331
|
-
...data
|
|
1332
|
-
}];
|
|
1333
|
-
setModals(newModals);
|
|
1334
|
-
modalsRef.current = newModals;
|
|
1335
|
-
};
|
|
1336
|
-
$[1] = t3;
|
|
1337
|
-
} else {
|
|
1338
|
-
t3 = $[1];
|
|
1339
|
-
}
|
|
1340
|
-
const register = t3;
|
|
1341
|
-
let t4;
|
|
1342
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1343
|
-
t4 = id_0 => {
|
|
1344
|
-
const {
|
|
1345
|
-
current: currentModals_0
|
|
1346
|
-
} = modalsRef;
|
|
1347
|
-
const foundIndex = currentModals_0.findIndex(t5 => {
|
|
1348
|
-
const {
|
|
1349
|
-
id: modalId
|
|
1350
|
-
} = t5;
|
|
1351
|
-
return modalId === id_0;
|
|
1352
|
-
});
|
|
1353
|
-
if (foundIndex !== -1) {
|
|
1354
|
-
const newModals_0 = currentModals_0.filter(t6 => {
|
|
1355
|
-
const {
|
|
1356
|
-
id: modalId_0
|
|
1357
|
-
} = t6;
|
|
1358
|
-
return modalId_0 !== id_0;
|
|
1359
|
-
});
|
|
1360
|
-
setModals(newModals_0);
|
|
1361
|
-
modalsRef.current = newModals_0;
|
|
1362
|
-
}
|
|
1363
|
-
};
|
|
1364
|
-
$[2] = t4;
|
|
1365
|
-
} else {
|
|
1366
|
-
t4 = $[2];
|
|
1367
|
-
}
|
|
1368
|
-
const unregister = t4;
|
|
1369
|
-
let t5;
|
|
1370
|
-
if ($[3] !== container || $[4] !== modals) {
|
|
1371
|
-
t5 = {
|
|
1372
|
-
modals,
|
|
1373
|
-
container,
|
|
1374
|
-
setContainer,
|
|
1375
|
-
register,
|
|
1376
|
-
unregister
|
|
1377
|
-
};
|
|
1378
|
-
$[3] = container;
|
|
1379
|
-
$[4] = modals;
|
|
1380
|
-
$[5] = t5;
|
|
1381
|
-
} else {
|
|
1382
|
-
t5 = $[5];
|
|
1383
|
-
}
|
|
1384
|
-
const value = t5;
|
|
1385
|
-
let t6;
|
|
1386
|
-
if ($[6] !== children || $[7] !== value) {
|
|
1387
|
-
t6 = /*#__PURE__*/jsx(ModalsContext.Provider, {
|
|
1388
|
-
value: value,
|
|
1389
|
-
children: children
|
|
1390
|
-
});
|
|
1391
|
-
$[6] = children;
|
|
1392
|
-
$[7] = value;
|
|
1393
|
-
$[8] = t6;
|
|
1394
|
-
} else {
|
|
1395
|
-
t6 = $[8];
|
|
1396
|
-
}
|
|
1397
|
-
return t6;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
1266
|
const PanelsContext = /*#__PURE__*/React.createContext({
|
|
1401
1267
|
container: null
|
|
1402
1268
|
});
|
|
@@ -2555,4 +2421,4 @@ function VisitorProvider(t0) {
|
|
|
2555
2421
|
return t7;
|
|
2556
2422
|
}
|
|
2557
2423
|
|
|
2558
|
-
export { ComponentsContext, ComponentsProvider, ConsentContext, ConsentProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE,
|
|
2424
|
+
export { ComponentsContext, ComponentsProvider, ConsentContext, ConsentProvider, ELEMENTS_NAMESPACE, EditorContext, EditorProvider, FIELDS_NAMESPACE, FORMS_NAMESPACE, FieldContext, FieldContextProvider, FieldsContext, FieldsProvider, FieldsValueContext, FieldsValueContextProvider, FontsContext, FontsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, MODALS_NAMESPACE, PanelsContext, PanelsProvider, PlaybackContext, PlaybackProvider, SCREENS_NAMESPACE, ScreenContext, ScreenProvider, ScreenSizeContext, ScreenSizeProvider, ScreensContext, ScreensProvider, SettingsContext, SettingsProvider, StoryContext, StoryProvider, TrackingProvider, ViewerContext, ViewerProvider, VisitorContext, VisitorProvider, useComponent, useComponents, useComponentsManager, useConsent, useEditor, useElementComponent, useElementsComponents, useElementsComponentsManager, useFieldComponent, useFieldContext, useFieldDefinition, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFieldsValue, useFonts, useFormComponent, useFormsComponents, useFormsComponentsManager, useGetColors, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useModalComponent, useModalsComponents, useModalsComponentsManager, usePanels, usePlaybackContext, usePlaybackMediaRef, useRouteBack, useRoutePush, useScreen, useScreenComponent, useScreenData, useScreenDefinition, useScreenRenderContext, useScreenSize, useScreenState, useScreensComponents, useScreensComponentsManager, useScreensManager, useSetVisitor, useSetting, useSettings, useStory, useStoryContext, useTracking, useViewerActivityDetected, useViewerContext, useViewerEvents, useViewerInteraction, useViewerNavigation, useViewerSize, useViewerWebView, useVisitor, useVisitorContext, withGoogleApiClient, withGoogleMapsClient, withPanels };
|