@gravity-ui/page-constructor 6.3.2-alpha.5 → 6.3.2-alpha.6

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 (374) hide show
  1. package/README.md +98 -10
  2. package/build/cjs/blocks/FoldableList/FoldableList.css +13 -0
  3. package/build/cjs/blocks/FoldableList/FoldableList.d.ts +3 -0
  4. package/build/cjs/blocks/FoldableList/FoldableList.js +31 -0
  5. package/build/cjs/blocks/FoldableList/FoldableList.js.map +1 -0
  6. package/build/cjs/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.css +78 -0
  7. package/build/cjs/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.d.ts +2 -0
  8. package/build/cjs/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.js +20 -0
  9. package/build/cjs/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.js.map +1 -0
  10. package/build/cjs/blocks/FoldableList/schema.d.ts +140 -0
  11. package/build/cjs/blocks/FoldableList/schema.js +39 -0
  12. package/build/cjs/blocks/FoldableList/schema.js.map +1 -0
  13. package/build/cjs/blocks/Header/Header.css +12 -1
  14. package/build/cjs/blocks/Header/Header.js +4 -1
  15. package/build/cjs/blocks/Header/Header.js.map +1 -1
  16. package/build/cjs/blocks/Header/schema.d.ts +10 -0
  17. package/build/cjs/blocks/Header/schema.js +5 -0
  18. package/build/cjs/blocks/Header/schema.js.map +1 -1
  19. package/build/cjs/blocks/HeaderSlider/schema.d.ts +5 -0
  20. package/build/cjs/blocks/Slider/Slider.js +4 -1
  21. package/build/cjs/blocks/Slider/Slider.js.map +1 -1
  22. package/build/cjs/blocks/index.d.ts +1 -0
  23. package/build/cjs/blocks/index.js +3 -1
  24. package/build/cjs/blocks/index.js.map +1 -1
  25. package/build/cjs/common/store.d.ts +1 -0
  26. package/build/cjs/common/store.js +1 -0
  27. package/build/cjs/common/store.js.map +1 -1
  28. package/build/cjs/common/types/forms.d.ts +12 -1
  29. package/build/cjs/common/types/forms.js.map +1 -1
  30. package/build/cjs/components/FullscreenImage/FullscreenImage.css +1 -1
  31. package/build/cjs/components/ReactPlayer/ReactPlayer.js +4 -1
  32. package/build/cjs/components/ReactPlayer/ReactPlayer.js.map +1 -1
  33. package/build/cjs/constructor-items.d.ts +1 -0
  34. package/build/cjs/constructor-items.js +4 -4
  35. package/build/cjs/constructor-items.js.map +1 -1
  36. package/build/cjs/containers/PageConstructor/PageConstructor.js +18 -1
  37. package/build/cjs/containers/PageConstructor/PageConstructor.js.map +1 -1
  38. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js +8 -1
  39. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -1
  40. package/build/cjs/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.css +6 -0
  41. package/build/cjs/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.d.ts +9 -0
  42. package/build/cjs/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.js +35 -0
  43. package/build/cjs/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.js.map +1 -0
  44. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.css +30 -0
  45. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js +9 -7
  46. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -1
  47. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.d.ts +2 -1
  48. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js +26 -4
  49. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js.map +1 -1
  50. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js +2 -2
  51. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -1
  52. package/build/cjs/editor-v2/hooks/useEditorTabs.js +2 -2
  53. package/build/cjs/editor-v2/hooks/useEditorTabs.js.map +1 -1
  54. package/build/cjs/editor-v2/store.d.ts +1 -0
  55. package/build/cjs/editor-v2/store.js +3 -0
  56. package/build/cjs/editor-v2/store.js.map +1 -1
  57. package/build/cjs/hooks/usePCEditorBlockMouseEvents.d.ts +1 -0
  58. package/build/cjs/hooks/usePCEditorBlockMouseEvents.js +1 -0
  59. package/build/cjs/hooks/usePCEditorBlockMouseEvents.js.map +1 -1
  60. package/build/cjs/hooks/usePCEditorItemWrap.d.ts +1 -0
  61. package/build/cjs/internal-typings/global.d.ts +1 -0
  62. package/build/cjs/models/constructor-items/blocks.d.ts +19 -1
  63. package/build/cjs/models/constructor-items/blocks.js +1 -0
  64. package/build/cjs/models/constructor-items/blocks.js.map +1 -1
  65. package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -1
  66. package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
  67. package/build/cjs/navigation/schema.d.ts +2 -0
  68. package/build/cjs/navigation/schema.js +12 -3
  69. package/build/cjs/navigation/schema.js.map +1 -1
  70. package/build/cjs/schema/constants.js +1 -0
  71. package/build/cjs/schema/constants.js.map +1 -1
  72. package/build/cjs/schema/index.d.ts +2 -0
  73. package/build/cjs/schema/validators/blocks.d.ts +1 -0
  74. package/build/cjs/schema/validators/blocks.js +1 -0
  75. package/build/cjs/schema/validators/blocks.js.map +1 -1
  76. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  77. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +5 -1
  78. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js.map +1 -1
  79. package/build/cjs/sub-blocks/HubspotForm/index.js +2 -2
  80. package/build/cjs/sub-blocks/HubspotForm/index.js.map +1 -1
  81. package/build/cjs/sub-blocks/HubspotForm/setHubspotDefaultValues.d.ts +2 -0
  82. package/build/cjs/sub-blocks/HubspotForm/setHubspotDefaultValues.js +51 -0
  83. package/build/cjs/sub-blocks/HubspotForm/setHubspotDefaultValues.js.map +1 -0
  84. package/build/cjs/text-transform/config.js +25 -1
  85. package/build/cjs/text-transform/config.js.map +1 -1
  86. package/build/cjs/utils/form-generator.js +27 -0
  87. package/build/cjs/utils/form-generator.js.map +1 -1
  88. package/build/cjs/utils/hubspot.d.ts +1 -0
  89. package/build/cjs/utils/hubspot.js.map +1 -1
  90. package/build/esm/blocks/FoldableList/FoldableList.css +13 -0
  91. package/build/esm/blocks/FoldableList/FoldableList.d.ts +4 -0
  92. package/build/esm/blocks/FoldableList/FoldableList.js +29 -0
  93. package/build/esm/blocks/FoldableList/FoldableList.js.map +1 -0
  94. package/build/esm/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.css +78 -0
  95. package/build/esm/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.d.ts +3 -0
  96. package/build/esm/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.js +16 -0
  97. package/build/esm/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.js.map +1 -0
  98. package/build/esm/blocks/FoldableList/schema.d.ts +140 -0
  99. package/build/esm/blocks/FoldableList/schema.js +35 -0
  100. package/build/esm/blocks/FoldableList/schema.js.map +1 -0
  101. package/build/esm/blocks/Header/Header.css +12 -1
  102. package/build/esm/blocks/Header/Header.js +4 -1
  103. package/build/esm/blocks/Header/Header.js.map +1 -1
  104. package/build/esm/blocks/Header/schema.d.ts +10 -0
  105. package/build/esm/blocks/Header/schema.js +5 -0
  106. package/build/esm/blocks/Header/schema.js.map +1 -1
  107. package/build/esm/blocks/HeaderSlider/schema.d.ts +5 -0
  108. package/build/esm/blocks/Slider/Slider.js +4 -1
  109. package/build/esm/blocks/Slider/Slider.js.map +1 -1
  110. package/build/esm/blocks/index.d.ts +1 -0
  111. package/build/esm/blocks/index.js +1 -0
  112. package/build/esm/blocks/index.js.map +1 -1
  113. package/build/esm/common/store.d.ts +1 -0
  114. package/build/esm/common/store.js +1 -0
  115. package/build/esm/common/store.js.map +1 -1
  116. package/build/esm/common/types/forms.d.ts +12 -1
  117. package/build/esm/common/types/forms.js.map +1 -1
  118. package/build/esm/components/FullscreenImage/FullscreenImage.css +1 -1
  119. package/build/esm/components/ReactPlayer/ReactPlayer.js +4 -1
  120. package/build/esm/components/ReactPlayer/ReactPlayer.js.map +1 -1
  121. package/build/esm/constructor-items.d.ts +1 -0
  122. package/build/esm/constructor-items.js +5 -5
  123. package/build/esm/constructor-items.js.map +1 -1
  124. package/build/esm/containers/PageConstructor/PageConstructor.js +18 -1
  125. package/build/esm/containers/PageConstructor/PageConstructor.js.map +1 -1
  126. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js +8 -1
  127. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -1
  128. package/build/esm/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.css +6 -0
  129. package/build/esm/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.d.ts +10 -0
  130. package/build/esm/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.js +33 -0
  131. package/build/esm/editor-v2/components/DynamicForm/Fields/AnyOf/AnyOf.js.map +1 -0
  132. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.css +30 -0
  133. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js +10 -8
  134. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -1
  135. package/build/esm/editor-v2/containers/SourceCode/SourceCode.d.ts +2 -1
  136. package/build/esm/editor-v2/containers/SourceCode/SourceCode.js +26 -4
  137. package/build/esm/editor-v2/containers/SourceCode/SourceCode.js.map +1 -1
  138. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js +3 -3
  139. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -1
  140. package/build/esm/editor-v2/hooks/useEditorTabs.js +2 -2
  141. package/build/esm/editor-v2/hooks/useEditorTabs.js.map +1 -1
  142. package/build/esm/editor-v2/store.d.ts +1 -0
  143. package/build/esm/editor-v2/store.js +3 -0
  144. package/build/esm/editor-v2/store.js.map +1 -1
  145. package/build/esm/hooks/usePCEditorBlockMouseEvents.d.ts +1 -0
  146. package/build/esm/hooks/usePCEditorBlockMouseEvents.js +1 -0
  147. package/build/esm/hooks/usePCEditorBlockMouseEvents.js.map +1 -1
  148. package/build/esm/hooks/usePCEditorItemWrap.d.ts +1 -0
  149. package/build/esm/internal-typings/global.d.ts +1 -0
  150. package/build/esm/models/constructor-items/blocks.d.ts +19 -1
  151. package/build/esm/models/constructor-items/blocks.js +1 -0
  152. package/build/esm/models/constructor-items/blocks.js.map +1 -1
  153. package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -1
  154. package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
  155. package/build/esm/navigation/schema.d.ts +2 -0
  156. package/build/esm/navigation/schema.js +12 -3
  157. package/build/esm/navigation/schema.js.map +1 -1
  158. package/build/esm/schema/constants.js +2 -1
  159. package/build/esm/schema/constants.js.map +1 -1
  160. package/build/esm/schema/index.d.ts +2 -0
  161. package/build/esm/schema/validators/blocks.d.ts +1 -0
  162. package/build/esm/schema/validators/blocks.js +1 -0
  163. package/build/esm/schema/validators/blocks.js.map +1 -1
  164. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  165. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +5 -1
  166. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js.map +1 -1
  167. package/build/esm/sub-blocks/HubspotForm/index.js +2 -2
  168. package/build/esm/sub-blocks/HubspotForm/index.js.map +1 -1
  169. package/build/esm/sub-blocks/HubspotForm/setHubspotDefaultValues.d.ts +2 -0
  170. package/build/esm/sub-blocks/HubspotForm/setHubspotDefaultValues.js +47 -0
  171. package/build/esm/sub-blocks/HubspotForm/setHubspotDefaultValues.js.map +1 -0
  172. package/build/esm/text-transform/config.js +25 -1
  173. package/build/esm/text-transform/config.js.map +1 -1
  174. package/build/esm/utils/form-generator.js +27 -0
  175. package/build/esm/utils/form-generator.js.map +1 -1
  176. package/build/esm/utils/hubspot.d.ts +1 -0
  177. package/build/esm/utils/hubspot.js.map +1 -1
  178. package/package.json +13 -15
  179. package/schema/index.js +1 -1
  180. package/server/models/constructor-items/blocks.d.ts +19 -1
  181. package/server/models/constructor-items/blocks.js +1 -0
  182. package/server/models/constructor-items/sub-blocks.d.ts +2 -1
  183. package/server/text-transform/config.js +25 -1
  184. package/server/utils/hubspot.d.ts +1 -0
  185. package/widget/{5287.index.js → 1092.index.js} +1 -1
  186. package/widget/{8092.index.js → 1130.index.js} +1 -1
  187. package/widget/1219.index.js +1 -0
  188. package/widget/{2390.index.js → 122.index.js} +1 -1
  189. package/widget/{6817.index.js → 1289.index.js} +1 -1
  190. package/widget/{2921.index.js → 1335.index.js} +1 -1
  191. package/widget/{1876.index.js → 1340.index.js} +1 -1
  192. package/widget/{3901.index.js → 1349.index.js} +1 -1
  193. package/widget/1532.index.js +1 -0
  194. package/widget/{2957.index.js → 1750.index.js} +1 -1
  195. package/widget/{5105.index.js → 1995.index.js} +1 -1
  196. package/widget/{5418.index.js → 2010.index.js} +1 -1
  197. package/widget/{9517.index.js → 2026.index.js} +1 -1
  198. package/widget/{1794.index.js → 2187.index.js} +1 -1
  199. package/widget/{7548.index.js → 2218.index.js} +1 -1
  200. package/widget/225.index.js +1 -0
  201. package/widget/2338.index.js +1 -0
  202. package/widget/{4653.index.js → 2355.index.js} +1 -1
  203. package/widget/{5001.index.js → 2369.index.js} +1 -1
  204. package/widget/{4127.index.js → 2487.index.js} +1 -1
  205. package/widget/{6165.index.js → 2498.index.js} +1 -1
  206. package/widget/{5254.index.js → 2509.index.js} +1 -1
  207. package/widget/2544.index.js +1 -1
  208. package/widget/2619.index.js +1 -0
  209. package/widget/{5941.index.js → 2673.index.js} +1 -1
  210. package/widget/{4717.index.js → 2698.index.js} +1 -1
  211. package/widget/{7427.index.js → 2706.index.js} +1 -1
  212. package/widget/{8602.index.js → 2739.index.js} +1 -1
  213. package/widget/2745.index.js +1 -0
  214. package/widget/2796.index.js +1 -0
  215. package/widget/{7573.index.js → 2830.index.js} +1 -1
  216. package/widget/{3237.index.js → 2878.index.js} +1 -1
  217. package/widget/292.index.js +1 -0
  218. package/widget/2979.index.js +1 -0
  219. package/widget/3187.index.js +1 -0
  220. package/widget/321.index.js +1 -0
  221. package/widget/{5437.index.js → 3222.index.js} +1 -1
  222. package/widget/{1987.index.js → 3225.index.js} +1 -1
  223. package/widget/{7719.index.js → 3309.index.js} +1 -1
  224. package/widget/{4254.index.js → 3433.index.js} +1 -1
  225. package/widget/{2722.index.js → 3473.index.js} +1 -1
  226. package/widget/3532.index.js +1 -0
  227. package/widget/3562.index.js +1 -0
  228. package/widget/{6148.index.js → 3672.index.js} +1 -1
  229. package/widget/{4990.index.js → 3713.index.js} +1 -1
  230. package/widget/{8894.index.js → 3860.index.js} +1 -1
  231. package/widget/{5551.index.js → 3900.index.js} +1 -1
  232. package/widget/{6629.index.js → 4007.index.js} +1 -1
  233. package/widget/{7467.index.js → 4061.index.js} +1 -1
  234. package/widget/{5423.index.js → 4072.index.js} +1 -1
  235. package/widget/{4144.index.js → 4173.index.js} +1 -1
  236. package/widget/4288.index.js +1 -0
  237. package/widget/{8242.index.js → 4309.index.js} +1 -1
  238. package/widget/{8146.index.js → 4334.index.js} +1 -1
  239. package/widget/{9339.index.js → 4405.index.js} +1 -1
  240. package/widget/4457.index.js +1 -0
  241. package/widget/{8768.index.js → 4485.index.js} +1 -1
  242. package/widget/4509.index.js +1 -0
  243. package/widget/{4067.index.js → 4608.index.js} +1 -1
  244. package/widget/465.index.js +1 -0
  245. package/widget/{7118.index.js → 4719.index.js} +1 -1
  246. package/widget/4734.index.js +1 -0
  247. package/widget/4780.index.js +1 -0
  248. package/widget/4895.index.js +1 -0
  249. package/widget/{790.index.js → 494.index.js} +1 -1
  250. package/widget/5012.index.js +1 -0
  251. package/widget/{4722.index.js → 5084.index.js} +1 -1
  252. package/widget/5285.index.js +1 -0
  253. package/widget/5376.index.js +1 -0
  254. package/widget/539.index.js +1 -0
  255. package/widget/5414.index.js +1 -0
  256. package/widget/{8980.index.js → 5513.index.js} +1 -1
  257. package/widget/5530.index.js +1 -0
  258. package/widget/5571.index.js +1 -0
  259. package/widget/{8540.index.js → 5592.index.js} +1 -1
  260. package/widget/5616.index.js +1 -0
  261. package/widget/{5903.index.js → 5662.index.js} +1 -1
  262. package/widget/{7109.index.js → 5665.index.js} +1 -1
  263. package/widget/{8792.index.js → 5681.index.js} +1 -1
  264. package/widget/5760.index.js +1 -0
  265. package/widget/{6257.index.js → 5811.index.js} +1 -1
  266. package/widget/{5054.index.js → 5826.index.js} +1 -1
  267. package/widget/{1560.index.js → 5877.index.js} +1 -1
  268. package/widget/{9149.index.js → 5944.index.js} +1 -1
  269. package/widget/{8341.index.js → 5977.index.js} +1 -1
  270. package/widget/{3646.index.js → 5993.index.js} +1 -1
  271. package/widget/{2009.index.js → 6007.index.js} +1 -1
  272. package/widget/{3852.index.js → 6033.index.js} +1 -1
  273. package/widget/{5567.index.js → 6101.index.js} +1 -1
  274. package/widget/623.index.js +1 -0
  275. package/widget/{7989.index.js → 6290.index.js} +1 -1
  276. package/widget/6364.index.js +1 -0
  277. package/widget/{7387.index.js → 6400.index.js} +1 -1
  278. package/widget/{5473.index.js → 6462.index.js} +1 -1
  279. package/widget/6467.index.js +1 -0
  280. package/widget/{6622.index.js → 6481.index.js} +1 -1
  281. package/widget/{4888.index.js → 6605.index.js} +1 -1
  282. package/widget/{2966.index.js → 6803.index.js} +1 -1
  283. package/widget/{5627.index.js → 6847.index.js} +1 -1
  284. package/widget/{2019.index.js → 7081.index.js} +1 -1
  285. package/widget/7205.index.js +1 -0
  286. package/widget/{5596.index.js → 7250.index.js} +1 -1
  287. package/widget/{7763.index.js → 7317.index.js} +1 -1
  288. package/widget/7329.index.js +1 -0
  289. package/widget/{5159.index.js → 7406.index.js} +1 -1
  290. package/widget/{7632.index.js → 7409.index.js} +1 -1
  291. package/widget/{3783.index.js → 7420.index.js} +1 -1
  292. package/widget/{7101.index.js → 7439.index.js} +1 -1
  293. package/widget/{9197.index.js → 7674.index.js} +1 -1
  294. package/widget/{5805.index.js → 7690.index.js} +1 -1
  295. package/widget/{2641.index.js → 7741.index.js} +1 -1
  296. package/widget/{4724.index.js → 7933.index.js} +1 -1
  297. package/widget/{9132.index.js → 8003.index.js} +1 -1
  298. package/widget/813.index.js +1 -0
  299. package/widget/{6513.index.js → 8142.index.js} +1 -1
  300. package/widget/{8562.index.js → 8298.index.js} +1 -1
  301. package/widget/{7200.index.js → 8361.index.js} +1 -1
  302. package/widget/{4855.index.js → 8418.index.js} +1 -1
  303. package/widget/860.index.js +1 -0
  304. package/widget/{1796.index.js → 8615.index.js} +1 -1
  305. package/widget/{6312.index.js → 8660.index.js} +1 -1
  306. package/widget/880.index.js +1 -0
  307. package/widget/8804.index.js +1 -0
  308. package/widget/8809.index.js +1 -0
  309. package/widget/{9157.index.js → 8928.index.js} +1 -1
  310. package/widget/912.index.js +1 -0
  311. package/widget/9160.index.js +1 -0
  312. package/widget/{5914.index.js → 9252.index.js} +1 -1
  313. package/widget/{3706.index.js → 9286.index.js} +1 -1
  314. package/widget/{2502.index.js → 9294.index.js} +1 -1
  315. package/widget/{9182.index.js → 9423.index.js} +1 -1
  316. package/widget/{8477.index.js → 9464.index.js} +1 -1
  317. package/widget/950.index.js +1 -0
  318. package/widget/952.index.js +1 -0
  319. package/widget/9677.index.js +1 -0
  320. package/widget/9751.index.js +1 -0
  321. package/widget/{3220.index.js → 9836.index.js} +1 -1
  322. package/widget/{2376.index.js → 9865.index.js} +1 -1
  323. package/widget/{5109.index.js → 9881.index.js} +1 -1
  324. package/widget/9911.index.js +1 -1
  325. package/widget/{7822.index.js → 9964.index.js} +1 -1
  326. package/widget/{9091.index.js → 9990.index.js} +1 -1
  327. package/widget/9998.index.js +1 -0
  328. package/widget/index.js +1 -1
  329. package/widget/1113.index.js +0 -1
  330. package/widget/123.index.js +0 -1
  331. package/widget/1573.index.js +0 -1
  332. package/widget/2030.index.js +0 -1
  333. package/widget/229.index.js +0 -1
  334. package/widget/261.index.js +0 -1
  335. package/widget/302.index.js +0 -1
  336. package/widget/3035.index.js +0 -1
  337. package/widget/313.index.js +0 -1
  338. package/widget/3521.index.js +0 -1
  339. package/widget/3864.index.js +0 -1
  340. package/widget/3939.index.js +0 -1
  341. package/widget/4017.index.js +0 -1
  342. package/widget/4149.index.js +0 -1
  343. package/widget/4502.index.js +0 -1
  344. package/widget/466.index.js +0 -1
  345. package/widget/504.index.js +0 -1
  346. package/widget/5321.index.js +0 -1
  347. package/widget/5742.index.js +0 -1
  348. package/widget/5817.index.js +0 -1
  349. package/widget/600.index.js +0 -1
  350. package/widget/6023.index.js +0 -1
  351. package/widget/6159.index.js +0 -1
  352. package/widget/617.index.js +0 -1
  353. package/widget/6183.index.js +0 -1
  354. package/widget/6509.index.js +0 -1
  355. package/widget/6636.index.js +0 -1
  356. package/widget/6831.index.js +0 -1
  357. package/widget/6953.index.js +0 -1
  358. package/widget/7296.index.js +0 -1
  359. package/widget/7486.index.js +0 -1
  360. package/widget/7496.index.js +0 -1
  361. package/widget/7553.index.js +0 -1
  362. package/widget/758.index.js +0 -1
  363. package/widget/772.index.js +0 -1
  364. package/widget/7797.index.js +0 -1
  365. package/widget/8066.index.js +0 -1
  366. package/widget/8507.index.js +0 -1
  367. package/widget/8529.index.js +0 -1
  368. package/widget/8727.index.js +0 -1
  369. package/widget/8864.index.js +0 -1
  370. package/widget/8889.index.js +0 -1
  371. package/widget/953.index.js +0 -1
  372. package/widget/9670.index.js +0 -1
  373. package/widget/9682.index.js +0 -1
  374. package/widget/9928.index.js +0 -1
