@frontify/guideline-blocks-settings 0.29.17 → 0.30.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +73 -79
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +103 -96
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +21 -0
  7. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -0
  8. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +47 -43
  9. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +123 -0
  11. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -0
  12. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js +27 -0
  13. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachments.es.js.map +1 -0
  14. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js +12 -0
  15. package/dist/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.es.js.map +1 -0
  16. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +6 -0
  17. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -0
  18. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +26 -0
  19. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -0
  20. package/dist/hooks/useAttachments.es.js +43 -20
  21. package/dist/hooks/useAttachments.es.js.map +1 -1
  22. package/dist/index.cjs.js +3 -3
  23. package/dist/index.cjs.js.map +1 -1
  24. package/dist/index.d.ts +95 -8
  25. package/dist/index.es.js +176 -171
  26. package/dist/index.es.js.map +1 -1
  27. package/dist/index.umd.js +3 -3
  28. package/dist/index.umd.js.map +1 -1
  29. package/dist/styles.css +1 -1
  30. package/package.json +3 -3
  31. package/src/components/Attachments/AttachmentItem.tsx +2 -13
  32. package/src/components/Attachments/Attachments.tsx +30 -15
  33. package/src/components/Attachments/AttachmentsButtonTrigger.tsx +22 -0
  34. package/src/components/Attachments/types.ts +10 -2
  35. package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +23 -20
  36. package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +127 -0
  37. package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +133 -0
  38. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachments.tsx +29 -0
  39. package/src/components/BlockItemWrapper/Toolbar/ToolbarAttachmentsTrigger.tsx +14 -0
  40. package/src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx +9 -0
  41. package/src/components/BlockItemWrapper/Toolbar/helpers.ts +33 -0
  42. package/src/components/BlockItemWrapper/Toolbar/index.ts +4 -0
  43. package/src/components/BlockItemWrapper/Toolbar/types.ts +38 -0
  44. package/src/components/BlockItemWrapper/index.ts +1 -0
  45. package/src/components/BlockItemWrapper/types.ts +11 -34
  46. package/src/hooks/{useAttachments.spec.ts → useAttachments.spec.tsx} +55 -4
  47. package/src/hooks/useAttachments.tsx +95 -0
  48. package/dist/components/BlockItemWrapper/Toolbar.es.js +0 -117
  49. package/dist/components/BlockItemWrapper/Toolbar.es.js.map +0 -1
  50. package/src/components/BlockItemWrapper/Toolbar.tsx +0 -133
  51. package/src/hooks/useAttachments.ts +0 -46
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ import type { AppBridgeTheme } from '@frontify/app-bridge';
6
6
  import { Asset } from '@frontify/app-bridge';
7
7
  import type { AssetInputBlock as AssetInputBlock_2 } from '@frontify/sidebar-settings';
8
8
  import type { BaseBlock as BaseBlock_2 } from '@frontify/sidebar-settings';
9
+ import { BlockContext } from '@frontify/app-bridge';
10
+ import { BlockState } from '@frontify/app-bridge';
9
11
  import type { Bundle as Bundle_2 } from '@frontify/sidebar-settings';
10
12
  import { ButtonSize } from '@frontify/fondue';
11
13
  import { CheckboxState } from '@frontify/fondue';
@@ -41,7 +43,7 @@ import { PluginComposer } from '@frontify/fondue';
41
43
  import { PluginProps } from '@frontify/fondue';
42
44
  import { RangeBeforeOptions } from '@udecode/plate';
43
45
  import { ReactElement } from 'react';
44
- import type { ReactNode } from 'react';
46
+ import { ReactNode } from 'react';
45
47
  import type { SectionHeadingBlock as SectionHeadingBlock_2 } from '@frontify/sidebar-settings';
46
48
  import type { SegmentedControlsBlock as SegmentedControlsBlock_2 } from '@frontify/sidebar-settings';
47
49
  import { SensorDescriptor } from '@dnd-kit/core';
@@ -50,6 +52,7 @@ import type { SettingBlock as SettingBlock_2 } from '@frontify/sidebar-settings'
50
52
  import type { SimpleSettingBlock as SimpleSettingBlock_2 } from '@frontify/sidebar-settings';
51
53
  import type { SwitchBlock as SwitchBlock_2 } from '@frontify/sidebar-settings';
52
54
  import type { TemplateInputBlock as TemplateInputBlock_2 } from '@frontify/sidebar-settings';
55
+ import { TemplateLegacy } from '@frontify/app-bridge';
53
56
  import type { TextareaBlock as TextareaBlock_2 } from '@frontify/sidebar-settings';
54
57
  import { TextStyleRenderElementProps } from '@frontify/fondue';
55
58
  import { TLinkElement } from '@udecode/plate';
@@ -75,7 +78,7 @@ export declare type AttachmentItemProps = SortableAttachmentItemProps & {
75
78
  isOverlay?: boolean;
76
79
  };
77
80
 
78
- export declare const Attachments: ({ items, onDelete, onReplaceWithBrowse, onReplaceWithUpload, onBrowse, onUpload, onSorted, appBridge, }: AttachmentsProps) => JSX_2.Element | null;
81
+ export declare const Attachments: ({ items, onDelete, onReplaceWithBrowse, onReplaceWithUpload, onBrowse, onUpload, onSorted, appBridge, triggerComponent: TriggerComponent, isOpen, onOpenChange, }: AttachmentsProps) => JSX_2.Element | null;
79
82
 
