@micromag/core 0.4.98 → 0.4.109
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/es/components.d.ts +67 -67
- package/es/components.js +52 -46
- package/es/contexts.d.ts +27 -27
- package/es/contexts.js +128 -125
- package/es/hooks.js +5 -5
- package/es/index.js +9 -10
- package/es/utils.js +4 -4
- package/package.json +41 -41
package/es/contexts.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import React__default, { ReactNode, ElementType, ComponentType } from 'react';
|
|
4
3
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
@@ -293,7 +292,7 @@ interface ComponentsProviderProps {
|
|
|
293
292
|
manager?: ComponentsManager | null;
|
|
294
293
|
components?: Record<string, Record<string, ElementType>> | Record<string, ElementType>;
|
|
295
294
|
}
|
|
296
|
-
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps):
|
|
295
|
+
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): React__default.JSX.Element;
|
|
297
296
|
|
|
298
297
|
declare const ConsentContext: React__default.Context<{
|
|
299
298
|
consent: null;
|
|
@@ -310,7 +309,7 @@ interface ConsentProviderProps {
|
|
|
310
309
|
expiration?: number;
|
|
311
310
|
children?: React__default.ReactNode | null;
|
|
312
311
|
}
|
|
313
|
-
declare function ConsentProvider({ consent: providedConsent, consented: initialConsented, expiration, children, }: ConsentProviderProps):
|
|
312
|
+
declare function ConsentProvider({ consent: providedConsent, consented: initialConsented, expiration, children, }: ConsentProviderProps): React__default.JSX.Element;
|
|
314
313
|
|
|
315
314
|
declare const EditorContext: React__default.Context<null>;
|
|
316
315
|
declare const useEditor: () => null;
|
|
@@ -318,7 +317,7 @@ declare const useGetColors: () => () => never[];
|
|
|
318
317
|
interface EditorProviderProps {
|
|
319
318
|
children: React__default.ReactNode;
|
|
320
319
|
}
|
|
321
|
-
declare function EditorProvider({ children }: EditorProviderProps):
|
|
320
|
+
declare function EditorProvider({ children }: EditorProviderProps): React__default.JSX.Element;
|
|
322
321
|
|
|
323
322
|
declare const FieldsContext: React.Context<FieldsManager | null>;
|
|
324
323
|
declare const useFieldsManager: () => FieldsManager | null;
|
|
@@ -328,7 +327,7 @@ interface FieldsProviderProps {
|
|
|
328
327
|
manager?: FieldsManager | null;
|
|
329
328
|
children: ReactNode;
|
|
330
329
|
}
|
|
331
|
-
declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps):
|
|
330
|
+
declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): React.JSX.Element;
|
|
332
331
|
|
|
333
332
|
declare const FieldsValueContext: React__default.Context<null>;
|
|
334
333
|
declare const useFieldsValue: () => null;
|
|
@@ -336,7 +335,7 @@ interface FieldsValueContextProviderProps {
|
|
|
336
335
|
value?: unknown;
|
|
337
336
|
children: React__default.ReactNode;
|
|
338
337
|
}
|
|
339
|
-
declare function FieldsValueContextProvider({ value, children }: FieldsValueContextProviderProps):
|
|
338
|
+
declare function FieldsValueContextProvider({ value, children }: FieldsValueContextProviderProps): React__default.JSX.Element;
|
|
340
339
|
|
|
341
340
|
declare const FieldContext: React__default.Context<null>;
|
|
342
341
|
declare const useFieldContext: () => null;
|
|
@@ -344,36 +343,37 @@ interface FieldContextProviderProps {
|
|
|
344
343
|
context?: unknown;
|
|
345
344
|
children: React__default.ReactNode;
|
|
346
345
|
}
|
|
347
|
-
declare function FieldContextProvider({ context, children }: FieldContextProviderProps):
|
|
346
|
+
declare function FieldContextProvider({ context, children }: FieldContextProviderProps): React__default.JSX.Element;
|
|
348
347
|
|
|
349
|
-
declare const FontsContext:
|
|
348
|
+
declare const FontsContext: React.Context<{
|
|
350
349
|
systemFonts: null;
|
|
351
350
|
googleFonts: null;
|
|
352
351
|
customFonts: null;
|
|
352
|
+
loadGoogleFonts: null;
|
|
353
353
|
}>;
|
|
354
354
|
declare const useGoogleFonts: (options?: null) => null;
|
|
355
|
-
declare const useFonts: (
|
|
355
|
+
declare const useFonts: () => {
|
|
356
356
|
systemFonts: null;
|
|
357
357
|
googleFonts: null;
|
|
358
358
|
customFonts: null;
|
|
359
359
|
};
|
|
360
360
|
interface FontsProviderProps {
|
|
361
|
-
children:
|
|
361
|
+
children: ReactNode;
|
|
362
362
|
systemFonts?: Font[];
|
|
363
363
|
customFonts?: Font[];
|
|
364
364
|
}
|
|
365
|
-
declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps):
|
|
365
|
+
declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): React.JSX.Element;
|
|
366
366
|
|
|
367
367
|
declare const GoogleApiClientContext: React__default.Context<null>;
|
|
368
368
|
declare const useGoogleApiClient: () => null;
|
|
369
369
|
declare const withGoogleApiClient: (WrappedComponent: any) => {
|
|
370
|
-
(props: any):
|
|
370
|
+
(props: any): React__default.JSX.Element;
|
|
371
371
|
displayName: string;
|
|
372
372
|
};
|
|
373
373
|
interface GoogleApiClientProviderProps {
|
|
374
374
|
children: React__default.ReactNode;
|
|
375
375
|
}
|
|
376
|
-
declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps):
|
|
376
|
+
declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): React__default.JSX.Element;
|
|
377
377
|
|
|
378
378
|
declare const GoogleKeysContext: React.Context<{
|
|
379
379
|
apiKey: null;
|
|
@@ -385,12 +385,12 @@ interface GoogleKeysProviderProps {
|
|
|
385
385
|
children: ReactNode;
|
|
386
386
|
apiKey?: string | null;
|
|
387
387
|
}
|
|
388
|
-
declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps):
|
|
388
|
+
declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): React.JSX.Element;
|
|
389
389
|
|
|
390
390
|
declare const GoogleMapsClientContext: React__default.Context<null>;
|
|
391
391
|
declare const useGoogleMapsClient: () => null;
|
|
392
392
|
declare const withGoogleMapsClient: (WrappedComponent: any) => {
|
|
393
|
-
(props: any):
|
|
393
|
+
(props: any): React__default.JSX.Element;
|
|
394
394
|
displayName: string;
|
|
395
395
|
};
|
|
396
396
|
interface GoogleMapsClientProviderProps {
|
|
@@ -398,7 +398,7 @@ interface GoogleMapsClientProviderProps {
|
|
|
398
398
|
locale?: string;
|
|
399
399
|
libraries?: string[];
|
|
400
400
|
}
|
|
401
|
-
declare function GoogleMapsClientProvider({ children, locale, libraries }: GoogleMapsClientProviderProps):
|
|
401
|
+
declare function GoogleMapsClientProvider({ children, locale, libraries }: GoogleMapsClientProviderProps): React__default.JSX.Element;
|
|
402
402
|
|
|
403
403
|
declare const PanelsContext: React__default.Context<{
|
|
404
404
|
container: null;
|
|
@@ -407,14 +407,14 @@ declare const usePanels: () => {
|
|
|
407
407
|
container: null;
|
|
408
408
|
};
|
|
409
409
|
declare const withPanels: (WrappedComponent: any) => {
|
|
410
|
-
(props: any):
|
|
410
|
+
(props: any): React__default.JSX.Element;
|
|
411
411
|
displayName: string;
|
|
412
412
|
};
|
|
413
413
|
interface PanelsProviderProps {
|
|
414
414
|
children: React__default.ReactNode;
|
|
415
415
|
container?: Record<string, unknown>;
|
|
416
416
|
}
|
|
417
|
-
declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps):
|
|
417
|
+
declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): React__default.JSX.Element;
|
|
418
418
|
|
|
419
419
|
interface PlaybackControlsTheme {
|
|
420
420
|
seekBarOnly?: boolean;
|
|
@@ -468,7 +468,7 @@ interface PlaybackProviderProps {
|
|
|
468
468
|
paused?: boolean;
|
|
469
469
|
currentQualityLevel?: number | null;
|
|
470
470
|
}
|
|
471
|
-
declare function PlaybackProvider({ muted: initialMuted, playing: initialPlaying, paused, controls: initialControls, controlsSuggestPlay: initialControlsSuggestPlay, controlsVisible: initialControlsVisible, controlsTheme: initialControlsTheme, currentQualityLevel: initialCurrentQualityLevel, children, }: PlaybackProviderProps):
|
|
471
|
+
declare function PlaybackProvider({ muted: initialMuted, playing: initialPlaying, paused, controls: initialControls, controlsSuggestPlay: initialControlsSuggestPlay, controlsVisible: initialControlsVisible, controlsTheme: initialControlsTheme, currentQualityLevel: initialCurrentQualityLevel, children, }: PlaybackProviderProps): React.JSX.Element;
|
|
472
472
|
|
|
473
473
|
declare const useRoutePush: () => (route: any, data: any, ...args: any[]) => void;
|
|
474
474
|
declare const useRouteBack: () => () => void;
|
|
@@ -480,7 +480,7 @@ interface SettingsProviderProps {
|
|
|
480
480
|
children: React__default.ReactNode;
|
|
481
481
|
settings?: Record<string, unknown>;
|
|
482
482
|
}
|
|
483
|
-
declare function SettingsProvider({ children, settings }: SettingsProviderProps):
|
|
483
|
+
declare function SettingsProvider({ children, settings }: SettingsProviderProps): React__default.JSX.Element;
|
|
484
484
|
|
|
485
485
|
declare const ScreenContext: React__default.Context<{
|
|
486
486
|
data: null;
|
|
@@ -511,7 +511,7 @@ interface ScreenProviderProps {
|
|
|
511
511
|
renderContext?: RenderContext;
|
|
512
512
|
screenState?: string;
|
|
513
513
|
}
|
|
514
|
-
declare function ScreenProvider({ data, definition, renderContext, screenState, children, }: ScreenProviderProps):
|
|
514
|
+
declare function ScreenProvider({ data, definition, renderContext, screenState, children, }: ScreenProviderProps): React__default.JSX.Element;
|
|
515
515
|
|
|
516
516
|
declare const ScreensContext: React.Context<null>;
|
|
517
517
|
declare const useScreensManager: () => null;
|
|
@@ -522,7 +522,7 @@ interface ScreensProviderProps {
|
|
|
522
522
|
manager?: ScreensManager | null;
|
|
523
523
|
children: ReactNode;
|
|
524
524
|
}
|
|
525
|
-
declare function ScreensProvider({ screens, namespaces, filterNamespaces, manager, children, }: ScreensProviderProps):
|
|
525
|
+
declare function ScreensProvider({ screens, namespaces, filterNamespaces, manager, children, }: ScreensProviderProps): React.JSX.Element;
|
|
526
526
|
|
|
527
527
|
declare const ScreenSizeContext: React__default.Context<{
|
|
528
528
|
screen: null;
|
|
@@ -544,7 +544,7 @@ interface ScreenSizeProviderProps {
|
|
|
544
544
|
children: React__default.ReactNode;
|
|
545
545
|
size?: ScreenSize;
|
|
546
546
|
}
|
|
547
|
-
declare function ScreenSizeProvider({ size, children }: ScreenSizeProviderProps):
|
|
547
|
+
declare function ScreenSizeProvider({ size, children }: ScreenSizeProviderProps): React__default.JSX.Element;
|
|
548
548
|
|
|
549
549
|
declare const StoryContext: React__default.Context<Story | null>;
|
|
550
550
|
declare const useStoryContext: () => Story | null;
|
|
@@ -553,10 +553,10 @@ interface StoryProviderProps {
|
|
|
553
553
|
story?: Story | null;
|
|
554
554
|
children: ReactNode;
|
|
555
555
|
}
|
|
556
|
-
declare function StoryProvider({ story, children }: StoryProviderProps):
|
|
556
|
+
declare function StoryProvider({ story, children }: StoryProviderProps): React__default.JSX.Element;
|
|
557
557
|
|
|
558
558
|
declare const useTracking: () => _folklore_tracking.Tracking;
|
|
559
|
-
declare function TrackingProvider(options?: null):
|
|
559
|
+
declare function TrackingProvider(options?: null): React__default.JSX.Element;
|
|
560
560
|
|
|
561
561
|
interface ViewerContextType {
|
|
562
562
|
events: EventEmitter;
|
|
@@ -620,7 +620,7 @@ interface ViewerProviderProps {
|
|
|
620
620
|
disableInteraction?: (...args: unknown[]) => void;
|
|
621
621
|
enableInteraction?: (...args: unknown[]) => void;
|
|
622
622
|
}
|
|
623
|
-
declare function ViewerProvider({ children, events, menuVisible, menuOverScreen, activityDetected, width, height, topHeight, bottomHeight, bottomSidesWidth, gotoNextScreen, gotoPreviousScreen, disableInteraction, enableInteraction, }: ViewerProviderProps):
|
|
623
|
+
declare function ViewerProvider({ children, events, menuVisible, menuOverScreen, activityDetected, width, height, topHeight, bottomHeight, bottomSidesWidth, gotoNextScreen, gotoPreviousScreen, disableInteraction, enableInteraction, }: ViewerProviderProps): React.JSX.Element;
|
|
624
624
|
|
|
625
625
|
type VisitorContextType = {
|
|
626
626
|
visitor: Visitor | null;
|
|
@@ -637,7 +637,7 @@ interface VisitorProviderProps {
|
|
|
637
637
|
children: React__default.ReactNode;
|
|
638
638
|
visitor?: Visitor | string | null;
|
|
639
639
|
}
|
|
640
|
-
declare function VisitorProvider({ visitor: providedVisitor, children, }: VisitorProviderProps):
|
|
640
|
+
declare function VisitorProvider({ visitor: providedVisitor, children, }: VisitorProviderProps): React__default.JSX.Element;
|
|
641
641
|
|
|
642
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 };
|
|
643
643
|
export type { ScreensProviderProps };
|
package/es/contexts.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
|
-
import isString from 'lodash/isString';
|
|
2
|
+
import isString from 'lodash-es/isString';
|
|
3
3
|
import React, { createContext, use, useState, useEffect, useContext, useRef, useMemo } from 'react';
|
|
4
4
|
import { ComponentsManager, FieldsManager, ScreensManager, ColorsParser, Tracking } from '@micromag/core';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import JSCookie from 'js-cookie';
|
|
7
7
|
import { defineMessages, useIntl } from 'react-intl';
|
|
8
|
-
import uniqBy from 'lodash/uniqBy';
|
|
8
|
+
import uniqBy from 'lodash-es/uniqBy';
|
|
9
9
|
import { getJSON } from '@folklore/fetch';
|
|
10
|
-
import isObject from 'lodash/isObject';
|
|
11
10
|
import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
|
|
12
11
|
export { ModalContext, ModalProvider as ModalsProvider } from '@panneau/core/contexts';
|
|
13
12
|
import { getDisplayName, getMediaSrc, getMediaHasAudio, getMediaFilename, getMediaDuration, getScreenExtraField } from '@micromag/core/utils';
|
|
@@ -890,10 +889,11 @@ function GoogleKeysProvider(t0) {
|
|
|
890
889
|
return t4;
|
|
891
890
|
}
|
|
892
891
|
|
|
893
|
-
const FontsContext = /*#__PURE__*/
|
|
892
|
+
const FontsContext = /*#__PURE__*/createContext({
|
|
894
893
|
systemFonts: null,
|
|
895
894
|
googleFonts: null,
|
|
896
|
-
customFonts: null
|
|
895
|
+
customFonts: null,
|
|
896
|
+
loadGoogleFonts: null
|
|
897
897
|
});
|
|
898
898
|
const useGoogleFonts = t0 => {
|
|
899
899
|
const $ = c(7);
|
|
@@ -908,25 +908,28 @@ const useGoogleFonts = t0 => {
|
|
|
908
908
|
}
|
|
909
909
|
const {
|
|
910
910
|
disabled: t2,
|
|
911
|
-
setFonts: t3
|
|
911
|
+
setFonts: t3,
|
|
912
|
+
apiKey: t4
|
|
912
913
|
} = t1;
|
|
913
914
|
const disabled = t2 === undefined ? false : t2;
|
|
914
915
|
const setFonts = t3 === undefined ? null : t3;
|
|
916
|
+
const optionsApiKey = t4 === undefined ? null : t4;
|
|
915
917
|
const {
|
|
916
|
-
apiKey
|
|
918
|
+
apiKey: contextApiKey
|
|
917
919
|
} = useGoogleKeys();
|
|
920
|
+
const apiKey = optionsApiKey || contextApiKey;
|
|
918
921
|
const [googleFonts, setGoogleFonts] = useState(null);
|
|
919
|
-
let t4;
|
|
920
922
|
let t5;
|
|
923
|
+
let t6;
|
|
921
924
|
if ($[2] !== apiKey || $[3] !== disabled || $[4] !== setFonts) {
|
|
922
|
-
|
|
925
|
+
t5 = () => {
|
|
923
926
|
let canceled = false;
|
|
924
927
|
if (apiKey !== null && !disabled) {
|
|
925
|
-
getJSON(`https://www.googleapis.com/webfonts/v1/webfonts?key=${apiKey}&sort=popularity`).then(
|
|
928
|
+
getJSON(`https://www.googleapis.com/webfonts/v1/webfonts?key=${apiKey}&sort=popularity`).then(t7 => {
|
|
926
929
|
const {
|
|
927
|
-
items:
|
|
928
|
-
} =
|
|
929
|
-
const items =
|
|
930
|
+
items: t8
|
|
931
|
+
} = t7;
|
|
932
|
+
const items = t8 === undefined ? [] : t8;
|
|
930
933
|
if (!canceled) {
|
|
931
934
|
const newFonts = items.map(_temp$1);
|
|
932
935
|
if (setFonts !== null) {
|
|
@@ -941,74 +944,63 @@ const useGoogleFonts = t0 => {
|
|
|
941
944
|
canceled = true;
|
|
942
945
|
};
|
|
943
946
|
};
|
|
944
|
-
|
|
947
|
+
t6 = [apiKey, disabled, setFonts, setGoogleFonts];
|
|
945
948
|
$[2] = apiKey;
|
|
946
949
|
$[3] = disabled;
|
|
947
950
|
$[4] = setFonts;
|
|
948
|
-
$[5] =
|
|
949
|
-
$[6] =
|
|
951
|
+
$[5] = t5;
|
|
952
|
+
$[6] = t6;
|
|
950
953
|
} else {
|
|
951
|
-
|
|
952
|
-
|
|
954
|
+
t5 = $[5];
|
|
955
|
+
t6 = $[6];
|
|
953
956
|
}
|
|
954
|
-
useEffect(
|
|
957
|
+
useEffect(t5, t6);
|
|
955
958
|
return googleFonts;
|
|
956
959
|
};
|
|
957
|
-
const useFonts =
|
|
958
|
-
const $ = c(
|
|
959
|
-
const options = t0 === undefined ? null : t0;
|
|
960
|
-
let t1;
|
|
961
|
-
if ($[0] !== options) {
|
|
962
|
-
t1 = options || {};
|
|
963
|
-
$[0] = options;
|
|
964
|
-
$[1] = t1;
|
|
965
|
-
} else {
|
|
966
|
-
t1 = $[1];
|
|
967
|
-
}
|
|
968
|
-
const {
|
|
969
|
-
withoutGoogleFonts: t2
|
|
970
|
-
} = t1;
|
|
971
|
-
const withoutGoogleFonts = t2 === undefined ? false : t2;
|
|
960
|
+
const useFonts = () => {
|
|
961
|
+
const $ = c(7);
|
|
972
962
|
const {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
} =
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
const
|
|
981
|
-
const
|
|
982
|
-
|
|
983
|
-
let
|
|
984
|
-
if ($[
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
963
|
+
systemFonts: t0,
|
|
964
|
+
googleFonts: t1,
|
|
965
|
+
customFonts: t2,
|
|
966
|
+
loadGoogleFonts: t3
|
|
967
|
+
} = use(FontsContext);
|
|
968
|
+
const systemFonts = t0 === undefined ? null : t0;
|
|
969
|
+
const googleFonts = t1 === undefined ? null : t1;
|
|
970
|
+
const customFonts = t2 === undefined ? null : t2;
|
|
971
|
+
const loadGoogleFonts = t3 === undefined ? null : t3;
|
|
972
|
+
let t4;
|
|
973
|
+
let t5;
|
|
974
|
+
if ($[0] !== loadGoogleFonts) {
|
|
975
|
+
t4 = () => {
|
|
976
|
+
if (loadGoogleFonts !== null) {
|
|
977
|
+
loadGoogleFonts();
|
|
978
|
+
}
|
|
988
979
|
};
|
|
989
|
-
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
980
|
+
t5 = [loadGoogleFonts];
|
|
981
|
+
$[0] = loadGoogleFonts;
|
|
982
|
+
$[1] = t4;
|
|
983
|
+
$[2] = t5;
|
|
992
984
|
} else {
|
|
993
|
-
|
|
985
|
+
t4 = $[1];
|
|
986
|
+
t5 = $[2];
|
|
994
987
|
}
|
|
995
|
-
|
|
996
|
-
let
|
|
997
|
-
if ($[
|
|
998
|
-
|
|
988
|
+
useEffect(t4, t5);
|
|
989
|
+
let t6;
|
|
990
|
+
if ($[3] !== customFonts || $[4] !== googleFonts || $[5] !== systemFonts) {
|
|
991
|
+
t6 = {
|
|
999
992
|
systemFonts,
|
|
1000
993
|
googleFonts,
|
|
1001
994
|
customFonts
|
|
1002
995
|
};
|
|
1003
|
-
$[
|
|
1004
|
-
$[
|
|
1005
|
-
$[
|
|
1006
|
-
$[
|
|
996
|
+
$[3] = customFonts;
|
|
997
|
+
$[4] = googleFonts;
|
|
998
|
+
$[5] = systemFonts;
|
|
999
|
+
$[6] = t6;
|
|
1007
1000
|
} else {
|
|
1008
|
-
|
|
1001
|
+
t6 = $[6];
|
|
1009
1002
|
}
|
|
1010
|
-
|
|
1011
|
-
return fonts;
|
|
1003
|
+
return t6;
|
|
1012
1004
|
};
|
|
1013
1005
|
function FontsProvider(t0) {
|
|
1014
1006
|
const $ = c(18);
|
|
@@ -1017,89 +1009,100 @@ function FontsProvider(t0) {
|
|
|
1017
1009
|
customFonts: t2,
|
|
1018
1010
|
children
|
|
1019
1011
|
} = t0;
|
|
1020
|
-
|
|
1021
|
-
if ($[0] !== t1) {
|
|
1022
|
-
t3 = t1 === undefined ? ["Arial", "Courier New", "Georgia", "Times New Roman", "Verdana"] : t1;
|
|
1023
|
-
$[0] = t1;
|
|
1024
|
-
$[1] = t3;
|
|
1025
|
-
} else {
|
|
1026
|
-
t3 = $[1];
|
|
1027
|
-
}
|
|
1028
|
-
const systemFonts = t3;
|
|
1012
|
+
const systemFonts = t1 === undefined ? ["Arial", "Courier New", "Georgia", "Times New Roman", "Verdana"] : t1;
|
|
1029
1013
|
const customFonts = t2 === undefined ? null : t2;
|
|
1030
1014
|
const {
|
|
1031
|
-
systemFonts:
|
|
1032
|
-
googleFonts:
|
|
1033
|
-
customFonts: previousCustomFonts
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
const
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
$[2] = previousSystemFonts;
|
|
1042
|
-
$[3] = systemFonts;
|
|
1043
|
-
$[4] = t6;
|
|
1044
|
-
} else {
|
|
1045
|
-
t6 = $[4];
|
|
1046
|
-
}
|
|
1015
|
+
systemFonts: t3,
|
|
1016
|
+
googleFonts: t4,
|
|
1017
|
+
customFonts: previousCustomFonts,
|
|
1018
|
+
loadGoogleFonts: t5
|
|
1019
|
+
} = use(FontsContext);
|
|
1020
|
+
const previousSystemFonts = t3 === undefined ? null : t3;
|
|
1021
|
+
const previousGoogleFonts = t4 === undefined ? null : t4;
|
|
1022
|
+
const previousLoadGoogleFonts = t5 === undefined ? null : t5;
|
|
1023
|
+
const [shouldLoadGoogleFonts, setShouldLoadGoogleFonts] = useState(false);
|
|
1024
|
+
const t6 = previousGoogleFonts !== null && previousGoogleFonts.length > 0 || !shouldLoadGoogleFonts;
|
|
1047
1025
|
let t7;
|
|
1048
|
-
if ($[
|
|
1049
|
-
t7 =
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
$[
|
|
1026
|
+
if ($[0] !== t6) {
|
|
1027
|
+
t7 = {
|
|
1028
|
+
disabled: t6
|
|
1029
|
+
};
|
|
1030
|
+
$[0] = t6;
|
|
1031
|
+
$[1] = t7;
|
|
1053
1032
|
} else {
|
|
1054
|
-
t7 = $[
|
|
1033
|
+
t7 = $[1];
|
|
1055
1034
|
}
|
|
1035
|
+
const googleFonts = useGoogleFonts(t7);
|
|
1056
1036
|
let t8;
|
|
1057
|
-
if ($[
|
|
1058
|
-
t8 =
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
$[
|
|
1037
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1038
|
+
t8 = () => {
|
|
1039
|
+
setShouldLoadGoogleFonts(true);
|
|
1040
|
+
};
|
|
1041
|
+
$[2] = t8;
|
|
1062
1042
|
} else {
|
|
1063
|
-
t8 = $[
|
|
1043
|
+
t8 = $[2];
|
|
1064
1044
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1045
|
+
const loadGoogleFonts = t8;
|
|
1046
|
+
const T0 = FontsContext;
|
|
1047
|
+
const t9 = uniqBy([...(previousSystemFonts || []), ...(systemFonts || [])], _temp2$1);
|
|
1048
|
+
let t10;
|
|
1049
|
+
if ($[3] !== googleFonts || $[4] !== previousGoogleFonts) {
|
|
1050
|
+
t10 = uniqBy([...(previousGoogleFonts || []), ...(googleFonts || [])], _temp3$1);
|
|
1051
|
+
$[3] = googleFonts;
|
|
1052
|
+
$[4] = previousGoogleFonts;
|
|
1053
|
+
$[5] = t10;
|
|
1054
|
+
} else {
|
|
1055
|
+
t10 = $[5];
|
|
1056
|
+
}
|
|
1057
|
+
let t11;
|
|
1058
|
+
if ($[6] !== customFonts || $[7] !== previousCustomFonts) {
|
|
1059
|
+
t11 = uniqBy([...(previousCustomFonts || []), ...(customFonts || [])], _temp4$1);
|
|
1060
|
+
$[6] = customFonts;
|
|
1061
|
+
$[7] = previousCustomFonts;
|
|
1062
|
+
$[8] = t11;
|
|
1063
|
+
} else {
|
|
1064
|
+
t11 = $[8];
|
|
1065
|
+
}
|
|
1066
|
+
const t12 = previousLoadGoogleFonts || loadGoogleFonts;
|
|
1067
|
+
let t13;
|
|
1068
|
+
if ($[9] !== t10 || $[10] !== t11 || $[11] !== t12 || $[12] !== t9) {
|
|
1069
|
+
t13 = {
|
|
1070
|
+
systemFonts: t9,
|
|
1071
|
+
googleFonts: t10,
|
|
1072
|
+
customFonts: t11,
|
|
1073
|
+
loadGoogleFonts: t12
|
|
1072
1074
|
};
|
|
1073
|
-
$[
|
|
1074
|
-
$[
|
|
1075
|
-
$[
|
|
1076
|
-
$[
|
|
1075
|
+
$[9] = t10;
|
|
1076
|
+
$[10] = t11;
|
|
1077
|
+
$[11] = t12;
|
|
1078
|
+
$[12] = t9;
|
|
1079
|
+
$[13] = t13;
|
|
1077
1080
|
} else {
|
|
1078
|
-
|
|
1081
|
+
t13 = $[13];
|
|
1079
1082
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
value: fonts,
|
|
1083
|
+
let t14;
|
|
1084
|
+
if ($[14] !== T0 || $[15] !== children || $[16] !== t13) {
|
|
1085
|
+
t14 = /*#__PURE__*/jsx(T0, {
|
|
1086
|
+
value: t13,
|
|
1085
1087
|
children: children
|
|
1086
1088
|
});
|
|
1089
|
+
$[14] = T0;
|
|
1087
1090
|
$[15] = children;
|
|
1088
|
-
$[16] =
|
|
1089
|
-
$[17] =
|
|
1091
|
+
$[16] = t13;
|
|
1092
|
+
$[17] = t14;
|
|
1090
1093
|
} else {
|
|
1091
|
-
|
|
1094
|
+
t14 = $[17];
|
|
1092
1095
|
}
|
|
1093
|
-
return
|
|
1096
|
+
return t14;
|
|
1094
1097
|
}
|
|
1095
1098
|
function _temp4$1(font_1) {
|
|
1096
|
-
return
|
|
1099
|
+
return isString(font_1) ? font_1 : font_1.name;
|
|
1097
1100
|
}
|
|
1098
1101
|
function _temp3$1(font_0) {
|
|
1099
|
-
return
|
|
1102
|
+
return isString(font_0) ? font_0 : font_0.name;
|
|
1100
1103
|
}
|
|
1101
1104
|
function _temp2$1(font) {
|
|
1102
|
-
return
|
|
1105
|
+
return isString(font) ? font : font.name;
|
|
1103
1106
|
}
|
|
1104
1107
|
function _temp$1(it) {
|
|
1105
1108
|
return {
|
package/es/hooks.js
CHANGED
|
@@ -9,17 +9,17 @@ import classNames from 'classnames';
|
|
|
9
9
|
import screenfull from 'screenfull';
|
|
10
10
|
import { useResizeObserver, useIntersectionObserver, useWindowSize } from '@folklore/hooks';
|
|
11
11
|
export { useIntersectionObserver, useResizeObserver } from '@folklore/hooks';
|
|
12
|
-
import isObject from 'lodash/isObject';
|
|
12
|
+
import isObject from 'lodash-es/isObject';
|
|
13
13
|
import raf from 'raf';
|
|
14
14
|
import createDebug from 'debug';
|
|
15
15
|
import { useScreensManager, useFieldsManager, useTracking, useScreen } from '@micromag/core/contexts';
|
|
16
|
-
import isEmpty from 'lodash/isEmpty';
|
|
16
|
+
import isEmpty from 'lodash-es/isEmpty';
|
|
17
17
|
import { match } from 'css-mediaquery';
|
|
18
|
-
import isArray from 'lodash/isArray';
|
|
18
|
+
import isArray from 'lodash-es/isArray';
|
|
19
19
|
import dayjs from 'dayjs';
|
|
20
|
-
import isString from 'lodash/isString';
|
|
20
|
+
import isString from 'lodash-es/isString';
|
|
21
21
|
import { useIntl } from 'react-intl';
|
|
22
|
-
import clamp from 'lodash/clamp';
|
|
22
|
+
import clamp from 'lodash-es/clamp';
|
|
23
23
|
|
|
24
24
|
function useActivityDetector(t0) {
|
|
25
25
|
const $ = c(8);
|
package/es/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import isArray from 'lodash/isArray';
|
|
2
|
-
import isObject from 'lodash/isObject';
|
|
3
|
-
import uniqWith from 'lodash/uniqWith';
|
|
4
|
-
import sortBy from 'lodash/sortBy';
|
|
1
|
+
import isArray from 'lodash-es/isArray';
|
|
2
|
+
import isObject from 'lodash-es/isObject';
|
|
3
|
+
import uniqWith from 'lodash-es/uniqWith';
|
|
4
|
+
import sortBy from 'lodash-es/sortBy';
|
|
5
5
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
6
6
|
import { pascalCase } from 'change-case';
|
|
7
|
-
import uniqBy from 'lodash/uniqBy';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import isEmpty from 'lodash/isEmpty';
|
|
7
|
+
import uniqBy from 'lodash-es/uniqBy';
|
|
8
|
+
import isString from 'lodash-es/isString';
|
|
9
|
+
import isEmpty from 'lodash-es/isEmpty';
|
|
11
10
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
12
11
|
|
|
13
12
|
const sortedColors = colors => sortBy(colors, ['color', 'alpha']);
|
|
@@ -663,7 +662,7 @@ class FontsParser {
|
|
|
663
662
|
theme = null,
|
|
664
663
|
components = []
|
|
665
664
|
} = story || {};
|
|
666
|
-
const fonts =
|
|
665
|
+
const fonts = uniqBy(components.reduce((currentFonts, screen) => {
|
|
667
666
|
const {
|
|
668
667
|
type
|
|
669
668
|
} = screen;
|
|
@@ -681,7 +680,7 @@ class FontsParser {
|
|
|
681
680
|
return fonts.length > 0 || themeFonts.length > 0 ? {
|
|
682
681
|
...story,
|
|
683
682
|
theme: newTheme,
|
|
684
|
-
fonts:
|
|
683
|
+
fonts: uniqBy([...themeFonts, ...fonts], 'name')
|
|
685
684
|
} : story;
|
|
686
685
|
}
|
|
687
686
|
return fonts.length > 0 ? {
|
package/es/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import isString from 'lodash/isString';
|
|
2
|
-
import isNumber from 'lodash/isNumber';
|
|
1
|
+
import isString from 'lodash-es/isString';
|
|
2
|
+
import isNumber from 'lodash-es/isNumber';
|
|
3
3
|
import { kebabCase, pascalCase, snakeCase } from 'change-case';
|
|
4
4
|
export { camelCase, pascalCase, snakeCase } from 'change-case';
|
|
5
|
-
import isObject from 'lodash/isObject';
|
|
5
|
+
import isObject from 'lodash-es/isObject';
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
7
|
import tinycolor from 'tinycolor2';
|
|
8
|
-
import isArray from 'lodash/isArray';
|
|
8
|
+
import isArray from 'lodash-es/isArray';
|
|
9
9
|
import slugify from 'slugify';
|
|
10
10
|
|
|
11
11
|
function addNonBreakingSpaces(text) {
|