@@ -12,6 +12,15 @@
12
12
  overflow-y: auto;
13
13
  background-color: var(--g-color-text-secondary);
14
14
  }
15
+ .pceditor-middle-screen__content_fullscreen {
16
+ position: fixed;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100vw;
20
+ height: 100vh;
21
+ z-index: 1000;
22
+ background-color: #000;
23
+ }
15
24
  .pceditor-middle-screen__wrapper {
16
25
  width: 100%;
17
26
  height: 100%;
@@ -28,10 +37,31 @@
28
37
  height: 100%;
29
38
  max-width: 100%;
30
39
  }
40
+ .pceditor-middle-screen__canvas_fullscreen {
41
+ overflow: hidden;
42
+ width: 100%;
43
+ height: 100%;
44
+ max-width: 100%;
45
+ }
31
46
  .pceditor-middle-screen__iframe {
32
47
  display: block;
33
48
  margin: 0 auto;
34
49
  }
50
+ .pceditor-middle-screen__iframe_fullscreen {
51
+ width: 100%;
52
+ height: 100%;
53
+ }
54
+ .pceditor-middle-screen__exit-preview {
55
+ position: fixed;
56
+ opacity: 0.5;
57
+ top: 16px;
58
+ right: 16px;
59
+ z-index: 1001;
60
+ border-radius: 50%;
61
+ display: flex;
62
+ align-items: center;
63
+ justify-content: center;
64
+ }
35
65
  .pceditor-middle-screen__overlay {
36
66
  position: absolute;
37
67
  left: 0;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Loader } from '@gravity-ui/uikit';
