@frontify/guideline-blocks-settings 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/CHANGELOG.md +15 -0
- package/README.md +24 -5
- package/package.json +46 -10
- package/postcss.config.js +8 -0
- package/setupTests.ts +13 -0
- package/src/components/Attachments/AttachmentItem.tsx +257 -0
- package/src/components/Attachments/Attachments.spec.ct.tsx +151 -0
- package/src/components/Attachments/Attachments.tsx +221 -0
- package/src/components/Attachments/index.ts +4 -0
- package/src/components/Attachments/types.ts +30 -0
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +48 -0
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +212 -0
- package/src/components/BlockInjectButton/index.ts +4 -0
- package/src/components/BlockInjectButton/types.ts +18 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +146 -0
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +76 -0
- package/src/components/BlockItemWrapper/Toolbar.tsx +128 -0
- package/src/components/BlockItemWrapper/constants.ts +4 -0
- package/src/components/BlockItemWrapper/index.ts +5 -0
- package/src/components/BlockItemWrapper/types.ts +46 -0
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +20 -0
- package/src/components/DownloadButton/DownloadButton.tsx +36 -0
- package/src/components/DownloadButton/index.ts +3 -0
- package/src/components/DownloadButton/types.ts +5 -0
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +204 -0
- package/src/components/RichTextEditor/RichTextEditor.tsx +62 -0
- package/src/components/RichTextEditor/SerializedText.tsx +25 -0
- package/src/components/RichTextEditor/constants.ts +3 -0
- package/src/components/RichTextEditor/index.ts +6 -0
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +53 -0
- package/src/components/RichTextEditor/pluginPresets/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +74 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +20 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +56 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +19 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +42 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +37 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +81 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +143 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +31 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +46 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +12 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +21 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +71 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +22 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +116 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +7 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +17 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +68 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +198 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +40 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +13 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +28 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +14 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +18 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +8 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +77 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +23 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +30 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +45 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +106 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +26 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +43 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +113 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +45 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +5 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +105 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +16 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +73 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +136 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +38 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +36 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +11 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +48 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +12 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.ts +30 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/index.ts +4 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.spec.ts +35 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.ts +3 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.spec.ts +75 -0
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/url.ts +21 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +59 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +44 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +61 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +15 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +58 -0
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +62 -0
- package/src/components/RichTextEditor/plugins/index.ts +6 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.tsx +97 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.spec.ct.tsx +138 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.tsx +80 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.tsx +83 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.tsx +68 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.tsx +37 -0
- package/src/components/RichTextEditor/plugins/shared/LinkSelector/index.ts +3 -0
- package/src/components/RichTextEditor/plugins/styles.ts +179 -0
- package/src/components/RichTextEditor/serializer/index.ts +3 -0
- package/src/components/RichTextEditor/serializer/nodes/button.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +29 -0
- package/src/components/RichTextEditor/serializer/nodes/default.ts +52 -0
- package/src/components/RichTextEditor/serializer/nodes/link.ts +25 -0
- package/src/components/RichTextEditor/serializer/nodes/mentionHtmlNode.ts +17 -0
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +134 -0
- package/src/components/RichTextEditor/serializer/serializeToHtml.ts +49 -0
- package/src/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.ts +21 -0
- package/src/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.ts +32 -0
- package/src/components/RichTextEditor/types.ts +23 -0
- package/src/components/index.ts +7 -0
- package/src/helpers/addHttps.spec.ts +42 -0
- package/src/helpers/addHttps.ts +15 -0
- package/src/helpers/convertToRichTextValue.spec.ts +32 -0
- package/src/helpers/convertToRichTextValue.ts +6 -0
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +69 -0
- package/src/helpers/customCoordinatesGetterFactory.ts +39 -0
- package/src/helpers/hasRichTextValue.spec.ts +63 -0
- package/src/helpers/hasRichTextValue.ts +29 -0
- package/src/helpers/index.ts +8 -0
- package/src/helpers/isDownloadable.spec.ts +47 -0
- package/src/helpers/isDownloadable.ts +7 -0
- package/src/helpers/mapColorPalettes.spec.ts +146 -0
- package/src/helpers/mapColorPalettes.ts +22 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAttachments.spec.ts +79 -0
- package/src/hooks/useAttachments.ts +46 -0
- package/src/hooks/useDndSensors.spec.ts +40 -0
- package/src/hooks/useDndSensors.ts +23 -0
- package/src/index.ts +8 -0
- package/src/settings/background.spec.ts +173 -0
- package/src/settings/background.ts +49 -0
- package/src/settings/border.spec.ts +76 -0
- package/src/settings/border.ts +90 -0
- package/src/settings/borderRadius.spec.ts +30 -0
- package/src/settings/borderRadius.ts +73 -0
- package/src/settings/borderRadiusExtended.spec.ts +52 -0
- package/src/settings/borderRadiusExtended.ts +84 -0
- package/src/settings/defaultValues.ts +21 -0
- package/src/settings/gutter.spec.ts +60 -0
- package/src/settings/gutter.ts +75 -0
- package/src/settings/index.ts +14 -0
- package/src/settings/margin.spec.ts +42 -0
- package/src/settings/margin.ts +72 -0
- package/src/settings/marginExtended.spec.ts +45 -0
- package/src/settings/marginExtended.ts +91 -0
- package/src/settings/padding.spec.ts +42 -0
- package/src/settings/padding.ts +73 -0
- package/src/settings/paddingExtended.spec.ts +45 -0
- package/src/settings/paddingExtended.ts +91 -0
- package/src/settings/security.spec.ts +87 -0
- package/src/settings/security.ts +61 -0
- package/src/settings/securityDownloadable.spec.ts +46 -0
- package/src/settings/securityDownloadable.ts +33 -0
- package/src/settings/securityGlobalControl.ts +42 -0
- package/src/settings/types.ts +128 -0
- package/src/utilities/color/getReadableColor.spec.ts +32 -0
- package/src/utilities/color/getReadableColor.ts +34 -0
- package/src/utilities/color/index.ts +10 -0
- package/src/utilities/color/isDark.spec.ts +33 -0
- package/src/utilities/color/isDark.ts +29 -0
- package/src/utilities/color/setAlpha.spec.ts +28 -0
- package/src/utilities/color/setAlpha.ts +14 -0
- package/src/utilities/color/toColorObject.spec.ts +19 -0
- package/src/utilities/color/toColorObject.ts +16 -0
- package/src/utilities/color/toHex8String.spec.ts +17 -0
- package/src/utilities/color/toHex8String.ts +14 -0
- package/src/utilities/color/toHexString.spec.ts +17 -0
- package/src/utilities/color/toHexString.ts +10 -0
- package/src/utilities/color/toRgbaString.spec.ts +12 -0
- package/src/utilities/color/toRgbaString.ts +14 -0
- package/src/utilities/color/toShortRgba.spec.ts +16 -0
- package/src/utilities/color/toShortRgba.ts +35 -0
- package/src/utilities/index.ts +5 -0
- package/src/utilities/moveItemInArray.spec.ts +17 -0
- package/src/utilities/moveItemInArray.ts +21 -0
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +18 -0
- package/src/utilities/react/getBackgroundColorStyles.ts +11 -0
- package/src/utilities/react/getBorderStyles.spec.ts +39 -0
- package/src/utilities/react/getBorderStyles.ts +21 -0
- package/src/utilities/react/getRadiusStyles.spec.ts +25 -0
- package/src/utilities/react/getRadiusStyles.ts +8 -0
- package/src/utilities/react/index.ts +6 -0
- package/src/utilities/react/joinClassNames.spec.ts +18 -0
- package/src/utilities/react/joinClassNames.ts +10 -0
- package/tailwind.config.js +27 -0
- package/tsconfig.json +3 -1
- package/vite.config.ts +11 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -147
- package/dist/index.es.js +0 -9
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Color } from '@frontify/fondue';
|
|
4
|
+
import tinycolor from '@ctrl/tinycolor';
|
|
5
|
+
import { toShortRgba } from './toShortRgba';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Maps color object of rgba values to hex alpha string.
|
|
9
|
+
*/
|
|
10
|
+
export const toHexString = (color: Color): string => tinycolor(toShortRgba(color)).toHexString();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { toRgbaString } from './toRgbaString';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
|
|
6
|
+
describe('toRgbaString', () => {
|
|
7
|
+
const data = [{ color: { red: 1, green: 2, blue: 3, alpha: 0.5 }, expected: 'rgba(1, 2, 3, 0.5)' }];
|
|
8
|
+
|
|
9
|
+
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
10
|
+
expect(toRgbaString(color)).toBe(expected);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Color } from '@frontify/fondue';
|
|
4
|
+
import tinycolor from '@ctrl/tinycolor';
|
|
5
|
+
import { toShortRgba } from './toShortRgba';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Maps color object of rgba values to rgba string.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} Color object
|
|
11
|
+
* @returns {String} To be used as css value.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const toRgbaString = (color: Color): string => tinycolor(toShortRgba(color)).toRgbString();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { toShortRgba } from './toShortRgba';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
|
|
6
|
+
describe('toShortRgba', () => {
|
|
7
|
+
const data = [
|
|
8
|
+
{ color: { red: 50, green: 100, blue: 150 }, expected: { r: 50, g: 100, b: 150, a: 1 } },
|
|
9
|
+
{ color: { red: 50, green: 100, blue: 150, alpha: 0.5 }, expected: { r: 50, g: 100, b: 150, a: 0.5 } },
|
|
10
|
+
{ color: { r: 50, g: 100, b: 150, a: 0.5 }, expected: { r: 50, g: 100, b: 150, a: 0.5 } },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
test.each(data)('validates against expected values', ({ color, expected }) => {
|
|
14
|
+
expect(toShortRgba(color)).toStrictEqual(expected);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Color } from '@frontify/fondue';
|
|
4
|
+
|
|
5
|
+
type ShortNotationColor = {
|
|
6
|
+
r: number;
|
|
7
|
+
g: number;
|
|
8
|
+
b: number;
|
|
9
|
+
a?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Maps color object from long to short rgba notation.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} Color object
|
|
16
|
+
* @returns {Object} ShortNotationColor object
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const toShortRgba = (color: unknown): ShortNotationColor => {
|
|
20
|
+
const isRgbaLongFormat = (value: Color) => {
|
|
21
|
+
const requiredKeys = ['red', 'green', 'blue'];
|
|
22
|
+
return typeof value === 'object' && requiredKeys.every((i) => value.hasOwnProperty(i));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const mapToShortFormat = (value: Color): ShortNotationColor => {
|
|
26
|
+
const alpha = typeof value.alpha === 'number' ? value.alpha : 1;
|
|
27
|
+
return { r: value.red, g: value.green, b: value.blue, a: alpha };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if (isRgbaLongFormat(color as Color)) {
|
|
31
|
+
return mapToShortFormat(color as Color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return color as ShortNotationColor;
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { moveItemInArray } from './moveItemInArray';
|
|
5
|
+
|
|
6
|
+
describe('moveItemInArray', () => {
|
|
7
|
+
it.each([
|
|
8
|
+
[[], 0, 0, []],
|
|
9
|
+
[[1, 2, 3], 0, 0, [1, 2, 3]],
|
|
10
|
+
[[1, 2, 3], 0, 1, [2, 1, 3]],
|
|
11
|
+
[[1, 2, 3], 1, 0, [2, 1, 3]],
|
|
12
|
+
[[1, { a: 1 }, 3], 1, 0, [{ a: 1 }, 1, 3]],
|
|
13
|
+
[[{ a: 1 }, { b: 1 }, { c: 1 }], 1, 0, [{ b: 1 }, { a: 1 }, { c: 1 }]],
|
|
14
|
+
])('move items accordingly', (items, from, to, expected) => {
|
|
15
|
+
expect(expected).toEqual(moveItemInArray(items as number[], from, to));
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Moves an item from the 'from' position to the 'to' position and updates the array
|
|
5
|
+
*
|
|
6
|
+
* @param {Array} array Array of items
|
|
7
|
+
* @param {Number} from Initial index of the item
|
|
8
|
+
* @param {Number} to New index of the item
|
|
9
|
+
* @returns {Array} New array with the item moved to the new position
|
|
10
|
+
*/
|
|
11
|
+
export const moveItemInArray = <T>(array: T[], from: number, to: number): T[] => {
|
|
12
|
+
const newArray = [...array];
|
|
13
|
+
const toIndex = to < 0 ? newArray.length + to : to;
|
|
14
|
+
|
|
15
|
+
if (toIndex >= 0 && toIndex < newArray.length) {
|
|
16
|
+
const slice = newArray.splice(from, 1)[0];
|
|
17
|
+
newArray.splice(toIndex, 0, slice);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return newArray;
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { getBackgroundColorStyles } from './getBackgroundColorStyles';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
|
|
6
|
+
describe('getBackgroundColorStyles', () => {
|
|
7
|
+
it('should return a rgba background color', () => {
|
|
8
|
+
expect(getBackgroundColorStyles({ red: 0, green: 0, blue: 0, alpha: 0.5 })).toEqual({
|
|
9
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should return a rgb background color', () => {
|
|
14
|
+
expect(getBackgroundColorStyles({ red: 255, green: 255, blue: 255 })).toEqual({
|
|
15
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Color } from '@frontify/fondue';
|
|
6
|
+
|
|
7
|
+
import { toRgbaString } from '../color';
|
|
8
|
+
|
|
9
|
+
export const getBackgroundColorStyles = (backgroundColor: Color): CSSProperties => ({
|
|
10
|
+
backgroundColor: toRgbaString(backgroundColor),
|
|
11
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { BorderStyle } from '../../settings/types';
|
|
4
|
+
import { getBorderStyles } from './getBorderStyles';
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
describe('getBorderStyles', () => {
|
|
8
|
+
it('should return the default border styles', () => {
|
|
9
|
+
expect(getBorderStyles()).toEqual({
|
|
10
|
+
borderStyle: 'solid',
|
|
11
|
+
borderWidth: '1px',
|
|
12
|
+
borderColor: 'rgb(234, 235, 235)',
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return a dashed border style', () => {
|
|
17
|
+
expect(getBorderStyles(BorderStyle.Dashed)).toEqual({
|
|
18
|
+
borderStyle: 'dashed',
|
|
19
|
+
borderWidth: '1px',
|
|
20
|
+
borderColor: 'rgb(234, 235, 235)',
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should return a border width of 5px', () => {
|
|
25
|
+
expect(getBorderStyles(BorderStyle.Solid, '5px')).toEqual({
|
|
26
|
+
borderStyle: 'solid',
|
|
27
|
+
borderWidth: '5px',
|
|
28
|
+
borderColor: 'rgb(234, 235, 235)',
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should return a border color of rgba(255, 0, 0, 0.5)', () => {
|
|
33
|
+
expect(getBorderStyles(BorderStyle.Solid, '1px', { red: 255, green: 0, blue: 0, alpha: 0.5 })).toEqual({
|
|
34
|
+
borderStyle: 'solid',
|
|
35
|
+
borderWidth: '1px',
|
|
36
|
+
borderColor: 'rgba(255, 0, 0, 0.5)',
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Color } from '@frontify/fondue';
|
|
6
|
+
|
|
7
|
+
import { BorderStyle, borderStyleMap } from '../../settings/types';
|
|
8
|
+
import { BORDER_COLOR_DEFAULT_VALUE } from '../../settings/defaultValues';
|
|
9
|
+
import { toRgbaString } from '../color';
|
|
10
|
+
|
|
11
|
+
export const getBorderStyles = (
|
|
12
|
+
style = BorderStyle.Solid,
|
|
13
|
+
borderWidth = '1px',
|
|
14
|
+
color = BORDER_COLOR_DEFAULT_VALUE as Color
|
|
15
|
+
): CSSProperties => {
|
|
16
|
+
return {
|
|
17
|
+
borderStyle: borderStyleMap[style],
|
|
18
|
+
borderWidth,
|
|
19
|
+
borderColor: toRgbaString(color),
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Radius } from '../../settings/types';
|
|
4
|
+
import { getRadiusStyles } from './getRadiusStyles';
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
describe('getRadiusStyles', () => {
|
|
8
|
+
it('should return border radius 0px', () => {
|
|
9
|
+
expect(getRadiusStyles(Radius.None, false)).toEqual({
|
|
10
|
+
borderRadius: '0px',
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return border radius 4px', () => {
|
|
15
|
+
expect(getRadiusStyles(Radius.Medium, false)).toEqual({
|
|
16
|
+
borderRadius: '4px',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should return custom radius of 20px', () => {
|
|
21
|
+
expect(getRadiusStyles(Radius.None, true, 20)).toEqual({
|
|
22
|
+
borderRadius: 20,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { CSSProperties } from 'react';
|
|
4
|
+
import { Radius, radiusStyleMap } from '../../settings/types';
|
|
5
|
+
|
|
6
|
+
export const getRadiusStyles = (radiusChoice: Radius, hasRadius = false, radiusValue?: number): CSSProperties => ({
|
|
7
|
+
borderRadius: hasRadius ? radiusValue : radiusStyleMap[radiusChoice],
|
|
8
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { joinClassNames } from './joinClassNames';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
|
|
6
|
+
describe('joinClassNames', () => {
|
|
7
|
+
const data = [
|
|
8
|
+
{ classes: ['lorem', undefined, false], expected: 'lorem' },
|
|
9
|
+
{ classes: ['lorem', 'ipsum'], expected: 'lorem ipsum' },
|
|
10
|
+
{ classes: ['lorem', ''], expected: 'lorem' },
|
|
11
|
+
{ classes: ['lorem', ' '], expected: 'lorem ' },
|
|
12
|
+
{ classes: [], expected: '' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
test.each(data)('validate correctly values', ({ classes, expected }) => {
|
|
16
|
+
expect(joinClassNames(classes)).toBe(expected);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cleans and joins an array of inputs with possible undefined or boolean values.
|
|
5
|
+
*
|
|
6
|
+
* @param {Array} classNames Array of class names
|
|
7
|
+
* @returns Clean string to be used for class name.
|
|
8
|
+
*/
|
|
9
|
+
export const joinClassNames = (classNames: (string | undefined | boolean)[]): string =>
|
|
10
|
+
classNames.filter(Boolean).join(' ');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
presets: [require('@frontify/fondue/tailwind')],
|
|
5
|
+
content: ['src/**/*.{ts,tsx}'],
|
|
6
|
+
corePlugins: {
|
|
7
|
+
preflight: false,
|
|
8
|
+
},
|
|
9
|
+
theme: {
|
|
10
|
+
extend: {
|
|
11
|
+
colors: {
|
|
12
|
+
'blank-state-weak': '#ABADAD',
|
|
13
|
+
'blank-state-weak-inverse': '#FFFFFF',
|
|
14
|
+
'blank-state-shaded': '#727474',
|
|
15
|
+
'blank-state-shaded-inverse': '#FAFAFA',
|
|
16
|
+
'blank-state-weighted': '#696B6B',
|
|
17
|
+
'blank-state-weighted-inverse': '#F1F1F1',
|
|
18
|
+
'blank-state-hover': '#1A1C1C',
|
|
19
|
+
'blank-state-hover-inverse': '#FFFFFF',
|
|
20
|
+
'blank-state-pressed': '#080808',
|
|
21
|
+
'blank-state-pressed-inverse': '#F1F1F1',
|
|
22
|
+
'blank-state-line': '#A3A5A5',
|
|
23
|
+
'blank-state-line-hover': '#1A1C1C',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
"sourceMap": true,
|
|
15
15
|
"strict": true,
|
|
16
16
|
"target": "es6",
|
|
17
|
+
"jsx": "react-jsx",
|
|
17
18
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
18
19
|
"resolveJsonModule": true,
|
|
19
20
|
"declaration": true,
|
|
20
21
|
"esModuleInterop": true,
|
|
21
|
-
"skipLibCheck": true
|
|
22
|
+
"skipLibCheck": true,
|
|
23
|
+
"types": ["cypress", "node", "cypress-real-events"]
|
|
22
24
|
},
|
|
23
25
|
"include": ["src/**/*"],
|
|
24
26
|
"exclude": ["node_modules", "dist"]
|
package/vite.config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
2
|
|
|
3
|
-
import { defineConfig } from '
|
|
3
|
+
import { defineConfig } from 'vitest/config';
|
|
4
4
|
import { dependencies as dependenciesMap } from './package.json';
|
|
5
5
|
import { resolve } from 'path';
|
|
6
6
|
import dts from 'vite-plugin-dts';
|
|
@@ -9,6 +9,16 @@ const dependencies = Object.keys(dependenciesMap);
|
|
|
9
9
|
|
|
10
10
|
export default defineConfig({
|
|
11
11
|
plugins: [dts({ insertTypesEntry: true, rollupTypes: true })],
|
|
12
|
+
resolve: {
|
|
13
|
+
mainFields: ['module', 'main'],
|
|
14
|
+
},
|
|
15
|
+
test: {
|
|
16
|
+
environment: 'happy-dom',
|
|
17
|
+
deps: {
|
|
18
|
+
inline: ['clsx', '@juggle/resize-observer'],
|
|
19
|
+
},
|
|
20
|
+
setupFiles: ['setupTests.ts'],
|
|
21
|
+
},
|
|
12
22
|
build: {
|
|
13
23
|
lib: {
|
|
14
24
|
entry: resolve(__dirname, 'src/index.ts'),
|
package/dist/index.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@frontify/sidebar-settings");var r=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(r||{});const a=e=>e,i=e=>e;exports.Sections=r;exports.defineBlock=a;exports.defineSettings=i;Object.keys(t).forEach(e=>{e!=="default"&&!exports.hasOwnProperty(e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
|
|
2
|
-
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\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 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 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"],"names":["Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":"8HAyDY,IAAAA,GAAAA,IACRA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UANFA,IAAAA,GAAA,CAAA,CAAA,EAyDC,MAAAC,EAAeC,GAAiDA,EAMhEC,EAMTC,GACIA"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { AppBridgeBlock } from '@frontify/app-bridge';
|
|
2
|
-
import type { AssetInputBlock as AssetInputBlock_2 } from '@frontify/sidebar-settings';
|
|
3
|
-
import type { BaseBlock as BaseBlock_2 } from '@frontify/sidebar-settings';
|
|
4
|
-
import type { Bundle as Bundle_2 } from '@frontify/sidebar-settings';
|
|
5
|
-
import type { ChecklistBlock as ChecklistBlock_2 } from '@frontify/sidebar-settings';
|
|
6
|
-
import type { ChoicesType as ChoicesType_2 } from '@frontify/sidebar-settings';
|
|
7
|
-
import type { ColorInputBlock as ColorInputBlock_2 } from '@frontify/sidebar-settings';
|
|
8
|
-
import type { DropdownBlock as DropdownBlock_2 } from '@frontify/sidebar-settings';
|
|
9
|
-
import type { DynamicSettingBlock as DynamicSettingBlock_2 } from '@frontify/sidebar-settings';
|
|
10
|
-
import type { DynamicSupportedBlock as DynamicSupportedBlock_2 } from '@frontify/sidebar-settings';
|
|
11
|
-
import type { FC } from 'react';
|
|
12
|
-
import type { FontInputBlock as FontInputBlock_2 } from '@frontify/sidebar-settings';
|
|
13
|
-
import type { InputBlock as InputBlock_2 } from '@frontify/sidebar-settings';
|
|
14
|
-
import type { LegacyAssetInputBlock as LegacyAssetInputBlock_2 } from '@frontify/sidebar-settings';
|
|
15
|
-
import type { LinkChooserBlock as LinkChooserBlock_2 } from '@frontify/sidebar-settings';
|
|
16
|
-
import type { MultiInputBlock as MultiInputBlock_2 } from '@frontify/sidebar-settings';
|
|
17
|
-
import type { NotificationBlock as NotificationBlock_2 } from '@frontify/sidebar-settings';
|
|
18
|
-
import type { SectionHeadingBlock as SectionHeadingBlock_2 } from '@frontify/sidebar-settings';
|
|
19
|
-
import type { SegmentedControlsBlock as SegmentedControlsBlock_2 } from '@frontify/sidebar-settings';
|
|
20
|
-
import type { SettingBlock as SettingBlock_2 } from '@frontify/sidebar-settings';
|
|
21
|
-
import type { SimpleSettingBlock as SimpleSettingBlock_2 } from '@frontify/sidebar-settings';
|
|
22
|
-
import type { SwitchBlock as SwitchBlock_2 } from '@frontify/sidebar-settings';
|
|
23
|
-
import type { TemplateInputBlock as TemplateInputBlock_2 } from '@frontify/sidebar-settings';
|
|
24
|
-
import type { TextareaBlock as TextareaBlock_2 } from '@frontify/sidebar-settings';
|
|
25
|
-
import type { ValueOrPromisedValue as ValueOrPromisedValue_2 } from '@frontify/sidebar-settings';
|
|
26
|
-
|
|
27
|
-
export declare type AssetInputBlock = AssetInputBlock_2<AppBridgeBlock>;
|
|
28
|
-
|
|
29
|
-
export declare type BaseBlock<T = undefined> = BaseBlock_2<AppBridgeBlock, T>;
|
|
30
|
-
|
|
31
|
-
export declare type BlockConfigExport = {
|
|
32
|
-
/**
|
|
33
|
-
* Block component to render.
|
|
34
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks}
|
|
35
|
-
*/
|
|
36
|
-
block: FC<BlockProps>;
|
|
37
|
-
/**
|
|
38
|
-
* Contains the block settings and its structure.
|
|
39
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-settings-1}
|
|
40
|
-
*/
|
|
41
|
-
settings: ReturnType<typeof defineSettings>;
|
|
42
|
-
/**
|
|
43
|
-
* Block lifecycle hook ran before the block gets added in the Guideline.
|
|
44
|
-
* The hook support both synchronous or asynchronous execution.
|
|
45
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-creation}
|
|
46
|
-
*/
|
|
47
|
-
onBlockCreated?: (({ appBridge }: {
|
|
48
|
-
appBridge: AppBridgeBlock;
|
|
49
|
-
}) => void) | (({ appBridge }: {
|
|
50
|
-
appBridge: AppBridgeBlock;
|
|
51
|
-
}) => Promise<void>);
|
|
52
|
-
/**
|
|
53
|
-
* Block lifecycle hook ran before the block gets deleted from the Guideline.
|
|
54
|
-
* The hook support both synchronous or asynchronous execution.
|
|
55
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-deletion}
|
|
56
|
-
*/
|
|
57
|
-
onBlockDeleted?: (({ appBridge }: {
|
|
58
|
-
appBridge: AppBridgeBlock;
|
|
59
|
-
}) => void) | (({ appBridge }: {
|
|
60
|
-
appBridge: AppBridgeBlock;
|
|
61
|
-
}) => Promise<void>);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export declare type BlockProps = {
|
|
65
|
-
/**
|
|
66
|
-
* The Frontify App Bridge provides an interface to the Frontify app internals.
|
|
67
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks/introducing-the-app-bridge}
|
|
68
|
-
*/
|
|
69
|
-
appBridge: AppBridgeBlock;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export declare type BlockSettingsStructureExport = {
|
|
73
|
-
[Sections.Main]?: SettingBlock[];
|
|
74
|
-
[Sections.Basics]?: SettingBlock[];
|
|
75
|
-
[Sections.Layout]?: SettingBlock[];
|
|
76
|
-
[Sections.Style]?: SettingBlock[];
|
|
77
|
-
[Sections.Security]?: SettingBlock[];
|
|
78
|
-
} & {
|
|
79
|
-
[customSectionName: string]: SettingBlock[];
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export declare type Bundle = Bundle_2<AppBridgeBlock>;
|
|
83
|
-
|
|
84
|
-
export declare type ChecklistBlock = ChecklistBlock_2<AppBridgeBlock>;
|
|
85
|
-
|
|
86
|
-
export declare type ChoicesType = ChoicesType_2<AppBridgeBlock>;
|
|
87
|
-
|
|
88
|
-
export declare type ColorInputBlock = ColorInputBlock_2<AppBridgeBlock>;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.
|
|
92
|
-
*/
|
|
93
|
-
export declare const defineBlock: (config: BlockConfigExport) => BlockConfigExport;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object
|
|
97
|
-
* or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.
|
|
98
|
-
*/
|
|
99
|
-
export declare const defineSettings: <T extends BlockSettingsStructureExport | (() => Promise<BlockSettingsStructureExport>) | (() => BlockSettingsStructureExport)>(settingsStructure: T) => T;
|
|
100
|
-
|
|
101
|
-
export declare type DropdownBlock = DropdownBlock_2<AppBridgeBlock>;
|
|
102
|
-
|
|
103
|
-
export declare type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> = DynamicSettingBlock_2<AppBridgeBlock, Block>;
|
|
104
|
-
|
|
105
|
-
export declare type DynamicSupportedBlock = DynamicSupportedBlock_2<AppBridgeBlock>;
|
|
106
|
-
|
|
107
|
-
export declare type FontInputBlock = FontInputBlock_2<AppBridgeBlock>;
|
|
108
|
-
|
|
109
|
-
export declare type InputBlock = InputBlock_2<AppBridgeBlock>;
|
|
110
|
-
|
|
111
|
-
export declare type LegacyAssetInputBlock = LegacyAssetInputBlock_2<AppBridgeBlock>;
|
|
112
|
-
|
|
113
|
-
export declare type LinkChooserBlock = LinkChooserBlock_2<AppBridgeBlock>;
|
|
114
|
-
|
|
115
|
-
export declare type MultiInputBlock = MultiInputBlock_2<AppBridgeBlock>;
|
|
116
|
-
|
|
117
|
-
export declare type NotificationBlock = NotificationBlock_2<AppBridgeBlock>;
|
|
118
|
-
|
|
119
|
-
export declare type SectionHeadingBlock = SectionHeadingBlock_2<AppBridgeBlock>;
|
|
120
|
-
|
|
121
|
-
export declare enum Sections {
|
|
122
|
-
Main = "main",
|
|
123
|
-
Basics = "basics",
|
|
124
|
-
Layout = "layout",
|
|
125
|
-
Style = "style",
|
|
126
|
-
Security = "security",
|
|
127
|
-
Targets = "targets"
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export declare type SegmentedControlsBlock = SegmentedControlsBlock_2<AppBridgeBlock>;
|
|
131
|
-
|
|
132
|
-
export declare type SettingBlock = SettingBlock_2<AppBridgeBlock>;
|
|
133
|
-
|
|
134
|
-
export declare type SimpleSettingBlock = SimpleSettingBlock_2<AppBridgeBlock>;
|
|
135
|
-
|
|
136
|
-
export declare type SwitchBlock = SwitchBlock_2<AppBridgeBlock>;
|
|
137
|
-
|
|
138
|
-
export declare type TemplateInputBlock = TemplateInputBlock_2<AppBridgeBlock>;
|
|
139
|
-
|
|
140
|
-
export declare type TextareaBlock = TextareaBlock_2<AppBridgeBlock>;
|
|
141
|
-
|
|
142
|
-
export declare type ValueOrPromisedValue<T> = ValueOrPromisedValue_2<AppBridgeBlock, T>;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
export * from "@frontify/sidebar-settings";
|
|
146
|
-
|
|
147
|
-
export { }
|
package/dist/index.es.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "@frontify/sidebar-settings";
|
|
2
|
-
var r = /* @__PURE__ */ ((t) => (t.Main = "main", t.Basics = "basics", t.Layout = "layout", t.Style = "style", t.Security = "security", t.Targets = "targets", t))(r || {});
|
|
3
|
-
const a = (t) => t, e = (t) => t;
|
|
4
|
-
export {
|
|
5
|
-
r as Sections,
|
|
6
|
-
a as defineBlock,
|
|
7
|
-
e as defineSettings
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\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 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 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"],"names":["Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":";AAyDY,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;"}
|
package/dist/index.umd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@frontify/sidebar-settings")):typeof define=="function"&&define.amd?define(["exports","@frontify/sidebar-settings"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t.GuidelineBlocksSettings={},t.sidebarSettings))})(this,function(t,i){"use strict";var n=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(n||{});const f=e=>e,s=e=>e;t.Sections=n,t.defineBlock=f,t.defineSettings=s,Object.keys(i).forEach(e=>{e!=="default"&&!t.hasOwnProperty(e)&&Object.defineProperty(t,e,{enumerable:!0,get:()=>i[e]})}),Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\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 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 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"],"names":["Sections","defineBlock","config","defineSettings","settingsStructure"],"mappings":"sUAyDY,IAAAA,GAAAA,IACRA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UANFA,IAAAA,GAAA,CAAA,CAAA,EAyDC,MAAAC,EAAeC,GAAiDA,EAMhEC,EAMTC,GACIA"}
|