@frontify/guideline-blocks-settings 0.33.4 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Attachments/AttachmentItem.es.js +174 -0
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -0
- package/dist/components/Attachments/Attachments.es.js +160 -0
- package/dist/components/Attachments/Attachments.es.js.map +1 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +29 -0
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +150 -0
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +71 -0
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +33 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +28 -0
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +35 -0
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +44 -0
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +25 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js +29 -0
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +22 -0
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +12 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +20 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +6 -0
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +11 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +26 -0
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -0
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -0
- package/dist/components/BlockItemWrapper/constants.es.js +6 -0
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -0
- package/dist/components/DownloadButton/DownloadButton.es.js +39 -0
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -0
- package/dist/components/Link/LinkInput.es.js +63 -0
- package/dist/components/Link/LinkInput.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +68 -0
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +60 -0
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +86 -0
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +7 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js +70 -0
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js +38 -0
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js +25 -0
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -0
- package/dist/components/Link/utils/getUrl.es.js +18 -0
- package/dist/components/Link/utils/getUrl.es.js.map +1 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js +5 -0
- package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -0
- package/dist/components/Link/utils/url.es.js +17 -0
- package/dist/components/Link/utils/url.es.js.map +1 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js +42 -0
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -0
- package/dist/components/RichTextEditor/SerializedText.es.js +20 -0
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -0
- package/dist/components/RichTextEditor/constants.es.js +5 -0
- package/dist/components/RichTextEditor/constants.es.js.map +1 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +35 -0
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +28 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +48 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +69 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +104 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +57 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +26 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +41 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +67 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +86 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +24 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +19 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +10 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +81 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +18 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +17 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +14 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +52 -0
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +32 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +35 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +8 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +66 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +79 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +22 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +12 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +25 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +5 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +13 -0
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +50 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +40 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +51 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +53 -0
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js +167 -0
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -0
- package/dist/helpers/addHttps.es.js +14 -0
- package/dist/helpers/addHttps.es.js.map +1 -0
- package/dist/helpers/convertToRichTextValue.es.js +6 -0
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js +32 -0
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -0
- package/dist/helpers/hasRichTextValue.es.js +15 -0
- package/dist/helpers/hasRichTextValue.es.js.map +1 -0
- package/dist/helpers/isDownloadable.es.js +6 -0
- package/dist/helpers/isDownloadable.es.js.map +1 -0
- package/dist/helpers/mapColorPalettes.es.js +28 -0
- package/dist/helpers/mapColorPalettes.es.js.map +1 -0
- package/dist/hooks/useAttachments.es.js +53 -0
- package/dist/hooks/useAttachments.es.js.map +1 -0
- package/dist/hooks/useDndSensors.es.js +20 -0
- package/dist/hooks/useDndSensors.es.js.map +1 -0
- package/dist/index.cjs.js +4 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1190 -0
- package/dist/index.es.js +217 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +4 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/settings/background.es.js +22 -0
- package/dist/settings/background.es.js.map +1 -0
- package/dist/settings/border.es.js +61 -0
- package/dist/settings/border.es.js.map +1 -0
- package/dist/settings/borderRadius.es.js +56 -0
- package/dist/settings/borderRadius.es.js.map +1 -0
- package/dist/settings/borderRadiusExtended.es.js +64 -0
- package/dist/settings/borderRadiusExtended.es.js.map +1 -0
- package/dist/settings/defaultValues.es.js +19 -0
- package/dist/settings/defaultValues.es.js.map +1 -0
- package/dist/settings/gutter.es.js +56 -0
- package/dist/settings/gutter.es.js.map +1 -0
- package/dist/settings/margin.es.js +53 -0
- package/dist/settings/margin.es.js.map +1 -0
- package/dist/settings/marginExtended.es.js +65 -0
- package/dist/settings/marginExtended.es.js.map +1 -0
- package/dist/settings/padding.es.js +53 -0
- package/dist/settings/padding.es.js.map +1 -0
- package/dist/settings/paddingExtended.es.js +65 -0
- package/dist/settings/paddingExtended.es.js.map +1 -0
- package/dist/settings/securityDownloadable.es.js +19 -0
- package/dist/settings/securityDownloadable.es.js.map +1 -0
- package/dist/settings/securityGlobalControl.es.js +33 -0
- package/dist/settings/securityGlobalControl.es.js.map +1 -0
- package/dist/settings/types.es.js +48 -0
- package/dist/settings/types.es.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.css.es.js +2 -0
- package/dist/styles.css.es.js.map +1 -0
- package/dist/utilities/color/getReadableColor.es.js +14 -0
- package/dist/utilities/color/getReadableColor.es.js.map +1 -0
- package/dist/utilities/color/isDark.es.js +10 -0
- package/dist/utilities/color/isDark.es.js.map +1 -0
- package/dist/utilities/color/setAlpha.es.js +6 -0
- package/dist/utilities/color/setAlpha.es.js.map +1 -0
- package/dist/utilities/color/toColorObject.es.js +9 -0
- package/dist/utilities/color/toColorObject.es.js.map +1 -0
- package/dist/utilities/color/toHex8String.es.js +7 -0
- package/dist/utilities/color/toHex8String.es.js.map +1 -0
- package/dist/utilities/color/toHexString.es.js +7 -0
- package/dist/utilities/color/toHexString.es.js.map +1 -0
- package/dist/utilities/color/toRgbaString.es.js +7 -0
- package/dist/utilities/color/toRgbaString.es.js.map +1 -0
- package/dist/utilities/color/toShortRgba.es.js +11 -0
- package/dist/utilities/color/toShortRgba.es.js.map +1 -0
- package/dist/utilities/moveItemInArray.es.js +12 -0
- package/dist/utilities/moveItemInArray.es.js.map +1 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js +8 -0
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -0
- package/dist/utilities/react/getBorderStyles.es.js +12 -0
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -0
- package/dist/utilities/react/getRadiusStyles.es.js +8 -0
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -0
- package/dist/utilities/react/joinClassNames.es.js +5 -0
- package/dist/utilities/react/joinClassNames.es.js.map +1 -0
- package/package.json +9 -6
- package/.eslintrc.cjs +0 -27
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -787
- package/postcss.config.cjs +0 -8
- package/setupTests.ts +0 -23
- package/src/components/Attachments/AttachmentItem.tsx +0 -247
- package/src/components/Attachments/Attachments.spec.ct.tsx +0 -165
- package/src/components/Attachments/Attachments.tsx +0 -241
- package/src/components/Attachments/AttachmentsButtonTrigger.tsx +0 -30
- package/src/components/Attachments/index.ts +0 -4
- package/src/components/Attachments/types.ts +0 -40
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +0 -48
- package/src/components/BlockInjectButton/BlockInjectButton.tsx +0 -212
- package/src/components/BlockInjectButton/index.ts +0 -4
- package/src/components/BlockInjectButton/types.ts +0 -18
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +0 -145
- package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +0 -76
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.spec.tsx +0 -96
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.tsx +0 -42
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.spec.tsx +0 -44
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.tsx +0 -24
- package/src/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.spec.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/BaseToolbarButton.tsx +0 -37
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.spec.tsx +0 -89
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.spec.tsx +0 -140
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.tsx +0 -61
- package/src/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.spec.tsx +0 -77
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.tsx +0 -30
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.spec.tsx +0 -63
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/ToolbarFlyoutMenu.tsx +0 -40
- package/src/components/BlockItemWrapper/Toolbar/MenuToolbarButton/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.spec.tsx +0 -259
- package/src/components/BlockItemWrapper/Toolbar/Toolbar.tsx +0 -36
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.spec.tsx +0 -70
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.tsx +0 -19
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButton/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx +0 -9
- package/src/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.tsx +0 -15
- package/src/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.tsx +0 -25
- package/src/components/BlockItemWrapper/Toolbar/context/index.ts +0 -4
- package/src/components/BlockItemWrapper/Toolbar/helpers.ts +0 -33
- package/src/components/BlockItemWrapper/Toolbar/hooks/index.ts +0 -3
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.spec.tsx +0 -59
- package/src/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.ts +0 -24
- package/src/components/BlockItemWrapper/Toolbar/index.ts +0 -10
- package/src/components/BlockItemWrapper/Toolbar/types.ts +0 -18
- package/src/components/BlockItemWrapper/constants.ts +0 -4
- package/src/components/BlockItemWrapper/index.ts +0 -6
- package/src/components/BlockItemWrapper/types.ts +0 -24
- package/src/components/DownloadButton/DownloadButton.spec.ct.tsx +0 -20
- package/src/components/DownloadButton/DownloadButton.tsx +0 -36
- package/src/components/DownloadButton/index.ts +0 -3
- package/src/components/DownloadButton/types.ts +0 -5
- package/src/components/Link/LinkInput.spec.ct.tsx +0 -142
- package/src/components/Link/LinkInput.tsx +0 -86
- package/src/components/Link/LinkSelector/DocumentLink.tsx +0 -81
- package/src/components/Link/LinkSelector/DocumentLinks.tsx +0 -102
- package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +0 -196
- package/src/components/Link/LinkSelector/LinkSelector.tsx +0 -96
- package/src/components/Link/LinkSelector/LoadingIndicator.tsx +0 -11
- package/src/components/Link/LinkSelector/PageLink.tsx +0 -96
- package/src/components/Link/LinkSelector/PageLinks.tsx +0 -71
- package/src/components/Link/LinkSelector/SectionLink.tsx +0 -36
- package/src/components/Link/LinkSelector/index.ts +0 -3
- package/src/components/Link/index.ts +0 -6
- package/src/components/Link/types.ts +0 -6
- package/src/components/Link/utils/getUrl.ts +0 -30
- package/src/components/Link/utils/index.ts +0 -5
- package/src/components/Link/utils/relativeUrlRegex.spec.ts +0 -32
- package/src/components/Link/utils/relativeUrlRegex.ts +0 -3
- package/src/components/Link/utils/url.spec.ts +0 -75
- package/src/components/Link/utils/url.ts +0 -21
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +0 -231
- package/src/components/RichTextEditor/RichTextEditor.tsx +0 -62
- package/src/components/RichTextEditor/SerializedText.tsx +0 -29
- package/src/components/RichTextEditor/constants.ts +0 -3
- package/src/components/RichTextEditor/index.ts +0 -6
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +0 -55
- package/src/components/RichTextEditor/pluginPresets/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.tsx +0 -74
- package/src/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.tsx +0 -20
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +0 -56
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.tsx +0 -19
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.tsx +0 -42
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButton.tsx +0 -37
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.tsx +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.tsx +0 -81
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +0 -143
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.tsx +0 -31
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.ts +0 -46
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/index.ts +0 -12
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +0 -21
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +0 -71
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.ts +0 -22
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/index.ts +0 -3
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +0 -118
- package/src/components/RichTextEditor/plugins/ButtonPlugin/index.ts +0 -7
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +0 -17
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +0 -68
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +0 -198
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.ts +0 -40
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/types.ts +0 -13
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +0 -28
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.ts +0 -14
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.ts +0 -18
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/index.ts +0 -8
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.ts +0 -83
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +0 -23
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.ts +0 -30
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +0 -45
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +0 -106
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.tsx +0 -26
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.tsx +0 -43
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +0 -113
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/FloatingLink.tsx +0 -45
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.tsx +0 -5
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +0 -88
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.ts +0 -4
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/types.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +0 -73
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +0 -136
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +0 -38
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +0 -36
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.ts +0 -11
- package/src/components/RichTextEditor/plugins/LinkPlugin/id.ts +0 -3
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +0 -49
- package/src/components/RichTextEditor/plugins/LinkPlugin/types.ts +0 -12
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/TextStylePlugins/helpers.tsx +0 -44
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +0 -62
- package/src/components/RichTextEditor/plugins/TextStylePlugins/index.ts +0 -15
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +0 -58
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +0 -63
- package/src/components/RichTextEditor/plugins/index.ts +0 -6
- package/src/components/RichTextEditor/plugins/styles.ts +0 -178
- package/src/components/RichTextEditor/types.ts +0 -23
- package/src/components/index.ts +0 -8
- package/src/helpers/addHttps.spec.ts +0 -42
- package/src/helpers/addHttps.ts +0 -15
- package/src/helpers/convertToRichTextValue.spec.ts +0 -32
- package/src/helpers/convertToRichTextValue.ts +0 -6
- package/src/helpers/customCoordinatesGetterFactory.spec.ts +0 -69
- package/src/helpers/customCoordinatesGetterFactory.ts +0 -39
- package/src/helpers/hasRichTextValue.spec.ts +0 -63
- package/src/helpers/hasRichTextValue.ts +0 -29
- package/src/helpers/index.ts +0 -8
- package/src/helpers/isDownloadable.spec.ts +0 -47
- package/src/helpers/isDownloadable.ts +0 -7
- package/src/helpers/mapColorPalettes.spec.ts +0 -47
- package/src/helpers/mapColorPalettes.ts +0 -65
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useAttachments.spec.tsx +0 -127
- package/src/hooks/useAttachments.tsx +0 -90
- package/src/hooks/useDndSensors.spec.ts +0 -40
- package/src/hooks/useDndSensors.ts +0 -23
- package/src/index.ts +0 -138
- package/src/settings/background.spec.ts +0 -173
- package/src/settings/background.ts +0 -52
- package/src/settings/border.spec.ts +0 -76
- package/src/settings/border.ts +0 -90
- package/src/settings/borderRadius.spec.ts +0 -30
- package/src/settings/borderRadius.ts +0 -73
- package/src/settings/borderRadiusExtended.spec.ts +0 -52
- package/src/settings/borderRadiusExtended.ts +0 -84
- package/src/settings/defaultValues.ts +0 -21
- package/src/settings/gutter.spec.ts +0 -60
- package/src/settings/gutter.ts +0 -75
- package/src/settings/index.ts +0 -14
- package/src/settings/margin.spec.ts +0 -42
- package/src/settings/margin.ts +0 -72
- package/src/settings/marginExtended.spec.ts +0 -45
- package/src/settings/marginExtended.ts +0 -91
- package/src/settings/padding.spec.ts +0 -42
- package/src/settings/padding.ts +0 -73
- package/src/settings/paddingExtended.spec.ts +0 -45
- package/src/settings/paddingExtended.ts +0 -91
- package/src/settings/security.spec.ts +0 -87
- package/src/settings/security.ts +0 -61
- package/src/settings/securityDownloadable.spec.ts +0 -46
- package/src/settings/securityDownloadable.ts +0 -33
- package/src/settings/securityGlobalControl.ts +0 -42
- package/src/settings/types.ts +0 -128
- package/src/styles.css +0 -3
- package/src/utilities/color/getReadableColor.spec.ts +0 -32
- package/src/utilities/color/getReadableColor.ts +0 -34
- package/src/utilities/color/index.ts +0 -10
- package/src/utilities/color/isDark.spec.ts +0 -33
- package/src/utilities/color/isDark.ts +0 -29
- package/src/utilities/color/setAlpha.spec.ts +0 -28
- package/src/utilities/color/setAlpha.ts +0 -14
- package/src/utilities/color/toColorObject.spec.ts +0 -19
- package/src/utilities/color/toColorObject.ts +0 -16
- package/src/utilities/color/toHex8String.spec.ts +0 -17
- package/src/utilities/color/toHex8String.ts +0 -14
- package/src/utilities/color/toHexString.spec.ts +0 -17
- package/src/utilities/color/toHexString.ts +0 -10
- package/src/utilities/color/toRgbaString.spec.ts +0 -12
- package/src/utilities/color/toRgbaString.ts +0 -14
- package/src/utilities/color/toShortRgba.spec.ts +0 -16
- package/src/utilities/color/toShortRgba.ts +0 -35
- package/src/utilities/index.ts +0 -5
- package/src/utilities/moveItemInArray.spec.ts +0 -17
- package/src/utilities/moveItemInArray.ts +0 -21
- package/src/utilities/react/getBackgroundColorStyles.spec.ts +0 -18
- package/src/utilities/react/getBackgroundColorStyles.ts +0 -10
- package/src/utilities/react/getBorderStyles.spec.ts +0 -39
- package/src/utilities/react/getBorderStyles.ts +0 -20
- package/src/utilities/react/getRadiusStyles.spec.ts +0 -25
- package/src/utilities/react/getRadiusStyles.ts +0 -8
- package/src/utilities/react/index.ts +0 -6
- package/src/utilities/react/joinClassNames.spec.ts +0 -18
- package/src/utilities/react/joinClassNames.ts +0 -10
- package/tailwind.config.ts +0 -27
- package/tsconfig.json +0 -24
- package/tsconfig.node.json +0 -12
- package/vite.config.ts +0 -71
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { ColorPalette } from '@frontify/app-bridge';
|
|
4
|
-
import { Palette } from '@frontify/fondue';
|
|
5
|
-
|
|
6
|
-
type Nullable<T> = T | null;
|
|
7
|
-
|
|
8
|
-
type V3Color = {
|
|
9
|
-
id: number;
|
|
10
|
-
name: Nullable<string>;
|
|
11
|
-
red: Nullable<number>;
|
|
12
|
-
green: Nullable<number>;
|
|
13
|
-
blue: Nullable<number>;
|
|
14
|
-
alpha: Nullable<number>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type V4Color = {
|
|
18
|
-
id: number;
|
|
19
|
-
title: Nullable<string>;
|
|
20
|
-
revision: {
|
|
21
|
-
rgba: {
|
|
22
|
-
red: Nullable<number>;
|
|
23
|
-
green: Nullable<number>;
|
|
24
|
-
blue: Nullable<number>;
|
|
25
|
-
alpha: Nullable<number>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type Color = V3Color | V4Color;
|
|
31
|
-
|
|
32
|
-
export const mapAppBridgeColorPalettesToFonduePalettes = (colorPalettes: ColorPalette[]): Palette[] => {
|
|
33
|
-
return colorPalettes.map(mapAppBridgeColorPaletteToFonduePalette);
|
|
34
|
-
};
|
|
35
|
-
export const mapAppBridgeColorPaletteToFonduePalette = (colorPalette: ColorPalette): Palette => {
|
|
36
|
-
return {
|
|
37
|
-
id: colorPalette.id,
|
|
38
|
-
title: colorPalette.name,
|
|
39
|
-
colors: colorPalette.colors.map(mapColor),
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const isV4Color = (color: Color): color is V4Color => {
|
|
44
|
-
return 'revision' in color;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const mapColor = (color: Color) => {
|
|
48
|
-
if (isV4Color(color)) {
|
|
49
|
-
const { title, revision } = color;
|
|
50
|
-
return {
|
|
51
|
-
alpha: revision.rgba.alpha ? revision.rgba.alpha / 255 : 1,
|
|
52
|
-
red: revision.rgba.red ?? 0,
|
|
53
|
-
green: revision.rgba.green ?? 0,
|
|
54
|
-
blue: revision.rgba.blue ?? 0,
|
|
55
|
-
name: title ?? '',
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
alpha: color.alpha ? color.alpha / 255 : 1,
|
|
60
|
-
red: color.red ?? 0,
|
|
61
|
-
green: color.green ?? 0,
|
|
62
|
-
blue: color.blue ?? 0,
|
|
63
|
-
name: color.name ?? '',
|
|
64
|
-
};
|
|
65
|
-
};
|
package/src/hooks/index.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { AssetDummy, getAppBridgeBlockStub } from '@frontify/app-bridge';
|
|
4
|
-
import { render, renderHook, waitFor } from '@testing-library/react';
|
|
5
|
-
import { describe, expect, it } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { AttachmentsProvider, useAttachments, useAttachmentsContext, withAttachmentsProvider } from './useAttachments';
|
|
8
|
-
|
|
9
|
-
const MOCK_SETTINGS_ID = 'attachments';
|
|
10
|
-
|
|
11
|
-
describe('useAttachments', async () => {
|
|
12
|
-
it('should have 1 attachment if attachment is added', async () => {
|
|
13
|
-
const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
|
|
14
|
-
blockId: 1,
|
|
15
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [] },
|
|
16
|
-
});
|
|
17
|
-
const { result } = renderHook(() => useAttachments(STUB_WITH_NO_ASSETS, MOCK_SETTINGS_ID));
|
|
18
|
-
|
|
19
|
-
await result.current.onAttachmentsAdd([AssetDummy.with(1)]);
|
|
20
|
-
await waitFor(() => {
|
|
21
|
-
expect(result.current.attachments).toHaveLength(1);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should decrease the attachment count from 3 to 2', async () => {
|
|
26
|
-
const STUB_WITH_THREE_ASSETS = getAppBridgeBlockStub({
|
|
27
|
-
blockId: 2,
|
|
28
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1), AssetDummy.with(2), AssetDummy.with(3)] },
|
|
29
|
-
editorState: true,
|
|
30
|
-
});
|
|
31
|
-
const { result } = renderHook(() => useAttachments(STUB_WITH_THREE_ASSETS, MOCK_SETTINGS_ID));
|
|
32
|
-
|
|
33
|
-
const initialValue = result.current;
|
|
34
|
-
await waitFor(() => {
|
|
35
|
-
expect(result.current).not.toBe(initialValue);
|
|
36
|
-
});
|
|
37
|
-
await result.current.onAttachmentDelete(AssetDummy.with(1));
|
|
38
|
-
await waitFor(() => {
|
|
39
|
-
expect(result.current.attachments).toHaveLength(2);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should replace the attachment in the same position', async () => {
|
|
44
|
-
const STUB_WITH_THREE_ASSETS = getAppBridgeBlockStub({
|
|
45
|
-
blockId: 2,
|
|
46
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1), AssetDummy.with(2), AssetDummy.with(3)] },
|
|
47
|
-
});
|
|
48
|
-
const { result } = renderHook(() => useAttachments(STUB_WITH_THREE_ASSETS, MOCK_SETTINGS_ID));
|
|
49
|
-
const initialValue = result.current;
|
|
50
|
-
await waitFor(() => {
|
|
51
|
-
expect(result.current).not.toBe(initialValue);
|
|
52
|
-
});
|
|
53
|
-
await result.current.onAttachmentReplace(AssetDummy.with(2), AssetDummy.with(10));
|
|
54
|
-
await waitFor(() => {
|
|
55
|
-
expect(result.current.attachments[1].id).toBe(10);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should reorder the attachments', async () => {
|
|
60
|
-
const STUB_WITH_THREE_ASSETS = getAppBridgeBlockStub({
|
|
61
|
-
blockId: 2,
|
|
62
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1), AssetDummy.with(2), AssetDummy.with(3)] },
|
|
63
|
-
});
|
|
64
|
-
const { result } = renderHook(() => useAttachments(STUB_WITH_THREE_ASSETS, MOCK_SETTINGS_ID));
|
|
65
|
-
const initialValue = result.current;
|
|
66
|
-
await waitFor(() => {
|
|
67
|
-
expect(result.current).not.toBe(initialValue);
|
|
68
|
-
});
|
|
69
|
-
await result.current.onAttachmentsSorted([AssetDummy.with(3), AssetDummy.with(2), AssetDummy.with(1)]);
|
|
70
|
-
await waitFor(() => {
|
|
71
|
-
expect(result.current.attachments[0].id).toBe(3);
|
|
72
|
-
expect(result.current.attachments[1].id).toBe(2);
|
|
73
|
-
expect(result.current.attachments[2].id).toBe(1);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('useAttachmentsContext', () => {
|
|
79
|
-
it('should throw an error when not a child of a provider', async () => {
|
|
80
|
-
expect(() => renderHook(() => useAttachmentsContext())).toThrowError();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should return correct info', async () => {
|
|
84
|
-
const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
|
|
85
|
-
blockId: 1,
|
|
86
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1)] },
|
|
87
|
-
});
|
|
88
|
-
const { result } = renderHook(useAttachmentsContext, {
|
|
89
|
-
wrapper: ({ children }) => (
|
|
90
|
-
<AttachmentsProvider appBridge={STUB_WITH_NO_ASSETS} assetId={MOCK_SETTINGS_ID}>
|
|
91
|
-
{children}
|
|
92
|
-
</AttachmentsProvider>
|
|
93
|
-
),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
expect(result.current.appBridge).toEqual(STUB_WITH_NO_ASSETS);
|
|
97
|
-
await waitFor(() => {
|
|
98
|
-
expect(result.current.attachments).toHaveLength(1);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('withAttachmentsProvider', () => {
|
|
104
|
-
it('should provide correct info to context consumer', async () => {
|
|
105
|
-
const STUB_WITH_THREE_ASSETS = getAppBridgeBlockStub({
|
|
106
|
-
blockId: 2,
|
|
107
|
-
blockAssets: { [MOCK_SETTINGS_ID]: [AssetDummy.with(1), AssetDummy.with(2), AssetDummy.with(3)] },
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
const Component = withAttachmentsProvider(() => {
|
|
111
|
-
const context = useAttachmentsContext();
|
|
112
|
-
return (
|
|
113
|
-
<ul>
|
|
114
|
-
{context.attachments.map((attachment) => (
|
|
115
|
-
<li key={attachment.id} data-test-id="item-test">
|
|
116
|
-
{attachment.id}
|
|
117
|
-
</li>
|
|
118
|
-
))}
|
|
119
|
-
</ul>
|
|
120
|
-
);
|
|
121
|
-
}, MOCK_SETTINGS_ID);
|
|
122
|
-
|
|
123
|
-
const { getAllByTestId } = render(<Component appBridge={STUB_WITH_THREE_ASSETS} />);
|
|
124
|
-
|
|
125
|
-
await waitFor(() => expect(getAllByTestId('item-test')).toHaveLength(3));
|
|
126
|
-
});
|
|
127
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { AppBridgeBlock, Asset, useBlockAssets } from '@frontify/app-bridge';
|
|
4
|
-
import { type ReactNode, createContext, useContext } from 'react';
|
|
5
|
-
|
|
6
|
-
import { type BlockProps } from '../index';
|
|
7
|
-
|
|
8
|
-
export const useAttachments = (appBridge: AppBridgeBlock, attachmentKey: string) => {
|
|
9
|
-
const { blockAssets, addAssetIdsToKey, deleteAssetIdsFromKey, updateAssetIdsFromKey } = useBlockAssets(appBridge);
|
|
10
|
-
const attachments = blockAssets?.[attachmentKey] || [];
|
|
11
|
-
|
|
12
|
-
const onAttachmentsAdd = async (newAssets: Asset[]) => {
|
|
13
|
-
await addAssetIdsToKey(
|
|
14
|
-
attachmentKey,
|
|
15
|
-
newAssets.map((asset) => asset.id),
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const onAttachmentDelete = async (assetToDelete: Asset) => {
|
|
20
|
-
await deleteAssetIdsFromKey(attachmentKey, [assetToDelete.id]);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const onAttachmentReplace = async (attachmentToReplace: Asset, newAsset: Asset) => {
|
|
24
|
-
const newAssetIds = attachments.map((attachment) =>
|
|
25
|
-
attachment.id === attachmentToReplace.id ? newAsset.id : attachment.id,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
await updateAssetIdsFromKey(attachmentKey, newAssetIds);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const onAttachmentsSorted = async (assets: Asset[]) => {
|
|
32
|
-
const newAssetIds = assets.map((asset) => asset.id);
|
|
33
|
-
|
|
34
|
-
await updateAssetIdsFromKey(attachmentKey, newAssetIds);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
onAttachmentsAdd,
|
|
39
|
-
onAttachmentDelete,
|
|
40
|
-
onAttachmentReplace,
|
|
41
|
-
onAttachmentsSorted,
|
|
42
|
-
attachments,
|
|
43
|
-
appBridge,
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const AttachmentsContext = createContext<ReturnType<typeof useAttachments> | null>(null);
|
|
48
|
-
|
|
49
|
-
export const AttachmentsProvider = ({
|
|
50
|
-
appBridge,
|
|
51
|
-
children,
|
|
52
|
-
assetId,
|
|
53
|
-
}: {
|
|
54
|
-
appBridge: AppBridgeBlock;
|
|
55
|
-
children: ReactNode;
|
|
56
|
-
assetId: string;
|
|
57
|
-
}) => {
|
|
58
|
-
const attachmentContext = useAttachments(appBridge, assetId);
|
|
59
|
-
|
|
60
|
-
return <AttachmentsContext.Provider value={attachmentContext}>{children}</AttachmentsContext.Provider>;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const useAttachmentsContext = () => {
|
|
64
|
-
const context = useContext(AttachmentsContext);
|
|
65
|
-
|
|
66
|
-
if (!context) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
"No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC",
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return context;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Block-level HOC for cases when there is only one attachment asset field related to the block.
|
|
77
|
-
* Recommended for most cases.
|
|
78
|
-
* If finer control is required over attachments, use {@link AttachmentsProvider} component.
|
|
79
|
-
*/
|
|
80
|
-
export const withAttachmentsProvider = <T extends BlockProps>(Component: (props: T) => ReactNode, assetId: string) => {
|
|
81
|
-
const wrappedComponent = (props: T) => (
|
|
82
|
-
<AttachmentsProvider appBridge={props.appBridge} assetId={assetId}>
|
|
83
|
-
<Component {...props} />
|
|
84
|
-
</AttachmentsProvider>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
wrappedComponent.displayName = 'withAttachmentsProvider';
|
|
88
|
-
|
|
89
|
-
return wrappedComponent;
|
|
90
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { renderHook } from '@testing-library/react';
|
|
4
|
-
import { useDndSensors } from './useDndSensors';
|
|
5
|
-
import { describe, expect, it } from 'vitest';
|
|
6
|
-
import { KeyboardSensorOptions } from '@dnd-kit/core';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @vitest-environment happy-dom
|
|
10
|
-
*/
|
|
11
|
-
describe('useDndSensors', () => {
|
|
12
|
-
it('should create a PointerSensor and a KeyboardSensor with a coordinate getter function and custom keyboardCodes', () => {
|
|
13
|
-
const { result } = renderHook(() => useDndSensors());
|
|
14
|
-
expect(result.current.length).toBe(2);
|
|
15
|
-
expect(result.current[0].sensor.name).toBe('PointerSensor');
|
|
16
|
-
expect(result.current[1].sensor.name).toBe('KeyboardSensor');
|
|
17
|
-
expect(typeof (result.current[1].options as KeyboardSensorOptions).coordinateGetter).toBe('function');
|
|
18
|
-
expect((result.current[1].options as KeyboardSensorOptions).keyboardCodes).toEqual({
|
|
19
|
-
start: ['Space', 'Enter'],
|
|
20
|
-
cancel: [],
|
|
21
|
-
end: ['Space', 'Enter', 'Escape'],
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should create a PointerSensor and a KeyboardSensor with a coordinate getter with columnGap', () => {
|
|
26
|
-
const { result } = renderHook(() => useDndSensors(100));
|
|
27
|
-
expect(result.current.length).toBe(2);
|
|
28
|
-
expect(result.current[0].sensor.name).toBe('PointerSensor');
|
|
29
|
-
expect(result.current[1].sensor.name).toBe('KeyboardSensor');
|
|
30
|
-
expect(typeof (result.current[1].options as KeyboardSensorOptions).coordinateGetter).toBe('function');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should create a PointerSensor and a KeyboardSensor with a coordinate getter with columnGap and rowGap', () => {
|
|
34
|
-
const { result } = renderHook(() => useDndSensors(100, 150));
|
|
35
|
-
expect(result.current.length).toBe(2);
|
|
36
|
-
expect(result.current[0].sensor.name).toBe('PointerSensor');
|
|
37
|
-
expect(result.current[1].sensor.name).toBe('KeyboardSensor');
|
|
38
|
-
expect(typeof (result.current[1].options as KeyboardSensorOptions).coordinateGetter).toBe('function');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
4
|
-
import { customCoordinatesGetterFactory } from '../helpers/customCoordinatesGetterFactory';
|
|
5
|
-
|
|
6
|
-
const keyboardCodes = {
|
|
7
|
-
start: ['Space', 'Enter'],
|
|
8
|
-
cancel: [],
|
|
9
|
-
end: ['Space', 'Enter', 'Escape'],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const useDndSensors = (columnGap = 0, rowGap = 0) => {
|
|
13
|
-
const customCoordinatesGetter = customCoordinatesGetterFactory(columnGap, rowGap);
|
|
14
|
-
const sensors = useSensors(
|
|
15
|
-
useSensor(PointerSensor),
|
|
16
|
-
useSensor(KeyboardSensor, {
|
|
17
|
-
coordinateGetter: customCoordinatesGetter,
|
|
18
|
-
keyboardCodes,
|
|
19
|
-
}),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return sensors;
|
|
23
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import './styles.css';
|
|
4
|
-
|
|
5
|
-
import type { FC } from 'react';
|
|
6
|
-
import type { AppBridgeBlock } from '@frontify/app-bridge';
|
|
7
|
-
import type {
|
|
8
|
-
AssetInputBlock as AssetInputBlockSidebarSettings,
|
|
9
|
-
BaseBlock as BaseBlockSidebarSettings,
|
|
10
|
-
Bundle as BundleSidebarSettings,
|
|
11
|
-
ChecklistBlock as ChecklistBlockSidebarSettings,
|
|
12
|
-
ChoicesType as ChoicesTypeSidebarSettings,
|
|
13
|
-
ColorInputBlock as ColorInputBlockSidebarSettings,
|
|
14
|
-
DropdownBlock as DropdownBlockSidebarSettings,
|
|
15
|
-
DynamicSettingBlock as DynamicSettingBlockSidebarSettings,
|
|
16
|
-
DynamicSupportedBlock as DynamicSupportedBlockSidebarSettings,
|
|
17
|
-
FontInputBlock as FontInputBlockSidebarSettings,
|
|
18
|
-
InputBlock as InputBlockSidebarSettings,
|
|
19
|
-
LegacyAssetInputBlock as LegacyAssetInputBlockSidebarSettings,
|
|
20
|
-
LinkBlock as LinkBlockSidebarSettings,
|
|
21
|
-
LinkChooserBlock as LinkChooserBlockSidebarSettings,
|
|
22
|
-
MultiInputBlock as MultiInputBlockSidebarSettings,
|
|
23
|
-
NotificationBlock as NotificationBlockSidebarSettings,
|
|
24
|
-
SectionHeadingBlock as SectionHeadingBlockSidebarSettings,
|
|
25
|
-
SegmentedControlsBlock as SegmentedControlsBlockSidebarSettings,
|
|
26
|
-
SettingBlock as SettingBlockSidebarSettings,
|
|
27
|
-
SimpleSettingBlock as SimpleSettingBlockSidebarSettings,
|
|
28
|
-
SwitchBlock as SwitchBlockSidebarSettings,
|
|
29
|
-
TemplateInputBlock as TemplateInputBlockSidebarSettings,
|
|
30
|
-
TextareaBlock as TextareaBlockSidebarSettings,
|
|
31
|
-
ValueOrPromisedValue as ValueOrPromisedValueSidebarSettings,
|
|
32
|
-
} from '@frontify/sidebar-settings';
|
|
33
|
-
|
|
34
|
-
export * from '@frontify/sidebar-settings';
|
|
35
|
-
|
|
36
|
-
export type AssetInputBlock = AssetInputBlockSidebarSettings<AppBridgeBlock>;
|
|
37
|
-
export type BaseBlock<T = undefined> = BaseBlockSidebarSettings<AppBridgeBlock, T>;
|
|
38
|
-
export type Bundle = BundleSidebarSettings<AppBridgeBlock>;
|
|
39
|
-
export type ChecklistBlock = ChecklistBlockSidebarSettings<AppBridgeBlock>;
|
|
40
|
-
export type ChoicesType = ChoicesTypeSidebarSettings<AppBridgeBlock>;
|
|
41
|
-
export type ColorInputBlock = ColorInputBlockSidebarSettings<AppBridgeBlock>;
|
|
42
|
-
export type DropdownBlock = DropdownBlockSidebarSettings<AppBridgeBlock>;
|
|
43
|
-
export type DynamicSettingBlock<Block extends DynamicSupportedBlock = DynamicSupportedBlock> =
|
|
44
|
-
DynamicSettingBlockSidebarSettings<AppBridgeBlock, Block>;
|
|
45
|
-
export type DynamicSupportedBlock = DynamicSupportedBlockSidebarSettings<AppBridgeBlock>;
|
|
46
|
-
export type FontInputBlock = FontInputBlockSidebarSettings<AppBridgeBlock>;
|
|
47
|
-
export type InputBlock = InputBlockSidebarSettings<AppBridgeBlock>;
|
|
48
|
-
export type LegacyAssetInputBlock = LegacyAssetInputBlockSidebarSettings<AppBridgeBlock>;
|
|
49
|
-
export type LinkBlock = LinkBlockSidebarSettings<AppBridgeBlock>;
|
|
50
|
-
export type LinkChooserBlock = LinkChooserBlockSidebarSettings<AppBridgeBlock>;
|
|
51
|
-
export type MultiInputBlock = MultiInputBlockSidebarSettings<AppBridgeBlock>;
|
|
52
|
-
export type NotificationBlock = NotificationBlockSidebarSettings<AppBridgeBlock>;
|
|
53
|
-
export type SectionHeadingBlock = SectionHeadingBlockSidebarSettings<AppBridgeBlock>;
|
|
54
|
-
export type SegmentedControlsBlock = SegmentedControlsBlockSidebarSettings<AppBridgeBlock>;
|
|
55
|
-
export type SettingBlock = SettingBlockSidebarSettings<AppBridgeBlock>;
|
|
56
|
-
export type SimpleSettingBlock = SimpleSettingBlockSidebarSettings<AppBridgeBlock>;
|
|
57
|
-
export type SwitchBlock = SwitchBlockSidebarSettings<AppBridgeBlock>;
|
|
58
|
-
export type TemplateInputBlock = TemplateInputBlockSidebarSettings<AppBridgeBlock>;
|
|
59
|
-
export type TextareaBlock = TextareaBlockSidebarSettings<AppBridgeBlock>;
|
|
60
|
-
export type ValueOrPromisedValue<T> = ValueOrPromisedValueSidebarSettings<AppBridgeBlock, T>;
|
|
61
|
-
|
|
62
|
-
export enum Sections {
|
|
63
|
-
Main = 'main',
|
|
64
|
-
Basics = 'basics',
|
|
65
|
-
Layout = 'layout',
|
|
66
|
-
Style = 'style',
|
|
67
|
-
Security = 'security',
|
|
68
|
-
Targets = 'targets',
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type BlockSettingsStructureExport = {
|
|
72
|
-
[Sections.Main]?: SettingBlock[];
|
|
73
|
-
[Sections.Basics]?: SettingBlock[];
|
|
74
|
-
[Sections.Layout]?: SettingBlock[];
|
|
75
|
-
[Sections.Style]?: SettingBlock[];
|
|
76
|
-
[Sections.Security]?: SettingBlock[];
|
|
77
|
-
} & { [customSectionName: string]: SettingBlock[] };
|
|
78
|
-
|
|
79
|
-
export type BlockProps = {
|
|
80
|
-
/**
|
|
81
|
-
* The Frontify App Bridge provides an interface to the Frontify app internals.
|
|
82
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks/introducing-the-app-bridge}
|
|
83
|
-
*/
|
|
84
|
-
appBridge: AppBridgeBlock;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export type BlockConfigExport = {
|
|
88
|
-
/**
|
|
89
|
-
* Block component to render.
|
|
90
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/content-blocks}
|
|
91
|
-
*/
|
|
92
|
-
block: FC<BlockProps>;
|
|
93
|
-
/**
|
|
94
|
-
* Contains the block settings and its structure.
|
|
95
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-settings-1}
|
|
96
|
-
*/
|
|
97
|
-
settings: ReturnType<typeof defineSettings>;
|
|
98
|
-
/**
|
|
99
|
-
* Block lifecycle hook ran before the block gets added in the Guideline.
|
|
100
|
-
* The hook support both synchronous or asynchronous execution.
|
|
101
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-creation}
|
|
102
|
-
*/
|
|
103
|
-
onBlockCreated?:
|
|
104
|
-
| (({ appBridge }: { appBridge: AppBridgeBlock }) => void)
|
|
105
|
-
| (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);
|
|
106
|
-
/**
|
|
107
|
-
* Block lifecycle hook ran before the block gets deleted from the Guideline.
|
|
108
|
-
* The hook support both synchronous or asynchronous execution.
|
|
109
|
-
* {@link https://developer.frontify.com/d/XFPCrGNrXQQM/content-blocks#/details-concepts-1/block-lifecycle/on-block-deletion}
|
|
110
|
-
*/
|
|
111
|
-
onBlockDeleted?:
|
|
112
|
-
| (({ appBridge }: { appBridge: AppBridgeBlock }) => void)
|
|
113
|
-
| (({ appBridge }: { appBridge: AppBridgeBlock }) => Promise<void>);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Type helper to make it easier to export a theme, accepts a direct {@link BlockConfigExport} object.
|
|
118
|
-
*/
|
|
119
|
-
export const defineBlock = (config: BlockConfigExport): BlockConfigExport => config;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Type helper to make it easier to export block's settings structure, accepts a direct {@link BlockSettingsStructureExport} object
|
|
123
|
-
* or a function return a direct {@link BlockSettingsStructureExport} or a function returning a Promise of {@link BlockSettingsStructureExport}.
|
|
124
|
-
*/
|
|
125
|
-
export const defineSettings = <
|
|
126
|
-
T extends
|
|
127
|
-
| BlockSettingsStructureExport
|
|
128
|
-
| (() => Promise<BlockSettingsStructureExport>)
|
|
129
|
-
| (() => BlockSettingsStructureExport),
|
|
130
|
-
>(
|
|
131
|
-
settingsStructure: T,
|
|
132
|
-
): T => settingsStructure;
|
|
133
|
-
|
|
134
|
-
export * from './components';
|
|
135
|
-
export * from './helpers';
|
|
136
|
-
export * from './hooks';
|
|
137
|
-
export * from './settings';
|
|
138
|
-
export * from './utilities';
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { getBackgroundSettings } from './background';
|
|
5
|
-
|
|
6
|
-
describe('getBackgroundSettings', () => {
|
|
7
|
-
it('should return background settings without arguments', () => {
|
|
8
|
-
expect(getBackgroundSettings()).toEqual({
|
|
9
|
-
id: 'hasBackground',
|
|
10
|
-
label: 'Background',
|
|
11
|
-
type: 'switch',
|
|
12
|
-
defaultValue: false,
|
|
13
|
-
on: [
|
|
14
|
-
{
|
|
15
|
-
id: 'backgroundColor',
|
|
16
|
-
defaultValue: {
|
|
17
|
-
red: 241,
|
|
18
|
-
green: 241,
|
|
19
|
-
blue: 241,
|
|
20
|
-
alpha: 1,
|
|
21
|
-
},
|
|
22
|
-
type: 'colorInput',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should return background settings with id', () => {
|
|
29
|
-
expect(getBackgroundSettings({ id: 'Test' })).toEqual({
|
|
30
|
-
id: 'hasBackgroundTest',
|
|
31
|
-
label: 'Background',
|
|
32
|
-
type: 'switch',
|
|
33
|
-
defaultValue: false,
|
|
34
|
-
on: [
|
|
35
|
-
{
|
|
36
|
-
id: 'backgroundColorTest',
|
|
37
|
-
defaultValue: {
|
|
38
|
-
red: 241,
|
|
39
|
-
green: 241,
|
|
40
|
-
blue: 241,
|
|
41
|
-
alpha: 1,
|
|
42
|
-
},
|
|
43
|
-
type: 'colorInput',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return background settings with default value', () => {
|
|
50
|
-
expect(getBackgroundSettings({ defaultValue: true })).toEqual({
|
|
51
|
-
id: 'hasBackground',
|
|
52
|
-
label: 'Background',
|
|
53
|
-
type: 'switch',
|
|
54
|
-
defaultValue: true,
|
|
55
|
-
on: [
|
|
56
|
-
{
|
|
57
|
-
id: 'backgroundColor',
|
|
58
|
-
defaultValue: {
|
|
59
|
-
red: 241,
|
|
60
|
-
green: 241,
|
|
61
|
-
blue: 241,
|
|
62
|
-
alpha: 1,
|
|
63
|
-
},
|
|
64
|
-
type: 'colorInput',
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should return background settings with default color', () => {
|
|
71
|
-
expect(getBackgroundSettings({ defaultColor: { red: 0, green: 0, blue: 0, alpha: 1 } })).toEqual({
|
|
72
|
-
id: 'hasBackground',
|
|
73
|
-
label: 'Background',
|
|
74
|
-
type: 'switch',
|
|
75
|
-
defaultValue: false,
|
|
76
|
-
on: [
|
|
77
|
-
{
|
|
78
|
-
id: 'backgroundColor',
|
|
79
|
-
defaultValue: {
|
|
80
|
-
red: 0,
|
|
81
|
-
green: 0,
|
|
82
|
-
blue: 0,
|
|
83
|
-
alpha: 1,
|
|
84
|
-
},
|
|
85
|
-
type: 'colorInput',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should return background settings with id, default value and default color', () => {
|
|
92
|
-
expect(
|
|
93
|
-
getBackgroundSettings({
|
|
94
|
-
id: 'Test',
|
|
95
|
-
defaultValue: true,
|
|
96
|
-
defaultColor: { red: 0, green: 0, blue: 0, alpha: 1 },
|
|
97
|
-
}),
|
|
98
|
-
).toEqual({
|
|
99
|
-
id: 'hasBackgroundTest',
|
|
100
|
-
label: 'Background',
|
|
101
|
-
type: 'switch',
|
|
102
|
-
defaultValue: true,
|
|
103
|
-
on: [
|
|
104
|
-
{
|
|
105
|
-
id: 'backgroundColorTest',
|
|
106
|
-
defaultValue: {
|
|
107
|
-
red: 0,
|
|
108
|
-
green: 0,
|
|
109
|
-
blue: 0,
|
|
110
|
-
alpha: 1,
|
|
111
|
-
},
|
|
112
|
-
type: 'colorInput',
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('should return background settings with switch label', () => {
|
|
119
|
-
expect(getBackgroundSettings({ switchLabel: 'Test' })).toEqual({
|
|
120
|
-
id: 'hasBackground',
|
|
121
|
-
label: 'Background',
|
|
122
|
-
type: 'switch',
|
|
123
|
-
switchLabel: 'Test',
|
|
124
|
-
defaultValue: false,
|
|
125
|
-
on: [
|
|
126
|
-
{
|
|
127
|
-
id: 'backgroundColor',
|
|
128
|
-
defaultValue: {
|
|
129
|
-
red: 241,
|
|
130
|
-
green: 241,
|
|
131
|
-
blue: 241,
|
|
132
|
-
alpha: 1,
|
|
133
|
-
},
|
|
134
|
-
type: 'colorInput',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
it('should not return default color if hasDefaultColor is false', () => {
|
|
140
|
-
expect(getBackgroundSettings({ preventDefaultColor: true })).toEqual({
|
|
141
|
-
id: 'hasBackground',
|
|
142
|
-
label: 'Background',
|
|
143
|
-
type: 'switch',
|
|
144
|
-
defaultValue: false,
|
|
145
|
-
on: [
|
|
146
|
-
{
|
|
147
|
-
id: 'backgroundColor',
|
|
148
|
-
type: 'colorInput',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('should return default color if hasDefaultColor is true', () => {
|
|
154
|
-
expect(getBackgroundSettings({ preventDefaultColor: false })).toEqual({
|
|
155
|
-
id: 'hasBackground',
|
|
156
|
-
label: 'Background',
|
|
157
|
-
type: 'switch',
|
|
158
|
-
defaultValue: false,
|
|
159
|
-
on: [
|
|
160
|
-
{
|
|
161
|
-
id: 'backgroundColor',
|
|
162
|
-
defaultValue: {
|
|
163
|
-
red: 241,
|
|
164
|
-
green: 241,
|
|
165
|
-
blue: 241,
|
|
166
|
-
alpha: 1,
|
|
167
|
-
},
|
|
168
|
-
type: 'colorInput',
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|