@gravity-ui/page-constructor 6.3.2-alpha.0 → 6.3.2-alpha.3

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 (482) hide show
  1. package/build/cjs/blocks/CardLayout/index.d.ts +1 -1
  2. package/build/cjs/blocks/CardLayout/index.js.map +1 -1
  3. package/build/cjs/blocks/ContentLayout/index.d.ts +1 -1
  4. package/build/cjs/blocks/ExtendedFeatures/index.d.ts +1 -1
  5. package/build/cjs/blocks/FilterBlock/index.d.ts +1 -1
  6. package/build/cjs/blocks/Form/index.d.ts +1 -1
  7. package/build/cjs/blocks/Header/dynamic-form.d.ts +1 -1
  8. package/build/cjs/blocks/Header/dynamic-form.js.map +1 -1
  9. package/build/cjs/blocks/Header/index.d.ts +1 -1
  10. package/build/cjs/blocks/HeaderSlider/index.d.ts +1 -1
  11. package/build/cjs/blocks/Icons/index.d.ts +1 -1
  12. package/build/cjs/blocks/Info/index.d.ts +1 -1
  13. package/build/cjs/blocks/Map/index.d.ts +1 -1
  14. package/build/cjs/blocks/Media/index.d.ts +1 -1
  15. package/build/cjs/blocks/PromoFeaturesBlock/index.d.ts +1 -1
  16. package/build/cjs/blocks/Questions/index.d.ts +1 -1
  17. package/build/cjs/blocks/Share/index.d.ts +1 -1
  18. package/build/cjs/blocks/Slider/dynamic-form.d.ts +1 -1
  19. package/build/cjs/blocks/Slider/dynamic-form.js.map +1 -1
  20. package/build/cjs/blocks/Slider/index.d.ts +1 -1
  21. package/build/cjs/blocks/Table/index.d.ts +1 -1
  22. package/build/cjs/blocks/Tabs/index.d.ts +1 -1
  23. package/build/cjs/blocks/TestEditorBlock/form.d.ts +1 -1
  24. package/build/cjs/blocks/TestEditorBlock/form.js.map +1 -1
  25. package/build/cjs/blocks/TestEditorBlock/index.d.ts +1 -1
  26. package/build/cjs/common/postMessage.d.ts +4 -0
  27. package/build/cjs/common/postMessage.js +31 -0
  28. package/build/cjs/common/postMessage.js.map +1 -0
  29. package/build/cjs/common/store.d.ts +40 -0
  30. package/build/cjs/common/store.js +20 -0
  31. package/build/cjs/common/store.js.map +1 -0
  32. package/build/cjs/common/types/actions.d.ts +36 -0
  33. package/build/cjs/common/types/actions.js +3 -0
  34. package/build/cjs/common/types/actions.js.map +1 -0
  35. package/build/cjs/common/types/common.d.ts +5 -0
  36. package/build/cjs/common/types/common.js +3 -0
  37. package/build/cjs/common/types/common.js.map +1 -0
  38. package/build/cjs/common/types/forms.d.ts +97 -0
  39. package/build/cjs/common/types/forms.js +3 -0
  40. package/build/cjs/common/types/forms.js.map +1 -0
  41. package/build/cjs/common/types/index.d.ts +4 -0
  42. package/build/cjs/common/types/index.js +8 -0
  43. package/build/cjs/common/types/index.js.map +1 -0
  44. package/build/cjs/common/types/messages.d.ts +9 -0
  45. package/build/cjs/common/types/messages.js +3 -0
  46. package/build/cjs/common/types/messages.js.map +1 -0
  47. package/build/cjs/common/utils.d.ts +25 -0
  48. package/build/cjs/common/utils.js +22 -0
  49. package/build/cjs/common/utils.js.map +1 -0
  50. package/build/cjs/components/Image/dynamic-form.d.ts +1 -1
  51. package/build/cjs/components/Image/dynamic-form.js.map +1 -1
  52. package/build/cjs/constructor-items.d.ts +1 -1
  53. package/build/cjs/constructor-items.js.map +1 -1
  54. package/build/cjs/context/editorStoreContext/PCEditorStoreContext.d.ts +1 -1
  55. package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js +1 -1
  56. package/build/cjs/context/editorStoreContext/PCEditorStoreContext.js.map +1 -1
  57. package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js +1 -1
  58. package/build/cjs/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -1
  59. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
  60. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.d.ts +9 -0
  61. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js +115 -0
  62. package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
  63. package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +76 -0
  64. package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +12 -0
  65. package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +27 -0
  66. package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
  67. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
  68. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +11 -0
  69. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js +68 -0
  70. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
  71. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
  72. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +22 -0
  73. package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
  74. package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -0
  75. package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +8 -0
  76. package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +13 -0
  77. package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js.map +1 -0
  78. package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
  79. package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js +16 -0
  80. package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
  81. package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
  82. package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js +12 -0
  83. package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
  84. package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
  85. package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +9 -0
  86. package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +35 -0
  87. package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
  88. package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -0
  89. package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +11 -0
  90. package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js +14 -0
  91. package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
  92. package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
  93. package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js +13 -0
  94. package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
  95. package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
  96. package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +13 -0
  97. package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
  98. package/build/cjs/editor-v2/components/DynamicForm/utils.d.ts +3 -0
  99. package/build/cjs/editor-v2/components/DynamicForm/utils.js +23 -0
  100. package/build/cjs/editor-v2/components/DynamicForm/utils.js.map +1 -0
  101. package/build/cjs/editor-v2/components/Panels/Panels.css +24 -0
  102. package/build/cjs/editor-v2/components/Panels/Panels.d.ts +8 -0
  103. package/build/cjs/editor-v2/components/Panels/Panels.js +28 -0
  104. package/build/cjs/editor-v2/components/Panels/Panels.js.map +1 -0
  105. package/build/cjs/editor-v2/components/Sidebar/Sidebar.css +14 -0
  106. package/build/cjs/editor-v2/components/Sidebar/Sidebar.d.ts +10 -0
  107. package/build/cjs/editor-v2/components/Sidebar/Sidebar.js +13 -0
  108. package/build/cjs/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
  109. package/build/cjs/editor-v2/components/Tabs/Tabs.css +31 -0
  110. package/build/cjs/editor-v2/components/Tabs/Tabs.d.ts +13 -0
  111. package/build/cjs/editor-v2/components/Tabs/Tabs.js +32 -0
  112. package/build/cjs/editor-v2/components/Tabs/Tabs.js.map +1 -0
  113. package/build/cjs/editor-v2/constants.d.ts +1 -0
  114. package/build/cjs/editor-v2/constants.js +5 -0
  115. package/build/cjs/editor-v2/constants.js.map +1 -0
  116. package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.css +22 -0
  117. package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.d.ts +4 -0
  118. package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js +58 -0
  119. package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
  120. package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.css +20 -0
  121. package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.d.ts +5 -0
  122. package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.js +28 -0
  123. package/build/cjs/editor-v2/containers/BlockConfigForm/BlockConfigForm.js.map +1 -0
  124. package/build/cjs/editor-v2/containers/BlocksList/BlocksList.css +52 -0
  125. package/build/cjs/editor-v2/containers/BlocksList/BlocksList.d.ts +2 -0
  126. package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js +43 -0
  127. package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
  128. package/build/cjs/editor-v2/containers/Editor/Editor.css +38 -0
  129. package/build/cjs/editor-v2/containers/Editor/Editor.d.ts +21 -0
  130. package/build/cjs/editor-v2/containers/Editor/Editor.js +41 -0
  131. package/build/cjs/editor-v2/containers/Editor/Editor.js.map +1 -0
  132. package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.css +9 -0
  133. package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +5 -0
  134. package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js +17 -0
  135. package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
  136. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.css +49 -0
  137. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +7 -0
  138. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js +34 -0
  139. package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
  140. package/build/cjs/editor-v2/containers/Overlay/Overlay.css +64 -0
  141. package/build/cjs/editor-v2/containers/Overlay/Overlay.d.ts +6 -0
  142. package/build/cjs/editor-v2/containers/Overlay/Overlay.js +90 -0
  143. package/build/cjs/editor-v2/containers/Overlay/Overlay.js.map +1 -0
  144. package/build/cjs/editor-v2/containers/Source/Source.css +14 -0
  145. package/build/cjs/editor-v2/containers/Source/Source.d.ts +2 -0
  146. package/build/cjs/editor-v2/containers/Source/Source.js +28 -0
  147. package/build/cjs/editor-v2/containers/Source/Source.js.map +1 -0
  148. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.css +37 -0
  149. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.d.ts +6 -0
  150. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js +41 -0
  151. package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
  152. package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
  153. package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +7 -0
  154. package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +18 -0
  155. package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
  156. package/build/cjs/editor-v2/containers/Tree/DragContext.css +25 -0
  157. package/build/cjs/editor-v2/containers/Tree/DragContext.d.ts +14 -0
  158. package/build/cjs/editor-v2/containers/Tree/DragContext.js +49 -0
  159. package/build/cjs/editor-v2/containers/Tree/DragContext.js.map +1 -0
  160. package/build/cjs/editor-v2/containers/Tree/Tree.css +10 -0
  161. package/build/cjs/editor-v2/containers/Tree/Tree.d.ts +2 -0
  162. package/build/cjs/editor-v2/containers/Tree/Tree.js +36 -0
  163. package/build/cjs/editor-v2/containers/Tree/Tree.js.map +1 -0
  164. package/build/cjs/editor-v2/containers/Tree/TreeContent.css +12 -0
  165. package/build/cjs/editor-v2/containers/Tree/TreeContent.d.ts +16 -0
  166. package/build/cjs/editor-v2/containers/Tree/TreeContent.js +61 -0
  167. package/build/cjs/editor-v2/containers/Tree/TreeContent.js.map +1 -0
  168. package/build/cjs/editor-v2/containers/Tree/TreeItem.css +50 -0
  169. package/build/cjs/editor-v2/containers/Tree/TreeItem.d.ts +13 -0
  170. package/build/cjs/editor-v2/containers/Tree/TreeItem.js +144 -0
  171. package/build/cjs/editor-v2/containers/Tree/TreeItem.js.map +1 -0
  172. package/build/cjs/editor-v2/containers/Tree/index.d.ts +4 -0
  173. package/build/cjs/editor-v2/containers/Tree/index.js +10 -0
  174. package/build/cjs/editor-v2/containers/Tree/index.js.map +1 -0
  175. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.css +13 -0
  176. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +3 -0
  177. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js +54 -0
  178. package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
  179. package/build/cjs/editor-v2/containers/index.d.ts +7 -0
  180. package/build/cjs/editor-v2/containers/index.js +19 -0
  181. package/build/cjs/editor-v2/containers/index.js.map +1 -0
  182. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
  183. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js +10 -0
  184. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
  185. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
  186. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js +35 -0
  187. package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
  188. package/build/cjs/editor-v2/context/editorStore/index.d.ts +2 -0
  189. package/build/cjs/editor-v2/context/editorStore/index.js +6 -0
  190. package/build/cjs/editor-v2/context/editorStore/index.js.map +1 -0
  191. package/build/cjs/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
  192. package/build/cjs/editor-v2/context/iframeContext/IframeContext.js +14 -0
  193. package/build/cjs/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
  194. package/build/cjs/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
  195. package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js +21 -0
  196. package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
  197. package/build/cjs/editor-v2/context/iframeContext/index.d.ts +2 -0
  198. package/build/cjs/editor-v2/context/iframeContext/index.js +6 -0
  199. package/build/cjs/editor-v2/context/iframeContext/index.js.map +1 -0
  200. package/build/cjs/editor-v2/hooks/index.d.ts +2 -0
  201. package/build/cjs/editor-v2/hooks/index.js +8 -0
  202. package/build/cjs/editor-v2/hooks/index.js.map +1 -0
  203. package/build/cjs/editor-v2/hooks/useEditorTabs.d.ts +16 -0
  204. package/build/cjs/editor-v2/hooks/useEditorTabs.js +77 -0
  205. package/build/cjs/editor-v2/hooks/useEditorTabs.js.map +1 -0
  206. package/build/cjs/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
  207. package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js +31 -0
  208. package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
  209. package/build/cjs/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
  210. package/build/cjs/editor-v2/hooks/useMainEditorStore.js +13 -0
  211. package/build/cjs/editor-v2/hooks/useMainEditorStore.js.map +1 -0
  212. package/build/cjs/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
  213. package/build/cjs/editor-v2/hooks/usePostMessageEvents.js +19 -0
  214. package/build/cjs/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
  215. package/build/cjs/editor-v2/index.d.ts +5 -0
  216. package/build/cjs/editor-v2/index.js +9 -0
  217. package/build/cjs/editor-v2/index.js.map +1 -0
  218. package/build/cjs/editor-v2/store.d.ts +48 -0
  219. package/build/cjs/editor-v2/store.js +181 -0
  220. package/build/cjs/editor-v2/store.js.map +1 -0
  221. package/build/cjs/editor-v2/styles/mixins.css +0 -0
  222. package/build/cjs/editor-v2/styles/root.css +9 -0
  223. package/build/cjs/editor-v2/styles/variables.css +0 -0
  224. package/build/cjs/editor-v2/utils/cn.d.ts +2 -0
  225. package/build/cjs/editor-v2/utils/cn.js +7 -0
  226. package/build/cjs/editor-v2/utils/cn.js.map +1 -0
  227. package/build/cjs/editor-v2/utils/code.d.ts +6 -0
  228. package/build/cjs/editor-v2/utils/code.js +13 -0
  229. package/build/cjs/editor-v2/utils/code.js.map +1 -0
  230. package/build/cjs/editor-v2/utils/index.d.ts +20 -0
  231. package/build/cjs/editor-v2/utils/index.js +161 -0
  232. package/build/cjs/editor-v2/utils/index.js.map +1 -0
  233. package/build/cjs/hooks/usePCEditorInitializeEvents.js.map +1 -1
  234. package/build/cjs/hooks/usePCEditorStore.d.ts +1 -1
  235. package/build/cjs/hooks/usePostMessageAPI.d.ts +1 -1
  236. package/build/cjs/hooks/usePostMessageAPI.js.map +1 -1
  237. package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.d.ts +1 -1
  238. package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -1
  239. package/build/cjs/utils/form-generator.d.ts +1 -1
  240. package/build/cjs/utils/form-generator.js.map +1 -1
  241. package/build/esm/blocks/CardLayout/index.d.ts +1 -1
  242. package/build/esm/blocks/CardLayout/index.js.map +1 -1
  243. package/build/esm/blocks/ContentLayout/index.d.ts +1 -1
  244. package/build/esm/blocks/ExtendedFeatures/index.d.ts +1 -1
  245. package/build/esm/blocks/FilterBlock/index.d.ts +1 -1
  246. package/build/esm/blocks/Form/index.d.ts +1 -1
  247. package/build/esm/blocks/Header/dynamic-form.d.ts +1 -1
  248. package/build/esm/blocks/Header/dynamic-form.js.map +1 -1
  249. package/build/esm/blocks/Header/index.d.ts +1 -1
  250. package/build/esm/blocks/HeaderSlider/index.d.ts +1 -1
  251. package/build/esm/blocks/Icons/index.d.ts +1 -1
  252. package/build/esm/blocks/Info/index.d.ts +1 -1
  253. package/build/esm/blocks/Map/index.d.ts +1 -1
  254. package/build/esm/blocks/Media/index.d.ts +1 -1
  255. package/build/esm/blocks/PromoFeaturesBlock/index.d.ts +1 -1
  256. package/build/esm/blocks/Questions/index.d.ts +1 -1
  257. package/build/esm/blocks/Share/index.d.ts +1 -1
  258. package/build/esm/blocks/Slider/dynamic-form.d.ts +1 -1
  259. package/build/esm/blocks/Slider/dynamic-form.js.map +1 -1
  260. package/build/esm/blocks/Slider/index.d.ts +1 -1
  261. package/build/esm/blocks/Table/index.d.ts +1 -1
  262. package/build/esm/blocks/Tabs/index.d.ts +1 -1
  263. package/build/esm/blocks/TestEditorBlock/form.d.ts +1 -1
  264. package/build/esm/blocks/TestEditorBlock/form.js.map +1 -1
  265. package/build/esm/blocks/TestEditorBlock/index.d.ts +1 -1
  266. package/build/esm/common/postMessage.d.ts +4 -0
  267. package/build/esm/common/postMessage.js +25 -0
  268. package/build/esm/common/postMessage.js.map +1 -0
  269. package/build/esm/common/store.d.ts +40 -0
  270. package/build/esm/common/store.js +17 -0
  271. package/build/esm/common/store.js.map +1 -0
  272. package/build/esm/common/types/actions.d.ts +36 -0
  273. package/build/esm/common/types/actions.js +2 -0
  274. package/build/esm/common/types/actions.js.map +1 -0
  275. package/build/esm/common/types/common.d.ts +5 -0
  276. package/build/esm/common/types/common.js +2 -0
  277. package/build/esm/common/types/common.js.map +1 -0
  278. package/build/esm/common/types/forms.d.ts +97 -0
  279. package/build/esm/common/types/forms.js +2 -0
  280. package/build/esm/common/types/forms.js.map +1 -0
  281. package/build/esm/common/types/index.d.ts +4 -0
  282. package/build/esm/common/types/index.js +5 -0
  283. package/build/esm/common/types/index.js.map +1 -0
  284. package/build/esm/common/types/messages.d.ts +9 -0
  285. package/build/esm/common/types/messages.js +2 -0
  286. package/build/esm/common/types/messages.js.map +1 -0
  287. package/build/esm/common/utils.d.ts +25 -0
  288. package/build/esm/common/utils.js +17 -0
  289. package/build/esm/common/utils.js.map +1 -0
  290. package/build/esm/components/Image/dynamic-form.d.ts +1 -1
  291. package/build/esm/components/Image/dynamic-form.js.map +1 -1
  292. package/build/esm/constructor-items.d.ts +1 -1
  293. package/build/esm/constructor-items.js.map +1 -1
  294. package/build/esm/context/editorStoreContext/PCEditorStoreContext.d.ts +1 -1
  295. package/build/esm/context/editorStoreContext/PCEditorStoreContext.js +1 -1
  296. package/build/esm/context/editorStoreContext/PCEditorStoreContext.js.map +1 -1
  297. package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js +1 -1
  298. package/build/esm/context/editorStoreContext/PCEditorStoreProvider.js.map +1 -1
  299. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
  300. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.d.ts +10 -0
  301. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js +113 -0
  302. package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
  303. package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +76 -0
  304. package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +13 -0
  305. package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +25 -0
  306. package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
  307. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
  308. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +12 -0
  309. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js +66 -0
  310. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
  311. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
  312. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +19 -0
  313. package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
  314. package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -0
  315. package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +9 -0
  316. package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +11 -0
  317. package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js.map +1 -0
  318. package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
  319. package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js +13 -0
  320. package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
  321. package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
  322. package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js +9 -0
  323. package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
  324. package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
  325. package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +10 -0
  326. package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +33 -0
  327. package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
  328. package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -0
  329. package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +12 -0
  330. package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js +12 -0
  331. package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
  332. package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
  333. package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js +10 -0
  334. package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
  335. package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
  336. package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +10 -0
  337. package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
  338. package/build/esm/editor-v2/components/DynamicForm/utils.d.ts +3 -0
  339. package/build/esm/editor-v2/components/DynamicForm/utils.js +17 -0
  340. package/build/esm/editor-v2/components/DynamicForm/utils.js.map +1 -0
  341. package/build/esm/editor-v2/components/Panels/Panels.css +24 -0
  342. package/build/esm/editor-v2/components/Panels/Panels.d.ts +9 -0
  343. package/build/esm/editor-v2/components/Panels/Panels.js +24 -0
  344. package/build/esm/editor-v2/components/Panels/Panels.js.map +1 -0
  345. package/build/esm/editor-v2/components/Sidebar/Sidebar.css +14 -0
  346. package/build/esm/editor-v2/components/Sidebar/Sidebar.d.ts +11 -0
  347. package/build/esm/editor-v2/components/Sidebar/Sidebar.js +9 -0
  348. package/build/esm/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
  349. package/build/esm/editor-v2/components/Tabs/Tabs.css +31 -0
  350. package/build/esm/editor-v2/components/Tabs/Tabs.d.ts +14 -0
  351. package/build/esm/editor-v2/components/Tabs/Tabs.js +30 -0
  352. package/build/esm/editor-v2/components/Tabs/Tabs.js.map +1 -0
  353. package/build/esm/editor-v2/constants.d.ts +1 -0
  354. package/build/esm/editor-v2/constants.js +2 -0
  355. package/build/esm/editor-v2/constants.js.map +1 -0
  356. package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.css +22 -0
  357. package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.d.ts +5 -0
  358. package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js +56 -0
  359. package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
  360. package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.css +20 -0
  361. package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.d.ts +6 -0
  362. package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.js +26 -0
  363. package/build/esm/editor-v2/containers/BlockConfigForm/BlockConfigForm.js.map +1 -0
  364. package/build/esm/editor-v2/containers/BlocksList/BlocksList.css +52 -0
  365. package/build/esm/editor-v2/containers/BlocksList/BlocksList.d.ts +3 -0
  366. package/build/esm/editor-v2/containers/BlocksList/BlocksList.js +41 -0
  367. package/build/esm/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
  368. package/build/esm/editor-v2/containers/Editor/Editor.css +38 -0
  369. package/build/esm/editor-v2/containers/Editor/Editor.d.ts +22 -0
  370. package/build/esm/editor-v2/containers/Editor/Editor.js +37 -0
  371. package/build/esm/editor-v2/containers/Editor/Editor.js.map +1 -0
  372. package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.css +9 -0
  373. package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +6 -0
  374. package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js +15 -0
  375. package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
  376. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.css +49 -0
  377. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +8 -0
  378. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js +32 -0
  379. package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
  380. package/build/esm/editor-v2/containers/Overlay/Overlay.css +64 -0
  381. package/build/esm/editor-v2/containers/Overlay/Overlay.d.ts +7 -0
  382. package/build/esm/editor-v2/containers/Overlay/Overlay.js +88 -0
  383. package/build/esm/editor-v2/containers/Overlay/Overlay.js.map +1 -0
  384. package/build/esm/editor-v2/containers/Source/Source.css +14 -0
  385. package/build/esm/editor-v2/containers/Source/Source.d.ts +3 -0
  386. package/build/esm/editor-v2/containers/Source/Source.js +26 -0
  387. package/build/esm/editor-v2/containers/Source/Source.js.map +1 -0
  388. package/build/esm/editor-v2/containers/SourceCode/SourceCode.css +37 -0
  389. package/build/esm/editor-v2/containers/SourceCode/SourceCode.d.ts +7 -0
  390. package/build/esm/editor-v2/containers/SourceCode/SourceCode.js +39 -0
  391. package/build/esm/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
  392. package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
  393. package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +8 -0
  394. package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +14 -0
  395. package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
  396. package/build/esm/editor-v2/containers/Tree/DragContext.css +25 -0
  397. package/build/esm/editor-v2/containers/Tree/DragContext.d.ts +15 -0
  398. package/build/esm/editor-v2/containers/Tree/DragContext.js +45 -0
  399. package/build/esm/editor-v2/containers/Tree/DragContext.js.map +1 -0
  400. package/build/esm/editor-v2/containers/Tree/Tree.css +10 -0
  401. package/build/esm/editor-v2/containers/Tree/Tree.d.ts +3 -0
  402. package/build/esm/editor-v2/containers/Tree/Tree.js +34 -0
  403. package/build/esm/editor-v2/containers/Tree/Tree.js.map +1 -0
  404. package/build/esm/editor-v2/containers/Tree/TreeContent.css +12 -0
  405. package/build/esm/editor-v2/containers/Tree/TreeContent.d.ts +17 -0
  406. package/build/esm/editor-v2/containers/Tree/TreeContent.js +57 -0
  407. package/build/esm/editor-v2/containers/Tree/TreeContent.js.map +1 -0
  408. package/build/esm/editor-v2/containers/Tree/TreeItem.css +50 -0
  409. package/build/esm/editor-v2/containers/Tree/TreeItem.d.ts +14 -0
  410. package/build/esm/editor-v2/containers/Tree/TreeItem.js +140 -0
  411. package/build/esm/editor-v2/containers/Tree/TreeItem.js.map +1 -0
  412. package/build/esm/editor-v2/containers/Tree/index.d.ts +4 -0
  413. package/build/esm/editor-v2/containers/Tree/index.js +5 -0
  414. package/build/esm/editor-v2/containers/Tree/index.js.map +1 -0
  415. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.css +13 -0
  416. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +4 -0
  417. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js +52 -0
  418. package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
  419. package/build/esm/editor-v2/containers/index.d.ts +7 -0
  420. package/build/esm/editor-v2/containers/index.js +8 -0
  421. package/build/esm/editor-v2/containers/index.js.map +1 -0
  422. package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
  423. package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js +6 -0
  424. package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
  425. package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
  426. package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js +30 -0
  427. package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
  428. package/build/esm/editor-v2/context/editorStore/index.d.ts +2 -0
  429. package/build/esm/editor-v2/context/editorStore/index.js +3 -0
  430. package/build/esm/editor-v2/context/editorStore/index.js.map +1 -0
  431. package/build/esm/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
  432. package/build/esm/editor-v2/context/iframeContext/IframeContext.js +10 -0
  433. package/build/esm/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
  434. package/build/esm/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
  435. package/build/esm/editor-v2/context/iframeContext/IframeProvider.js +16 -0
  436. package/build/esm/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
  437. package/build/esm/editor-v2/context/iframeContext/index.d.ts +2 -0
  438. package/build/esm/editor-v2/context/iframeContext/index.js +3 -0
  439. package/build/esm/editor-v2/context/iframeContext/index.js.map +1 -0
  440. package/build/esm/editor-v2/hooks/index.d.ts +2 -0
  441. package/build/esm/editor-v2/hooks/index.js +3 -0
  442. package/build/esm/editor-v2/hooks/index.js.map +1 -0
  443. package/build/esm/editor-v2/hooks/useEditorTabs.d.ts +16 -0
  444. package/build/esm/editor-v2/hooks/useEditorTabs.js +72 -0
  445. package/build/esm/editor-v2/hooks/useEditorTabs.js.map +1 -0
  446. package/build/esm/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
  447. package/build/esm/editor-v2/hooks/useMainEditorInitialize.js +29 -0
  448. package/build/esm/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
  449. package/build/esm/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
  450. package/build/esm/editor-v2/hooks/useMainEditorStore.js +8 -0
  451. package/build/esm/editor-v2/hooks/useMainEditorStore.js.map +1 -0
  452. package/build/esm/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
  453. package/build/esm/editor-v2/hooks/usePostMessageEvents.js +15 -0
  454. package/build/esm/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
  455. package/build/esm/editor-v2/index.d.ts +5 -0
  456. package/build/esm/editor-v2/index.js +6 -0
  457. package/build/esm/editor-v2/index.js.map +1 -0
  458. package/build/esm/editor-v2/store.d.ts +48 -0
  459. package/build/esm/editor-v2/store.js +177 -0
  460. package/build/esm/editor-v2/store.js.map +1 -0
  461. package/build/esm/editor-v2/styles/mixins.css +0 -0
  462. package/build/esm/editor-v2/styles/root.css +9 -0
  463. package/build/esm/editor-v2/styles/variables.css +0 -0
  464. package/build/esm/editor-v2/utils/cn.d.ts +2 -0
  465. package/build/esm/editor-v2/utils/cn.js +4 -0
  466. package/build/esm/editor-v2/utils/cn.js.map +1 -0
  467. package/build/esm/editor-v2/utils/code.d.ts +6 -0
  468. package/build/esm/editor-v2/utils/code.js +9 -0
  469. package/build/esm/editor-v2/utils/code.js.map +1 -0
  470. package/build/esm/editor-v2/utils/index.d.ts +20 -0
  471. package/build/esm/editor-v2/utils/index.js +143 -0
  472. package/build/esm/editor-v2/utils/index.js.map +1 -0
  473. package/build/esm/hooks/usePCEditorInitializeEvents.js.map +1 -1
  474. package/build/esm/hooks/usePCEditorStore.d.ts +1 -1
  475. package/build/esm/hooks/usePostMessageAPI.d.ts +1 -1
  476. package/build/esm/hooks/usePostMessageAPI.js.map +1 -1
  477. package/build/esm/sub-blocks/BackgroundCard/dynamic-form.d.ts +1 -1
  478. package/build/esm/sub-blocks/BackgroundCard/dynamic-form.js.map +1 -1
  479. package/build/esm/utils/form-generator.d.ts +1 -1
  480. package/build/esm/utils/form-generator.js.map +1 -1
  481. package/package.json +1 -2
  482. package/widget/index.js +1 -1