2
+ import { Xmark } from '@gravity-ui/icons';
3
+ import { Button, Icon, Loader } from '@gravity-ui/uikit';
3
4
  import * as React from 'react';
4
5
  import { usePostMessageAPIListener } from "../../../common/postMessage.js";
5
6
  import { IframeContext } from "../../context/iframeContext/index.js";
@@ -9,10 +10,16 @@ import Overlay from "../Overlay/Overlay.js";
9
10
  import './MiddleScreen.css';
10
11
  const b = editorCn('middle-screen');
11
12
  const MiddleScreen = ({ className, CustomTop }) => {
12
- const { zoom, initialized, deviceWidth } = useMainEditorStore();
13
+ const { zoom, initialized, deviceWidth, isPreviewMode, togglePreviewMode } = useMainEditorStore();
13
14
  const { url, setIframeElement } = React.useContext(IframeContext);
14
15
  const [canvasRef, setCanvasRef] = React.useState(null);
15
16
  const [height, setHeight] = React.useState(0);
17
+ const canvasStyle = React.useMemo(() => ({
18
+ transform: isPreviewMode ? 'none' : `scale(${zoom}%)`,
19
+ height: isPreviewMode ? '100%' : `${(100 / zoom) * 100}%`,
20
+ width: isPreviewMode ? '100%' : deviceWidth,
21
+ maxWidth: isPreviewMode ? '100%' : `${(100 / zoom) * 100}%`,
22
+ }), [isPreviewMode, zoom, deviceWidth]);
16
23
  const onResize = React.useCallback((newHeight) => {
17
24
  setHeight(newHeight + 500);
18
25
  }, [setHeight]);
@@ -22,12 +29,7 @@ const MiddleScreen = ({ className, CustomTop }) => {
22
29
  usePostMessageAPIListener('ON_INIT', ({ height: newHeight }) => {
23
30
  onResize(newHeight);
24
31
  });
25
- return (_jsxs("div", { className: b(null, className), children: [CustomTop ? (_jsx("div", { className: b('topbar'), children: _jsx(CustomTop, {}) })) : null, _jsx("div", { className: b('content'), children: _jsx("div", { className: b('wrapper'), children: _jsxs("div", { ref: setCanvasRef, className: b('canvas', { hidden: !initialized }), style: {
26
- transform: `scale(${zoom}%)`,
27
- height: `${(100 / zoom) * 100}%`,
28
- width: deviceWidth,
29
- maxWidth: `${(100 / zoom) * 100}%`,
30
- }, children: [_jsx("iframe", { ref: (instance) => instance && setIframeElement(instance), className: b('iframe'), src: url, height: `${height}px`, width: deviceWidth, frameBorder: "0", title: "Page Constructor Iframe" }), _jsx(Overlay, { className: b('overlay'), canvasElement: canvasRef }), !initialized && (_jsx("div", { className: b('loading'), children: _jsx(Loader, { size: 'l' }) }))] }) }) })] }));
32
+ return (_jsxs("div", { className: b(null, className), children: [CustomTop && !isPreviewMode ? (_jsx("div", { className: b('topbar'), children: _jsx(CustomTop, {}) })) : null, _jsx("div", { className: b('content', { fullscreen: isPreviewMode }), children: _jsx("div", { className: b('wrapper'), children: _jsxs("div", { ref: setCanvasRef, className: b('canvas', { hidden: !initialized, fullscreen: isPreviewMode }), style: canvasStyle, children: [_jsx("iframe", { ref: (instance) => instance && setIframeElement(instance), className: b('iframe', { fullscreen: isPreviewMode }), src: url, height: isPreviewMode ? '100%' : `${height}px`, width: isPreviewMode ? '100%' : deviceWidth, frameBorder: "0", title: "Page Constructor Iframe" }), !isPreviewMode && (_jsx(Overlay, { className: b('overlay'), canvasElement: canvasRef })), isPreviewMode && (_jsx(Button, { view: "action", className: b('exit-preview'), onClick: togglePreviewMode, "aria-label": "Exit preview mode", title: "Exit preview mode", size: "l", children: _jsx(Icon, { size: 24, data: Xmark }) })), !initialized && (_jsx("div", { className: b('loading'), children: _jsx(Loader, { size: 'l' }) }))] }) }) })] }));
31
33
  };
32
34
  export default MiddleScreen;
33
35
  //# sourceMappingURL=MiddleScreen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MiddleScreen.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/MiddleScreen/MiddleScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,yBAAyB,EAAC,uCAAoC;AACtE,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AACxC,OAAO,OAAO,8BAA2B;AAEzC,OAAO,oBAAoB,CAAC;AAE5B,MAAM,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAOpC,MAAM,YAAY,GAAG,CAAC,EAAC,SAAS,EAAE,SAAS,EAAoB,EAAE,EAAE;IAC/D,MAAM,EAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAC9D,MAAM,EAAC,GAAG,EAAE,gBAAgB,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAChE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAC9E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,SAAiB,EAAE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,IAAI,EACrB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAC,GAAG,EACf,KAAK,EAAC,yBAAyB,GACjC,EACF,KAAC,OAAO,IAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,SAAS,GAAI,EAC7D,CAAC,WAAW,IAAI,CACb,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YACxB,KAAC,MAAM,IAAC,IAAI,EAAE,GAAG,GAAI,GACnB,CACT,IACC,GACJ,GACJ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {Loader} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {usePostMessageAPIListener} from '../../../common/postMessage';\nimport {IframeContext} from '../../context/iframeContext';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {editorCn} from '../../utils/cn';\nimport Overlay from '../Overlay/Overlay';\n\nimport './MiddleScreen.scss';\n\nconst b = editorCn('middle-screen');\n\ninterface MiddleScreenProps {\n className?: string;\n CustomTop?: React.ElementType;\n}\n\nconst MiddleScreen = ({className, CustomTop}: MiddleScreenProps) => {\n const {zoom, initialized, deviceWidth} = useMainEditorStore();\n const {url, setIframeElement} = React.useContext(IframeContext);\n const [canvasRef, setCanvasRef] = React.useState<HTMLDivElement | null>(null);\n const [height, setHeight] = React.useState(0);\n\n const onResize = React.useCallback(\n (newHeight: number) => {\n setHeight(newHeight + 500);\n },\n [setHeight],\n );\n\n usePostMessageAPIListener('ON_RESIZE', ({height: newHeight}) => {\n onResize(newHeight);\n });\n\n usePostMessageAPIListener('ON_INIT', ({height: newHeight}) => {\n onResize(newHeight);\n });\n\n return (\n <div className={b(null, className)}>\n {CustomTop ? (\n <div className={b('topbar')}>\n <CustomTop />\n </div>\n ) : null}\n <div className={b('content')}>\n <div className={b('wrapper')}>\n <div\n ref={setCanvasRef}\n className={b('canvas', {hidden: !initialized})}\n style={{\n transform: `scale(${zoom}%)`,\n height: `${(100 / zoom) * 100}%`,\n width: deviceWidth,\n maxWidth: `${(100 / zoom) * 100}%`,\n }}\n >\n <iframe\n ref={(instance) => instance && setIframeElement(instance)}\n className={b('iframe')}\n src={url}\n height={`${height}px`}\n width={deviceWidth}\n frameBorder=\"0\"\n title=\"Page Constructor Iframe\"\n />\n <Overlay className={b('overlay')} canvasElement={canvasRef} />\n {!initialized && (\n <div className={b('loading')}>\n <Loader size={'l'} />\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default MiddleScreen;\n"]}
1
+ {"version":3,"file":"MiddleScreen.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/MiddleScreen/MiddleScreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,yBAAyB,EAAC,uCAAoC;AACtE,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AACxC,OAAO,OAAO,8BAA2B;AAEzC,OAAO,oBAAoB,CAAC;AAE5B,MAAM,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAOpC,MAAM,YAAY,GAAG,CAAC,EAAC,SAAS,EAAE,SAAS,EAAoB,EAAE,EAAE;IAC/D,MAAM,EAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAChG,MAAM,EAAC,GAAG,EAAE,gBAAgB,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAChE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA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AI,CACb,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YACxB,KAAC,MAAM,IAAC,IAAI,EAAE,GAAG,GAAI,GACnB,CACT,IACC,GACJ,GACJ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {Xmark} from '@gravity-ui/icons';\nimport {Button, Icon, Loader} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {usePostMessageAPIListener} from '../../../common/postMessage';\nimport {IframeContext} from '../../context/iframeContext';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {editorCn} from '../../utils/cn';\nimport Overlay from '../Overlay/Overlay';\n\nimport './MiddleScreen.scss';\n\nconst b = editorCn('middle-screen');\n\ninterface MiddleScreenProps {\n className?: string;\n CustomTop?: React.ElementType;\n}\n\nconst MiddleScreen = ({className, CustomTop}: MiddleScreenProps) => {\n const {zoom, initialized, deviceWidth, isPreviewMode, togglePreviewMode} = useMainEditorStore();\n const {url, setIframeElement} = React.useContext(IframeContext);\n const [canvasRef, setCanvasRef] = React.useState<HTMLDivElement | null>(null);\n const [height, setHeight] = React.useState(0);\n\n const canvasStyle = React.useMemo(\n () => ({\n transform: isPreviewMode ? 'none' : `scale(${zoom}%)`,\n height: isPreviewMode ? '100%' : `${(100 / zoom) * 100}%`,\n width: isPreviewMode ? '100%' : deviceWidth,\n maxWidth: isPreviewMode ? '100%' : `${(100 / zoom) * 100}%`,\n }),\n [isPreviewMode, zoom, deviceWidth],\n );\n\n const onResize = React.useCallback(\n (newHeight: number) => {\n setHeight(newHeight + 500);\n },\n [setHeight],\n );\n\n usePostMessageAPIListener('ON_RESIZE', ({height: newHeight}) => {\n onResize(newHeight);\n });\n\n usePostMessageAPIListener('ON_INIT', ({height: newHeight}) => {\n onResize(newHeight);\n });\n\n return (\n <div className={b(null, className)}>\n {CustomTop && !isPreviewMode ? (\n <div className={b('topbar')}>\n <CustomTop />\n </div>\n ) : null}\n <div className={b('content', {fullscreen: isPreviewMode})}>\n <div className={b('wrapper')}>\n <div\n ref={setCanvasRef}\n className={b('canvas', {hidden: !initialized, fullscreen: isPreviewMode})}\n style={canvasStyle}\n >\n <iframe\n ref={(instance) => instance && setIframeElement(instance)}\n className={b('iframe', {fullscreen: isPreviewMode})}\n src={url}\n height={isPreviewMode ? '100%' : `${height}px`}\n width={isPreviewMode ? '100%' : deviceWidth}\n frameBorder=\"0\"\n title=\"Page Constructor Iframe\"\n />\n {!isPreviewMode && (\n <Overlay className={b('overlay')} canvasElement={canvasRef} />\n )}\n {isPreviewMode && (\n <Button\n view=\"action\"\n className={b('exit-preview')}\n onClick={togglePreviewMode}\n aria-label=\"Exit preview mode\"\n title=\"Exit preview mode\"\n size=\"l\"\n >\n <Icon size={24} data={Xmark} />\n </Button>\n )}\n {!initialized && (\n <div className={b('loading')}>\n <Loader size={'l'} />\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default MiddleScreen;\n"]}
@@ -2,6 +2,7 @@ import './SourceCode.css';
2
2
  interface SourceCodeProps {
3
3
  className?: string;
4
4
  format: 'yaml' | 'json';
5
+ showSelectedBlockOnly?: boolean;
5
6
  }