80
83
  export declare type AttachmentsProps = {
81
84
  items?: Asset[];
@@ -86,6 +89,24 @@ export declare type AttachmentsProps = {
86
89
  onUpload: (uploadedAttachments: Asset[]) => Promise<void>;
87
90
  onBrowse: (browserAttachments: Asset[]) => void;
88
91
  onSorted: (sortedAttachments: Asset[]) => void;
92
+ triggerComponent?: (props: AttachmentsTriggerProps) => JSX.Element;
93
+ } & ({
94
+ isOpen?: never;
95
+ onOpenChange?: never;
96
+ } | {
97
+ isOpen: boolean;
98
+ onOpenChange: (isOpen: boolean) => void;
99
+ });
100
+
101
+ export declare const AttachmentsProvider: ({ appBridge, children, assetId, }: {
102
+ appBridge: AppBridgeBlock;
103
+ children: ReactNode;
104
+ assetId: string;
105
+ }) => JSX_2.Element;
106
+
107
+ export declare type AttachmentsTriggerProps = {
108
+ children: ReactNode;
109
+ isFlyoutOpen: boolean;
89
110
  };
90
111
 
91
112
  /**
@@ -168,7 +189,7 @@ export declare type BlockInjectButtonProps = {
168
189
  verticalLayout?: boolean;
169
190
  };
170
191
 
171
- export declare const BlockItemWrapper: ({ children, toolbarFlyoutItems, toolbarItems, shouldHideWrapper, shouldHideComponent, isDragging, shouldFillContainer, outlineOffset, shouldBeShown, }: BlockItemWrapperProps) => ReactElement;
192
+ export declare const BlockItemWrapper: ({ children, toolbarFlyoutItems, toolbarItems, shouldHideWrapper, shouldHideComponent, isDragging, shouldFillContainer, outlineOffset, shouldBeShown, showAttachments, }: BlockItemWrapperProps) => ReactElement;
172
193
 
173
194
  export declare type BlockItemWrapperProps = {
174
195
  children: ReactNode;
@@ -180,6 +201,12 @@ export declare type BlockItemWrapperProps = {
180
201
  shouldFillContainer?: boolean;
181
202
  outlineOffset?: number;
182
203
  shouldBeShown?: boolean;
204
+ /**
205
+ * When set to true the BlockItemWrapper must be a child of a {@link AttachmentsProvider} component,
206
+ * or the block must be wrapped with a {@link withAttachmentsProvider} HOC.
207
+ * @default false
208
+ */
209
+ showAttachments?: boolean;
183
210
  };
184
211
 