@@ -0,0 +1,10 @@
1
+ .pceditor-tree {
2
+ padding: 12px;
3
+ position: relative;
4
+ }
5
+ .pceditor-tree__head {
6
+ margin-bottom: 10px;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ }
@@ -0,0 +1,3 @@
1
+ import './Tree.css';
2
+ declare const Tree: () => import("react/jsx-runtime").JSX.Element;
3
+ export default Tree;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { editorCn } from "../../utils/cn.js";
4
+ import { DragContextProvider } from "./DragContext.js";
5
+ import { TreeContent } from "./TreeContent.js";
6
+ import { useMainEditorStore } from "../../hooks/useMainEditorStore.js";
7
+ import { Button, Icon } from '@gravity-ui/uikit';
8
+ import { TrashBin } from '@gravity-ui/icons';
9
+ import { generateChildrenPathFromArray, getItemTitle } from "../../utils/index.js";
10
+ import './Tree.css';
11
+ const b = editorCn('tree');
12
+ const generateTree = (items) => {
13
+ return items.map((item) => {
14
+ let children;
15
+ if ('children' in item && item.children?.length) {
16
+ children = generateTree(item.children);
17
+ }
18
+ return {
19
+ type: item.type,
20
+ children,
21
+ treeTitle: getItemTitle(item),
22
+ };
23
+ });
24
+ };
25
+ // Main Tree component with context provider
26
+ const Tree = () => {
27
+ const { content, resetBlocks, selectedBlock, duplicateBlock, deleteBlock, setSelectedBlock, reorderBlock, } = useMainEditorStore();
28
+ const selectedBlockPath = React.useMemo(() => {
29
+ return generateChildrenPathFromArray(selectedBlock || []);
30
+ }, [selectedBlock]);
31
+ return (_jsx(DragContextProvider, { children: _jsxs("div", { className: b(), children: [_jsx("div", { className: b('head'), children: _jsxs(Button, { view: "outlined-danger", onClick: () => resetBlocks(), children: [_jsx(Icon, { data: TrashBin }), "Clear all"] }) }), _jsx(TreeContent, { reorderBlock: reorderBlock, onCopy: duplicateBlock, onDelete: deleteBlock, onSelect: setSelectedBlock, blockTree: generateTree(content.blocks), selectedBlockPath: selectedBlockPath })] }) }));
32
+ };
33
+ export default Tree;
34
+ //# sourceMappingURL=Tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/Tree/Tree.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AACxC,OAAO,EAAC,mBAAmB,EAAC,yBAAsB;AAClD,OAAO,EAAC,WAAW,EAAW,yBAAsB;AAEpD,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,6BAA6B,EAAE,YAAY,EAAC,6BAAoB;AAExE,OAAO,YAAY,CAAC;AAEpB,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE3B,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAc,EAAE;IACnD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtB,IAAI,QAAQ,CAAC;QAEb,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\nimport {DragContextProvider} from './DragContext';\nimport {TreeContent, TreeItem} from './TreeContent';\n\nimport {useMainEditorStore} from '../../hooks/useMainEditorStore';\nimport {Button, Icon} from '@gravity-ui/uikit';\nimport {TrashBin} from '@gravity-ui/icons';\nimport {generateChildrenPathFromArray, getItemTitle} from '../../utils';\n\nimport './Tree.scss';\n\nconst b = editorCn('tree');\n\nconst generateTree = (items: TreeItem[]): TreeItem[] => {\n return items.map((item) => {\n let children;\n\n if ('children' in item && item.children?.length) {\n children = generateTree(item.children);\n }\n\n return {\n type: item.type,\n children,\n treeTitle: getItemTitle(item),\n };\n });\n};\n\n// Main Tree component with context provider\nconst Tree = () => {\n const {\n content,\n resetBlocks,\n selectedBlock,\n duplicateBlock,\n deleteBlock,\n setSelectedBlock,\n reorderBlock,\n } = useMainEditorStore();\n\n const selectedBlockPath = React.useMemo(() => {\n return generateChildrenPathFromArray(selectedBlock || []);\n }, [selectedBlock]);\n\n return (\n <DragContextProvider>\n <div className={b()}>\n <div className={b('head')}>\n <Button view=\"outlined-danger\" onClick={() => resetBlocks()}>\n <Icon data={TrashBin} />\n Clear all\n </Button>\n </div>\n <TreeContent\n reorderBlock={reorderBlock}\n onCopy={duplicateBlock}\n onDelete={deleteBlock}\n onSelect={setSelectedBlock}\n blockTree={generateTree(content.blocks)}\n selectedBlockPath={selectedBlockPath}\n />\n </div>\n </DragContextProvider>\n );\n};\n\nexport default Tree;\n"]}
@@ -0,0 +1,12 @@
1
+ .pceditor-tree-content {
2
+ position: relative;
3
+ }
4
+ .pceditor-tree-content__drop-zone {
5
+ height: 8px;
6
+ margin-bottom: 8px;
7
+ border-radius: 4px;
8
+ transition: background-color 0.2s;
9
+ }
10
+ .pceditor-tree-content__children {
11
+ margin-top: 8px;
12
+ }
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import './TreeContent.css';
3
+ interface TreeContentProps {
4
+ blockTree: TreeItem[];
5
+ selectedBlockPath: string;
6
+ reorderBlock(selectedBlock: number[], destination: number[], position?: 'prepend' | 'append'): void;
7
+ onCopy(path: number[]): void;
8
+ onDelete(path: number[]): void;
9
+ onSelect(path: number[]): void;
10
+ }
11
+ export type TreeItem = {
12
+ type: string;
13
+ children?: TreeItem[];
14
+ treeTitle?: string;
15
+ };
16
+ export declare const TreeContent: ({ blockTree, selectedBlockPath, reorderBlock, onCopy, onDelete, onSelect, }: React.PropsWithChildren<TreeContentProps>) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { generateChildrenPathFromArray } from "../../utils/index.js";
4
+ import { DragContext } from "./DragContext.js";
5
+ import { Item } from "./TreeItem.js";
6
+ import { editorCn } from "../../utils/cn.js";
7
+ import './TreeContent.css';
8
+ const b = editorCn('tree-content');
9
+ export const TreeContent = ({ blockTree, selectedBlockPath, reorderBlock, onCopy, onDelete, onSelect, }) => {
10
+ const { draggedItem, setDraggedItem, hidePreview, showPreview } = React.useContext(DragContext);
11
+ const handleFirstPositionDrop = React.useCallback((e) => {
12
+ e.preventDefault();
13
+ e.stopPropagation();
14
+ try {
15
+ const data = e.dataTransfer.getData('application/json');
16
+ if (data) {
17
+ const dragItem = JSON.parse(data);
18
+ // Reorder to the first position by using [0] as destination
19
+ // and 'prepend' as position
20
+ reorderBlock(dragItem.path, [0], 'prepend');
21
+ // Reset drag context
22
+ setDraggedItem(null);
23
+ hidePreview();
24
+ }
25
+ }
26
+ catch (error) {
27
+ // eslint-disable-next-line no-console
28
+ console.error('Error parsing drag data:', error);
29
+ }
30
+ }, [reorderBlock, hidePreview, setDraggedItem]);
31
+ const handleDragOver = React.useCallback((e) => {
32
+ e.preventDefault();
33
+ e.stopPropagation();
34
+ // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
35
+ e.dataTransfer.dropEffect = 'move';
36
+ // Show preview element at this position
37
+ const rect = e.currentTarget.getBoundingClientRect();
38
+ if (draggedItem) {
39
+ showPreview(rect, draggedItem);
40
+ }
41
+ }, [draggedItem, showPreview]);
42
+ const renderTree = (items, parentPathArray) => {
43
+ return items.map(({ type, treeTitle, children }, index) => {
44
+ let blockPathArray;
45
+ if (parentPathArray) {
46
+ blockPathArray = [...parentPathArray, index];
47
+ }
48
+ else {
49
+ blockPathArray = [index];
50
+ }
51
+ const blockPath = generateChildrenPathFromArray(blockPathArray);
52
+ return (_jsx(Item, { type: type, treeTitle: treeTitle, onCopy: onCopy, onDelete: onDelete, onSelect: onSelect, onReorder: reorderBlock, path: blockPathArray, selected: selectedBlockPath === blockPath, children: children && (_jsx("div", { className: b('children'), children: renderTree(children, blockPathArray) })) }, index));
53
+ });
54
+ };
55
+ return (_jsxs("div", { className: b(), children: [_jsx("div", { className: b('drop-zone'), onDragOver: handleDragOver, onDragLeave: hidePreview, onDrop: handleFirstPositionDrop }), _jsx("div", { children: renderTree(blockTree) })] }));
56
+ };
57
+ //# sourceMappingURL=TreeContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeContent.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/Tree/TreeContent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,6BAA6B,EAAC,6BAAoB;AAC1D,OAAO,EAAC,WAAW,EAAW,yBAAsB;AACpD,OAAO,EAAC,IAAI,EAAC,sBAAmB;AAChC,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AAExC,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAqBnC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EACxB,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,GACgC,EAAE,EAAE;IAC5C,MAAM,EAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAC,GAA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AAC,CAC7B,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAE,eAA0B,EAAE,EAAE;QACjE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,EAAE,KAAK,EAAE,EAAE;YACpD,IAAI,cAAwB,CAAC;YAC7B,IAAI,eAAe,EAAE,CAAC;gBAClB,cAAc,GAAG,CAAC,GAAG,eAAe,EAAE,KAAK,CAAC,CAAC;YACjD,CAAC;iBAAM,CAAC;gBACJ,cAAc,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;YACD,MAAM,SAAS,GAAG,6BAA6B,CAAC,cAAc,CAAC,CAAC;YAEhE,OAAO,CACH,KAAC,IAAI,IACD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,YAAY,EAEvB,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,iBAAiB,KAAK,SAAS,YAExC,QAAQ,IAAI,CACT,cAAK,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,YAAG,UAAU,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAO,CAC9E,IANI,KAAK,CAOP,CACV,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,EAAE,aACf,cACI,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EACzB,UAAU,EAAE,cAAc,EAC1B,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,uBAAuB,GAC5B,EACP,wBAAM,UAAU,CAAC,SAAS,CAAC,GAAO,IAChC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {generateChildrenPathFromArray} from '../../utils';\nimport {DragContext, DragItem} from './DragContext';\nimport {Item} from './TreeItem';\nimport {editorCn} from '../../utils/cn';\n\nimport './TreeContent.scss';\n\nconst b = editorCn('tree-content');\n\ninterface TreeContentProps {\n blockTree: TreeItem[];\n selectedBlockPath: string;\n reorderBlock(\n selectedBlock: number[],\n destination: number[],\n position?: 'prepend' | 'append',\n ): void;\n onCopy(path: number[]): void;\n onDelete(path: number[]): void;\n onSelect(path: number[]): void;\n}\n\nexport type TreeItem = {\n type: string;\n children?: TreeItem[];\n treeTitle?: string;\n};\n\nexport const TreeContent = ({\n blockTree,\n selectedBlockPath,\n reorderBlock,\n onCopy,\n onDelete,\n onSelect,\n}: React.PropsWithChildren<TreeContentProps>) => {\n const {draggedItem, setDraggedItem, hidePreview, showPreview} = React.useContext(DragContext);\n\n const handleFirstPositionDrop = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n try {\n const data = e.dataTransfer.getData('application/json');\n if (data) {\n const dragItem: DragItem = JSON.parse(data);\n // Reorder to the first position by using [0] as destination\n // and 'prepend' as position\n reorderBlock(dragItem.path, [0], 'prepend');\n\n // Reset drag context\n setDraggedItem(null);\n hidePreview();\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error parsing drag data:', error);\n }\n },\n [reorderBlock, hidePreview, setDraggedItem],\n );\n\n const handleDragOver = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n e.dataTransfer.dropEffect = 'move';\n\n // Show preview element at this position\n const rect = e.currentTarget.getBoundingClientRect();\n if (draggedItem) {\n showPreview(rect, draggedItem);\n }\n },\n [draggedItem, showPreview],\n );\n\n const renderTree = (items: TreeItem[], parentPathArray?: number[]) => {\n return items.map(({type, treeTitle, children}, index) => {\n let blockPathArray: number[];\n if (parentPathArray) {\n blockPathArray = [...parentPathArray, index];\n } else {\n blockPathArray = [index];\n }\n const blockPath = generateChildrenPathFromArray(blockPathArray);\n\n return (\n <Item\n type={type}\n treeTitle={treeTitle}\n onCopy={onCopy}\n onDelete={onDelete}\n onSelect={onSelect}\n onReorder={reorderBlock}\n key={index}\n path={blockPathArray}\n selected={selectedBlockPath === blockPath}\n >\n {children && (\n <div className={b('children')}>{renderTree(children, blockPathArray)}</div>\n )}\n </Item>\n );\n });\n };\n\n return (\n <div className={b()}>\n <div\n className={b('drop-zone')}\n onDragOver={handleDragOver}\n onDragLeave={hidePreview}\n onDrop={handleFirstPositionDrop}\n ></div>\n <div>{renderTree(blockTree)}</div>\n </div>\n );\n};\n"]}
@@ -0,0 +1,50 @@
1
+ .pceditor-tree-item {
2
+ padding: 8px;
3
+ margin-bottom: 8px;
4
+ cursor: pointer;
5
+ }
6
+ .pceditor-tree-item_selected {
7
+ border: 1.5px var(--g-color-line-brand) solid;
8
+ }
9
+ .pceditor-tree-item_dragging {
10
+ opacity: 0.5;
11
+ }
12
+ .pceditor-tree-item_drag-over {
13
+ border: 1.5px var(--g-color-line-generic) dashed;
14
+ }
15
+ .pceditor-tree-item:last-child {
16
+ margin-bottom: 0;
17
+ }
18
+ .pceditor-tree-item__main {
19
+ display: flex;
20
+ flex-direction: row;
21
+ align-items: center;
22
+ }
23
+ .pceditor-tree-item__main:hover .pceditor-tree-item__buttons {
24
+ display: flex;
25
+ }
26
+ .pceditor-tree-item__text {
27
+ flex: 1 1 auto;
28
+ min-width: 1px;
29
+ }
30
+ .pceditor-tree-item__buttons {
31
+ flex: 0 0 auto;
32
+ flex-direction: row;
33
+ gap: 4px;
34
+ display: none;
35
+ }
36
+ .pceditor-tree-item__type {
37
+ color: var(--g-color-text-secondary);
38
+ }
39
+ .pceditor-tree-item__title {
40
+ white-space: nowrap;
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ }
44
+ .pceditor-tree-item__children-drop-zone {
45
+ height: 8px;
46
+ margin-top: 8px;
47
+ margin-bottom: 0;
48
+ border-radius: 4px;
49
+ transition: background-color 0.2s;
50
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import './TreeItem.css';
3
+ export interface ItemProps {
4
+ type: string;
5
+ treeTitle?: string;
6
+ path: number[];
7
+ selected: boolean;
8
+ onCopy(path: number[]): void;
9
+ onDelete(path: number[]): void;
10
+ onSelect(path: number[]): void;
11
+ onReorder(sourcePath: number[], destinationPath: number[], position?: 'prepend' | 'append'): void;
12
+ children?: React.ReactNode;
13
+ }
14
+ export declare const Item: ({ type, children, treeTitle, path, selected, onCopy, onDelete, onSelect, onReorder, }: ItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,140 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Copy, TrashBin } from '@gravity-ui/icons';
3
+ import { Button, Card, Icon } from '@gravity-ui/uikit';
4
+ import * as React from 'react';
5
+ import { editorCn } from "../../utils/cn.js";
6
+ import { DragContext } from "./DragContext.js";
7
+ import './TreeItem.css';
8
+ const b = editorCn('tree-item');
9
+ export const Item = ({ type, children, treeTitle, path, selected, onCopy, onDelete, onSelect, onReorder, }) => {
10
+ const { draggedItem, setDraggedItem, showPreview, hidePreview } = React.useContext(DragContext);
11
+ const [isDragging, setIsDragging] = React.useState(false);
12
+ const [isDragOver, setIsDragOver] = React.useState(false);
13
+ const [mouseDownPos, setMouseDownPos] = React.useState(null);
14
+ const itemRef = React.useRef(null);
15
+ // Scroll into view when selected
16
+ React.useEffect(() => {
17
+ if (selected && itemRef.current) {
18
+ itemRef.current.scrollIntoView({
19
+ behavior: 'smooth',
20
+ block: 'nearest',
21
+ });
22
+ }
23
+ }, [selected]);
24
+ const handleCopy = React.useCallback(() => {
25
+ onCopy(path);
26
+ }, [onCopy, path]);
27
+ const handleDelete = React.useCallback(() => {
28
+ onDelete(path);
29
+ }, [onDelete, path]);
30
+ const handleMouseDown = React.useCallback((e) => {
31
+ setMouseDownPos({ x: e.clientX, y: e.clientY });
32
+ }, []);
33
+ const handleMouseUp = React.useCallback((e) => {
34
+ if (mouseDownPos) {
35
+ // Check if the mouse has moved significantly (dragging) or just a click
36
+ const dx = Math.abs(e.clientX - mouseDownPos.x);
37
+ const dy = Math.abs(e.clientY - mouseDownPos.y);
38
+ // If the mouse hasn't moved much, consider it a click for selection
39
+ if (dx < 5 && dy < 5) {
40
+ e.stopPropagation();
41
+ onSelect(path);
42
+ }
43
+ }
44
+ setMouseDownPos(null);
45
+ }, [mouseDownPos, onSelect, path]);
46
+ const handleDragStart = React.useCallback((e) => {
47
+ e.stopPropagation();
48
+ const dragData = {
49
+ path,
50
+ type,
51
+ treeTitle,
52
+ };
53
+ e.dataTransfer.setData('application/json', JSON.stringify(dragData));
54
+ // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
55
+ e.dataTransfer.effectAllowed = 'move';
56
+ setIsDragging(true);
57
+ // Update drag context
58
+ setDraggedItem(dragData);
59
+ }, [path, type, treeTitle, setDraggedItem]);
60
+ const handleDragEnd = React.useCallback(() => {
61
+ setIsDragging(false);
62
+ // Reset drag context
63
+ setDraggedItem(null);
64
+ hidePreview();
65
+ }, [setDraggedItem, hidePreview]);
66
+ const handleDragOver = React.useCallback((e) => {
67
+ e.preventDefault();
68
+ e.stopPropagation();
69
+ // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
70
+ e.dataTransfer.dropEffect = 'move';
71
+ setIsDragOver(true);
72
+ const rect = e.currentTarget.getBoundingClientRect();
73
+ if (draggedItem) {
74
+ showPreview(rect, draggedItem);
75
+ }
76
+ }, [showPreview, draggedItem]);
77
+ const handleDragLeave = React.useCallback(() => {
78
+ setIsDragOver(false);
79
+ hidePreview();
80
+ }, [hidePreview]);
81
+ const handleDrop = React.useCallback((e) => {
82
+ e.preventDefault();
83
+ e.stopPropagation();
84
+ setIsDragOver(false);
85
+ try {
86
+ const data = e.dataTransfer.getData('application/json');
87
+ if (data) {
88
+ const dragItem = JSON.parse(data);
89
+ if (dragItem.path.join(',') !== path.join(',')) {
90
+ onReorder(dragItem.path, path);
91
+ // Reset drag context
92
+ setDraggedItem(null);
93
+ hidePreview();
94
+ }
95
+ }
96
+ }
97
+ catch (error) {
98
+ // eslint-disable-next-line no-console
99
+ console.error('Error parsing drag data:', error);
100
+ }
101
+ }, [onReorder, path, setDraggedItem, hidePreview]);
102
+ const handleChildrenFirstPositionDrop = React.useCallback((e) => {
103
+ e.preventDefault();
104
+ e.stopPropagation();
105
+ try {
106
+ const data = e.dataTransfer.getData('application/json');
107
+ if (data) {
108
+ const dragItem = JSON.parse(data);
109
+ // Create a path for the first child position
110
+ const firstChildPath = [...path, 0];
111
+ // Reorder to the first position within children
112
+ onReorder(dragItem.path, firstChildPath, 'prepend');
113
+ // Reset drag context
114
+ setDraggedItem(null);
115
+ hidePreview();
116
+ }
117
+ }
118
+ catch (error) {
119
+ // eslint-disable-next-line no-console
120
+ console.error('Error parsing drag data:', error);
121
+ }
122
+ }, [onReorder, path, setDraggedItem, hidePreview]);
123
+ const handleDropZoneDragOver = (e) => {
124
+ e.preventDefault();
125
+ e.stopPropagation();
126
+ // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
127
+ e.dataTransfer.dropEffect = 'move';
128
+ // Show preview element at this position
129
+ const rect = e.currentTarget.getBoundingClientRect();
130
+ if (draggedItem) {
131
+ showPreview(rect, draggedItem);
132
+ }
133
+ };
134
+ return (_jsxs(Card, { ref: itemRef, className: b({
135
+ selected,
136
+ dragging: isDragging,
137
+ 'drag-over': isDragOver,
138
+ }), onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, draggable: true, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsxs("div", { className: b('main'), children: [_jsxs("div", { className: b('text'), children: [_jsx("div", { className: b('type'), children: type }), _jsx("div", { className: b('title'), children: treeTitle })] }), _jsxs("div", { className: b('buttons'), children: [_jsx(Button, { view: "flat", size: "xs", onClick: handleCopy, children: _jsx(Icon, { size: 12, data: Copy }) }), _jsx(Button, { view: "flat", size: "xs", onClick: handleDelete, children: _jsx(Icon, { size: 12, data: TrashBin }) })] })] }), children && (_jsxs(React.Fragment, { children: [_jsx("div", { className: b('children-drop-zone'), onDragOver: handleDropZoneDragOver, onDragLeave: hidePreview, onDrop: handleChildrenFirstPositionDrop }), children] }))] }));
139
+ };
140
+ //# sourceMappingURL=TreeItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeItem.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/Tree/TreeItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AACxC,OAAO,EAAC,WAAW,EAAW,yBAAsB;AAEpD,OAAO,gBAAgB,CAAC;AAExB,MAAM,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAkBhC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACjB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,GACD,EAAE,EAAE;IACZ,MAAM,EAAC,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,YAAY,EAAE,eAAe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xB,MAAM,EAAE,+BAA+B,GACpC,EACN,QAAQ,IACI,CACpB,IACE,CACV,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {Copy, TrashBin} from '@gravity-ui/icons';\nimport {Button, Card, Icon} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {editorCn} from '../../utils/cn';\nimport {DragContext, DragItem} from './DragContext';\n\nimport './TreeItem.scss';\n\nconst b = editorCn('tree-item');\n\nexport interface ItemProps {\n type: string;\n treeTitle?: string;\n path: number[];\n selected: boolean;\n onCopy(path: number[]): void;\n onDelete(path: number[]): void;\n onSelect(path: number[]): void;\n onReorder(\n sourcePath: number[],\n destinationPath: number[],\n position?: 'prepend' | 'append',\n ): void;\n children?: React.ReactNode;\n}\n\nexport const Item = ({\n type,\n children,\n treeTitle,\n path,\n selected,\n onCopy,\n onDelete,\n onSelect,\n onReorder,\n}: ItemProps) => {\n const {draggedItem, setDraggedItem, showPreview, hidePreview} = React.useContext(DragContext);\n const [isDragging, setIsDragging] = React.useState(false);\n const [isDragOver, setIsDragOver] = React.useState(false);\n const [mouseDownPos, setMouseDownPos] = React.useState<{x: number; y: number} | null>(null);\n const itemRef = React.useRef<HTMLDivElement>(null);\n\n // Scroll into view when selected\n React.useEffect(() => {\n if (selected && itemRef.current) {\n itemRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n });\n }\n }, [selected]);\n\n const handleCopy = React.useCallback(() => {\n onCopy(path);\n }, [onCopy, path]);\n\n const handleDelete = React.useCallback(() => {\n onDelete(path);\n }, [onDelete, path]);\n\n const handleMouseDown = React.useCallback((e: React.MouseEvent<HTMLDivElement>) => {\n setMouseDownPos({x: e.clientX, y: e.clientY});\n }, []);\n\n const handleMouseUp = React.useCallback(\n (e: React.MouseEvent<HTMLDivElement>) => {\n if (mouseDownPos) {\n // Check if the mouse has moved significantly (dragging) or just a click\n const dx = Math.abs(e.clientX - mouseDownPos.x);\n const dy = Math.abs(e.clientY - mouseDownPos.y);\n\n // If the mouse hasn't moved much, consider it a click for selection\n if (dx < 5 && dy < 5) {\n e.stopPropagation();\n onSelect(path);\n }\n }\n setMouseDownPos(null);\n },\n [mouseDownPos, onSelect, path],\n );\n\n const handleDragStart = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.stopPropagation();\n const dragData: DragItem = {\n path,\n type,\n treeTitle,\n };\n e.dataTransfer.setData('application/json', JSON.stringify(dragData));\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n e.dataTransfer.effectAllowed = 'move';\n setIsDragging(true);\n\n // Update drag context\n setDraggedItem(dragData);\n },\n [path, type, treeTitle, setDraggedItem],\n );\n\n const handleDragEnd = React.useCallback(() => {\n setIsDragging(false);\n\n // Reset drag context\n setDraggedItem(null);\n hidePreview();\n }, [setDraggedItem, hidePreview]);\n\n const handleDragOver = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n e.dataTransfer.dropEffect = 'move';\n setIsDragOver(true);\n\n const rect = e.currentTarget.getBoundingClientRect();\n if (draggedItem) {\n showPreview(rect, draggedItem);\n }\n },\n [showPreview, draggedItem],\n );\n\n const handleDragLeave = React.useCallback(() => {\n setIsDragOver(false);\n hidePreview();\n }, [hidePreview]);\n\n const handleDrop = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n setIsDragOver(false);\n\n try {\n const data = e.dataTransfer.getData('application/json');\n if (data) {\n const dragItem: DragItem = JSON.parse(data);\n if (dragItem.path.join(',') !== path.join(',')) {\n onReorder(dragItem.path, path);\n\n // Reset drag context\n setDraggedItem(null);\n hidePreview();\n }\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error parsing drag data:', error);\n }\n },\n [onReorder, path, setDraggedItem, hidePreview],\n );\n\n const handleChildrenFirstPositionDrop = React.useCallback(\n (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n\n try {\n const data = e.dataTransfer.getData('application/json');\n if (data) {\n const dragItem: DragItem = JSON.parse(data);\n // Create a path for the first child position\n const firstChildPath = [...path, 0];\n // Reorder to the first position within children\n onReorder(dragItem.path, firstChildPath, 'prepend');\n\n // Reset drag context\n setDraggedItem(null);\n hidePreview();\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error parsing drag data:', error);\n }\n },\n [onReorder, path, setDraggedItem, hidePreview],\n );\n\n const handleDropZoneDragOver = (e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n e.dataTransfer.dropEffect = 'move';\n\n // Show preview element at this position\n const rect = e.currentTarget.getBoundingClientRect();\n if (draggedItem) {\n showPreview(rect, draggedItem);\n }\n };\n\n return (\n <Card\n ref={itemRef}\n className={b({\n selected,\n dragging: isDragging,\n 'drag-over': isDragOver,\n })}\n onMouseDown={handleMouseDown as unknown as React.MouseEventHandler<'div'>}\n onMouseUp={handleMouseUp as unknown as React.MouseEventHandler<'div'>}\n draggable\n onDragStart={handleDragStart as unknown as React.DragEventHandler<'div'>}\n onDragEnd={handleDragEnd}\n onDragOver={handleDragOver as unknown as React.DragEventHandler<'div'>}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop as unknown as React.DragEventHandler<'div'>}\n >\n <div className={b('main')}>\n <div className={b('text')}>\n <div className={b('type')}>{type}</div>\n <div className={b('title')}>{treeTitle}</div>\n </div>\n <div className={b('buttons')}>\n <Button view=\"flat\" size=\"xs\" onClick={handleCopy}>\n <Icon size={12} data={Copy} />\n </Button>\n <Button view=\"flat\" size=\"xs\" onClick={handleDelete}>\n <Icon size={12} data={TrashBin} />\n </Button>\n </div>\n </div>\n {children && (\n <React.Fragment>\n <div\n className={b('children-drop-zone')}\n onDragOver={handleDropZoneDragOver}\n onDragLeave={hidePreview}\n onDrop={handleChildrenFirstPositionDrop}\n ></div>\n {children}\n </React.Fragment>\n )}\n </Card>\n );\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export { default } from "./Tree.js";
2
+ export * from "./DragContext.js";
3
+ export * from "./TreeItem.js";
4
+ export * from "./TreeContent.js";
@@ -0,0 +1,5 @@
1
+ export { default } from "./Tree.js";
2
+ export * from "./DragContext.js";
3
+ export * from "./TreeItem.js";
4
+ export * from "./TreeContent.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["editor-v2/containers/Tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,kBAAe;AAC/B,iCAA8B;AAC9B,8BAA2B;AAC3B,iCAA8B","sourcesContent":["export {default} from './Tree';\nexport * from './DragContext';\nexport * from './TreeItem';\nexport * from './TreeContent';\n"]}
@@ -0,0 +1,13 @@
1
+ .pceditor-view-switches {
2
+ padding: 12px;
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: 12px;
6
+ }
7
+ .pceditor-view-switches__zoom {
8
+ display: flex;
9
+ gap: 4px;
10
+ }
11
+ .pceditor-view-switches__zoom-select {
12
+ min-width: 80px;
13
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import './ViewSwitches.css';
3
+ declare const _default: React.NamedExoticComponent<{}>;
4
+ export default _default;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { Display, Minus, Plus, Smartphone } from '@gravity-ui/icons';
4
+ import { Button, Icon, SegmentedRadioGroup, Select } from '@gravity-ui/uikit';
5
+ import { ZOOM_STEPS } from "../../constants.js";
6
+ import { useMainEditorStore } from "../../hooks/useMainEditorStore.js";
7
+ import { editorCn } from "../../utils/cn.js";
8
+ import './ViewSwitches.css';
9
+ const b = editorCn('view-switches');
10
+ /**
11
+ * Available device viewport options
12
+ * - Desktop: 100% width
13
+ * - Tablet: 768px width
14
+ * - Mobile: 576px width
15
+ */
16
+ const DEVICE_OPTIONS = [
17
+ {
18
+ label: _jsx(Icon, { data: Display }),
19
+ value: '100%',
20
+ ariaLabel: 'Desktop view',
21
+ },
22
+ {
23
+ label: _jsx(Icon, { data: Smartphone }),
24
+ value: '768px',
25
+ ariaLabel: 'Tablet view',
26
+ },
27
+ {
28
+ label: _jsx(Icon, { width: 14, data: Smartphone }),
29
+ value: '576px',
30
+ ariaLabel: 'Mobile view',
31
+ },
32
+ ];
33
+ const ViewSwitches = () => {
34
+ const { zoom, setZoom, decreaseZoom, increaseZoom, deviceWidth, setDeviceWidth } = useMainEditorStore();
35
+ // Memoize zoom options to prevent unnecessary recalculations
36
+ const zoomOptions = React.useMemo(() => ZOOM_STEPS.map((step) => ({
37
+ value: String(step),
38
+ content: `${step}%`,
39
+ })), []);
40
+ // Memoize current zoom value for Select component
41
+ const currentZoomValue = React.useMemo(() => [String(zoom)], [zoom]);
42
+ // Create stable callback for zoom updates
43
+ const handleZoomUpdate = React.useCallback((value) => {
44
+ const newZoom = Number(Array.isArray(value) ? value[0] : value);
45
+ if (!isNaN(newZoom) && ZOOM_STEPS.includes(newZoom)) {
46
+ setZoom(newZoom);
47
+ }
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 }) })] })] }));
50
+ };
51
+ export default React.memo(ViewSwitches);
52
+ //# sourceMappingURL=ViewSwitches.js.map
@@ -0,0 +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,EAAE,mBAAmB,EAAE,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAC,UAAU,EAAC,2BAAwB;AAC3C,OAAO,EAAC,kBAAkB,EAAC,0CAAuC;AAClE,OAAO,EAAC,QAAQ,EAAC,0BAAuB;AAExC,OAAO,oBAAoB,CAAC;AAE5B,MAAM,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAcpC;;;;;GAKG;AACH,MAAM,cAAc,GAAmB;IACnC;QACI,KAAK,EAAE,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,GAAI;QAC9B,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,cAAc;KAC5B;IACD;QACI,KAAK,EAAE,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,GAAI;QACjC,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,aAAa;KAC3B;IACD;QACI,KAAK,EAAE,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,GAAI;QAC5C,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,aAAa;KAC3B;CACJ,CAAC;AAEF,MAAM,YAAY,GAAa,GAAG,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E,CAAC,CAC/C,KAAC,mBAAmB,CAAC,MAAM,IAAa,KAAK,EAAE,KAAK,gBAAc,SAAS,YACtE,KAAK,IADuB,KAAK,CAET,CAChC,CAAC,GACgB,EAEtB,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAC,OAAO,gBAAY,eAAe,aAC9D,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,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, 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"]}
@@ -0,0 +1,7 @@
1
+ export { Editor } from "./Editor/Editor.js";
2
+ export { default as BlockConfigForm } from "./BlockConfigForm/BlockConfigForm.js";
3
+ export { default as BlocksList } from "./BlocksList/BlocksList.js";
4
+ export { default as Source } from "./Source/Source.js";
5
+ export { default as SourceCode } from "./SourceCode/SourceCode.js";
6
+ export { default as Tree } from "./Tree/Tree.js";
7
+ export { default as ViewSwitches } from "./ViewSwitches/ViewSwitches.js";
@@ -0,0 +1,8 @@
1
+ export { Editor } from "./Editor/Editor.js";
2
+ export { default as BlockConfigForm } from "./BlockConfigForm/BlockConfigForm.js";
3
+ export { default as BlocksList } from "./BlocksList/BlocksList.js";
4
+ export { default as Source } from "./Source/Source.js";
5
+ export { default as SourceCode } from "./SourceCode/SourceCode.js";
6
+ export { default as Tree } from "./Tree/Tree.js";
7
+ export { default as ViewSwitches } from "./ViewSwitches/ViewSwitches.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["editor-v2/containers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,2BAAwB;AACvC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,6CAA0C;AAC7E,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,mCAAgC;AAC9D,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,2BAAwB;AAClD,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,mCAAgC;AAC9D,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,uBAAoB;AAC5C,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,uCAAoC","sourcesContent":["export {Editor} from './Editor/Editor';\nexport {default as BlockConfigForm} from './BlockConfigForm/BlockConfigForm';\nexport {default as BlocksList} from './BlocksList/BlocksList';\nexport {default as Source} from './Source/Source';\nexport {default as SourceCode} from './SourceCode/SourceCode';\nexport {default as Tree} from './Tree/Tree';\nexport {default as ViewSwitches} from './ViewSwitches/ViewSwitches';\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { StoreApi } from 'zustand';
3
+ import { EditorStore } from "../../store.js";
4
+ export interface MainEditorStoreContextProps {
5
+ state: StoreApi<EditorStore>;
6
+ }
7
+ export declare const MainEditorStoreContext: React.Context<MainEditorStoreContextProps>;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { createEditorStore } from "../../store.js";
3
+ export const MainEditorStoreContext = React.createContext({
4
+ state: createEditorStore(),
5
+ });
6
+ //# sourceMappingURL=MainEditorStoreContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainEditorStoreContext.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/editorStore/MainEditorStoreContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAc,iBAAiB,EAAC,uBAAoB;AAM3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAA8B;IACnF,KAAK,EAAE,iBAAiB,EAAE;CAC7B,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {StoreApi} from 'zustand';\n\nimport {EditorStore, createEditorStore} from '../../store';\n\nexport interface MainEditorStoreContextProps {\n state: StoreApi<EditorStore>;\n}\n\nexport const MainEditorStoreContext = React.createContext<MainEditorStoreContextProps>({\n state: createEditorStore(),\n});\n"]}
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface MainEditorProviderProps extends React.PropsWithChildren {
3
+ }
4
+ export declare const MainEditorStoreProvider: ({ children }: MainEditorProviderProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { removeFn } from "../../../common/utils.js";
4
+ import { createEditorStore } from "../../store.js";
5
+ import { IframeContext } from "../iframeContext/index.js";
6
+ import { MainEditorStoreContext } from "./MainEditorStoreContext.js";
7
+ export const MainEditorStoreProvider = ({ children }) => {
8
+ const { iframeElement } = React.useContext(IframeContext);
9
+ const storeRef = React.useRef();
10
+ const sendPostMessage = React.useCallback((data) => {
11
+ const message = {
12
+ state: data,
13
+ };
14
+ if (iframeElement && iframeElement.contentWindow) {
15
+ iframeElement.contentWindow.postMessage(message, '*');
16
+ }
17
+ }, [iframeElement]);
18
+ if (!storeRef.current) {
19
+ storeRef.current = createEditorStore();
20
+ }
21
+ React.useEffect(() => {
22
+ storeRef.current?.subscribe((state) => {
23
+ sendPostMessage(removeFn(state));
24
+ });
25
+ }, [sendPostMessage]);
26
+ return (_jsx(MainEditorStoreContext.Provider, { value: {
27
+ state: storeRef.current,
28
+ }, children: children }));
29
+ };
30
+ //# sourceMappingURL=MainEditorStoreProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainEditorStoreProvider.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/editorStore/MainEditorStoreProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAC,QAAQ,EAAC,iCAA8B;AAC/C,OAAO,EAAc,iBAAiB,EAAC,uBAAoB;AAC3D,OAAO,EAAC,aAAa,EAAC,kCAAyB;AAE/C,OAAO,EAAC,sBAAsB,EAAC,oCAAiC;AAIhE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAC,QAAQ,EAA0B,EAAE,EAAE;IAC3E,MAAM,EAAC,aAAa,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAyB,CAAC;IAEvD,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,IAAiB,EAAE,EAAE;QAClB,MAAM,OAAO,GAAqB;YAC9B,KAAK,EAAE,IAAI;SACd,CAAC;QAEF,IAAI,aAAa,IAAI,aAAa,CAAC,aAAa,EAAE,CAAC;YAC/C,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC,EACD,CAAC,aAAa,CAAC,CAClB,CAAC;IAEF,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,QAAQ,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YAClC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,OAAO,CACH,KAAC,sBAAsB,CAAC,QAAQ,IAC5B,KAAK,EAAE;YACH,KAAK,EAAE,QAAQ,CAAC,OAAO;SAC1B,YAEA,QAAQ,GACqB,CACrC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {StoreApi} from 'zustand';\n\nimport {EditorState} from '../../../common/store';\nimport {StoreSyncMessage} from '../../../common/types';\nimport {removeFn} from '../../../common/utils';\nimport {EditorStore, createEditorStore} from '../../store';\nimport {IframeContext} from '../iframeContext';\n\nimport {MainEditorStoreContext} from './MainEditorStoreContext';\n\ninterface MainEditorProviderProps extends React.PropsWithChildren {}\n\nexport const MainEditorStoreProvider = ({children}: MainEditorProviderProps) => {\n const {iframeElement} = React.useContext(IframeContext);\n const storeRef = React.useRef<StoreApi<EditorStore>>();\n\n const sendPostMessage = React.useCallback(\n (data: EditorState) => {\n const message: StoreSyncMessage = {\n state: data,\n };\n\n if (iframeElement && iframeElement.contentWindow) {\n iframeElement.contentWindow.postMessage(message, '*');\n }\n },\n [iframeElement],\n );\n\n if (!storeRef.current) {\n storeRef.current = createEditorStore();\n }\n\n React.useEffect(() => {\n storeRef.current?.subscribe((state) => {\n sendPostMessage(removeFn(state));\n });\n }, [sendPostMessage]);\n\n return (\n <MainEditorStoreContext.Provider\n value={{\n state: storeRef.current,\n }}\n >\n {children}\n </MainEditorStoreContext.Provider>\n );\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./MainEditorStoreContext.js";
2
+ export * from "./MainEditorStoreProvider.js";
@@ -0,0 +1,3 @@
1
+ export * from "./MainEditorStoreContext.js";
2
+ export * from "./MainEditorStoreProvider.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["editor-v2/context/editorStore/index.ts"],"names":[],"mappings":"AAAA,4CAAyC;AACzC,6CAA0C","sourcesContent":["export * from './MainEditorStoreContext';\nexport * from './MainEditorStoreProvider';\n"]}