6
- declare const SourceCode: ({ className, format }: SourceCodeProps) => import("react/jsx-runtime").JSX.Element;
7
+ declare const SourceCode: ({ className, format, showSelectedBlockOnly }: SourceCodeProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export default SourceCode;
@@ -2,16 +2,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowDownToSquare } from '@gravity-ui/icons';
3
3
  import { Button, ClipboardButton, Icon } from '@gravity-ui/uikit';
4
4
  import yaml from 'js-yaml';
5
+ import _ from 'lodash';
5
6
  import * as React from 'react';
6
7
  import { useMainEditorStore } from "../../hooks/useMainEditorStore.js";
8
+ import { generateChildrenPathFromArray } from "../../utils/index.js";
7
9
  import { editorCn } from "../../utils/cn.js";
8
10
  import './SourceCode.css';
9
11
  import { UpdateModal } from "./UpdateModal/UpdateModal.js";
10
12
  const b = editorCn('source-code');
11
- const SourceCode = ({ className, format }) => {
12
- const { content, setContent } = useMainEditorStore();
13
+ const SourceCode = ({ className, format, showSelectedBlockOnly = false }) => {
14
+ const { content, setContent, selectedBlock } = useMainEditorStore();
13
15
  const [isOpen, setIsOpen] = React.useState(false);
14
16
  const handleUpdate = (tempConfig) => {
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
18
  let object;
16
19
  try {
17
20
  if (tempConfig.trim().startsWith('{') && tempConfig.trim().endsWith('}')) {
@@ -24,15 +27,34 @@ const SourceCode = ({ className, format }) => {
24
27
  catch {
25
28
  // eslint-disable-next-line no-console
26
29
  console.error('JSON.parse failed');
30
+ return;
27
31
  }
28
- if (object) {
32
+ if (showSelectedBlockOnly && selectedBlock) {
33
+ // Update only the selected block
34
+ const currentBlockPath = generateChildrenPathFromArray(selectedBlock);
35
+ const newContent = _.cloneDeep(content);
36
+ _.set(newContent.blocks, currentBlockPath, object);
37
+ setContent(newContent);
38
+ }
39
+ else if (object) {
40
+ // Update the entire content
29
41
  setContent(object);
30
42
  }
31
43
  setIsOpen(false);
32
44
  };
33
45
  const textContent = React.useMemo(() => {
46
+ if (showSelectedBlockOnly && selectedBlock) {
47
+ const currentBlockPath = generateChildrenPathFromArray(selectedBlock);
48
+ const currentConfig = _.get(content.blocks, currentBlockPath || '');
49
+ if (currentConfig) {
50
+ return format === 'yaml'
51
+ ? yaml.dump(currentConfig)
52
+ : JSON.stringify(currentConfig, null, 2);
53
+ }
54
+ return 'No block selected';
55
+ }
34
56
  return format === 'yaml' ? yaml.dump(content) : JSON.stringify(content, null, 2);
35
- }, [format, content]);
57
+ }, [format, content, showSelectedBlockOnly, selectedBlock]);
36
58
  return (_jsxs("div", { className: b(null, className), children: [_jsx("div", { className: b('title'), children: format }), _jsxs("div", { className: b('code'), children: [_jsx("div", { className: b('content'), children: textContent }), _jsxs("div", { className: b('controls'), children: [_jsx(ClipboardButton, { view: "flat", size: "xs", text: textContent }), _jsx(Button, { view: "flat", size: "xs", onClick: () => setIsOpen(true), children: _jsx(Icon, { size: 14, data: ArrowDownToSquare }) })] })] }), _jsx(UpdateModal, { onApply: handleUpdate, onClose: () => setIsOpen(false), isOpen: isOpen })] }));
37
59
  };
38
60
  export default SourceCode;
@@ -1 +1 @@
1
- {"version":3,"file":"SourceCode.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/SourceCode/SourceCode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAChE,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AAExC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,qCAAkC;AAEtD,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAOlC,MAAM,UAAU,GAAG,CAAC,EAAC,SAAS,EAAE,MAAM,EAAkB,EAAE,EAAE;IACxD,MAAM,EAAC,OAAO,EAAE,UAAU,EAAC,GAAG,kBAAkB,EAAE,CAAC;IACnD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;QACxC,IAAI,MAA6C,CAAC;QAElD,IAAI,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,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AI,GACtC,IACP,IACJ,EACN,KAAC,WAAW,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,IACrF,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {ArrowDownToSquare} from '@gravity-ui/icons';\nimport {Button, ClipboardButton, Icon} from '@gravity-ui/uikit';\nimport yaml from 'js-yaml';\nimport * as React from 'react';\n\nimport {PageContentWithNavigation} from '../../../models';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {editorCn} from '../../utils/cn';\n\nimport './SourceCode.scss';\nimport {UpdateModal} from './UpdateModal/UpdateModal';\n\nconst b = editorCn('source-code');\n\ninterface SourceCodeProps {\n className?: string;\n format: 'yaml' | 'json';\n}\n\nconst SourceCode = ({className, format}: SourceCodeProps) => {\n const {content, setContent} = useMainEditorStore();\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleUpdate = (tempConfig: string) => {\n let object: PageContentWithNavigation | undefined;\n\n try {\n if (tempConfig.trim().startsWith('{') && tempConfig.trim().endsWith('}')) {\n object = JSON.parse(tempConfig);\n } else {\n object = yaml.load(tempConfig) as PageContentWithNavigation;\n }\n } catch {\n // eslint-disable-next-line no-console\n console.error('JSON.parse failed');\n }\n\n if (object) {\n setContent(object);\n }\n\n setIsOpen(false);\n };\n\n const textContent = React.useMemo(() => {\n return format === 'yaml' ? yaml.dump(content) : JSON.stringify(content, null, 2);\n }, [format, content]);\n\n return (\n <div className={b(null, className)}>\n <div className={b('title')}>{format}</div>\n <div className={b('code')}>\n <div className={b('content')}>{textContent}</div>\n <div className={b('controls')}>\n <ClipboardButton view=\"flat\" size=\"xs\" text={textContent} />\n <Button view=\"flat\" size=\"xs\" onClick={() => setIsOpen(true)}>\n <Icon size={14} data={ArrowDownToSquare} />\n </Button>\n </div>\n </div>\n <UpdateModal onApply={handleUpdate} onClose={() => setIsOpen(false)} isOpen={isOpen} />\n </div>\n );\n};\n\nexport default SourceCode;\n"]}
1
+ {"version":3,"file":"SourceCode.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/SourceCode/SourceCode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAChE,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,6BAA6B,EAAC,6BAAoB;AAC1D,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AAExC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAC,qCAAkC;AAEtD,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAQlC,MAAM,UAAU,GAAG,CAAC,EAAC,SAAS,EAAE,MAAM,EAAE,qBAAqB,GAAG,KAAK,EAAkB,EAAE,EAAE;IACvF,MAAM,EAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAClE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE;QACxC,8DAA8D;QAC9D,IAAI,MAAW,CAAC;QAEhB,IAAI,CAAC;YACD,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC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AAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5D,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,aAC9B,cAAK,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YAAG,MAAM,GAAO,EAC1C,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,aACrB,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAAG,WAAW,GAAO,EACjD,eAAK,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,aACzB,KAAC,eAAe,IAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAE,WAAW,GAAI,EAC5D,KAAC,MAAM,IAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,YACxD,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,GAAI,GACtC,IACP,IACJ,EACN,KAAC,WAAW,IAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,GAAI,IACrF,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {ArrowDownToSquare} from '@gravity-ui/icons';\nimport {Button, ClipboardButton, Icon} from '@gravity-ui/uikit';\nimport yaml from 'js-yaml';\nimport _ from 'lodash';\nimport * as React from 'react';\n\nimport {PageContentWithNavigation} from '../../../models';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {generateChildrenPathFromArray} from '../../utils';\nimport {editorCn} from '../../utils/cn';\n\nimport './SourceCode.scss';\nimport {UpdateModal} from './UpdateModal/UpdateModal';\n\nconst b = editorCn('source-code');\n\ninterface SourceCodeProps {\n className?: string;\n format: 'yaml' | 'json';\n showSelectedBlockOnly?: boolean;\n}\n\nconst SourceCode = ({className, format, showSelectedBlockOnly = false}: SourceCodeProps) => {\n const {content, setContent, selectedBlock} = useMainEditorStore();\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleUpdate = (tempConfig: string) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let object: any;\n\n try {\n if (tempConfig.trim().startsWith('{') && tempConfig.trim().endsWith('}')) {\n object = JSON.parse(tempConfig);\n } else {\n object = yaml.load(tempConfig);\n }\n } catch {\n // eslint-disable-next-line no-console\n console.error('JSON.parse failed');\n return;\n }\n\n if (showSelectedBlockOnly && selectedBlock) {\n // Update only the selected block\n const currentBlockPath = generateChildrenPathFromArray(selectedBlock);\n const newContent = _.cloneDeep(content);\n _.set(newContent.blocks, currentBlockPath, object);\n setContent(newContent);\n } else if (object) {\n // Update the entire content\n setContent(object as PageContentWithNavigation);\n }\n\n setIsOpen(false);\n };\n\n const textContent = React.useMemo(() => {\n if (showSelectedBlockOnly && selectedBlock) {\n const currentBlockPath = generateChildrenPathFromArray(selectedBlock);\n const currentConfig = _.get(content.blocks, currentBlockPath || '');\n\n if (currentConfig) {\n return format === 'yaml'\n ? yaml.dump(currentConfig)\n : JSON.stringify(currentConfig, null, 2);\n }\n\n return 'No block selected';\n }\n\n return format === 'yaml' ? yaml.dump(content) : JSON.stringify(content, null, 2);\n }, [format, content, showSelectedBlockOnly, selectedBlock]);\n\n return (\n <div className={b(null, className)}>\n <div className={b('title')}>{format}</div>\n <div className={b('code')}>\n <div className={b('content')}>{textContent}</div>\n <div className={b('controls')}>\n <ClipboardButton view=\"flat\" size=\"xs\" text={textContent} />\n <Button view=\"flat\" size=\"xs\" onClick={() => setIsOpen(true)}>\n <Icon size={14} data={ArrowDownToSquare} />\n </Button>\n </div>\n </div>\n <UpdateModal onApply={handleUpdate} onClose={() => setIsOpen(false)} isOpen={isOpen} />\n </div>\n );\n};\n\nexport default SourceCode;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { Display, Minus, Plus, Smartphone } from '@gravity-ui/icons';
3
+ import { Display, Eye, Minus, Plus, Smartphone } from '@gravity-ui/icons';
4
4
  import { Button, Icon, SegmentedRadioGroup, Select } from '@gravity-ui/uikit';
5
5
  import { ZOOM_STEPS } from "../../constants.js";
6
6
  import { useMainEditorStore } from "../../hooks/useMainEditorStore.js";
@@ -31,7 +31,7 @@ const DEVICE_OPTIONS = [
31
31
  },
32
32
  ];
33
33
  const ViewSwitches = () => {
34
- const { zoom, setZoom, decreaseZoom, increaseZoom, deviceWidth, setDeviceWidth } = useMainEditorStore();
34
+ const { zoom, setZoom, decreaseZoom, increaseZoom, deviceWidth, setDeviceWidth, togglePreviewMode, } = useMainEditorStore();
35
35
  // Memoize zoom options to prevent unnecessary recalculations
36
36
  const zoomOptions = React.useMemo(() => ZOOM_STEPS.map((step) => ({
37
37
  value: String(step),
@@ -46,7 +46,7 @@ const ViewSwitches = () => {
46
46
  setZoom(newZoom);
47
47
  }
48
48
  }, [setZoom]);
49
- return (_jsxs("div", { className: b(), role: "toolbar", "aria-label": "View controls", children: [_jsx(SegmentedRadioGroup, { value: deviceWidth, onUpdate: setDeviceWidth, "aria-label": "Device viewport selector", children: DEVICE_OPTIONS.map(({ value, label, ariaLabel }) => (_jsx(SegmentedRadioGroup.Option, { value: value, "aria-label": ariaLabel, children: label }, value))) }), _jsxs("div", { className: b('zoom'), role: "group", "aria-label": "Zoom controls", children: [_jsx(Button, { view: "flat", onClick: decreaseZoom, "aria-label": "Decrease zoom", disabled: zoom <= Math.min(...ZOOM_STEPS), children: _jsx(Icon, { data: Minus }) }), _jsx(Select, { className: b('zoom-select'), multiple: false, value: currentZoomValue, options: zoomOptions, onUpdate: handleZoomUpdate, "aria-label": "Select zoom level", width: "max" }), _jsx(Button, { view: "flat", onClick: increaseZoom, "aria-label": "Increase zoom", disabled: zoom >= Math.max(...ZOOM_STEPS), children: _jsx(Icon, { data: Plus }) })] })] }));
49
+ return (_jsxs("div", { className: b(), role: "toolbar", "aria-label": "View controls", children: [_jsx(SegmentedRadioGroup, { value: deviceWidth, onUpdate: setDeviceWidth, "aria-label": "Device viewport selector", children: DEVICE_OPTIONS.map(({ value, label, ariaLabel }) => (_jsx(SegmentedRadioGroup.Option, { value: value, "aria-label": ariaLabel, children: label }, value))) }), _jsx(Button, { view: "flat", onClick: togglePreviewMode, "aria-label": "Switch to preview mode", title: "Switch to preview mode", children: _jsx(Icon, { data: Eye }) }), _jsxs("div", { className: b('zoom'), role: "group", "aria-label": "Zoom controls", children: [_jsx(Button, { view: "flat", onClick: decreaseZoom, "aria-label": "Decrease zoom", disabled: zoom <= Math.min(...ZOOM_STEPS), children: _jsx(Icon, { data: Minus }) }), _jsx(Select, { className: b('zoom-select'), multiple: false, value: currentZoomValue, options: zoomOptions, onUpdate: handleZoomUpdate, "aria-label": "Select zoom level", width: "max" }), _jsx(Button, { view: "flat", onClick: increaseZoom, "aria-label": "Increase zoom", disabled: zoom >= Math.max(...ZOOM_STEPS), children: _jsx(Icon, { data: Plus }) })] })] }));
50
50
  };
51
51
  export default React.memo(ViewSwitches);
52
52
  //# sourceMappingURL=ViewSwitches.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewSwitches.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/ViewSwitches/ViewSwitches.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAC,MAAM,EAAE,IAAI,EA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AK,EAAE,gBAAgB,EACvB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,gBACf,mBAAmB,EAC9B,KAAK,EAAC,KAAK,GACb,EAEF,KAAC,MAAM,IACH,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,YAAY,gBACV,eAAe,EAC1B,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,IACP,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {Display, Minus, Plus, Smartphone} from '@gravity-ui/icons';\nimport {Button, Icon, SegmentedRadioGroup, Select} from '@gravity-ui/uikit';\n\nimport {ZOOM_STEPS} from '../../constants';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {editorCn} from '../../utils/cn';\n\nimport './ViewSwitches.scss';\n\nconst b = editorCn('view-switches');\n\n/**\n * Device option type definition\n */\ninterface DeviceOption {\n /** React node to display as the option label */\n label: React.ReactNode;\n /** Device width value (e.g., '100%', '768px') */\n value: string;\n /** Descriptive name for accessibility */\n ariaLabel: string;\n}\n\n/**\n * Available device viewport options\n * - Desktop: 100% width\n * - Tablet: 768px width\n * - Mobile: 576px width\n */\nconst DEVICE_OPTIONS: DeviceOption[] = [\n {\n label: <Icon data={Display} />,\n value: '100%',\n ariaLabel: 'Desktop view',\n },\n {\n label: <Icon data={Smartphone} />,\n value: '768px',\n ariaLabel: 'Tablet view',\n },\n {\n label: <Icon width={14} data={Smartphone} />,\n value: '576px',\n ariaLabel: 'Mobile view',\n },\n];\n\nconst ViewSwitches: React.FC = () => {\n const {zoom, setZoom, decreaseZoom, increaseZoom, deviceWidth, setDeviceWidth} =\n useMainEditorStore();\n\n // Memoize zoom options to prevent unnecessary recalculations\n const zoomOptions = React.useMemo(\n () =>\n ZOOM_STEPS.map((step) => ({\n value: String(step),\n content: `${step}%`,\n })),\n [],\n );\n\n // Memoize current zoom value for Select component\n const currentZoomValue = React.useMemo(() => [String(zoom)], [zoom]);\n\n // Create stable callback for zoom updates\n const handleZoomUpdate = React.useCallback(\n (value: string | string[]) => {\n const newZoom = Number(Array.isArray(value) ? value[0] : value);\n if (!isNaN(newZoom) && ZOOM_STEPS.includes(newZoom)) {\n setZoom(newZoom);\n }\n },\n [setZoom],\n );\n\n return (\n <div className={b()} role=\"toolbar\" aria-label=\"View controls\">\n <SegmentedRadioGroup\n value={deviceWidth}\n onUpdate={setDeviceWidth}\n aria-label=\"Device viewport selector\"\n >\n {DEVICE_OPTIONS.map(({value, label, ariaLabel}) => (\n <SegmentedRadioGroup.Option key={value} value={value} aria-label={ariaLabel}>\n {label}\n </SegmentedRadioGroup.Option>\n ))}\n </SegmentedRadioGroup>\n\n <div className={b('zoom')} role=\"group\" aria-label=\"Zoom controls\">\n <Button\n view=\"flat\"\n onClick={decreaseZoom}\n aria-label=\"Decrease zoom\"\n disabled={zoom <= Math.min(...ZOOM_STEPS)}\n >\n <Icon data={Minus} />\n </Button>\n\n <Select\n className={b('zoom-select')}\n multiple={false}\n value={currentZoomValue}\n options={zoomOptions}\n onUpdate={handleZoomUpdate}\n aria-label=\"Select zoom level\"\n width=\"max\"\n />\n\n <Button\n view=\"flat\"\n onClick={increaseZoom}\n aria-label=\"Increase zoom\"\n disabled={zoom >= Math.max(...ZOOM_STEPS)}\n >\n <Icon data={Plus} />\n </Button>\n </div>\n </div>\n );\n};\n\nexport default React.memo(ViewSwitches);\n"]}
1
+ {"version":3,"file":"ViewSwitches.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/ViewSwitches/ViewSwitches.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAC,MAAM,mB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C1B,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,GAAI,GAChB,EAET,KAAC,MAAM,IACH,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,EAC3B,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,gBACf,mBAAmB,EAC9B,KAAK,EAAC,KAAK,GACb,EAEF,KAAC,MAAM,IACH,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,YAAY,gBACV,eAAe,EAC1B,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,YAEzC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,IACP,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {Display, Eye, Minus, Plus, Smartphone} from '@gravity-ui/icons';\nimport {Button, Icon, SegmentedRadioGroup, Select} from '@gravity-ui/uikit';\n\nimport {ZOOM_STEPS} from '../../constants';\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {editorCn} from '../../utils/cn';\n\nimport './ViewSwitches.scss';\n\nconst b = editorCn('view-switches');\n\n/**\n * Device option type definition\n */\ninterface DeviceOption {\n /** React node to display as the option label */\n label: React.ReactNode;\n /** Device width value (e.g., '100%', '768px') */\n value: string;\n /** Descriptive name for accessibility */\n ariaLabel: string;\n}\n\n/**\n * Available device viewport options\n * - Desktop: 100% width\n * - Tablet: 768px width\n * - Mobile: 576px width\n */\nconst DEVICE_OPTIONS: DeviceOption[] = [\n {\n label: <Icon data={Display} />,\n value: '100%',\n ariaLabel: 'Desktop view',\n },\n {\n label: <Icon data={Smartphone} />,\n value: '768px',\n ariaLabel: 'Tablet view',\n },\n {\n label: <Icon width={14} data={Smartphone} />,\n value: '576px',\n ariaLabel: 'Mobile view',\n },\n];\n\nconst ViewSwitches: React.FC = () => {\n const {\n zoom,\n setZoom,\n decreaseZoom,\n increaseZoom,\n deviceWidth,\n setDeviceWidth,\n togglePreviewMode,\n } = useMainEditorStore();\n\n // Memoize zoom options to prevent unnecessary recalculations\n const zoomOptions = React.useMemo(\n () =>\n ZOOM_STEPS.map((step) => ({\n value: String(step),\n content: `${step}%`,\n })),\n [],\n );\n\n // Memoize current zoom value for Select component\n const currentZoomValue = React.useMemo(() => [String(zoom)], [zoom]);\n\n // Create stable callback for zoom updates\n const handleZoomUpdate = React.useCallback(\n (value: string | string[]) => {\n const newZoom = Number(Array.isArray(value) ? value[0] : value);\n if (!isNaN(newZoom) && ZOOM_STEPS.includes(newZoom)) {\n setZoom(newZoom);\n }\n },\n [setZoom],\n );\n\n return (\n <div className={b()} role=\"toolbar\" aria-label=\"View controls\">\n <SegmentedRadioGroup\n value={deviceWidth}\n onUpdate={setDeviceWidth}\n aria-label=\"Device viewport selector\"\n >\n {DEVICE_OPTIONS.map(({value, label, ariaLabel}) => (\n <SegmentedRadioGroup.Option key={value} value={value} aria-label={ariaLabel}>\n {label}\n </SegmentedRadioGroup.Option>\n ))}\n </SegmentedRadioGroup>\n\n <Button\n view=\"flat\"\n onClick={togglePreviewMode}\n aria-label=\"Switch to preview mode\"\n title=\"Switch to preview mode\"\n >\n <Icon data={Eye} />\n </Button>\n\n <div className={b('zoom')} role=\"group\" aria-label=\"Zoom controls\">\n <Button\n view=\"flat\"\n onClick={decreaseZoom}\n aria-label=\"Decrease zoom\"\n disabled={zoom <= Math.min(...ZOOM_STEPS)}\n >\n <Icon data={Minus} />\n </Button>\n\n <Select\n className={b('zoom-select')}\n multiple={false}\n value={currentZoomValue}\n options={zoomOptions}\n onUpdate={handleZoomUpdate}\n aria-label=\"Select zoom level\"\n width=\"max\"\n />\n\n <Button\n view=\"flat\"\n onClick={increaseZoom}\n aria-label=\"Increase zoom\"\n disabled={zoom >= Math.max(...ZOOM_STEPS)}\n >\n <Icon data={Plus} />\n </Button>\n </div>\n </div>\n );\n};\n\nexport default React.memo(ViewSwitches);\n"]}
@@ -55,12 +55,12 @@ export const useEditorTabs = ({ leftTabs, rightTabs, }) => {
55
55
  {
56
56
  id: 'source-code-yaml',
57
57
  title: 'YAML',
58
- component: () => _jsx(SourceCode, { format: "yaml" }),
58
+ component: () => (_jsx(SourceCode, { format: "yaml", showSelectedBlockOnly: true })),
59
59
  },
60
60
  {
61
61
  id: 'source-code-json',
62
62
  title: 'JSON',
63
- component: () => _jsx(SourceCode, { format: "json" }),
63
+ component: () => (_jsx(SourceCode, { format: "json", showSelectedBlockOnly: true })),
64
64
  },
65
65
  ] })),