185
212
  export declare type BlockProps = {
@@ -839,6 +866,7 @@ export declare type SortableAttachmentItemProps = {
839
866
  isLoading?: boolean;
840
867
  onReplaceWithBrowse: () => void;
841
868
  onReplaceWithUpload: (uploadedAsset: Asset) => void;
869
+ onDownload?: () => Promise<void>;
842
870
  };
843
871
 
844
872
  export declare const submitFloatingButton: <V extends Value>(editor: PlateEditor<V>) => true | undefined;
@@ -907,15 +935,24 @@ export declare const toHex8String: (color: Color) => string;
907
935
  */
908
936
  export declare const toHexString: (color: Color) => string;
909
937
 
938
+ export declare const Toolbar: ({ items, flyoutMenu, attachments, isDragging }: ToolbarProps) => JSX_2.Element;
939
+
940
+ export declare type ToolbarFlyoutState = {
941
+ isOpen: boolean;
942
+ onOpenChange: (isOpen: boolean) => void;
943
+ };
944
+
910
945
  export declare type ToolbarItem = DraghandleToolbarItem | ButtonToolbarItem;
911
946
 
912
947
  export declare type ToolbarProps = {
913
948
  items: ToolbarItem[];
914
- flyoutItems: FlyoutToolbarItem[][];
915
- isFlyoutOpen: boolean;
916
- setIsFlyoutOpen: (isOpen: boolean) => void;
949
+ flyoutMenu: ToolbarFlyoutState & {
950
+ items: FlyoutToolbarItem[][];
951
+ };
952
+ attachments: ToolbarFlyoutState & {
953
+ isEnabled: boolean;
954
+ };
917
955
  isDragging?: boolean;
918
- isFlyoutDisabled?: boolean;
919
956
  };
920
957
 
921
958
  /**
@@ -988,17 +1025,67 @@ export declare type UpsertButtonOptions<V extends Value = Value> = CreateButtonN
988
1025
  export declare const upsertButtonText: <V extends Value>(editor: PlateEditor<V>, { text }: UpsertButtonOptions<V>) => void;
989
1026
 
990
1027
  export declare const useAttachments: (appBridge: AppBridgeBlock, assetId: string) => {
991
- onAddAttachments: (newAssets: Asset[]) => Promise<void>;
1028
+ onAttachmentsAdd: (newAssets: Asset[]) => Promise<void>;
992
1029
  onAttachmentDelete: (assetToDelete: Asset) => Promise<void>;
993
1030
  onAttachmentReplace: (attachmentToReplace: Asset, newAsset: Asset) => Promise<void>;
994
1031
  onAttachmentsSorted: (assets: Asset[]) => Promise<void>;
995
1032
  attachments: Asset[];
1033
+ appBridge: AppBridgeBlock<BlockState, BlockContext, {
1034
+ assetsChosen: {
1035
+ assets: Asset[];
1036
+ };
1037
+ templateChosen: {
1038
+ template: TemplateLegacy;
1039
+ };
1040
+ "State.settings": [Record<string, unknown>, Record<string, unknown>];
1041
+ "State.assets": [Record<string, unknown>, Record<string, unknown>];
1042
+ "State.templates": [Record<string, unknown>, Record<string, unknown>];
1043
+ "State.*": [BlockState, BlockState];
1044
+ "Context.portalId": [number, number];
1045
+ "Context.blockId": [number, number];
1046
+ "Context.sectionId"?: [number | undefined, number | undefined] | undefined;
1047
+ "Context.*": [BlockContext, BlockContext];
1048
+ }>;
1049
+ };
1050
+
1051
+ export declare const useAttachmentsContext: () => {
1052
+ onAttachmentsAdd: (newAssets: Asset[]) => Promise<void>;
1053
+ onAttachmentDelete: (assetToDelete: Asset) => Promise<void>;
1054
+ onAttachmentReplace: (attachmentToReplace: Asset, newAsset: Asset) => Promise<void>;
1055
+ onAttachmentsSorted: (assets: Asset[]) => Promise<void>;
1056
+ attachments: Asset[];
1057
+ appBridge: AppBridgeBlock<BlockState, BlockContext, {
1058
+ assetsChosen: {
1059
+ assets: Asset[];
1060
+ };
1061
+ templateChosen: {
1062
+ template: TemplateLegacy;
1063
+ };
1064
+ "State.settings": [Record<string, unknown>, Record<string, unknown>];
1065
+ "State.assets": [Record<string, unknown>, Record<string, unknown>];
1066
+ "State.templates": [Record<string, unknown>, Record<string, unknown>];
1067
+ "State.*": [BlockState, BlockState];
1068
+ "Context.portalId": [number, number];
1069
+ "Context.blockId": [number, number];
1070
+ "Context.sectionId"?: [number | undefined, number | undefined] | undefined;
1071
+ "Context.*": [BlockContext, BlockContext];
1072
+ }>;
996
1073
  };
997
1074
 
998
1075
  export declare const useDndSensors: (columnGap?: number, rowGap?: number) => SensorDescriptor<SensorOptions>[];
999
1076
 
1000
1077
  export declare type ValueOrPromisedValue<T> = ValueOrPromisedValue_2<AppBridgeBlock, T>;
1001
1078
 
1079
+ /**
1080
+ * Block-level HOC for cases when there is only one attachment asset field related to the block.
1081
+ * Recommended for most cases.
1082
+ * If finer control is required over attachments, use {@link AttachmentsProvider} component.
1083
+ */
1084
+ export declare const withAttachmentsProvider: <T extends BlockProps>(Component: (props: T) => ReactNode, assetId: string) => {
1085
+ (props: T): JSX_2.Element;
1086
+ displayName: string;
1087
+ };
1088
+
1002
1089
  /**
1003
1090
  * Insert space after a url to wrap a button.
1004
1091
  * Lookup from the block start to the cursor to check if there is an url.
package/dist/index.es.js CHANGED
@@ -2,191 +2,196 @@ import "./styles.css.es.js";
2
2
  export * from "@frontify/sidebar-settings";
3
3
  import { BlockInjectButton as g } from "./components/BlockInjectButton/BlockInjectButton.es.js";
4
4
  import { BlockItemWrapper as l } from "./components/BlockItemWrapper/BlockItemWrapper.es.js";
5
- import { DEFAULT_DRAGGING_TOOLTIP as u, DEFAULT_DRAG_TOOLTIP as f } from "./components/BlockItemWrapper/constants.es.js";
6
- import { Attachments as s } from "./components/Attachments/Attachments.es.js";
7
- import { DownloadButton as P } from "./components/DownloadButton/DownloadButton.es.js";
8
- import { RichTextEditor as c } from "./components/RichTextEditor/RichTextEditor.es.js";
9
- import { LinkPlugin as T, createLinkPlugin as E } from "./components/RichTextEditor/plugins/LinkPlugin/index.es.js";
10
- import { BUTTON_PLUGIN as L, ButtonPlugin as R, ELEMENT_BUTTON as h, createButtonPlugin as A } from "./components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js";
11
- import { withButton as C } from "./components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js";
12
- import { insertButton as F } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js";
13
- import { submitFloatingButton as b } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js";
14
- import { unwrapButton as D } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js";
15
- import { upsertButton as N } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js";
16
- import { upsertButtonText as _ } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js";
17
- import { wrapButton as v } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js";
18
- import { getUrlFromEditor as W } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js";
19
- import { createButtonNode as Q } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js";
20
- import { triggerFloatingButton as q } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js";
21
- import { triggerFloatingButtonEdit as J } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js";
22
- import { triggerFloatingButtonInsert as Y } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js";
23
- import { BlockButtonStyles as $ } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js";
24
- import { Custom1Plugin as rt } from "./components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js";
25
- import { Custom2Plugin as ot } from "./components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js";
5
+ import { Toolbar as u } from "./components/BlockItemWrapper/Toolbar/Toolbar.es.js";
6
+ import { DEFAULT_DRAGGING_TOOLTIP as s, DEFAULT_DRAG_TOOLTIP as d } from "./components/BlockItemWrapper/constants.es.js";
7
+ import { Attachments as P } from "./components/Attachments/Attachments.es.js";
8
+ import { DownloadButton as B } from "./components/DownloadButton/DownloadButton.es.js";
9
+ import { RichTextEditor as T } from "./components/RichTextEditor/RichTextEditor.es.js";
10
+ import { LinkPlugin as E, createLinkPlugin as k } from "./components/RichTextEditor/plugins/LinkPlugin/index.es.js";
11
+ import { BUTTON_PLUGIN as L, ButtonPlugin as R, ELEMENT_BUTTON as C, createButtonPlugin as I } from "./components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js";
12
+ import { withButton as F } from "./components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js";
13
+ import { insertButton as U } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js";
14
+ import { submitFloatingButton as D } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js";
15
+ import { unwrapButton as N } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js";
16
+ import { upsertButton as _ } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js";
17
+ import { upsertButtonText as v } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js";
18
+ import { wrapButton as W } from "./components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js";
19
+ import { getUrlFromEditor as Q } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js";
20
+ import { createButtonNode as q } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js";
21
+ import { triggerFloatingButton as J } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js";
22
+ import { triggerFloatingButtonEdit as Y } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js";
23
+ import { triggerFloatingButtonInsert as $ } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js";
24
+ import { BlockButtonStyles as rt } from "./components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js";
25
+ import { Custom1Plugin as ot } from "./components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js";
26
+ import { Custom2Plugin as it } from "./components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js";
26
27
  import { Custom3Plugin as pt } from "./components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js";
27
- import { Heading1Plugin as at } from "./components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js";
28
- import { Heading2Plugin as mt } from "./components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js";
29
- import { Heading3Plugin as xt } from "./components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js";
30
- import { Heading4Plugin as ft } from "./components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js";
31
- import { ImageCaptionPlugin as st } from "./components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js";
32
- import { ImageTitlePlugin as Pt } from "./components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js";
33
- import { PARAGRAPH_CLASSES as ct, ParagraphMarkupElement as yt, ParagraphMarkupElementNode as Tt, ParagraphPlugin as Et, createParagraphPlugin as kt } from "./components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js";
34
- import { QuoteMarkupElementNode as Rt, QuotePlugin as ht, createQuotePlugin as At } from "./components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js";
35
- import { AllTextStylePlugins as Ct, AllTextStyles as Mt, TextStylePluginsWithoutImage as Ft, TextStylesWithoutImage as Ut } from "./components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js";
36
- import { BlockStyles as Gt, TextStyles as Dt } from "./components/RichTextEditor/plugins/styles.es.js";
37
- import { getDefaultPluginsWithLinkChooser as Nt } from "./components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js";
38
- import { THEME_PREFIX as _t } from "./components/RichTextEditor/constants.es.js";
39
- import { LinkSelector as vt } from "./components/Link/LinkSelector/LinkSelector.es.js";
40
- import { LinkInput as Wt } from "./components/Link/LinkInput.es.js";
41
- import { getLegacyUrl as Qt, getLinkFromEditor as Xt, getUrl as qt, getUrlFromLinkOrLegacyLink as zt } from "./components/Link/utils/getUrl.es.js";
42
- import { relativeUrlRegex as Kt } from "./components/Link/utils/relativeUrlRegex.es.js";
43
- import { isValidUrl as Zt, isValidUrlOrEmpty as $t } from "./components/Link/utils/url.es.js";
44
- import { convertToRteValue as rr } from "./helpers/convertToRichTextValue.es.js";
45
- import { customCoordinatesGetterFactory as or } from "./helpers/customCoordinatesGetterFactory.es.js";
28
+ import { Heading1Plugin as mt } from "./components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js";
29
+ import { Heading2Plugin as xt } from "./components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js";
30
+ import { Heading3Plugin as ft } from "./components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js";
31
+ import { Heading4Plugin as dt } from "./components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js";
32
+ import { ImageCaptionPlugin as Pt } from "./components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js";
33
+ import { ImageTitlePlugin as Bt } from "./components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js";
34
+ import { PARAGRAPH_CLASSES as Tt, ParagraphMarkupElement as ht, ParagraphMarkupElementNode as Et, ParagraphPlugin as kt, createParagraphPlugin as At } from "./components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js";
35
+ import { QuoteMarkupElementNode as Rt, QuotePlugin as Ct, createQuotePlugin as It } from "./components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js";
36
+ import { AllTextStylePlugins as Ft, AllTextStyles as bt, TextStylePluginsWithoutImage as Ut, TextStylesWithoutImage as Gt } from "./components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js";
37
+ import { BlockStyles as Ht, TextStyles as Nt } from "./components/RichTextEditor/plugins/styles.es.js";
38
+ import { getDefaultPluginsWithLinkChooser as _t } from "./components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js";
39
+ import { THEME_PREFIX as vt } from "./components/RichTextEditor/constants.es.js";
40
+ import { LinkSelector as Wt } from "./components/Link/LinkSelector/LinkSelector.es.js";
41
+ import { LinkInput as Qt } from "./components/Link/LinkInput.es.js";
42
+ import { getLegacyUrl as qt, getLinkFromEditor as zt, getUrl as Jt, getUrlFromLinkOrLegacyLink as Kt } from "./components/Link/utils/getUrl.es.js";
43
+ import { relativeUrlRegex as Zt } from "./components/Link/utils/relativeUrlRegex.es.js";
44
+ import { isValidUrl as tr, isValidUrlOrEmpty as rr } from "./components/Link/utils/url.es.js";
45
+ import { convertToRteValue as or } from "./helpers/convertToRichTextValue.es.js";
46
+ import { customCoordinatesGetterFactory as ir } from "./helpers/customCoordinatesGetterFactory.es.js";
46
47
  import { hasRichTextValue as pr } from "./helpers/hasRichTextValue.es.js";
47
- import { isDownloadable as ar } from "./helpers/isDownloadable.es.js";
48
- import { mapAppBridgeColorPaletteToFonduePalette as mr, mapAppBridgeColorPalettesToFonduePalettes as lr } from "./helpers/mapColorPalettes.es.js";
49
- import { addHttps as ur } from "./helpers/addHttps.es.js";
50
- import { useAttachments as dr } from "./hooks/useAttachments.es.js";
51
- import { useDndSensors as Sr } from "./hooks/useDndSensors.es.js";
52
- import { getBackgroundSettings as Br } from "./settings/background.es.js";
53
- import { getBorderSettings as yr } from "./settings/border.es.js";
54
- import { getBorderRadiusSettings as Er, getBorderRadiusSlider as kr } from "./settings/borderRadius.es.js";
55
- import { getExtendedBorderRadiusSettings as Rr } from "./settings/borderRadiusExtended.es.js";
56
- import { getGutterSettings as Ar } from "./settings/gutter.es.js";
57
- import { getMarginSettings as Cr, getMarginSlider as Mr } from "./settings/margin.es.js";
58
- import { getMarginExtendedSettings as Ur } from "./settings/marginExtended.es.js";
59
- import { getPaddingSettings as Gr, getPaddingSlider as Dr } from "./settings/padding.es.js";
60
- import { getPaddingExtendedSettings as Nr } from "./settings/paddingExtended.es.js";
61
- import { BorderStyle as _r, GutterSpacing as wr, Margin as vr, Padding as Vr, Radius as Wr, Security as jr, borderStyleMap as Qr, gutterSpacingStyleMap as Xr, marginStyleMap as qr, paddingStyleMap as zr, radiusStyleMap as Jr } from "./settings/types.es.js";
62
- import { getSecurityDownloadableSetting as Yr, getSecurityGlobalControlId as Zr } from "./settings/securityDownloadable.es.js";
63
- import { getSecurityGlobalControlSetting as te } from "./settings/securityGlobalControl.es.js";
64
- import { isDark as ee } from "./utilities/color/isDark.es.js";
65
- import { toHex8String as ne } from "./utilities/color/toHex8String.es.js";
66
- import { toHexString as ie } from "./utilities/color/toHexString.es.js";
67
- import { toRgbaString as ge } from "./utilities/color/toRgbaString.es.js";
68
- import { setAlpha as le } from "./utilities/color/setAlpha.es.js";
69
- import { toColorObject as ue } from "./utilities/color/toColorObject.es.js";
70
- import { getReadableColor as de } from "./utilities/color/getReadableColor.es.js";
71
- import { toShortRgba as Se } from "./utilities/color/toShortRgba.es.js";
72
- import { moveItemInArray as Be } from "./utilities/moveItemInArray.es.js";
73
- import { getBackgroundColorStyles as ye } from "./utilities/react/getBackgroundColorStyles.es.js";
74
- import { getBorderStyles as Ee } from "./utilities/react/getBorderStyles.es.js";
75
- import { getRadiusStyles as Le } from "./utilities/react/getRadiusStyles.es.js";
76
- import { joinClassNames as he } from "./utilities/react/joinClassNames.es.js";
48
+ import { isDownloadable as mr } from "./helpers/isDownloadable.es.js";
49
+ import { mapAppBridgeColorPaletteToFonduePalette as xr, mapAppBridgeColorPalettesToFonduePalettes as ur } from "./helpers/mapColorPalettes.es.js";
50
+ import { addHttps as sr } from "./helpers/addHttps.es.js";
51
+ import { AttachmentsProvider as Sr, useAttachments as Pr, useAttachmentsContext as cr, withAttachmentsProvider as Br } from "./hooks/useAttachments.es.js";
52
+ import { useDndSensors as Tr } from "./hooks/useDndSensors.es.js";
53
+ import { getBackgroundSettings as Er } from "./settings/background.es.js";
54
+ import { getBorderSettings as Ar } from "./settings/border.es.js";
55
+ import { getBorderRadiusSettings as Rr, getBorderRadiusSlider as Cr } from "./settings/borderRadius.es.js";
56
+ import { getExtendedBorderRadiusSettings as Mr } from "./settings/borderRadiusExtended.es.js";
57
+ import { getGutterSettings as br } from "./settings/gutter.es.js";
58
+ import { getMarginSettings as Gr, getMarginSlider as Dr } from "./settings/margin.es.js";
59
+ import { getMarginExtendedSettings as Nr } from "./settings/marginExtended.es.js";
60
+ import { getPaddingSettings as _r, getPaddingSlider as wr } from "./settings/padding.es.js";
61
+ import { getPaddingExtendedSettings as Vr } from "./settings/paddingExtended.es.js";
62
+ import { BorderStyle as jr, GutterSpacing as Qr, Margin as Xr, Padding as qr, Radius as zr, Security as Jr, borderStyleMap as Kr, gutterSpacingStyleMap as Yr, marginStyleMap as Zr, paddingStyleMap as $r, radiusStyleMap as te } from "./settings/types.es.js";
63
+ import { getSecurityDownloadableSetting as ee, getSecurityGlobalControlId as oe } from "./settings/securityDownloadable.es.js";
64
+ import { getSecurityGlobalControlSetting as ie } from "./settings/securityGlobalControl.es.js";
65
+ import { isDark as pe } from "./utilities/color/isDark.es.js";
66
+ import { toHex8String as me } from "./utilities/color/toHex8String.es.js";
67
+ import { toHexString as xe } from "./utilities/color/toHexString.es.js";
68
+ import { toRgbaString as fe } from "./utilities/color/toRgbaString.es.js";
69
+ import { setAlpha as de } from "./utilities/color/setAlpha.es.js";
70
+ import { toColorObject as Pe } from "./utilities/color/toColorObject.es.js";
71
+ import { getReadableColor as Be } from "./utilities/color/getReadableColor.es.js";
72
+ import { toShortRgba as Te } from "./utilities/color/toShortRgba.es.js";
73
+ import { moveItemInArray as Ee } from "./utilities/moveItemInArray.es.js";
74
+ import { getBackgroundColorStyles as Ae } from "./utilities/react/getBackgroundColorStyles.es.js";
75
+ import { getBorderStyles as Re } from "./utilities/react/getBorderStyles.es.js";
76
+ import { getRadiusStyles as Ie } from "./utilities/react/getRadiusStyles.es.js";
77
+ import { joinClassNames as Fe } from "./utilities/react/joinClassNames.es.js";
77
78
  var r = /* @__PURE__ */ ((t) => (t.Main = "main", t.Basics = "basics", t.Layout = "layout", t.Style = "style", t.Security = "security", t.Targets = "targets", t))(r || {});
78
79
  const o = (t) => t, n = (t) => t;
79
80
  export {
80
- Ct as AllTextStylePlugins,
81
- Mt as AllTextStyles,
82
- s as Attachments,
81
+ Ft as AllTextStylePlugins,
82
+ bt as AllTextStyles,
83
+ P as Attachments,
84
+ Sr as AttachmentsProvider,
83
85
  L as BUTTON_PLUGIN,
84
- $ as BlockButtonStyles,
86
+ rt as BlockButtonStyles,
85
87
  g as BlockInjectButton,
86
88
  l as BlockItemWrapper,
87
- Gt as BlockStyles,
88
- _r as BorderStyle,
89
+ Ht as BlockStyles,
90
+ jr as BorderStyle,
89
91
  R as ButtonPlugin,
90
- rt as Custom1Plugin,
91
- ot as Custom2Plugin,
92
+ ot as Custom1Plugin,
93
+ it as Custom2Plugin,
92
94
  pt as Custom3Plugin,
93
- u as DEFAULT_DRAGGING_TOOLTIP,
94
- f as DEFAULT_DRAG_TOOLTIP,
95
- P as DownloadButton,
96
- h as ELEMENT_BUTTON,
97
- wr as GutterSpacing,
98
- at as Heading1Plugin,
99
- mt as Heading2Plugin,
100
- xt as Heading3Plugin,
101
- ft as Heading4Plugin,
102
- st as ImageCaptionPlugin,
103
- Pt as ImageTitlePlugin,
104
- Wt as LinkInput,
105
- T as LinkPlugin,
106
- vt as LinkSelector,
107
- vr as Margin,
108
- ct as PARAGRAPH_CLASSES,
109
- Vr as Padding,
110
- yt as ParagraphMarkupElement,
111
- Tt as ParagraphMarkupElementNode,
112
- Et as ParagraphPlugin,
95
+ s as DEFAULT_DRAGGING_TOOLTIP,
96
+ d as DEFAULT_DRAG_TOOLTIP,
97
+ B as DownloadButton,
98
+ C as ELEMENT_BUTTON,
99
+ Qr as GutterSpacing,
100
+ mt as Heading1Plugin,
101
+ xt as Heading2Plugin,
102
+ ft as Heading3Plugin,
103
+ dt as Heading4Plugin,
104
+ Pt as ImageCaptionPlugin,
105
+ Bt as ImageTitlePlugin,
106
+ Qt as LinkInput,
107
+ E as LinkPlugin,
108
+ Wt as LinkSelector,
109
+ Xr as Margin,
110
+ Tt as PARAGRAPH_CLASSES,
111
+ qr as Padding,
112
+ ht as ParagraphMarkupElement,
113
+ Et as ParagraphMarkupElementNode,
114
+ kt as ParagraphPlugin,
113
115
  Rt as QuoteMarkupElementNode,
114
- ht as QuotePlugin,
115
- Wr as Radius,
116
- c as RichTextEditor,
116
+ Ct as QuotePlugin,
117
+ zr as Radius,
118
+ T as RichTextEditor,
117
119
  r as Sections,
118
- jr as Security,
119
- _t as THEME_PREFIX,
120
- Ft as TextStylePluginsWithoutImage,
121
- Dt as TextStyles,
122
- Ut as TextStylesWithoutImage,
123
- ur as addHttps,
124
- Qr as borderStyleMap,
125
- rr as convertToRteValue,
126
- Q as createButtonNode,
127
- A as createButtonPlugin,
128
- E as createLinkPlugin,
129
- kt as createParagraphPlugin,
130
- At as createQuotePlugin,
131
- or as customCoordinatesGetterFactory,
120
+ Jr as Security,
121
+ vt as THEME_PREFIX,
122
+ Ut as TextStylePluginsWithoutImage,
123
+ Nt as TextStyles,
124
+ Gt as TextStylesWithoutImage,
125
+ u as Toolbar,
126
+ sr as addHttps,
127
+ Kr as borderStyleMap,
128
+ or as convertToRteValue,
129
+ q as createButtonNode,
130
+ I as createButtonPlugin,
131
+ k as createLinkPlugin,
132
+ At as createParagraphPlugin,
133
+ It as createQuotePlugin,
134
+ ir as customCoordinatesGetterFactory,
132
135
  o as defineBlock,
133
136
  n as defineSettings,
134
- ye as getBackgroundColorStyles,
135
- Br as getBackgroundSettings,
136
- Er as getBorderRadiusSettings,
137
- kr as getBorderRadiusSlider,
138
- yr as getBorderSettings,
139
- Ee as getBorderStyles,
140
- Nt as getDefaultPluginsWithLinkChooser,
141
- Rr as getExtendedBorderRadiusSettings,
142
- Ar as getGutterSettings,
143
- Qt as getLegacyUrl,
144
- Xt as getLinkFromEditor,
145
- Ur as getMarginExtendedSettings,
146
- Cr as getMarginSettings,
147
- Mr as getMarginSlider,
148
- Nr as getPaddingExtendedSettings,
149
- Gr as getPaddingSettings,
150
- Dr as getPaddingSlider,
151
- Le as getRadiusStyles,
152
- de as getReadableColor,
153
- Yr as getSecurityDownloadableSetting,
154
- Zr as getSecurityGlobalControlId,
155
- te as getSecurityGlobalControlSetting,
156
- qt as getUrl,
157
- W as getUrlFromEditor,
158
- zt as getUrlFromLinkOrLegacyLink,
159
- Xr as gutterSpacingStyleMap,
137
+ Ae as getBackgroundColorStyles,
138
+ Er as getBackgroundSettings,
139
+ Rr as getBorderRadiusSettings,
140
+ Cr as getBorderRadiusSlider,
141
+ Ar as getBorderSettings,
142
+ Re as getBorderStyles,
143
+ _t as getDefaultPluginsWithLinkChooser,
144
+ Mr as getExtendedBorderRadiusSettings,
145
+ br as getGutterSettings,
146
+ qt as getLegacyUrl,
147
+ zt as getLinkFromEditor,
148
+ Nr as getMarginExtendedSettings,
149
+ Gr as getMarginSettings,
150
+ Dr as getMarginSlider,
151
+ Vr as getPaddingExtendedSettings,
152
+ _r as getPaddingSettings,
153
+ wr as getPaddingSlider,
154
+ Ie as getRadiusStyles,
155
+ Be as getReadableColor,
156
+ ee as getSecurityDownloadableSetting,
157
+ oe as getSecurityGlobalControlId,
158
+ ie as getSecurityGlobalControlSetting,
159
+ Jt as getUrl,
160
+ Q as getUrlFromEditor,
161
+ Kt as getUrlFromLinkOrLegacyLink,
162
+ Yr as gutterSpacingStyleMap,
160
163
  pr as hasRichTextValue,
161
- F as insertButton,
162
- ee as isDark,
163
- ar as isDownloadable,
164
- Zt as isValidUrl,
165
- $t as isValidUrlOrEmpty,
166
- he as joinClassNames,
167
- mr as mapAppBridgeColorPaletteToFonduePalette,
168
- lr as mapAppBridgeColorPalettesToFonduePalettes,
169
- qr as marginStyleMap,
170
- Be as moveItemInArray,
171
- zr as paddingStyleMap,
172
- Jr as radiusStyleMap,
173
- Kt as relativeUrlRegex,
174
- le as setAlpha,
175
- b as submitFloatingButton,
176
- ue as toColorObject,
177
- ne as toHex8String,
178
- ie as toHexString,
179
- ge as toRgbaString,
180
- Se as toShortRgba,
181
- q as triggerFloatingButton,
182
- J as triggerFloatingButtonEdit,
183
- Y as triggerFloatingButtonInsert,
184
- D as unwrapButton,
185
- N as upsertButton,
186
- _ as upsertButtonText,
187
- dr as useAttachments,
188
- Sr as useDndSensors,
189
- C as withButton,
190
- v as wrapButton
164
+ U as insertButton,
165
+ pe as isDark,
166
+ mr as isDownloadable,
167
+ tr as isValidUrl,
168
+ rr as isValidUrlOrEmpty,
169
+ Fe as joinClassNames,
170
+ xr as mapAppBridgeColorPaletteToFonduePalette,
171
+ ur as mapAppBridgeColorPalettesToFonduePalettes,
172
+ Zr as marginStyleMap,
173
+ Ee as moveItemInArray,
174
+ $r as paddingStyleMap,
175
+ te as radiusStyleMap,
176
+ Zt as relativeUrlRegex,
177
+ de as setAlpha,
178
+ D as submitFloatingButton,
179
+ Pe as toColorObject,
180
+ me as toHex8String,
181
+ xe as toHexString,
182
+ fe as toRgbaString,
183
+ Te as toShortRgba,
184
+ J as triggerFloatingButton,
185
+ Y as triggerFloatingButtonEdit,
186
+ $ as triggerFloatingButtonInsert,
187
+ N as unwrapButton,
188
+ _ as upsertButton,
189
+ v as upsertButtonText,
190
+ Pr as useAttachments,
191
+ cr as useAttachmentsContext,
192
+ Tr as useDndSensors,
193
+ Br as withAttachmentsProvider,
194
+ F as withButton,
195
+ W as wrapButton
191
196
  };
192
197
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport './styles.css';\n\nimport type { FC } from 'react';\nimport type { AppBridgeBlock } from '@frontify/app-bridge';\nimport type {\n AssetInputBlock as AssetInputBlockSidebarSettings,\n BaseBlock as BaseBlockSidebarSettings,\n Bundle as BundleSidebarSettings,\n ChecklistBlock as ChecklistBlockSidebarSettings,\n ChoicesType as ChoicesTypeSidebarSettings,\n ColorInputBlock as ColorInputBlockSidebarSettings,\n DropdownBlock as DropdownBlockSidebarSettings,\n DynamicSettingBlock as DynamicSettingBlockSidebarSettings,\n DynamicSupportedBlock as DynamicSupportedBlockSidebarSettings,\n FontInputBlock as FontInputBlockSidebarSettings,\n InputBlock as InputBlockSidebarSettings,\n LegacyAssetInputBlock as LegacyAssetInputBlockSidebarSettings,\n LinkBlock as LinkBlockSidebarSettings,\n LinkChooserBlock as LinkChooserBlockSidebarSettings,\n MultiInputBlock as MultiInputBlockSidebarSettings,\n NotificationBlock as NotificationBlockSidebarSettings,\n SectionHeadingBlock as SectionHeadingBlockSidebarSettings,\n SegmentedControlsBlock as SegmentedControlsBlockSidebarSettings,\n SettingBlock as SettingBlockSidebarSettings,\n SimpleSettingBlock as SimpleSettingBlockSidebarSettings,\n SwitchBlock as SwitchBlockSidebarSettings,\n TemplateInputBlock as TemplateInputBlockSidebarSettings,\n TextareaBlock as TextareaBlockSidebarSettings,\n ValueOrPromisedValue as ValueOrPromisedValueSidebarSettings,\n} from '@frontify/sidebar-settings';\n\nexport * from '@frontify/sidebar-settings';\n\nexport type AssetInputBlock = AssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type BaseBlock<T = undefined> = BaseBlockSidebarSettings<AppBridgeBlock, T>;\nexport type Bundle = BundleSidebarSettings<AppBridgeBlock>;\nexport type ChecklistBlock = ChecklistBlockSidebarSettings<AppBridgeBlock>;\nexport type ChoicesType = ChoicesTypeSidebarSettings<AppBridgeBlock>;\nexport type ColorInputBlock = ColorInputBlockSidebarSettings<AppBridgeBlock>;\nexport type DropdownBlock = DropdownBlockSidebarSettings<AppBridgeBlock>;\nexport type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> =\n DynamicSettingBlockSidebarSettings<AppBridgeBlock, Block>;\nexport type DynamicSupportedBlock = DynamicSupportedBlockSidebarSettings<AppBridgeBlock>;\nexport type FontInputBlock = FontInputBlockSidebarSettings<AppBridgeBlock>;\nexport type InputBlock = InputBlockSidebarSettings<AppBridgeBlock>;\nexport type LegacyAssetInputBlock = LegacyAssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkBlock = LinkBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkChooserBlock = LinkChooserBlockSidebarSettings<AppBridgeBlock>;\nexport type MultiInputBlock = MultiInputBlockSidebarSettings<AppBridgeBlock>;\nexport type NotificationBlock = NotificationBlockSidebarSettings<AppBridgeBlock>;\nexport type SectionHeadingBlock = SectionHeadingBlockSidebarSettings<AppBridgeBlock>;\nexport type SegmentedControlsBlock = SegmentedControlsBlockSidebarSettings<AppBridgeBlock>;\nexport type SettingBlock = SettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SimpleSettingBlock = SimpleSettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SwitchBlock = SwitchBlockSidebarSettings<AppBridgeBlock>;\nexport type TemplateInputBlock = TemplateInputBlockSidebarSettings<AppBridgeBlock>;\nexport type TextareaBlock = TextareaBlockSidebarSettings<AppBridgeBlock>;\nexport type ValueOrPromisedValue<T> = ValueOrPromisedValueSidebarSettings<AppBridgeBlock, T>;\n\nexport enum Sections {\n Main = 'main',\n Basics = 'basics',\n Layout = 'layout',\n Style = 'style',\n Security = 'security',\n Targets = 'targets',\n}\n\nexport type BlockSettingsStructureExport = {\n [Sections.Main]?: SettingBlock[];\n [Sections.Basics]?: SettingBlock[];\n [Sections.Layout]?: SettingBlock[];\n [Sections.Style]?: SettingBlock[];\n [Sections.Security]?: SettingBlock[];\n} & { [customSectionName: string]: SettingBlock[] };\n\nexport type BlockProps = {\n /**\n * The Frontify App Bridge provides an interface to the Frontify app internals.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks/introducing-the-app-bridge}\n */\n appBridge: AppBridgeBlock;\n};\n\nexport type BlockConfigExport = {\n /**\n * Block component to render.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks}\n */\n block: FC<BlockProps>;\n /**\n * Contains the block settings and its structure.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-settings-1}\n */\n settings: ReturnType<typeof defineSettings>;\n /**\n * Block lifecycle hook ran before the block gets added in the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-creation}\n */\n onBlockCreated?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n /**\n * Block lifecycle hook ran before the block gets deleted from the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-deletion}\n */\n onBlockDeleted?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n};\n\n/**\n * Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.\n */\nexport const defineBlock = (config: BlockConfigExport): BlockConfigExport => config;\n\n/**\n * Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object\n * or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.\n */\nexport const defineSettings = <\n T extends\n | BlockSettingsStructureExport\n | (() => Promise<BlockSettingsStructureExport>)\n | (() => BlockSettingsStructureExport),\n>(\n settingsStructure: T,\n): T => settingsStructure;\n\nexport * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './settings';\nexport * from './utilities';\n"],"names":["Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DY,IAAAA,sBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,UAAU,WANFA,IAAAA,KAAA,CAAA,CAAA;AAyDC,MAAAC,IAAc,CAACC,MAAiDA,GAMhEC,IAAiB,CAM1BC,MACIA;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport './styles.css';\n\nimport type { FC } from 'react';\nimport type { AppBridgeBlock } from '@frontify/app-bridge';\nimport type {\n AssetInputBlock as AssetInputBlockSidebarSettings,\n BaseBlock as BaseBlockSidebarSettings,\n Bundle as BundleSidebarSettings,\n ChecklistBlock as ChecklistBlockSidebarSettings,\n ChoicesType as ChoicesTypeSidebarSettings,\n ColorInputBlock as ColorInputBlockSidebarSettings,\n DropdownBlock as DropdownBlockSidebarSettings,\n DynamicSettingBlock as DynamicSettingBlockSidebarSettings,\n DynamicSupportedBlock as DynamicSupportedBlockSidebarSettings,\n FontInputBlock as FontInputBlockSidebarSettings,\n InputBlock as InputBlockSidebarSettings,\n LegacyAssetInputBlock as LegacyAssetInputBlockSidebarSettings,\n LinkBlock as LinkBlockSidebarSettings,\n LinkChooserBlock as LinkChooserBlockSidebarSettings,\n MultiInputBlock as MultiInputBlockSidebarSettings,\n NotificationBlock as NotificationBlockSidebarSettings,\n SectionHeadingBlock as SectionHeadingBlockSidebarSettings,\n SegmentedControlsBlock as SegmentedControlsBlockSidebarSettings,\n SettingBlock as SettingBlockSidebarSettings,\n SimpleSettingBlock as SimpleSettingBlockSidebarSettings,\n SwitchBlock as SwitchBlockSidebarSettings,\n TemplateInputBlock as TemplateInputBlockSidebarSettings,\n TextareaBlock as TextareaBlockSidebarSettings,\n ValueOrPromisedValue as ValueOrPromisedValueSidebarSettings,\n} from '@frontify/sidebar-settings';\n\nexport * from '@frontify/sidebar-settings';\n\nexport type AssetInputBlock = AssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type BaseBlock<T = undefined> = BaseBlockSidebarSettings<AppBridgeBlock, T>;\nexport type Bundle = BundleSidebarSettings<AppBridgeBlock>;\nexport type ChecklistBlock = ChecklistBlockSidebarSettings<AppBridgeBlock>;\nexport type ChoicesType = ChoicesTypeSidebarSettings<AppBridgeBlock>;\nexport type ColorInputBlock = ColorInputBlockSidebarSettings<AppBridgeBlock>;\nexport type DropdownBlock = DropdownBlockSidebarSettings<AppBridgeBlock>;\nexport type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> =\n DynamicSettingBlockSidebarSettings<AppBridgeBlock, Block>;\nexport type DynamicSupportedBlock = DynamicSupportedBlockSidebarSettings<AppBridgeBlock>;\nexport type FontInputBlock = FontInputBlockSidebarSettings<AppBridgeBlock>;\nexport type InputBlock = InputBlockSidebarSettings<AppBridgeBlock>;\nexport type LegacyAssetInputBlock = LegacyAssetInputBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkBlock = LinkBlockSidebarSettings<AppBridgeBlock>;\nexport type LinkChooserBlock = LinkChooserBlockSidebarSettings<AppBridgeBlock>;\nexport type MultiInputBlock = MultiInputBlockSidebarSettings<AppBridgeBlock>;\nexport type NotificationBlock = NotificationBlockSidebarSettings<AppBridgeBlock>;\nexport type SectionHeadingBlock = SectionHeadingBlockSidebarSettings<AppBridgeBlock>;\nexport type SegmentedControlsBlock = SegmentedControlsBlockSidebarSettings<AppBridgeBlock>;\nexport type SettingBlock = SettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SimpleSettingBlock = SimpleSettingBlockSidebarSettings<AppBridgeBlock>;\nexport type SwitchBlock = SwitchBlockSidebarSettings<AppBridgeBlock>;\nexport type TemplateInputBlock = TemplateInputBlockSidebarSettings<AppBridgeBlock>;\nexport type TextareaBlock = TextareaBlockSidebarSettings<AppBridgeBlock>;\nexport type ValueOrPromisedValue<T> = ValueOrPromisedValueSidebarSettings<AppBridgeBlock, T>;\n\nexport enum Sections {\n Main = 'main',\n Basics = 'basics',\n Layout = 'layout',\n Style = 'style',\n Security = 'security',\n Targets = 'targets',\n}\n\nexport type BlockSettingsStructureExport = {\n [Sections.Main]?: SettingBlock[];\n [Sections.Basics]?: SettingBlock[];\n [Sections.Layout]?: SettingBlock[];\n [Sections.Style]?: SettingBlock[];\n [Sections.Security]?: SettingBlock[];\n} & { [customSectionName: string]: SettingBlock[] };\n\nexport type BlockProps = {\n /**\n * The Frontify App Bridge provides an interface to the Frontify app internals.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks/introducing-the-app-bridge}\n */\n appBridge: AppBridgeBlock;\n};\n\nexport type BlockConfigExport = {\n /**\n * Block component to render.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks}\n */\n block: FC<BlockProps>;\n /**\n * Contains the block settings and its structure.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-settings-1}\n */\n settings: ReturnType<typeof defineSettings>;\n /**\n * Block lifecycle hook ran before the block gets added in the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-creation}\n */\n onBlockCreated?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n /**\n * Block lifecycle hook ran before the block gets deleted from the Guideline.\n * The hook support both synchronous or asynchronous execution.\n * {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-deletion}\n */\n onBlockDeleted?:\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => void)\n | (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);\n};\n\n/**\n * Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.\n */\nexport const defineBlock = (config: BlockConfigExport): BlockConfigExport => config;\n\n/**\n * Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object\n * or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.\n */\nexport const defineSettings = <\n T extends\n | BlockSettingsStructureExport\n | (() => Promise<BlockSettingsStructureExport>)\n | (() => BlockSettingsStructureExport),\n>(\n settingsStructure: T,\n): T => settingsStructure;\n\nexport * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './settings';\nexport * from './utilities';\n"],"names":["Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DY,IAAAA,sBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,UAAU,WANFA,IAAAA,KAAA,CAAA,CAAA;AAyDC,MAAAC,IAAc,CAACC,MAAiDA,GAMhEC,IAAiB,CAM1BC,MACIA;"}