@flozy/editor 9.5.9 → 9.6.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.
Files changed (259) hide show
  1. package/dist/Editor/ChatEditor.js +19 -26
  2. package/dist/Editor/CommonEditor.js +23 -139
  3. package/dist/Editor/DialogWrapper.js +25 -31
  4. package/dist/Editor/Editor.css +9 -13
  5. package/dist/Editor/Elements/AI/AIInput.js +3 -5
  6. package/dist/Editor/Elements/AI/CustomSelect.js +5 -9
  7. package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -4
  8. package/dist/Editor/Elements/Accordion/Accordion.js +3 -4
  9. package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +1 -4
  10. package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -6
  11. package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +1 -4
  12. package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
  13. package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +2 -6
  14. package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +1 -4
  15. package/dist/Editor/Elements/Attachments/AttachmentsButton.js +1 -4
  16. package/dist/Editor/Elements/Button/ButtonPopup.js +1 -4
  17. package/dist/Editor/Elements/Button/ButtonToolIcon.js +2 -6
  18. package/dist/Editor/Elements/Button/EditorButton.js +14 -31
  19. package/dist/Editor/Elements/Carousel/Carousel.js +4 -5
  20. package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -6
  21. package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -3
  22. package/dist/Editor/Elements/ChipText/ChipTextPopup.js +1 -4
  23. package/dist/Editor/Elements/CodeToText/CodeToText.js +4 -5
  24. package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +2 -6
  25. package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -60
  26. package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
  27. package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
  28. package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
  29. package/dist/Editor/Elements/Colorbox/ColorboxButton.js +2 -6
  30. package/dist/Editor/Elements/DataView/DataView.js +2 -5
  31. package/dist/Editor/Elements/DataView/DataViewButton.js +2 -6
  32. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +2 -7
  33. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +3 -4
  34. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -25
  35. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +2 -7
  36. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +12 -13
  37. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +4 -7
  38. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +5 -7
  39. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +7 -9
  40. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +3 -8
  41. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +3 -5
  42. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +5 -6
  43. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +3 -5
  44. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +7 -9
  45. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +38 -64
  46. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +2 -3
  47. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +2 -3
  48. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +6 -23
  49. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +1 -4
  50. package/dist/Editor/Elements/DataView/Layouts/TableView.js +4 -6
  51. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +4 -8
  52. package/dist/Editor/Elements/DataView/Layouts/index.js +1 -3
  53. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +2 -5
  54. package/dist/Editor/Elements/DataView/styles.js +0 -13
  55. package/dist/Editor/Elements/Divider/Divider.js +3 -5
  56. package/dist/Editor/Elements/Divider/DividerButton.js +2 -6
  57. package/dist/Editor/Elements/Divider/DividerPopup.js +2 -3
  58. package/dist/Editor/Elements/Embed/Embed.js +1 -4
  59. package/dist/Editor/Elements/Embed/EmbedPopup.js +1 -4
  60. package/dist/Editor/Elements/Embed/Image.js +9 -14
  61. package/dist/Editor/Elements/Embed/Video.js +6 -9
  62. package/dist/Editor/Elements/EmbedScript/Code.js +4 -7
  63. package/dist/Editor/Elements/EmbedScript/EmbedScript.js +2 -6
  64. package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +5 -8
  65. package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -6
  66. package/dist/Editor/Elements/Form/FieldPopup.js +1 -4
  67. package/dist/Editor/Elements/Form/Form.js +9 -12
  68. package/dist/Editor/Elements/Form/FormButton.js +2 -6
  69. package/dist/Editor/Elements/Form/FormPopup.js +2 -3
  70. package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -18
  71. package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +8 -13
  72. package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +2 -3
  73. package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
  74. package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -4
  75. package/dist/Editor/Elements/Form/Workflow/index.js +9 -15
  76. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +23 -67
  77. package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -23
  78. package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
  79. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +5 -36
  80. package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +2 -3
  81. package/dist/Editor/Elements/FreeGrid/Options/More.js +4 -10
  82. package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
  83. package/dist/Editor/Elements/Grid/Grid.js +10 -13
  84. package/dist/Editor/Elements/Grid/GridButton.js +5 -9
  85. package/dist/Editor/Elements/Grid/GridItem.js +8 -14
  86. package/dist/Editor/Elements/Grid/GridItemPopup.js +1 -4
  87. package/dist/Editor/Elements/Grid/GridPopup.js +1 -4
  88. package/dist/Editor/Elements/Grid/SectionPopup.js +1 -4
  89. package/dist/Editor/Elements/Link/Link.js +5 -8
  90. package/dist/Editor/Elements/Link/LinkButton.js +1 -4
  91. package/dist/Editor/Elements/List/CheckList.js +9 -14
  92. package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -6
  93. package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -4
  94. package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -4
  95. package/dist/Editor/Elements/Search/SearchButton.js +3 -6
  96. package/dist/Editor/Elements/Search/SearchList.js +3 -7
  97. package/dist/Editor/Elements/Signature/SignatureButton.js +2 -6
  98. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -6
  99. package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +1 -4
  100. package/dist/Editor/Elements/Signature/SignaturePopup.js +16 -17
  101. package/dist/Editor/Elements/SimpleText/index.js +4 -5
  102. package/dist/Editor/Elements/SimpleText/style.js +2 -2
  103. package/dist/Editor/Elements/Table/DragButton.js +2 -4
  104. package/dist/Editor/Elements/Table/Table.js +11 -23
  105. package/dist/Editor/Elements/Table/TableCell.js +24 -2
  106. package/dist/Editor/Elements/Table/TablePopup.js +1 -4
  107. package/dist/Editor/Elements/Table/TableSelector.js +6 -10
  108. package/dist/Editor/Elements/Table/TableTool.js +4 -8
  109. package/dist/Editor/Elements/Title/title.js +0 -10
  110. package/dist/Editor/Elements/TopBanner/TopBannerButton.js +1 -4
  111. package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
  112. package/dist/Editor/MiniEditor.js +3 -10
  113. package/dist/Editor/Styles/EditorStyles.js +5 -5
  114. package/dist/Editor/Toolbar/Basic/index.js +1 -2
  115. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +2 -6
  116. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
  117. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
  118. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +4 -8
  119. package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
  120. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -5
  121. package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +5 -10
  122. package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +4 -10
  123. package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +4 -10
  124. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +3 -9
  125. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +35 -42
  126. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
  127. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +51 -58
  128. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +22 -29
  129. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +87 -226
  130. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +10 -20
  131. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +5 -10
  132. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +11 -71
  133. package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
  134. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -128
  135. package/dist/Editor/Toolbar/PopupTool/index.js +17 -21
  136. package/dist/Editor/Toolbar/Toolbar.js +10 -20
  137. package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
  138. package/dist/Editor/common/ColorPickerButton.js +14 -39
  139. package/dist/Editor/common/CustomDialog/index.js +10 -8
  140. package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
  141. package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
  142. package/dist/Editor/common/Icon.js +1 -46
  143. package/dist/Editor/common/ImageSelector/ImageSelector.js +8 -10
  144. package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -6
  145. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
  146. package/dist/Editor/common/ImageSelector/Styles.js +9 -3
  147. package/dist/Editor/common/ImageSelector/UploadStyles.js +9 -9
  148. package/dist/Editor/common/LinkSettings/NavComponents.js +10 -14
  149. package/dist/Editor/common/LinkSettings/index.js +14 -20
  150. package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
  151. package/dist/Editor/common/MentionsPopup/index.js +2 -6
  152. package/dist/Editor/common/RnD/ContextMenu/CMenus.js +22 -22
  153. package/dist/Editor/common/RnD/ContextMenu/index.js +2 -3
  154. package/dist/Editor/common/RnD/ElementOptions/index.js +2 -7
  155. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +3 -8
  156. package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +3 -7
  157. package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
  158. package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
  159. package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
  160. package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
  161. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -7
  162. package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
  163. package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
  164. package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -6
  165. package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
  166. package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
  167. package/dist/Editor/common/RnD/OptionsPopup/index.js +3 -4
  168. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +4 -11
  169. package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +8 -20
  170. package/dist/Editor/common/RnD/Utils/gridDropItem.js +7 -56
  171. package/dist/Editor/common/RnD/Utils/index.js +0 -3
  172. package/dist/Editor/common/RnD/VirtualElement/index.js +105 -188
  173. package/dist/Editor/common/RnD/VirtualElement/styles.js +7 -123
  174. package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
  175. package/dist/Editor/common/RnD/index.js +14 -59
  176. package/dist/Editor/common/Section/index.js +4 -7
  177. package/dist/Editor/common/Shorthands/elements.js +3 -74
  178. package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
  179. package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
  180. package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -6
  181. package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
  182. package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
  183. package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
  184. package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +9 -13
  185. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -11
  186. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +5 -19
  187. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +10 -22
  188. package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -6
  189. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +13 -27
  190. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +14 -43
  191. package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +6 -10
  192. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +6 -19
  193. package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +2 -6
  194. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -5
  195. package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +6 -9
  196. package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +2 -8
  197. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +11 -12
  198. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -6
  199. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -8
  200. package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +2 -6
  201. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -21
  202. package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
  203. package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
  204. package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
  205. package/dist/Editor/common/StyleBuilder/index.js +5 -8
  206. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
  207. package/dist/Editor/common/Uploader.js +5 -16
  208. package/dist/Editor/commonStyle.js +12 -23
  209. package/dist/Editor/helper/index.js +15 -35
  210. package/dist/Editor/helper/theme.js +2 -202
  211. package/dist/Editor/hooks/useDrag.js +11 -17
  212. package/dist/Editor/hooks/useEditorScroll.js +6 -10
  213. package/dist/Editor/hooks/useMouseMove.js +13 -25
  214. package/dist/Editor/hooks/useTable.js +1 -1
  215. package/dist/Editor/plugins/withEmbeds.js +1 -1
  216. package/dist/Editor/plugins/withHTML.js +9 -11
  217. package/dist/Editor/plugins/withLayout.js +2 -3
  218. package/dist/Editor/plugins/withTable.js +1 -1
  219. package/dist/Editor/theme/ThemeList.js +173 -50
  220. package/dist/Editor/utils/SlateUtilityFunctions.js +49 -168
  221. package/dist/Editor/utils/draftToSlate.js +2 -3
  222. package/dist/Editor/utils/font.js +37 -40
  223. package/dist/Editor/utils/freegrid.js +2 -2
  224. package/dist/Editor/utils/helper.js +19 -90
  225. package/package.json +3 -3
  226. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -425
  227. package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -436
  228. package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
  229. package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
  230. package/dist/Editor/common/CustomColorPicker/index.js +0 -131
  231. package/dist/Editor/common/CustomColorPicker/style.js +0 -53
  232. package/dist/Editor/common/CustomDialog2/index.js +0 -94
  233. package/dist/Editor/common/CustomDialog2/style.js +0 -67
  234. package/dist/Editor/common/CustomSelect.js +0 -43
  235. package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
  236. package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -117
  237. package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -134
  238. package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -281
  239. package/dist/Editor/common/SnackBar/index.js +0 -43
  240. package/dist/Editor/helper/textIndeces.js +0 -58
  241. package/dist/Editor/hooks/useAutoScroll.js +0 -38
  242. package/dist/Editor/hooks/useEditorTheme.js +0 -153
  243. package/dist/Editor/hooks/useThemeValues.js +0 -63
  244. package/dist/Editor/theme/index.js +0 -149
  245. package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
  246. package/dist/Editor/themeSettings/buttons/index.js +0 -290
  247. package/dist/Editor/themeSettings/buttons/style.js +0 -23
  248. package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
  249. package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
  250. package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
  251. package/dist/Editor/themeSettings/fonts/index.js +0 -240
  252. package/dist/Editor/themeSettings/fonts/style.js +0 -61
  253. package/dist/Editor/themeSettings/icons.js +0 -60
  254. package/dist/Editor/themeSettings/index.js +0 -351
  255. package/dist/Editor/themeSettings/style.js +0 -220
  256. package/dist/Editor/themeSettingsAI/icons.js +0 -96
  257. package/dist/Editor/themeSettingsAI/index.js +0 -355
  258. package/dist/Editor/themeSettingsAI/saveTheme.js +0 -205
  259. package/dist/Editor/themeSettingsAI/style.js +0 -259
