@alpaca-editor/core 1.0.4114 → 1.0.4120

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 (314) hide show
  1. package/dist/components/FilterInput.js +3 -7
  2. package/dist/components/FilterInput.js.map +1 -1
  3. package/dist/components/ui/input.js +3 -1
  4. package/dist/components/ui/input.js.map +1 -1
  5. package/dist/components/ui/textarea.js +3 -1
  6. package/dist/components/ui/textarea.js.map +1 -1
  7. package/dist/config/config.js +1 -1
  8. package/dist/editor/AspectRatioSelector.js +3 -3
  9. package/dist/editor/AspectRatioSelector.js.map +1 -1
  10. package/dist/editor/ContentTree.js +52 -4
  11. package/dist/editor/ContentTree.js.map +1 -1
  12. package/dist/editor/ContextMenu.d.ts +2 -0
  13. package/dist/editor/ContextMenu.js +9 -7
  14. package/dist/editor/ContextMenu.js.map +1 -1
  15. package/dist/editor/EditorWarning.js +2 -2
  16. package/dist/editor/EditorWarning.js.map +1 -1
  17. package/dist/editor/FieldEditorPopup.js +7 -6
  18. package/dist/editor/FieldEditorPopup.js.map +1 -1
  19. package/dist/editor/FieldHistory.js +2 -1
  20. package/dist/editor/FieldHistory.js.map +1 -1
  21. package/dist/editor/FieldListField.js +1 -1
  22. package/dist/editor/LinkEditorDialog.d.ts +3 -1
  23. package/dist/editor/LinkEditorDialog.js +7 -3
  24. package/dist/editor/LinkEditorDialog.js.map +1 -1
  25. package/dist/editor/MainLayout.js +3 -3
  26. package/dist/editor/MainLayout.js.map +1 -1
  27. package/dist/editor/PictureCropper.js +3 -3
  28. package/dist/editor/PictureCropper.js.map +1 -1
  29. package/dist/editor/PictureEditor.d.ts +2 -1
  30. package/dist/editor/PictureEditor.js +2 -2
  31. package/dist/editor/PictureEditor.js.map +1 -1
  32. package/dist/editor/PictureEditorDialog.js +55 -50
  33. package/dist/editor/PictureEditorDialog.js.map +1 -1
  34. package/dist/editor/Terminal.js +4 -4
  35. package/dist/editor/Terminal.js.map +1 -1
  36. package/dist/editor/ai/AgentTerminal.js +298 -53
  37. package/dist/editor/ai/AgentTerminal.js.map +1 -1
  38. package/dist/editor/ai/Agents.js +2 -2
  39. package/dist/editor/ai/Agents.js.map +1 -1
  40. package/dist/editor/ai/ContextInfoBar.js +2 -2
  41. package/dist/editor/ai/ContextInfoBar.js.map +1 -1
  42. package/dist/editor/client/EditorShell.js +3 -0
  43. package/dist/editor/client/EditorShell.js.map +1 -1
  44. package/dist/editor/client/GenericDialog.js +3 -3
  45. package/dist/editor/client/GenericDialog.js.map +1 -1
  46. package/dist/editor/client/editContext.d.ts +2 -1
  47. package/dist/editor/client/editContext.js.map +1 -1
  48. package/dist/editor/client/ui/EditorChrome.js +8 -2
  49. package/dist/editor/client/ui/EditorChrome.js.map +1 -1
  50. package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +9 -7
  51. package/dist/editor/commands/localizeItem/LocalizeItemDialog.js.map +1 -1
  52. package/dist/editor/context-menu/CopyMoveMenu.js +3 -3
  53. package/dist/editor/context-menu/CopyMoveMenu.js.map +1 -1
  54. package/dist/editor/control-center/IndexOverview.js +39 -17
  55. package/dist/editor/control-center/IndexOverview.js.map +1 -1
  56. package/dist/editor/control-center/setup-steps/SettingsSetupStep.js +9 -6
  57. package/dist/editor/control-center/setup-steps/SettingsSetupStep.js.map +1 -1
  58. package/dist/editor/field-types/CheckboxEditor.js +2 -2
  59. package/dist/editor/field-types/CheckboxEditor.js.map +1 -1
  60. package/dist/editor/field-types/DateFieldEditor.js +2 -2
  61. package/dist/editor/field-types/DateFieldEditor.js.map +1 -1
  62. package/dist/editor/field-types/DateTimeFieldEditor.js.map +1 -1
  63. package/dist/editor/field-types/ImageFieldEditor.js +2 -2
  64. package/dist/editor/field-types/ImageFieldEditor.js.map +1 -1
  65. package/dist/editor/field-types/InternalLinkFieldEditor.js +2 -2
  66. package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -1
  67. package/dist/editor/field-types/LinkFieldEditor.js +8 -3
  68. package/dist/editor/field-types/LinkFieldEditor.js.map +1 -1
  69. package/dist/editor/field-types/MultiLineText.js +2 -2
  70. package/dist/editor/field-types/MultiLineText.js.map +1 -1
  71. package/dist/editor/field-types/PictureFieldEditor.js +3 -2
  72. package/dist/editor/field-types/PictureFieldEditor.js.map +1 -1
  73. package/dist/editor/field-types/RawEditor.js +2 -2
  74. package/dist/editor/field-types/RawEditor.js.map +1 -1
  75. package/dist/editor/field-types/SingleLineText.js +2 -2
  76. package/dist/editor/field-types/SingleLineText.js.map +1 -1
  77. package/dist/editor/field-types/richtext/components/ReactSlate.js +2 -2
  78. package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
  79. package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js +2 -2
  80. package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js.map +1 -1
  81. package/dist/editor/fieldTypes.d.ts +1 -0
  82. package/dist/editor/media-selector/AiImageSearch.js +5 -4
  83. package/dist/editor/media-selector/AiImageSearch.js.map +1 -1
  84. package/dist/editor/media-selector/MediaFolderBrowser.js +8 -8
  85. package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
  86. package/dist/editor/media-selector/Thumbnails.js +2 -2
  87. package/dist/editor/media-selector/Thumbnails.js.map +1 -1
  88. package/dist/editor/media-selector/TreeSelector.js +2 -2
  89. package/dist/editor/media-selector/TreeSelector.js.map +1 -1
  90. package/dist/editor/media-selector/UploadZone.js +2 -2
  91. package/dist/editor/media-selector/UploadZone.js.map +1 -1
  92. package/dist/editor/menubar/NavButtons.js +3 -5
  93. package/dist/editor/menubar/NavButtons.js.map +1 -1
  94. package/dist/editor/menubar/Separator.js +2 -2
  95. package/dist/editor/menubar/Separator.js.map +1 -1
  96. package/dist/editor/menubar/SiteInfo.js +9 -9
  97. package/dist/editor/menubar/SiteInfo.js.map +1 -1
  98. package/dist/editor/page-editor-chrome/CommentHighlighting.js +2 -2
  99. package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
  100. package/dist/editor/page-editor-chrome/FieldActionIndicator.js +2 -2
  101. package/dist/editor/page-editor-chrome/FieldActionIndicator.js.map +1 -1
  102. package/dist/editor/page-editor-chrome/FrameMenu.js +6 -1
  103. package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
  104. package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +34 -1
  105. package/dist/editor/page-editor-chrome/PictureEditorOverlay.js.map +1 -1
  106. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +6 -1
  107. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
  108. package/dist/editor/page-editor-chrome/SuggestionHighlighting.js +2 -2
  109. package/dist/editor/page-editor-chrome/SuggestionHighlighting.js.map +1 -1
  110. package/dist/editor/page-viewer/DeviceToolbar.js +3 -3
  111. package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
  112. package/dist/editor/page-viewer/PageViewerFrame.js +20 -4
  113. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  114. package/dist/editor/reviews/Reviews.js +55 -54
  115. package/dist/editor/reviews/Reviews.js.map +1 -1
  116. package/dist/editor/services/agentService.d.ts +4 -3
  117. package/dist/editor/services/agentService.js.map +1 -1
  118. package/dist/editor/services/aiService.js +5 -5
  119. package/dist/editor/services/aiService.js.map +1 -1
  120. package/dist/editor/sidebar/ComponentPalette.js +3 -3
  121. package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
  122. package/dist/editor/sidebar/ComponentTree.js +14 -10
  123. package/dist/editor/sidebar/ComponentTree.js.map +1 -1
  124. package/dist/editor/sidebar/DictionaryEditor.js +9 -9
  125. package/dist/editor/sidebar/DictionaryEditor.js.map +1 -1
  126. package/dist/editor/sidebar/EditHistory.js +4 -3
  127. package/dist/editor/sidebar/EditHistory.js.map +1 -1
  128. package/dist/editor/sidebar/SEOInfo.js +3 -2
  129. package/dist/editor/sidebar/SEOInfo.js.map +1 -1
  130. package/dist/editor/sidebar/SidebarView.js +5 -6
  131. package/dist/editor/sidebar/SidebarView.js.map +1 -1
  132. package/dist/editor/sidebar/Translations.js +5 -2
  133. package/dist/editor/sidebar/Translations.js.map +1 -1
  134. package/dist/editor/sidebar/Validation.js +2 -2
  135. package/dist/editor/sidebar/Validation.js.map +1 -1
  136. package/dist/editor/sidebar/ViewSelector.js +22 -5
  137. package/dist/editor/sidebar/ViewSelector.js.map +1 -1
  138. package/dist/editor/sidebar/Workbox.js +14 -13
  139. package/dist/editor/sidebar/Workbox.js.map +1 -1
  140. package/dist/editor/ui/DragPreview.d.ts +3 -2
  141. package/dist/editor/ui/DragPreview.js +4 -6
  142. package/dist/editor/ui/DragPreview.js.map +1 -1
  143. package/dist/editor/ui/ItemNameDialogNew.js +2 -2
  144. package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
  145. package/dist/editor/ui/PerfectTree.d.ts +4 -2
  146. package/dist/editor/ui/PerfectTree.js +6 -6
  147. package/dist/editor/ui/PerfectTree.js.map +1 -1
  148. package/dist/editor/ui/Section.js +3 -3
  149. package/dist/editor/ui/Section.js.map +1 -1
  150. package/dist/editor/ui/SimpleTable.js +3 -3
  151. package/dist/editor/ui/SimpleTable.js.map +1 -1
  152. package/dist/editor/ui/Splitter.js +8 -5
  153. package/dist/editor/ui/Splitter.js.map +1 -1
  154. package/dist/editor/views/ItemEditor.js +1 -1
  155. package/dist/editor/views/ItemEditor.js.map +1 -1
  156. package/dist/index.d.ts +1 -0
  157. package/dist/index.js +1 -0
  158. package/dist/index.js.map +1 -1
  159. package/dist/page-wizard/WizardSteps.js +2 -3
  160. package/dist/page-wizard/WizardSteps.js.map +1 -1
  161. package/dist/page-wizard/steps/CollectStep.js +2 -2
  162. package/dist/page-wizard/steps/CollectStep.js.map +1 -1
  163. package/dist/page-wizard/steps/ContentStep.js +3 -4
  164. package/dist/page-wizard/steps/ContentStep.js.map +1 -1
  165. package/dist/page-wizard/steps/Generate.js +2 -2
  166. package/dist/page-wizard/steps/Generate.js.map +1 -1
  167. package/dist/page-wizard/steps/ImagesStep.js +17 -15
  168. package/dist/page-wizard/steps/ImagesStep.js.map +1 -1
  169. package/dist/page-wizard/steps/MetaDataStep.js +2 -2
  170. package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
  171. package/dist/page-wizard/steps/SelectStep.js +5 -5
  172. package/dist/page-wizard/steps/SelectStep.js.map +1 -1
  173. package/dist/page-wizard/steps/StructureStep.js +3 -3
  174. package/dist/page-wizard/steps/StructureStep.js.map +1 -1
  175. package/dist/page-wizard/steps/TranslateStep.js +2 -2
  176. package/dist/page-wizard/steps/TranslateStep.js.map +1 -1
  177. package/dist/revision.d.ts +2 -2
  178. package/dist/revision.js +2 -2
  179. package/dist/splash-screen/NewPage.js +2 -2
  180. package/dist/splash-screen/NewPage.js.map +1 -1
  181. package/dist/splash-screen/SectionHeadline.js +2 -2
  182. package/dist/splash-screen/SectionHeadline.js.map +1 -1
  183. package/dist/styles.css +52 -26
  184. package/package.json +1 -1
  185. package/src/components/FilterInput.tsx +13 -16
  186. package/src/components/ui/input.tsx +3 -2
  187. package/src/components/ui/textarea.tsx +3 -1
  188. package/src/config/config.tsx +1 -1
  189. package/src/editor/AspectRatioSelector.tsx +3 -3
  190. package/src/editor/ContentTree.tsx +51 -2
  191. package/src/editor/ContextMenu.tsx +30 -8
  192. package/src/editor/EditorWarning.tsx +6 -6
  193. package/src/editor/FieldEditorPopup.tsx +36 -26
  194. package/src/editor/FieldHistory.tsx +2 -1
  195. package/src/editor/FieldListField.tsx +2 -2
  196. package/src/editor/LinkEditorDialog.tsx +20 -0
  197. package/src/editor/MainLayout.tsx +3 -3
  198. package/src/editor/PictureCropper.tsx +3 -3
  199. package/src/editor/PictureEditor.tsx +3 -0
  200. package/src/editor/PictureEditorDialog.tsx +167 -145
  201. package/src/editor/Terminal.tsx +5 -6
  202. package/src/editor/ai/AgentTerminal.tsx +410 -87
  203. package/src/editor/ai/Agents.tsx +2 -2
  204. package/src/editor/ai/ContextInfoBar.tsx +15 -7
  205. package/src/editor/client/EditorShell.tsx +3 -0
  206. package/src/editor/client/GenericDialog.tsx +13 -9
  207. package/src/editor/client/editContext.ts +2 -1
  208. package/src/editor/client/ui/EditorChrome.tsx +8 -4
  209. package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +30 -11
  210. package/src/editor/context-menu/CopyMoveMenu.tsx +5 -3
  211. package/src/editor/control-center/IndexOverview.tsx +63 -34
  212. package/src/editor/control-center/setup-steps/SettingsSetupStep.tsx +11 -6
  213. package/src/editor/field-types/CheckboxEditor.tsx +2 -2
  214. package/src/editor/field-types/DateFieldEditor.tsx +2 -2
  215. package/src/editor/field-types/DateTimeFieldEditor.tsx +0 -1
  216. package/src/editor/field-types/ImageFieldEditor.tsx +3 -4
  217. package/src/editor/field-types/InternalLinkFieldEditor.tsx +2 -2
  218. package/src/editor/field-types/LinkFieldEditor.tsx +8 -2
  219. package/src/editor/field-types/MultiLineText.tsx +4 -5
  220. package/src/editor/field-types/PictureFieldEditor.tsx +5 -5
  221. package/src/editor/field-types/RawEditor.tsx +4 -5
  222. package/src/editor/field-types/SingleLineText.tsx +4 -6
  223. package/src/editor/field-types/richtext/components/ReactSlate.tsx +2 -2
  224. package/src/editor/field-types/richtext/components/SimpleRichTextEditor.tsx +2 -2
  225. package/src/editor/fieldTypes.ts +1 -0
  226. package/src/editor/media-selector/AiImageSearch.tsx +11 -14
  227. package/src/editor/media-selector/MediaFolderBrowser.tsx +42 -35
  228. package/src/editor/media-selector/Thumbnails.tsx +3 -3
  229. package/src/editor/media-selector/TreeSelector.tsx +2 -2
  230. package/src/editor/media-selector/UploadZone.tsx +2 -2
  231. package/src/editor/menubar/NavButtons.tsx +12 -14
  232. package/src/editor/menubar/Separator.tsx +2 -2
  233. package/src/editor/menubar/SiteInfo.tsx +29 -23
  234. package/src/editor/page-editor-chrome/CommentHighlighting.tsx +2 -2
  235. package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +2 -2
  236. package/src/editor/page-editor-chrome/FrameMenu.tsx +6 -1
  237. package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +46 -0
  238. package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +6 -1
  239. package/src/editor/page-editor-chrome/SuggestionHighlighting.tsx +2 -2
  240. package/src/editor/page-viewer/DeviceToolbar.tsx +4 -3
  241. package/src/editor/page-viewer/PageViewerFrame.tsx +19 -3
  242. package/src/editor/reviews/Reviews.tsx +116 -106
  243. package/src/editor/services/agentService.ts +8 -3
  244. package/src/editor/services/aiService.ts +5 -5
  245. package/src/editor/sidebar/ComponentPalette.tsx +3 -3
  246. package/src/editor/sidebar/ComponentTree.tsx +19 -10
  247. package/src/editor/sidebar/DictionaryEditor.tsx +12 -13
  248. package/src/editor/sidebar/EditHistory.tsx +4 -3
  249. package/src/editor/sidebar/SEOInfo.tsx +9 -7
  250. package/src/editor/sidebar/SidebarView.tsx +8 -6
  251. package/src/editor/sidebar/Translations.tsx +9 -5
  252. package/src/editor/sidebar/Validation.tsx +2 -2
  253. package/src/editor/sidebar/ViewSelector.tsx +32 -6
  254. package/src/editor/sidebar/Workbox.tsx +81 -63
  255. package/src/editor/ui/DragPreview.tsx +10 -5
  256. package/src/editor/ui/ItemNameDialogNew.tsx +2 -2
  257. package/src/editor/ui/PerfectTree.tsx +14 -6
  258. package/src/editor/ui/Section.tsx +4 -4
  259. package/src/editor/ui/SimpleTable.tsx +3 -3
  260. package/src/editor/ui/Splitter.tsx +11 -5
  261. package/src/editor/views/ItemEditor.tsx +1 -1
  262. package/src/index.ts +6 -0
  263. package/src/page-wizard/WizardSteps.tsx +2 -3
  264. package/src/page-wizard/steps/CollectStep.tsx +3 -3
  265. package/src/page-wizard/steps/ContentStep.tsx +4 -5
  266. package/src/page-wizard/steps/Generate.tsx +2 -2
  267. package/src/page-wizard/steps/ImagesStep.tsx +43 -24
  268. package/src/page-wizard/steps/MetaDataStep.tsx +5 -5
  269. package/src/page-wizard/steps/SelectStep.tsx +8 -6
  270. package/src/page-wizard/steps/StructureStep.tsx +9 -8
  271. package/src/page-wizard/steps/TranslateStep.tsx +5 -3
  272. package/src/revision.ts +2 -2
  273. package/src/splash-screen/NewPage.tsx +2 -2
  274. package/src/splash-screen/SectionHeadline.tsx +4 -4
  275. package/dist/editor/component-designer/ComponentDesigner.d.ts +0 -1
  276. package/dist/editor/component-designer/ComponentDesigner.js +0 -51
  277. package/dist/editor/component-designer/ComponentDesigner.js.map +0 -1
  278. package/dist/editor/component-designer/ComponentDesignerMenu.d.ts +0 -1
  279. package/dist/editor/component-designer/ComponentDesignerMenu.js +0 -65
  280. package/dist/editor/component-designer/ComponentDesignerMenu.js.map +0 -1
  281. package/dist/editor/component-designer/ComponentEditor.d.ts +0 -4
  282. package/dist/editor/component-designer/ComponentEditor.js +0 -55
  283. package/dist/editor/component-designer/ComponentEditor.js.map +0 -1
  284. package/dist/editor/component-designer/ComponentRenderingCodeEditor.d.ts +0 -5
  285. package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +0 -11
  286. package/dist/editor/component-designer/ComponentRenderingCodeEditor.js.map +0 -1
  287. package/dist/editor/component-designer/ComponentRenderingEditor.d.ts +0 -1
  288. package/dist/editor/component-designer/ComponentRenderingEditor.js +0 -69
  289. package/dist/editor/component-designer/ComponentRenderingEditor.js.map +0 -1
  290. package/dist/editor/component-designer/ComponentsDropdown.d.ts +0 -4
  291. package/dist/editor/component-designer/ComponentsDropdown.js +0 -20
  292. package/dist/editor/component-designer/ComponentsDropdown.js.map +0 -1
  293. package/dist/editor/component-designer/PlaceholdersEditor.d.ts +0 -4
  294. package/dist/editor/component-designer/PlaceholdersEditor.js +0 -63
  295. package/dist/editor/component-designer/PlaceholdersEditor.js.map +0 -1
  296. package/dist/editor/component-designer/RenderingsDropdown.d.ts +0 -1
  297. package/dist/editor/component-designer/RenderingsDropdown.js +0 -23
  298. package/dist/editor/component-designer/RenderingsDropdown.js.map +0 -1
  299. package/dist/editor/component-designer/TemplateEditor.d.ts +0 -1
  300. package/dist/editor/component-designer/TemplateEditor.js +0 -142
  301. package/dist/editor/component-designer/TemplateEditor.js.map +0 -1
  302. package/dist/editor/component-designer/aiContext.d.ts +0 -5
  303. package/dist/editor/component-designer/aiContext.js +0 -14
  304. package/dist/editor/component-designer/aiContext.js.map +0 -1
  305. package/src/editor/component-designer/ComponentDesigner.tsx +0 -66
  306. package/src/editor/component-designer/ComponentDesignerMenu.tsx +0 -91
  307. package/src/editor/component-designer/ComponentEditor.tsx +0 -95
  308. package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +0 -31
  309. package/src/editor/component-designer/ComponentRenderingEditor.tsx +0 -104
  310. package/src/editor/component-designer/ComponentsDropdown.tsx +0 -39
  311. package/src/editor/component-designer/PlaceholdersEditor.tsx +0 -179
  312. package/src/editor/component-designer/RenderingsDropdown.tsx +0 -36
  313. package/src/editor/component-designer/TemplateEditor.tsx +0 -236
  314. package/src/editor/component-designer/aiContext.ts +0 -21