66
66
  },
@@ -1 +1 @@
1
- {"version":3,"file":"useEditorTabs.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/useEditorTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,IAAqB,mCAAgC;AAC5D,OAAO,eAAe,yDAAsD;AAC5E,OAAO,UAAU,+CAA4C;AAC7D,OAAO,YAAY,mDAAgD;AACnE,OAAO,UAAU,+CAA4C;AAC7D,OAAO,IAAI,oCAA2B;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC1B,QAAQ,EACR,SAAS,GAIZ,EAAE,EAAE;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CACtB,GAAG,EAAE,CAAC,CAAC;QACH,IAAI,EAAE;YACF;gBACI,EAAE,EAAE,MAAM;gBACV,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,IAAI,IACD,KAAK,EAAE;wBACH;4BACI,EAAE,EAAE,aAAa;4BACjB,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,UAAU;yBACxB;wBACD;4BACI,EAAE,EAAE,QAAQ;4BACZ,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,IAAI;yBAClB;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;qBACJ,GACH,CACL;aACJ;YACD;gBACI,EAAE,EAAE,YAAY;gBAChB,KAAK,EAAE,YAAY;gBACnB,SAAS,EAAE,YAAY;aAC1B;YACD,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;SACtB;QACD,KAAK,EAAE;YACH;gBACI,EAAE,EAAE,MAAM;gBACV,KAAK,EAAE,MAAM;gBACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,IAAI,IACD,KAAK,EAAE;wBACH;4BACI,EAAE,EAAE,cAAc;4BAClB,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE,eAAe;yBAC7B;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,GAAG;yBAChD;qBACJ,GACH,CACL;aACJ;YACD,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;SACvB;KACJ,CAAC,EACF,CAAC,QAAQ,EAAE,SAAS,CAAC,CACxB,CAAC;IAEF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport Tabs, {TabsItemProps} from '../components/Tabs/Tabs';\nimport BlockConfigForm from '../containers/BlockConfigForm/BlockConfigForm';\nimport BlocksList from '../containers/BlocksList/BlocksList';\nimport GlobalConfig from '../containers/GlobalConfig/GlobalConfig';\nimport SourceCode from '../containers/SourceCode/SourceCode';\nimport Tree from '../containers/Tree';\n\nexport const useEditorTabs = ({\n leftTabs,\n rightTabs,\n}: {\n leftTabs?: TabsItemProps[];\n rightTabs?: TabsItemProps[];\n}) => {\n const tabs = React.useMemo(\n () => ({\n left: [\n {\n id: 'page',\n title: 'PAGE',\n component: () => (\n <Tabs\n items={[\n {\n id: 'blocks-list',\n title: 'BLOCKS',\n component: BlocksList,\n },\n {\n id: 'layers',\n title: 'LAYERS',\n component: Tree,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => <SourceCode format=\"yaml\" />,\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => <SourceCode format=\"json\" />,\n },\n ]}\n />\n ),\n },\n {\n id: 'navigation',\n title: 'NAVIGATION',\n component: GlobalConfig,\n },\n ...(leftTabs || []),\n ],\n right: [\n {\n id: 'edit',\n title: 'EDIT',\n component: () => (\n <Tabs\n items={[\n {\n id: 'block-config',\n title: 'INPUTS',\n component: BlockConfigForm,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => <SourceCode format=\"yaml\" />,\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => <SourceCode format=\"json\" />,\n },\n ]}\n />\n ),\n },\n ...(rightTabs || []),\n ],\n }),\n [leftTabs, rightTabs],\n );\n\n return tabs;\n};\n"]}
1
+ {"version":3,"file":"useEditorTabs.js","sourceRoot":"../../../../src","sources":["editor-v2/hooks/useEditorTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,IAAqB,mCAAgC;AAC5D,OAAO,eAAe,yDAAsD;AAC5E,OAAO,UAAU,+CAA4C;AAC7D,OAAO,YAAY,mDAAgD;AACnE,OAAO,UAAU,+CAA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AAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,EAAC,qBAAqB,EAAE,IAAI,GAAI,CAC5D;yBACJ;wBACD;4BACI,EAAE,EAAE,kBAAkB;4BACtB,KAAK,EAAE,MAAM;4BACb,SAAS,EAAE,GAAG,EAAE,CAAC,CACb,KAAC,UAAU,IAAC,MAAM,EAAC,MAAM,EAAC,qBAAqB,EAAE,IAAI,GAAI,CAC5D;yBACJ;qBACJ,GACH,CACL;aACJ;YACD,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;SACvB;KACJ,CAAC,EACF,CAAC,QAAQ,EAAE,SAAS,CAAC,CACxB,CAAC;IAEF,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport Tabs, {TabsItemProps} from '../components/Tabs/Tabs';\nimport BlockConfigForm from '../containers/BlockConfigForm/BlockConfigForm';\nimport BlocksList from '../containers/BlocksList/BlocksList';\nimport GlobalConfig from '../containers/GlobalConfig/GlobalConfig';\nimport SourceCode from '../containers/SourceCode/SourceCode';\nimport Tree from '../containers/Tree';\n\nexport const useEditorTabs = ({\n leftTabs,\n rightTabs,\n}: {\n leftTabs?: TabsItemProps[];\n rightTabs?: TabsItemProps[];\n}) => {\n const tabs = React.useMemo(\n () => ({\n left: [\n {\n id: 'page',\n title: 'PAGE',\n component: () => (\n <Tabs\n items={[\n {\n id: 'blocks-list',\n title: 'BLOCKS',\n component: BlocksList,\n },\n {\n id: 'layers',\n title: 'LAYERS',\n component: Tree,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => <SourceCode format=\"yaml\" />,\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => <SourceCode format=\"json\" />,\n },\n ]}\n />\n ),\n },\n {\n id: 'navigation',\n title: 'NAVIGATION',\n component: GlobalConfig,\n },\n ...(leftTabs || []),\n ],\n right: [\n {\n id: 'edit',\n title: 'EDIT',\n component: () => (\n <Tabs\n items={[\n {\n id: 'block-config',\n title: 'INPUTS',\n component: BlockConfigForm,\n },\n {\n id: 'source-code-yaml',\n title: 'YAML',\n component: () => (\n <SourceCode format=\"yaml\" showSelectedBlockOnly={true} />\n ),\n },\n {\n id: 'source-code-json',\n title: 'JSON',\n component: () => (\n <SourceCode format=\"json\" showSelectedBlockOnly={true} />\n ),\n },\n ]}\n />\n ),\n },\n ...(rightTabs || []),\n ],\n }),\n [leftTabs, rightTabs],\n );\n\n return tabs;\n};\n"]}
@@ -9,6 +9,7 @@ export interface EditorMethods {
9
9
  setZoom(zoom: number): void;
10
10
  increaseZoom(): void;
11
11
  decreaseZoom(): void;
12
+ togglePreviewMode(): void;
12
13
  setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;
13
14
  setContent(data: PageContentWithNavigation): void;
14
15
  insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;
@@ -37,6 +37,9 @@ export const createEditorStore = initializeStore(initialStore, (set, get) => ({
37
37
  }
38
38
  }
39
39
  },
40
+ togglePreviewMode() {
41
+ set((state) => ({ ...state, isPreviewMode: !state.isPreviewMode }));
42
+ },
40
43
  setConfig(data) {
41
44
  set((state) => ({ ...state, ...data }));
42
45
  },
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"../../../src","sources":["editor-v2/store.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAc,YAAY,EAAC,2BAAwB;AAE1D,OAAO,EAAC,eAAe,EAAC,2BAAwB;AAGhD,OAAO,EAAC,UAAU,EAAC,uBAAoB;AACvC,OAAO,EACH,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GACpB,yBAAgB;AA0BjB,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAC5C,YAAY,EACZ,CAAC,GAAG,EAAE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QAED,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAC;YACpD,aAAa,EAAE,oBAAoB;SACtC,CAAC,CAAC,CAAC;IACR,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,WAAW,EAAE,KAAK;SACrB,CAAC,CAAC,CAAC;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC;SAC1C,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAC,CACL,CAAC","sourcesContent":["import _ from 'lodash';\n\nimport {EditorState, initialStore} from '../common/store';\nimport {DynamicFormValue} from '../common/types';\nimport {initializeStore} from '../common/utils';\nimport {ConstructorBlock, PageContentWithNavigation} from '../models';\n\nimport {ZOOM_STEPS} from './constants';\nimport {\n duplicateArrayItem,\n generateChildrenPathFromArray,\n getDestinationShiftBeforeReorder,\n insert,\n isItemsNeighbours,\n modifyObjectByPath,\n removeFromArray,\n reorderArrayItems,\n} from './utils';\n\nexport interface EditorMethods {\n initialize(): void;\n setSelectedBlock(path: number[] | null): void;\n setHeight(height: number): void;\n setDeviceWidth(deviceWidth: string): void;\n setZoom(zoom: number): void;\n increaseZoom(): void;\n decreaseZoom(): void;\n setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;\n setContent(data: PageContentWithNavigation): void;\n insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;\n enableInsertMode(blockType: string): void;\n enableReorderMode(path: number[]): void;\n disableMode(): void;\n updateField(path: string, value: DynamicFormValue): void;\n deleteBlock(path: number[]): void;\n duplicateBlock(path: number[]): void;\n reorderBlock(path: number[], destination: number[], position?: 'prepend' | 'append'): void;\n resetInitialize(): void;\n resetBlocks(): void;\n}\n\nexport type EditorStore = EditorState & EditorMethods;\n\nexport const createEditorStore = initializeStore<EditorState, EditorMethods>(\n initialStore,\n (set, get) => ({\n setHeight(height: number) {\n // We have to add 200-500px, because of bottom padding or margin of last element\n // which is not taken into calculation of final height\n const newHeight = height + 500;\n set((state) => ({...state, height: newHeight}));\n },\n setDeviceWidth(deviceWidth: string) {\n set((state) => ({...state, deviceWidth}));\n },\n setZoom(zoom) {\n if (zoom > 0) {\n set((state) => ({...state, zoom}));\n }\n },\n increaseZoom() {\n const currentZoom = get().zoom;\n\n for (const step of ZOOM_STEPS) {\n if (currentZoom < step) {\n get().setZoom(step);\n break;\n }\n }\n },\n decreaseZoom() {\n const currentZoom = get().zoom;\n const reverseSteps = ZOOM_STEPS.slice().reverse();\n\n for (const step of reverseSteps) {\n if (currentZoom > step) {\n get().setZoom(step);\n break;\n }\n }\n },\n setConfig(data) {\n set((state) => ({...state, ...data}));\n },\n insertBlock: (arrayPath, blockType, position = 'append') => {\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n arrayPath[arrayPath.length - 1] = arrayPath[arrayPath.length - 1] + 1;\n }\n\n const blocksConfig = get().content.blocks;\n const blocksData = get().blocks;\n\n const foundBlock = blocksData.find(({type}) => type === blockType);\n const defaultValue =\n foundBlock && foundBlock.schema.default\n ? {...foundBlock.schema.default, type: blockType}\n : {type: blockType};\n\n const newBlocksConfig = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n (parentBlocks, index) =>\n insert(parentBlocks, index, defaultValue as ConstructorBlock),\n );\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: arrayPath,\n }));\n },\n enableInsertMode(blockType: string) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'insert',\n preInsertBlockType: blockType,\n }));\n },\n disableMode() {\n set((state) => ({\n ...state,\n manipulateOverlayMode: false,\n preInsertBlockType: undefined,\n preReorderBlockPath: undefined,\n }));\n },\n enableReorderMode(path) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'reorder',\n preReorderBlockPath: path,\n }));\n },\n setContent(content) {\n set((state) => ({\n ...state,\n content: content,\n }));\n },\n initialize() {\n set((state) => ({\n ...state,\n initialized: true,\n }));\n },\n setSelectedBlock(path) {\n set((state) => ({\n ...state,\n selectedBlock: path,\n }));\n },\n updateField(path, value) {\n set((state) => {\n const newConfig = _.set(state.content, path, value);\n return {\n ...state,\n content: newConfig,\n };\n });\n },\n deleteBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: null,\n }));\n },\n duplicateBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, duplicateArrayItem);\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n }));\n },\n reorderBlock: (arrayPath, destination, position = 'append') => {\n // Create a copy of the destination array before any modifications\n let finalDestinationPath: number[] = _.cloneDeep(destination);\n\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n destination[destination.length - 1] = destination[destination.length - 1] + 1;\n }\n\n let newBlocksConfig: ConstructorBlock[];\n const blocksConfig = get().content.blocks;\n // Copy\n const copiedBlock = _.get(blocksConfig, generateChildrenPathFromArray(arrayPath));\n\n if (isItemsNeighbours(arrayPath, destination)) {\n newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks) => {\n return reorderArrayItems(\n parentBlocks,\n arrayPath[arrayPath.length - 1],\n destination[destination.length - 1],\n );\n });\n\n if (\n position === 'append' &&\n destination[destination.length - 1] < arrayPath[arrayPath.length - 1]\n ) {\n finalDestinationPath[finalDestinationPath.length - 1] =\n finalDestinationPath[finalDestinationPath.length - 1] + 1;\n }\n } else {\n const arrayDest = getDestinationShiftBeforeReorder(arrayPath, destination);\n finalDestinationPath = _.cloneDeep(arrayDest);\n\n // Delete\n const blocksConfigWithoutBlock = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n removeFromArray,\n );\n // Paste\n newBlocksConfig = modifyObjectByPath(\n blocksConfigWithoutBlock,\n arrayDest,\n (parentBlocks, index) => insert(parentBlocks, index, copiedBlock),\n );\n }\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: finalDestinationPath,\n }));\n },\n resetInitialize: () => {\n set((state) => ({\n ...state,\n initialized: false,\n }));\n },\n resetBlocks: () => {\n set((state) => ({\n ...state,\n content: {...state.content, blocks: []},\n }));\n },\n }),\n);\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"../../../src","sources":["editor-v2/store.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAc,YAAY,EAAC,2BAAwB;AAE1D,OAAO,EAAC,eAAe,EAAC,2BAAwB;AAGhD,OAAO,EAAC,UAAU,EAAC,uBAAoB;AACvC,OAAO,EACH,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GACpB,yBAAgB;AA2BjB,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAC5C,YAAY,EACZ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACX,SAAS,CAAC,MAAc;QACpB,gFAAgF;QAChF,sDAAsD;QACtD,MAAM,SAAS,GAAG,MAAM,GAAG,GAAG,CAAC;QAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,C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AC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAC;YACpD,aAAa,EAAE,oBAAoB;SACtC,CAAC,CAAC,CAAC;IACR,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,WAAW,EAAE,KAAK;SACrB,CAAC,CAAC,CAAC;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC;SAC1C,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAC,CACL,CAAC","sourcesContent":["import _ from 'lodash';\n\nimport {EditorState, initialStore} from '../common/store';\nimport {DynamicFormValue} from '../common/types';\nimport {initializeStore} from '../common/utils';\nimport {ConstructorBlock, PageContentWithNavigation} from '../models';\n\nimport {ZOOM_STEPS} from './constants';\nimport {\n duplicateArrayItem,\n generateChildrenPathFromArray,\n getDestinationShiftBeforeReorder,\n insert,\n isItemsNeighbours,\n modifyObjectByPath,\n removeFromArray,\n reorderArrayItems,\n} from './utils';\n\nexport interface EditorMethods {\n initialize(): void;\n setSelectedBlock(path: number[] | null): void;\n setHeight(height: number): void;\n setDeviceWidth(deviceWidth: string): void;\n setZoom(zoom: number): void;\n increaseZoom(): void;\n decreaseZoom(): void;\n togglePreviewMode(): void;\n setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;\n setContent(data: PageContentWithNavigation): void;\n insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;\n enableInsertMode(blockType: string): void;\n enableReorderMode(path: number[]): void;\n disableMode(): void;\n updateField(path: string, value: DynamicFormValue): void;\n deleteBlock(path: number[]): void;\n duplicateBlock(path: number[]): void;\n reorderBlock(path: number[], destination: number[], position?: 'prepend' | 'append'): void;\n resetInitialize(): void;\n resetBlocks(): void;\n}\n\nexport type EditorStore = EditorState & EditorMethods;\n\nexport const createEditorStore = initializeStore<EditorState, EditorMethods>(\n initialStore,\n (set, get) => ({\n setHeight(height: number) {\n // We have to add 200-500px, because of bottom padding or margin of last element\n // which is not taken into calculation of final height\n const newHeight = height + 500;\n set((state) => ({...state, height: newHeight}));\n },\n setDeviceWidth(deviceWidth: string) {\n set((state) => ({...state, deviceWidth}));\n },\n setZoom(zoom) {\n if (zoom > 0) {\n set((state) => ({...state, zoom}));\n }\n },\n increaseZoom() {\n const currentZoom = get().zoom;\n\n for (const step of ZOOM_STEPS) {\n if (currentZoom < step) {\n get().setZoom(step);\n break;\n }\n }\n },\n decreaseZoom() {\n const currentZoom = get().zoom;\n const reverseSteps = ZOOM_STEPS.slice().reverse();\n\n for (const step of reverseSteps) {\n if (currentZoom > step) {\n get().setZoom(step);\n break;\n }\n }\n },\n togglePreviewMode() {\n set((state) => ({...state, isPreviewMode: !state.isPreviewMode}));\n },\n setConfig(data) {\n set((state) => ({...state, ...data}));\n },\n insertBlock: (arrayPath, blockType, position = 'append') => {\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n arrayPath[arrayPath.length - 1] = arrayPath[arrayPath.length - 1] + 1;\n }\n\n const blocksConfig = get().content.blocks;\n const blocksData = get().blocks;\n\n const foundBlock = blocksData.find(({type}) => type === blockType);\n const defaultValue =\n foundBlock && foundBlock.schema.default\n ? {...foundBlock.schema.default, type: blockType}\n : {type: blockType};\n\n const newBlocksConfig = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n (parentBlocks, index) =>\n insert(parentBlocks, index, defaultValue as ConstructorBlock),\n );\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: arrayPath,\n }));\n },\n enableInsertMode(blockType: string) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'insert',\n preInsertBlockType: blockType,\n }));\n },\n disableMode() {\n set((state) => ({\n ...state,\n manipulateOverlayMode: false,\n preInsertBlockType: undefined,\n preReorderBlockPath: undefined,\n }));\n },\n enableReorderMode(path) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'reorder',\n preReorderBlockPath: path,\n }));\n },\n setContent(content) {\n set((state) => ({\n ...state,\n content: content,\n }));\n },\n initialize() {\n set((state) => ({\n ...state,\n initialized: true,\n }));\n },\n setSelectedBlock(path) {\n set((state) => ({\n ...state,\n selectedBlock: path,\n }));\n },\n updateField(path, value) {\n set((state) => {\n const newConfig = _.set(state.content, path, value);\n return {\n ...state,\n content: newConfig,\n };\n });\n },\n deleteBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: null,\n }));\n },\n duplicateBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, duplicateArrayItem);\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n }));\n },\n reorderBlock: (arrayPath, destination, position = 'append') => {\n // Create a copy of the destination array before any modifications\n let finalDestinationPath: number[] = _.cloneDeep(destination);\n\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n destination[destination.length - 1] = destination[destination.length - 1] + 1;\n }\n\n let newBlocksConfig: ConstructorBlock[];\n const blocksConfig = get().content.blocks;\n // Copy\n const copiedBlock = _.get(blocksConfig, generateChildrenPathFromArray(arrayPath));\n\n if (isItemsNeighbours(arrayPath, destination)) {\n newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks) => {\n return reorderArrayItems(\n parentBlocks,\n arrayPath[arrayPath.length - 1],\n destination[destination.length - 1],\n );\n });\n\n if (\n position === 'append' &&\n destination[destination.length - 1] < arrayPath[arrayPath.length - 1]\n ) {\n finalDestinationPath[finalDestinationPath.length - 1] =\n finalDestinationPath[finalDestinationPath.length - 1] + 1;\n }\n } else {\n const arrayDest = getDestinationShiftBeforeReorder(arrayPath, destination);\n finalDestinationPath = _.cloneDeep(arrayDest);\n\n // Delete\n const blocksConfigWithoutBlock = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n removeFromArray,\n );\n // Paste\n newBlocksConfig = modifyObjectByPath(\n blocksConfigWithoutBlock,\n arrayDest,\n (parentBlocks, index) => insert(parentBlocks, index, copiedBlock),\n );\n }\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: finalDestinationPath,\n }));\n },\n resetInitialize: () => {\n set((state) => ({\n ...state,\n initialized: false,\n }));\n },\n resetBlocks: () => {\n set((state) => ({\n ...state,\n content: {...state.content, blocks: []},\n }));\n },\n }),\n);\n"]}
@@ -4,5 +4,6 @@ declare const usePCEditorBlockMouseEvents: (arrayIndex: number[], element?: HTML
4
4
  onMouseMove: (e: React.MouseEvent) => void;
5
5
  onMouseUp: (e: React.MouseEvent) => void;
6
6
  onMouseLeave: () => void;
7
+ 'data-editor-item': boolean;
7
8
  };
8
9
  export default usePCEditorBlockMouseEvents;
@@ -41,6 +41,7 @@ const usePCEditorBlockMouseEvents = (arrayIndex, element) => {
41
41
  onMouseMove,
42
42
  onMouseUp,
43
43
  onMouseLeave,
44
+ 'data-editor-item': true,
44
45
  };
45
46
  };
46
47
  export default usePCEditorBlockMouseEvents;
@@ -1 +1 @@
1
- {"version":3,"file":"usePCEditorBlockMouseEvents.js","sourceRoot":"../../../src","sources":["hooks/usePCEditorBlockMouseEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,4BAA4B,EAAC,2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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,IAAI,EAAE,CAAC;gBACP,oBAAoB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAC7B,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,IAAI,OAAO,EAAE,CAAC;YACV,oBAAoB,CAAC,gBAAgB,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACxB,CAAC;IAEF,OAAO;QACH,OAAO;QACP,WAAW;QACX,SAAS;QACT,YAAY;KACf,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC","sourcesContent":["import * as React from 'react';\n\nimport _ from 'lodash';\n\nimport {getCursorPositionOverElement} from '../utils/editor';\n\nimport {sendEventPostMessage} from './usePostMessageAPI';\n\nconst usePCEditorBlockMouseEvents = (arrayIndex: number[], element?: HTMLElement) => {\n const onMouseUp = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n const position = getCursorPositionOverElement(rect, e);\n sendEventPostMessage('ON_MOUSE_UP', {path: arrayIndex, rect, position});\n }\n }\n },\n [arrayIndex, element],\n );\n\n const onMouseMove = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n const position = getCursorPositionOverElement(rect, e);\n sendEventPostMessage('ON_HOVER_BLOCK', {rect, position});\n }\n }\n },\n [element],\n );\n\n const onMouseLeave = React.useCallback(() => {\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n sendEventPostMessage('ON_HOVER_BLOCK', {});\n }\n }\n }, [element]);\n\n const onClick = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n sendEventPostMessage('ON_CLICK_BLOCK', {path: arrayIndex});\n }\n },\n [arrayIndex, element],\n );\n\n return {\n onClick,\n onMouseMove,\n onMouseUp,\n onMouseLeave,\n };\n};\n\nexport default usePCEditorBlockMouseEvents;\n"]}
1
+ {"version":3,"file":"usePCEditorBlockMouseEvents.js","sourceRoot":"../../../src","sources":["hooks/usePCEditorBlockMouseEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,4BAA4B,EAAC,2BAAwB;AAE7D,OAAO,EAAC,oBAAoB,EAAC,+BAA4B;AAEzD,MAAM,2BAA2B,GAAG,CAAC,UAAoB,EAAE,OAAqB,EAAE,EAAE;IAChF,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAC/B,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,IAAI,EAAE,CAAC;gBACP,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBACvD,oBAAoB,CAAC,aAAa,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAC,CAAC,CAAC;YAC5E,CAAC;QACL,CAAC;IACL,CAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACxB,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACjC,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,IAAI,EAAE,CAAC;gBACP,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBACvD,oBAAoB,CAAC,gBAAgB,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC,CAAC;YAC7D,CAAC;QACL,CAAC;IACL,CAAC,EACD,CAAC,OAAO,CAAC,CACZ,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,IAAI,EAAE,CAAC;gBACP,oBAAoB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAC7B,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,IAAI,OAAO,EAAE,CAAC;YACV,oBAAoB,CAAC,gBAAgB,EAAE,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACxB,CAAC;IAEF,OAAO;QACH,OAAO;QACP,WAAW;QACX,SAAS;QACT,YAAY;QACZ,kBAAkB,EAAE,IAAI;KAC3B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC","sourcesContent":["import * as React from 'react';\n\nimport _ from 'lodash';\n\nimport {getCursorPositionOverElement} from '../utils/editor';\n\nimport {sendEventPostMessage} from './usePostMessageAPI';\n\nconst usePCEditorBlockMouseEvents = (arrayIndex: number[], element?: HTMLElement) => {\n const onMouseUp = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n const position = getCursorPositionOverElement(rect, e);\n sendEventPostMessage('ON_MOUSE_UP', {path: arrayIndex, rect, position});\n }\n }\n },\n [arrayIndex, element],\n );\n\n const onMouseMove = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n const position = getCursorPositionOverElement(rect, e);\n sendEventPostMessage('ON_HOVER_BLOCK', {rect, position});\n }\n }\n },\n [element],\n );\n\n const onMouseLeave = React.useCallback(() => {\n if (element) {\n const rect = element.getClientRects().item(0);\n if (rect) {\n sendEventPostMessage('ON_HOVER_BLOCK', {});\n }\n }\n }, [element]);\n\n const onClick = React.useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n if (element) {\n sendEventPostMessage('ON_CLICK_BLOCK', {path: arrayIndex});\n }\n },\n [arrayIndex, element],\n );\n\n return {\n onClick,\n onMouseMove,\n onMouseUp,\n onMouseLeave,\n 'data-editor-item': true,\n };\n};\n\nexport default usePCEditorBlockMouseEvents;\n"]}
@@ -5,6 +5,7 @@ export declare function usePCEditorItemWrap(index?: number): {
5
5
  onMouseMove: (e: React.MouseEvent) => void;
6
6
  onMouseUp: (e: React.MouseEvent) => void;
7
7
  onMouseLeave: () => void;
8
+ 'data-editor-item': boolean;
8
9
  };
9
10
  blockRef: (node: HTMLElement | null) => void;
10
11
  };
@@ -20,6 +20,7 @@ declare namespace Hbspt {
20
20
  target?: string;
21
21
  cssClass?: string;
22
22
  formInstanceId?: string;
23
+ onFormReady?: (form: HTMLFormElement) => void;
23
24
  }
24
25
  }
25
26
 
@@ -10,6 +10,7 @@ export declare enum BlockType {
10
10
  ExtendedFeaturesBlock = "extended-features-block",
11
11
  SliderBlock = "slider-block",
12
12
  QuestionsBlock = "questions-block",
13
+ FoldableListBlock = "foldable-list-block",
13
14
  BannerBlock = "banner-block",
14
15
  CompaniesBlock = "companies-block",
15
16
  MediaBlock = "media-block",
@@ -112,6 +113,7 @@ export interface HeaderBlockProps {
112
113
  title: string;
113
114
  overtitle?: string | JSX.Element;
114
115
  description?: string;
116
+ additionalInfo?: string;
115
117
  buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];
116
118
  width?: HeaderWidth;
117
119
  /** @deprecated imageSize now depends on width */
@@ -170,6 +172,19 @@ export interface QuestionBlockItemProps extends QuestionItem {
170
172
  isOpened: boolean;
171
173
  onClick: () => void;
172
174
  }
175
+ export interface FoldableListItem {
176
+ title: string;
177
+ text: string;
178
+ listStyle?: 'dash' | 'disk';
179
+ link?: LinkProps;
180
+ }
181
+ export interface FoldableListProps extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
182
+ items: FoldableListItem[];
183
+ }
184
+ export interface FoldableListBlockItemProps extends FoldableListItem {
185
+ isOpened: boolean;
186
+ onClick: () => void;
187
+ }
173
188
  export interface BannerBlockProps extends BannerCardProps, Animatable {
174
189
  }
175
190
  export interface CompaniesBlockProps extends Animatable {
@@ -369,6 +384,9 @@ export type PromoFeaturesBlockModel = {
369
384
  export type QuestionsBlockModel = {
370
385
  type: BlockType.QuestionsBlock;
371
386
  } & QuestionsProps;
387
+ export type FoldableListBlockModel = {
388
+ type: BlockType.FoldableListBlock;
389
+ } & FoldableListProps;
372
390
  export type BannerBlockModel = {
373
391
  type: BlockType.BannerBlock;
374
392
  } & BannerBlockProps;
@@ -414,7 +432,7 @@ export type FormBlockModel = {
414
432
  export type SliderNewBlockModel = {
415
433
  type: BlockType.SliderNewBlock;
416
434
  } & SliderNewProps;
417
- type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | TabsBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel | FormBlockModel;
435
+ type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | FoldableListBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | TabsBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel | FormBlockModel;
418
436
  type UnstableBlockModels = SliderNewBlockModel;
419
437
  export type Block = (BlockModels | UnstableBlockModels) & BlockBaseProps;
420
438
  export {};
@@ -4,6 +4,7 @@ export var BlockType;
4
4
  BlockType["ExtendedFeaturesBlock"] = "extended-features-block";
5
5
  BlockType["SliderBlock"] = "slider-block";
6
6
  BlockType["QuestionsBlock"] = "questions-block";
7
+ BlockType["FoldableListBlock"] = "foldable-list-block";
7
8
  BlockType["BannerBlock"] = "banner-block";
8
9
  BlockType["CompaniesBlock"] = "companies-block";
9
10
  BlockType["MediaBlock"] = "media-block";