@@ -1,38 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- function useAutoScroll(speed = 10, scrollElementId = "slate-wrapper-scroll-container") {
3
- const scrollInterval = useRef(null);
4
- function getScrollElement() {
5
- return document.getElementById(scrollElementId) || window;
6
- }
7
- function startAutoScroll(direction) {
8
- if (scrollInterval.current) return; // Prevent multiple intervals
9
-
10
- const scrollContainer = getScrollElement();
11
- scrollInterval.current = setInterval(() => {
12
- scrollContainer.style.scrollBehavior = "auto";
13
- if (direction === "up") {
14
- scrollContainer.scrollBy(0, -speed);
15
- } else if (direction === "down") {
16
- scrollContainer.scrollBy(0, speed);
17
- scrollContainer.style.scrollBehavior = "smooth";
18
- }
19
- }, 16); // Approx 60fps
20
- }
21
-
22
- function stopAutoScroll() {
23
- if (scrollInterval.current) {
24
- clearInterval(scrollInterval.current);
25
- scrollInterval.current = null;
26
- const scrollContainer = getScrollElement();
27
- scrollContainer.style.scrollBehavior = "smooth";
28
- }
29
- }
30
- useEffect(() => {
31
- return () => stopAutoScroll(); // Cleanup on unmount
32
- }, []);
33
- return {
34
- startAutoScroll,
35
- stopAutoScroll
36
- };
37
- }
38
- export default useAutoScroll;
@@ -1,153 +0,0 @@
1
- import { useSlate } from "slate-react";
2
- import { defaultTheme } from "../theme";
3
- import { getPageSettings, updatePageSettings } from "../utils/pageSettings";
4
- import { HEADING_THEME_FIELDS, PARAGRAPH_THEME_FIELDS } from "../helper/theme";
5
- import { useEditorContext } from "./useMouseMove";
6
- const MAP_FIELDS = {
7
- HEADING: HEADING_THEME_FIELDS,
8
- PARAGRAPH: PARAGRAPH_THEME_FIELDS
9
- };
10
- const MAP_FONT_FIELD_KEYS = {
11
- HEADING: "headingFontFamily",
12
- PARAGRAPH: "paragraphFontFamily"
13
- };
14
- function getUpdatePayload(prevTheme = {}, update, actionData) {
15
- const {
16
- action,
17
- fieldName
18
- } = actionData || {};
19
- const {
20
- theme: prev
21
- } = prevTheme;
22
- let theme = {};
23
- let themeProps = {};
24
- switch (action) {
25
- case "THEME_CHANGE":
26
- theme = update;
27
- break;
28
- case "CSS_VAR_CHANGE":
29
- const prevCssVars = prev?.cssVars || {};
30
- const prevValue = prevCssVars[fieldName] || {};
31
- themeProps = {
32
- ...(prev || {}),
33
- cssVars: {
34
- ...prevCssVars,
35
- [fieldName]: {
36
- ...prevValue,
37
- ...update
38
- }
39
- }
40
- };
41
- theme = {
42
- ...prevTheme,
43
- theme: themeProps
44
- };
45
- break;
46
- case "ELEMENT_PROPS_CHANGE":
47
- const prevEleProps = prev?.elementProps || {};
48
- const prevEleValue = prevEleProps[fieldName] || {};
49
- themeProps = {
50
- ...(prev || {}),
51
- elementProps: {
52
- ...prevEleProps,
53
- [fieldName]: {
54
- ...prevEleValue,
55
- ...update
56
- }
57
- }
58
- };
59
- theme = {
60
- ...prevTheme,
61
- theme: themeProps
62
- };
63
- break;
64
- case "OTHER_PROPS_CHANGE":
65
- themeProps = {
66
- ...(prev || {}),
67
- otherProps: {
68
- ...(prev.otherProps || {}),
69
- ...update
70
- }
71
- };
72
- theme = {
73
- ...prevTheme,
74
- theme: themeProps
75
- };
76
- break;
77
- case "FONT_CHANGE":
78
- const {
79
- elementProps = {},
80
- otherProps = {}
81
- } = prev;
82
- const {
83
- fieldType
84
- } = actionData || {};
85
- const fields = MAP_FIELDS[fieldType];
86
- const fontFieldsUpdate = {};
87
- fields?.forEach(field => {
88
- const prevFieldData = elementProps[field];
89
- fontFieldsUpdate[field] = {
90
- ...prevFieldData,
91
- ...update
92
- };
93
- });
94
- const FONT_KEY_FOR_FIELD = MAP_FONT_FIELD_KEYS[fieldType];
95
- themeProps = {
96
- ...(prev || {}),
97
- elementProps: {
98
- ...elementProps,
99
- ...fontFieldsUpdate
100
- },
101
- otherProps: {
102
- ...otherProps,
103
- [FONT_KEY_FOR_FIELD]: update?.fontFamily
104
- }
105
- };
106
- theme = {
107
- ...prevTheme,
108
- theme: themeProps
109
- };
110
- break;
111
- default:
112
- theme = {
113
- ...prevTheme,
114
- ...(update || {})
115
- };
116
- break;
117
- }
118
- return theme;
119
- }
120
- const updateTheme = (editor, pageSt, update, actionData, triggerRender) => {
121
- const {
122
- pageProps
123
- } = pageSt || {};
124
- const {
125
- theme
126
- } = pageProps || {};
127
- const updatedTheme = getUpdatePayload(theme, update, actionData);
128
- updatePageSettings(editor, {
129
- ...(pageProps || {}),
130
- theme: updatedTheme
131
- });
132
- triggerRender();
133
- };
134
- export const useEditorTheme = () => {
135
- const editor = useSlate();
136
- const {
137
- triggerRender
138
- } = useEditorContext();
139
- const {
140
- element: pageSt
141
- } = getPageSettings(editor) || {};
142
- const {
143
- pageProps
144
- } = pageSt || {};
145
- const {
146
- theme
147
- } = pageProps || {};
148
- return {
149
- selectedTheme: theme?.theme || defaultTheme?.theme,
150
- updateTheme: (update, actionData) => updateTheme(editor, pageSt, update, actionData, triggerRender),
151
- theme
152
- };
153
- };
@@ -1,63 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { getElementProperty } from "../helper/theme";
3
- import { ReactEditor } from "slate-react";
4
- import { Node } from "slate";
5
- import { useEditorTheme } from "./useEditorTheme";
6
- function useThemeValues() {
7
- return {};
8
- }
9
- export default useThemeValues;
10
- export function useButtonStyle(value, key, element) {
11
- const [buttonStyle, setButtonStyle] = useState(value);
12
- const {
13
- selectedTheme
14
- } = useEditorTheme();
15
- const themeBtnProps = selectedTheme?.elementProps?.button || {};
16
- useEffect(() => {
17
- const color = getColorValue(value, key, element, themeBtnProps);
18
- setButtonStyle({
19
- color
20
- });
21
- }, [value, key, element]);
22
- return {
23
- buttonStyle
24
- };
25
- }
26
- const DEFAULT_MAP_THEMES = {
27
- textColor: "color",
28
- bgColor: "backgroundColor"
29
- };
30
- const hoverMap = (theme, format) => {
31
- const hover = theme?.hover || {};
32
- const key = DEFAULT_MAP_THEMES[format];
33
- return hover[key];
34
- };
35
- const MAP_THEME_KEYS = {
36
- ...DEFAULT_MAP_THEMES,
37
- textColorHover: hoverMap,
38
- bgColorHover: hoverMap
39
- };
40
- const getColorValue = (val, key, elementProps, themeBtnProps) => {
41
- const themeKey = MAP_THEME_KEYS[key];
42
- if (elementProps?.type === "button" && !val && themeKey) {
43
- if (typeof themeKey === "string") {
44
- return themeBtnProps[themeKey];
45
- } else {
46
- return themeKey(themeBtnProps, key);
47
- }
48
- }
49
- return val;
50
- };
51
- export function getButtonElementStyle(editor, element, stylePropertyName) {
52
- try {
53
- const path = ReactEditor.findPath(editor, element);
54
- if (path?.length) {
55
- const currentEle = Node.get(editor, path);
56
- const dom = ReactEditor.toDOMNode(editor, currentEle);
57
- const editorBtn = dom?.querySelector(".button.theme-element");
58
- return getElementProperty(editorBtn, stylePropertyName);
59
- }
60
- } catch (err) {
61
- // console.log(err);
62
- }
63
- }
@@ -1,149 +0,0 @@
1
- import { getDevice } from "../helper/theme";
2
- const themeClassName = ".theme-element";
3
- function getTextStyles(props) {
4
- const {
5
- fontSize,
6
- textDecoration,
7
- color,
8
- ...rest
9
- } = props;
10
- const device = getDevice();
11
- const fontS = typeof fontSize === "object" ? fontSize[device] : fontSize;
12
- return {
13
- ...rest,
14
- '& span[data-slate-string="true"]': {
15
- textDecoration,
16
- fontSize: fontS,
17
- color: color || "inherit"
18
- }
19
-
20
- // "&::after": {
21
- // // for placeholder
22
- // fontSize,
23
- // },
24
- };
25
- }
26
-
27
- const transformHeading = (props, elementType) => {
28
- return {
29
- [`& ${elementType}${themeClassName}`]: getTextStyles(props)
30
- };
31
- };
32
- const transformParagraph = (props, paraType) => {
33
- return {
34
- [`& p${themeClassName}.${paraType}`]: getTextStyles(props)
35
- };
36
- };
37
- const transformButton = props => {
38
- const {
39
- borderRadius,
40
- lockRadius,
41
- bannerSpacing,
42
- buttonIcon,
43
- hover,
44
- ...classProps
45
- } = props;
46
- return {
47
- [`& .button${themeClassName}`]: {
48
- ...classProps,
49
- "&:hover": hover
50
- },
51
- buttonTheme: {
52
- borderRadius,
53
- lockRadius,
54
- bannerSpacing,
55
- buttonIcon
56
- }
57
- };
58
- };
59
- const transformProps = (elementType, props) => {
60
- let transformedProp = {};
61
- let otherProps = {};
62
- switch (elementType) {
63
- case "h1":
64
- case "h2":
65
- case "h3":
66
- case "h4":
67
- case "h5":
68
- case "h6":
69
- transformedProp = transformHeading(props, elementType);
70
- break;
71
- case "para1":
72
- case "para2":
73
- case "para3":
74
- transformedProp = transformParagraph(props, elementType);
75
- break;
76
- case "button":
77
- const {
78
- buttonTheme,
79
- ...classProps
80
- } = transformButton(props, elementType);
81
- transformedProp = classProps;
82
- otherProps = {
83
- buttonTheme
84
- };
85
- break;
86
- default:
87
- }
88
- return {
89
- transformedProp,
90
- otherProps
91
- };
92
- };
93
- export const transformTheme = (selectedTheme = {}) => {
94
- let sxProps = {};
95
- let others = {};
96
- const {
97
- elementProps
98
- } = selectedTheme;
99
- if (elementProps) {
100
- Object.entries(elementProps).forEach(([key, value]) => {
101
- const {
102
- transformedProp,
103
- otherProps
104
- } = transformProps(key, value);
105
- sxProps = {
106
- ...sxProps,
107
- ...transformedProp
108
- };
109
- others = {
110
- ...others,
111
- ...otherProps
112
- };
113
- });
114
- }
115
- return {
116
- sxProps,
117
- ...others
118
- };
119
- };
120
- export const defaultTheme = {
121
- theme: {
122
- cssVars: {},
123
- elementProps: {
124
- button: {
125
- color: "#FFFFFF",
126
- background: "#2563EB",
127
- fontFamily: "PoppinsRegular",
128
- fontWeight: 400,
129
- fontSize: "inherit",
130
- borderColor: "transparent",
131
- borderRadius: {
132
- topLeft: 30,
133
- topRight: 30,
134
- bottomLeft: 30,
135
- bottomRight: 30
136
- },
137
- bannerSpacing: {
138
- left: 16,
139
- top: 8,
140
- right: 16,
141
- bottom: 8
142
- }
143
- }
144
- }
145
- }
146
- };
147
- export function getTheme(selectedTheme) {
148
- return transformTheme(selectedTheme?.theme || defaultTheme.theme);
149
- }
@@ -1,72 +0,0 @@
1
- import { Grid, Link, Typography } from "@mui/material";
2
- import { useEditorTheme } from "../hooks/useEditorTheme";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
- import { Fragment as _Fragment } from "react/jsx-runtime";
6
- function ActiveTheme(props) {
7
- const {
8
- onExplore
9
- } = props;
10
- const {
11
- theme
12
- } = useEditorTheme();
13
- const {
14
- colors = {}
15
- } = theme?.theme?.cssVars || {};
16
- const {
17
- id,
18
- name,
19
- mood_name = ""
20
- } = theme || {};
21
- const themeColors = Object.values(colors || {});
22
- return /*#__PURE__*/_jsxs(Grid, {
23
- className: "activeThemeInnner",
24
- children: [/*#__PURE__*/_jsx(Typography, {
25
- variant: "body1",
26
- className: "title activeThemeTitle",
27
- children: id ? "Active Theme" : "No theme activated"
28
- }), /*#__PURE__*/_jsxs(Grid, {
29
- className: "flexAlign",
30
- children: [/*#__PURE__*/_jsx(Typography, {
31
- variant: "body1",
32
- className: "fs-14",
33
- children: name
34
- }), /*#__PURE__*/_jsxs(Typography, {
35
- variant: "body2",
36
- className: "fs-12 textSecondary",
37
- style: {
38
- marginLeft: id ? "4px" : "0px"
39
- },
40
- children: [id ? ` - ` : null, id ? mood_name : "Select 'Explore More' to activate a theme and customize your design."]
41
- })]
42
- }), /*#__PURE__*/_jsxs(Grid, {
43
- container: true,
44
- justifyContent: "space-between",
45
- alignItems: "end",
46
- sx: {
47
- mt: 1
48
- },
49
- children: [/*#__PURE__*/_jsx(Grid, {
50
- className: "flexAlign",
51
- sx: {
52
- gap: "10px"
53
- },
54
- children: id ? /*#__PURE__*/_jsx(_Fragment, {
55
- children: themeColors?.map((color, i) => {
56
- return /*#__PURE__*/_jsx(Grid, {
57
- className: "activeColorBox",
58
- style: {
59
- background: color
60
- }
61
- }, i);
62
- })
63
- }) : null
64
- }), onExplore && /*#__PURE__*/_jsx(Link, {
65
- className: "pointer fs-12 fw-500 exploreBtn",
66
- onClick: onExplore,
67
- children: "Explore More"
68
- })]
69
- })]
70
- });
71
- }
72
- export default ActiveTheme;