@@ -1,69 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Toolbar } from "../ui/Toolbar";
4
- import { ComponentRenderingCodeEditor } from "./ComponentRenderingCodeEditor";
5
- import { RenderingsDropdown } from "./RenderingsDropdown";
6
- import { useEditContext } from "../client/editContext";
7
- import { getSelectedComponents } from "../componentTreeHelper";
8
- import { Button } from "primereact/button";
9
- export function ComponentRenderingEditor() {
10
- const context = useEditContext();
11
- const [code, setCode] = useState("");
12
- useEffect(() => {
13
- async function loadRendering() {
14
- const selectedComponents = getSelectedComponents(context);
15
- if (selectedComponents.length !== 1) {
16
- context;
17
- return;
18
- }
19
- const component = selectedComponents[0];
20
- const renderingId = component?.rendering?.id;
21
- if (renderingId) {
22
- const renderingItem = await context.itemsRepository.getItem({
23
- id: renderingId,
24
- language: "en",
25
- version: 0,
26
- });
27
- context?.setComponentDesignerRendering(renderingItem);
28
- }
29
- else {
30
- context?.setComponentDesignerRendering(undefined);
31
- }
32
- }
33
- loadRendering();
34
- }, [context.selection]);
35
- const codeField = context.componentDesignerRendering?.fields.find((x) => x.name === "code");
36
- useEffect(() => {
37
- if (codeField) {
38
- setCode(codeField.value);
39
- }
40
- else {
41
- setCode("");
42
- }
43
- }, [context.componentDesignerRendering]);
44
- useEffect(() => {
45
- const refresh = async () => {
46
- if (context.componentDesignerRendering) {
47
- const renderingItem = await context.itemsRepository.getItem({
48
- id: context.componentDesignerRendering.id,
49
- language: "en",
50
- version: 0,
51
- });
52
- context?.setComponentDesignerRendering(renderingItem);
53
- }
54
- };
55
- refresh();
56
- }, [context.refreshCompletedFlag]);
57
- if (!context.componentDesignerComponent)
58
- return (_jsx("div", { className: "flex items-center justify-center h-full text-xs", children: "Select a component" }));
59
- else
60
- return (_jsxs("div", { className: "flex flex-col h-full", children: [_jsxs(Toolbar, { children: [_jsx(RenderingsDropdown, {}), _jsx(Button, { icon: "pi pi-fw pi-save", text: true, size: "small", disabled: !codeField, onClick: () => {
61
- if (!codeField)
62
- return;
63
- context.operations.editField({
64
- field: codeField.descriptor,
65
- value: code,
66
- });
67
- } })] }), _jsxs("div", { className: "flex-1", children: [!codeField && (_jsx("div", { className: "flex items-center justify-center h-full text-xs", children: "Select a rendering" })), codeField && (_jsx(ComponentRenderingCodeEditor, { code: code, setCode: setCode }))] })] }));
68
- }
69
- //# sourceMappingURL=ComponentRenderingEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentRenderingEditor.js","sourceRoot":"","sources":["../../../src/editor/component-designer/ComponentRenderingEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EA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,IAAI,CACZ,KAAC,4BAA4B,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,CAC/D,IACG,IACF,CACP,CAAC;AACN,CAAC"}
@@ -1,4 +0,0 @@
1
- import { Component } from "../services/componentDesignerService";
2
- export declare function ComponentsDropdown({ allComponents, }: {
3
- allComponents: Component[];
4
- }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEditContext } from "../client/editContext";
3
- import { loadComponentDetails, } from "../services/componentDesignerService";
4
- import { Dropdown } from "primereact/dropdown";
5
- export function ComponentsDropdown({ allComponents, }) {
6
- const context = useEditContext();
7
- if (!context?.page)
8
- return null;
9
- async function loadComponent(id) {
10
- const component = await loadComponentDetails(id, context.page.item.id);
11
- context.setComponentDesignerComponent(component);
12
- }
13
- const value = allComponents.find((x) => x.templateId === context.componentDesignerComponent?.templateId);
14
- return (_jsx(Dropdown, { value: value, filter: true, options: allComponents, optionLabel: "name", placeholder: "Select a Component", onChange: (e) => {
15
- loadComponent(e.value.templateId);
16
- context.setComponentDesignerRendering(undefined);
17
- context.select([]);
18
- } }));
19
- }
20
- //# sourceMappingURL=ComponentsDropdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentsDropdown.js","sourceRoot":"","sources":["../../../src/editor/component-designer/ComponentsDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAEL,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,UAAU,kBAAkB,CAAC,EACjC,aAAa,GAGd;IACC,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,KAAK,UAAU,aAAa,CAAC,EAAU;QACrC,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,EAAE,EAAE,OAAQ,CAAC,IAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzE,OAAQ,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,0BAA0B,EAAE,UAAU,CACvE,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,KAAK,EAAE,KAAK,EACZ,MAAM,QACN,OAAO,EAAE,aAAa,EACtB,WAAW,EAAC,MAAM,EAClB,WAAW,EAAC,oBAAoB,EAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAClC,OAAO,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC;YACjD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- import { Component } from "../services/componentDesignerService";
2
- export declare function PlaceholdersEditor({ allComponents, }: {
3
- allComponents: Component[];
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEditContext } from "../client/editContext";
3
- import { saveComponentDetails, } from "../services/componentDesignerService";
4
- import { ArrowDownIcon } from "../ui/Icons";
5
- import { Toolbar } from "../ui/Toolbar";
6
- import { Button } from "primereact/button";
7
- export function PlaceholdersEditor({ allComponents, }) {
8
- const context = useEditContext();
9
- const component = context.componentDesignerComponent;
10
- // const itemNameDialogRef = useRef<ItemNameDialogHandle>(null);
11
- const handleDragStart = (event, component) => {
12
- event.dataTransfer.setData("text/plain", JSON.stringify(component));
13
- };
14
- const handleDragOver = (event) => {
15
- event.preventDefault();
16
- };
17
- const handleDrop = (event, placeholderName) => {
18
- event.preventDefault();
19
- const componentData = JSON.parse(event.dataTransfer.getData("text/plain"));
20
- const placeholder = component?.placeholders.find((x) => x.name == placeholderName);
21
- if (!placeholder)
22
- return;
23
- console.log(placeholder, componentData);
24
- if (placeholder.components.find((x) => x.typeId === componentData.typeId))
25
- return;
26
- placeholder.components.push(componentData);
27
- context.setComponentDesignerComponent({
28
- ...context.componentDesignerComponent,
29
- });
30
- };
31
- const removeInsertOption = (placeholder, insertOption) => {
32
- placeholder.components = placeholder.components.filter((x) => x.typeId !== insertOption.typeId);
33
- context.setComponentDesignerComponent({
34
- ...context.componentDesignerComponent,
35
- });
36
- };
37
- // const addNewPlaceholder = async () => {
38
- // itemNameDialogRef.current?.show({
39
- // title: "Choose Placeholder Name",
40
- // accept: async (name: string) => {
41
- // if (!context.componentDesignerComponent) return;
42
- // const placeholder = {
43
- // name: name,
44
- // components: [],
45
- // };
46
- // context.componentDesignerComponent.placeholders.push(placeholder);
47
- // context.setComponentDesignerComponent({
48
- // ...context.componentDesignerComponent!,
49
- // });
50
- // },
51
- // });
52
- // };
53
- if (!component)
54
- return (_jsx("div", { className: "flex h-full items-center justify-center text-xs", children: "Select a component" }));
55
- else
56
- return (_jsxs("div", { className: "flex h-full flex-col", children: [_jsx(Toolbar, { children: _jsx(Button, { icon: "pi pi-fw pi-save", label: "Save", text: true, size: "small", className: "text-xs font-normal text-gray-800", disabled: !component, onClick: () => {
57
- saveComponentDetails(component, context.page.item);
58
- } }) }), _jsxs("div", { className: "flex flex-1", children: [_jsx("div", { className: "relative h-full flex-1", children: _jsx("div", { className: "absolute inset-1 overflow-y-auto", children: component.placeholders.map((x) => (_jsxs("div", { className: "mb-2", onDragOver: handleDragOver, onDrop: (event) => handleDrop(event, x.name), children: [_jsxs("div", { className: "flex items-center gap-1 text-xs", children: [_jsx(ArrowDownIcon, {}), " ", x.name] }), _jsx("div", { className: "mt-1.5 flex flex-wrap gap-4 p-1 text-xs", children: x.components.map((y) => (_jsxs("div", { className: "relative", children: [_jsx("div", { className: "absolute top-[-12px] right-[-12px] cursor-pointer rounded-full border bg-white p-1", onClick: () => removeInsertOption(x, y), children: _jsx("i", { className: "pi pi-times text-xs" }) }), renderComponent(y)] }, y.typeId))) })] }, x.name))) }) }), _jsx("div", { className: "relative w-24", children: _jsx("div", { className: "absolute inset-0 overflow-y-auto border-l text-xs", children: allComponents.map((x) => (_jsx("div", { className: "mb-2 cursor-grab", draggable: true, onDragStart: (event) => handleDragStart(event, x), children: renderComponent(x) }, x.templateId))) }) })] })] }));
59
- }
60
- function renderComponent(y) {
61
- return (_jsxs("div", { className: "flex flex-col items-center border border-gray-200 p-2", children: [y.svg && (_jsx("div", { className: "h-8 w-8", dangerouslySetInnerHTML: { __html: y.svg } })), !y.svg && _jsx("img", { src: y.icon, width: "32", height: "32" }), y.name] }));
62
- }
63
- //# sourceMappingURL=PlaceholdersEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlaceholdersEditor.js","sourceRoot":"","sources":["../../../src/editor/component-designer/PlaceholdersEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAGL,oBAAoB,GACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAK3C,MAAM,UAAU,kBAAkB,CAAC,EACjC,aAAa,GAGd;IACC,MAAM,OAAO,GAAG,cAAc,EAAG,CAAC;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,0BAA0B,CAAC;IACrD,gEAAgE;IAEhE,MAAM,eAAe,GAAG,CACtB,KAAsC,EACtC,SAAmC,EACnC,EAAE;QACF,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,I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,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,YAEvC,YAAG,SAAS,EAAC,qBAAqB,GAAG,GACjC,EACL,eAAe,CAAC,CAAC,CAAC,KAPU,CAAC,CAAC,MAAM,CAQjC,CACP,CAAC,GACE,KApBD,CAAC,CAAC,IAAI,CAqBP,CACP,CAAC,GACE,GACF,EACN,cAAK,SAAS,EAAC,eAAe,YAC5B,cAAK,SAAS,EAAC,mDAAmD,YAC/D,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACxB,cAEE,SAAS,EAAC,kBAAkB,EAC5B,SAAS,QACT,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,YAEhD,eAAe,CAAC,CAAC,CAAC,IALd,CAAC,CAAC,UAAU,CAMb,CACP,CAAC,GACE,GACF,IACF,IAEF,CACP,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,CAA2B;IAClD,OAAO,CACL,eAAK,SAAS,EAAC,uDAAuD,aACnE,CAAC,CAAC,GAAG,IAAI,CACR,cACE,SAAS,EAAC,SAAS,EACnB,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,GACrC,CACR,EACA,CAAC,CAAC,CAAC,GAAG,IAAI,cAAK,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,GAAO,EACzD,CAAC,CAAC,IAAI,IACH,CACP,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- export declare function RenderingsDropdown(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEditContext } from "../client/editContext";
3
- import { Dropdown } from "primereact/dropdown";
4
- export function RenderingsDropdown() {
5
- const context = useEditContext();
6
- if (!context.componentDesignerComponent)
7
- return null;
8
- const compatibleRenderings = [
9
- ...context.componentDesignerComponent.compatibleRenderings,
10
- ];
11
- if (!compatibleRenderings)
12
- return null;
13
- const loadRendering = async (value) => {
14
- const item = await context.itemsRepository.getItem({
15
- id: value.id,
16
- language: "en",
17
- version: 0,
18
- });
19
- context.setComponentDesignerRendering(item);
20
- };
21
- return (_jsx(Dropdown, { options: compatibleRenderings, optionLabel: "name", value: compatibleRenderings.find((x) => x.id === (context.componentDesignerRendering?.id || "")), onChange: (e) => loadRendering(e.value) }));
22
- }
23
- //# sourceMappingURL=RenderingsDropdown.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderingsDropdown.js","sourceRoot":"","sources":["../../../src/editor/component-designer/RenderingsDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,cAAc,EAAG,CAAC;IAElC,IAAI,CAAC,OAAO,CAAC,0BAA0B;QAAE,OAAO,IAAI,CAAC;IAErD,MAAM,oBAAoB,GAAG;QAC3B,GAAG,OAAO,CAAC,0BAA0B,CAAC,oBAAoB;KAC3D,CAAC;IAEF,IAAI,CAAC,oBAAoB;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,aAAa,GAAG,KAAK,EAAE,KAAgB,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC;YACjD,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAC;SACX,CAAC,CAAC;QACH,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,OAAO,EAAE,oBAAoB,EAC7B,WAAW,EAAC,MAAM,EAClB,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,CAAC,CAC/D,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,KAAkB,CAAC,GACpD,CACH,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- export declare function TemplateEditor(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,142 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEditContext } from "../client/editContext";
3
- import { InputText } from "primereact/inputtext";
4
- import { getFieldTypes, } from "../services/componentDesignerService";
5
- import { useEffect, useState } from "react";
6
- import { Dropdown } from "primereact/dropdown";
7
- export function TemplateEditor() {
8
- const context = useEditContext();
9
- if (!context)
10
- return null;
11
- const [sections, setSections] = useState([]);
12
- const [fieldTypes, setFieldTypes] = useState([]);
13
- useEffect(() => {
14
- const newSections = [
15
- ...(context.componentDesignerComponent?.template?.sections.map((s) => ({
16
- ...s,
17
- })) || []),
18
- ];
19
- if (newSections.length === 0 ||
20
- newSections[newSections.length - 1].fields.length > 0)
21
- newSections.push({
22
- name: "",
23
- fields: [],
24
- key: Math.random().toString(),
25
- });
26
- newSections.forEach((section) => {
27
- const fields = [...section.fields];
28
- if (section.id ||
29
- (section.name != "" &&
30
- (!fields.length ||
31
- fields[fields.length - 1].id ||
32
- fields[fields.length - 1].name != ""))) {
33
- fields.push({
34
- name: "",
35
- type: "",
36
- source: "",
37
- key: Math.random().toString(),
38
- });
39
- }
40
- section.fields = fields;
41
- });
42
- setSections(newSections);
43
- }, [context.componentDesignerComponent]);
44
- useEffect(() => {
45
- const load = async () => {
46
- const types = await getFieldTypes();
47
- setFieldTypes(types);
48
- };
49
- load();
50
- }, []);
51
- const template = context.componentDesignerComponent?.template;
52
- if (!template)
53
- return null;
54
- const updateComponent = (sections) => {
55
- const newSections = sections.filter((x) => x.id || x.name);
56
- newSections.forEach((section) => {
57
- section.fields = section.fields.filter((x) => x.id || x.name);
58
- });
59
- const newTemplate = {
60
- ...template,
61
- sections: newSections,
62
- };
63
- const newComponent = {
64
- ...context.componentDesignerComponent,
65
- template: newTemplate,
66
- };
67
- console.log("Updating component", newComponent);
68
- context.setComponentDesignerComponent(newComponent);
69
- };
70
- const update = () => {
71
- updateComponent(sections);
72
- };
73
- const removeField = (section, field) => {
74
- section.fields = section.fields.filter((x) => x.id !== field.id);
75
- update();
76
- };
77
- const handleDragStart = (event, index, sectionIndex) => {
78
- event.dataTransfer.setData("text/plain", index.toString());
79
- event.dataTransfer.effectAllowed = "move";
80
- //event.currentTarget.style.opacity = "0.5";
81
- if (sectionIndex === undefined) {
82
- event.dataTransfer.setData("isSection", "true");
83
- }
84
- else {
85
- event.dataTransfer.setData("sectionIndex", sectionIndex.toString());
86
- event.dataTransfer.setData("isSection", "false");
87
- }
88
- };
89
- const handleDragOver = (event) => {
90
- event.preventDefault();
91
- event.dataTransfer.dropEffect = "move";
92
- };
93
- const handleDrop = (event, dropIndex, sectionIndex) => {
94
- event.preventDefault();
95
- const dragIndex = parseInt(event.dataTransfer.getData("text/plain"));
96
- const isSectionDrag = event.dataTransfer.getData("isSection") === "true";
97
- if (isSectionDrag && sectionIndex === undefined) {
98
- const newSections = sections;
99
- const [removed] = newSections.splice(dragIndex, 1);
100
- newSections.splice(dropIndex, 0, removed);
101
- updateComponent(newSections);
102
- }
103
- else if (!isSectionDrag) {
104
- const sourceSectionIndex = parseInt(event.dataTransfer.getData("sectionIndex"));
105
- const sourceSection = sections[sourceSectionIndex];
106
- const targetSection = sections[sectionIndex ?? dropIndex];
107
- const sourceFields = sourceSection.fields;
108
- const targetFields = targetSection.fields;
109
- const [removed] = sourceFields.splice(dragIndex, 1);
110
- if (sectionIndex === undefined) {
111
- targetFields.push(removed);
112
- }
113
- else {
114
- targetFields.splice(dropIndex, 0, removed);
115
- }
116
- updateComponent(sections);
117
- }
118
- };
119
- return (_jsx("div", { className: "p-1", children: sections.map((section, sectionIndex) => {
120
- return (_jsxs("div", { className: "mb-4", children: [_jsxs("div", { className: " flex gap-1", children: [dragHandle(sectionIndex), _jsx(InputText, { className: "text-xs", value: section.name, onChange: (e) => {
121
- section.name = e.target.value;
122
- update();
123
- } })] }), section.fields.map((field, fieldIndex) => {
124
- return (_jsxs("div", { className: "ml-4 flex gap-2 mt-1 items-center", children: [dragHandle(fieldIndex, sectionIndex), _jsx(InputText, { className: "text-xs flex-1", value: field.name, onChange: (e) => {
125
- field.name = e.target.value;
126
- update();
127
- } }, "name"), _jsx(Dropdown, { filter: true, options: fieldTypes, optionGroupLabel: "name", optionGroupChildren: "fieldTypes", className: "text-xs flex-1", value: field.type, onChange: (e) => {
128
- field.type = e.target.value;
129
- update();
130
- } }, "type"), _jsx(InputText, { className: "text-xs flex-1", value: field.source, onChange: (e) => {
131
- field.source = e.target.value;
132
- update();
133
- } }, "source"), _jsx("i", { className: "pi pi-fw pi-times cursor-pointer", onClick: () => removeField(section, field) })] }, field.id || field.key));
134
- })] }, section.id || section.key));
135
- }) }));
136
- function dragHandle(index, sectionIndex) {
137
- return (_jsx("div", { draggable: true, onDragStart: (event) => handleDragStart(event, index, sectionIndex), onDragOver: handleDragOver, onDrop: (event) => handleDrop(event, index, sectionIndex),
138
- // onDragEnd={handleDragEnd}
139
- className: "cursor-grab text-xs bg-gray-50 text-center p-0.5 border flex justify-center items-center", children: _jsx("i", { className: "pi pi-ellipsis-v" }) }));
140
- }
141
- }
142
- //# sourceMappingURL=TemplateEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemplateEditor.js","sourceRoot":"","sources":["../../../src/editor/component-designer/TemplateEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAIL,aAAa,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ext";
3
- export declare function createDesignerAiContext({ editContext, }: {
4
- editContext: EditContextType;
5
- }): AiContext;
@@ -1,14 +0,0 @@
1
- import { getItemDescriptor } from "../utils";
2
- export function createDesignerAiContext({ editContext, }) {
3
- return {
4
- callback: () => {
5
- editContext.requestRefresh();
6
- },
7
- promptData: {
8
- templateId: editContext.componentDesignerComponent?.templateId,
9
- renderingId: editContext.componentDesignerRendering?.id,
10
- contextItem: getItemDescriptor(editContext.page?.item),
11
- },
12
- };
13
- }
14
- //# sourceMappingURL=aiContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aiContext.js","sourceRoot":"","sources":["../../../src/editor/component-designer/aiContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,UAAU,uBAAuB,CAAC,EACtC,WAAW,GAGZ;IACC,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE;YACb,WAAW,CAAC,cAAc,EAAE,CAAC;QAC/B,CAAC;QACD,UAAU,EAAE;YACV,UAAU,EAAE,WAAW,CAAC,0BAA0B,EAAE,UAAU;YAC9D,WAAW,EAAE,WAAW,CAAC,0BAA0B,EAAE,EAAE;YACvD,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,IAAI,EAAE,IAAK,CAAC;SACxD;KACF,CAAC;AACJ,CAAC"}
@@ -1,66 +0,0 @@
1
- import { ComponentRenderingEditor } from "./ComponentRenderingEditor";
2
- import { Splitter, SplitterPanel } from "primereact/splitter";
3
-
4
- import { Panel } from "../../config/types";
5
-
6
- import { PlaceholdersEditor } from "./PlaceholdersEditor";
7
- import { PuzzleIcon } from "../ui/Icons";
8
- import { ComponentEditor } from "./ComponentEditor";
9
- import { useEffect, useState } from "react";
10
- import { useEditContext } from "../client/editContext";
11
- import {
12
- Component,
13
- getAllComponents,
14
- } from "../services/componentDesignerService";
15
- import { PageViewerFrame } from "../page-viewer/PageViewerFrame";
16
-
17
- export function ComponentDesigner() {
18
- // const [allComponents, setAllComponents] = useState<Component[]>([]);
19
- // const context = useEditContext();
20
- // if (!context?.page) return null;
21
- // useEffect(() => {
22
- // async function loadComponents() {
23
- // if (context?.page) {
24
- // const components = await getAllComponents(context.page.item.id);
25
- // setAllComponents(components);
26
- // } else setAllComponents([]);
27
- // }
28
- // loadComponents();
29
- // }, [context.page]);
30
- // const mainPanels: Panel[] = [
31
- // {
32
- // name: "template",
33
- // title: "Component",
34
- // initialSize: 30,
35
- // icon: <PuzzleIcon />,
36
- // noOverflow: true,
37
- // content: <ComponentEditor allComponents={allComponents} />,
38
- // },
39
- // {
40
- // name: "placeholders",
41
- // title: "Placeholders",
42
- // icon: "pi pi-th-large",
43
- // initialSize: 30,
44
- // noOverflow: true,
45
- // content: <PlaceholdersEditor allComponents={allComponents} />,
46
- // },
47
- // {
48
- // name: "rendering",
49
- // title: "Rendering",
50
- // icon: "pi pi-palette",
51
- // initialSize: 40,
52
- // content: <ComponentRenderingEditor />,
53
- // noOverflow: true,
54
- // },
55
- // ];
56
- // return (
57
- // <Splitter className="h-full">
58
- // <SplitterPanel>
59
- // <StackedPanels panels={mainPanels} />
60
- // </SplitterPanel>
61
- // <SplitterPanel>
62
- // <PageViewerFrame compareView={false} />
63
- // </SplitterPanel>
64
- // </Splitter>
65
- // );
66
- }
@@ -1,91 +0,0 @@
1
- import { Menubar } from "primereact/menubar";
2
-
3
- import {
4
- createNewComponent,
5
- createRendering,
6
- loadComponentDetails,
7
- } from "../services/componentDesignerService";
8
- import { ItemNameDialog } from "../ui/ItemNameDialogNew";
9
- import { useRef } from "react";
10
- import { useEditContext } from "../client/editContext";
11
- import { ItemLanguageVersion } from "../menubar/ItemLanguageVersion";
12
-
13
- export function ComponentDesignerMenu() {
14
- const context = useEditContext();
15
- if (!context) return;
16
-
17
- // const menuItems = [
18
- // {
19
- // id: "newComponent",
20
- // label: "New Component",
21
- // icon: "pi pi-fw pi-plus",
22
- // command: () => createNew(),
23
- // // disabled: !context.componentRenderingFolder,
24
- // },
25
- // {
26
- // id: "newRendering",
27
- // label: "New Rendering",
28
- // icon: "pi pi-fw pi-palette",
29
- // command: () => createNewRendering(),
30
- // disabled: !context.componentDesignerComponent,
31
- // },
32
- // {
33
- // id: "delete",
34
- // label: "Delete rendering",
35
- // icon: "pi pi-fw pi-trash",
36
- // disabled: !context.componentDesignerRendering,
37
- // },
38
- // ];
39
- // const itemNameDialogRef = useRef<ItemNameDialogHandle>(null);
40
-
41
- // const createNew = async () => {
42
- // itemNameDialogRef.current?.show({
43
- // title: "Choose Component Name",
44
- // accept: async (name) => {
45
- // await createNewComponent(name, context.page!.item);
46
- // },
47
- // });
48
- // };
49
-
50
- // const createNewRendering = async () => {
51
- // itemNameDialogRef.current?.show({
52
- // title: "Choose Rendering Name",
53
- // accept: async (name) => {
54
- // if (!context.componentDesignerComponent) return;
55
- // const details = await createRendering(
56
- // name,
57
- // context.page!.item,
58
- // context.componentDesignerComponent.templateId
59
- // );
60
- // if (!("id" in details)) return;
61
-
62
- // const component = await loadComponentDetails(
63
- // context.componentDesignerComponent.templateId,
64
- // context!.page!.item.id
65
- // );
66
- // // const rendering = await getItem({
67
- // // id: details.id,
68
- // // language: "en",
69
- // // version: 0,
70
- // // });
71
- // context.setComponentDesignerComponent(component);
72
- // // context.setComponentDesignerRendering(rendering);
73
- // },
74
- // });
75
- // };
76
-
77
- return (
78
- <>
79
- {/* <Menubar
80
- model={menuItems}
81
- end={
82
- <div className="flex items-center space-x-2">
83
- <ItemLanguageVersion />
84
- </div>
85
- }
86
- className="rounded-none border-0 border-b bg-gray-50 p-1 text-sm"
87
- ></Menubar>
88
- <ItemNameDialog ref={itemNameDialogRef} /> */}
89
- </>
90
- );
91
- }