@alpaca-editor/core 1.0.3762-mono

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 (460) hide show
  1. package/.prettierrc +3 -0
  2. package/dist/client-components/api.js +6 -0
  3. package/dist/client-components/index.js +36 -0
  4. package/dist/components/ActionButton.js +9 -0
  5. package/dist/components/Error.js +28 -0
  6. package/dist/config/config.js +654 -0
  7. package/dist/config/types.js +2 -0
  8. package/dist/editor/ComponentInfo.js +31 -0
  9. package/dist/editor/ConfirmationDialog.js +32 -0
  10. package/dist/editor/ContentTree.js +406 -0
  11. package/dist/editor/ContextMenu.js +117 -0
  12. package/dist/editor/Editor.js +55 -0
  13. package/dist/editor/EditorWarning.js +13 -0
  14. package/dist/editor/EditorWarnings.js +24 -0
  15. package/dist/editor/FieldEditorPopup.js +24 -0
  16. package/dist/editor/FieldHistory.js +40 -0
  17. package/dist/editor/FieldList.js +63 -0
  18. package/dist/editor/FieldListField.js +164 -0
  19. package/dist/editor/FieldListFieldWithFallbacks.js +114 -0
  20. package/dist/editor/FloatingToolbar.js +92 -0
  21. package/dist/editor/ImageEditor.js +55 -0
  22. package/dist/editor/InsertMenu.js +164 -0
  23. package/dist/editor/ItemInfo.js +30 -0
  24. package/dist/editor/LinkEditorDialog.js +89 -0
  25. package/dist/editor/MainLayout.js +46 -0
  26. package/dist/editor/NewEditorClient.js +9 -0
  27. package/dist/editor/PictureCropper.js +332 -0
  28. package/dist/editor/PictureEditor.js +104 -0
  29. package/dist/editor/PictureEditorDialog.js +194 -0
  30. package/dist/editor/ScrollingContentTree.js +30 -0
  31. package/dist/editor/Terminal.js +109 -0
  32. package/dist/editor/Titlebar.js +11 -0
  33. package/dist/editor/ai/AiPopup.js +25 -0
  34. package/dist/editor/ai/AiResponseMessage.js +24 -0
  35. package/dist/editor/ai/AiTerminal.js +241 -0
  36. package/dist/editor/ai/AiToolCall.js +18 -0
  37. package/dist/editor/ai/EditorAiTerminal.js +9 -0
  38. package/dist/editor/ai/editorAiContext.js +14 -0
  39. package/dist/editor/client/DialogContext.js +29 -0
  40. package/dist/editor/client/EditorClient.js +1336 -0
  41. package/dist/editor/client/GenericDialog.js +27 -0
  42. package/dist/editor/client/editContext.js +59 -0
  43. package/dist/editor/client/helpers.js +31 -0
  44. package/dist/editor/client/itemsRepository.js +255 -0
  45. package/dist/editor/client/operations.js +398 -0
  46. package/dist/editor/client/pageModelBuilder.js +129 -0
  47. package/dist/editor/commands/commands.js +2 -0
  48. package/dist/editor/commands/componentCommands.js +277 -0
  49. package/dist/editor/commands/createVersionCommand.js +26 -0
  50. package/dist/editor/commands/deleteVersionCommand.js +55 -0
  51. package/dist/editor/commands/itemCommands.js +134 -0
  52. package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +94 -0
  53. package/dist/editor/commands/undo.js +32 -0
  54. package/dist/editor/component-designer/ComponentDesigner.js +58 -0
  55. package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +9 -0
  56. package/dist/editor/component-designer/ComponentDesignerMenu.js +67 -0
  57. package/dist/editor/component-designer/ComponentEditor.js +59 -0
  58. package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +16 -0
  59. package/dist/editor/component-designer/ComponentRenderingEditor.js +71 -0
  60. package/dist/editor/component-designer/ComponentsDropdown.js +22 -0
  61. package/dist/editor/component-designer/PlaceholdersEditor.js +70 -0
  62. package/dist/editor/component-designer/RenderingsDropdown.js +25 -0
  63. package/dist/editor/component-designer/TemplateEditor.js +144 -0
  64. package/dist/editor/component-designer/aiContext.js +18 -0
  65. package/dist/editor/componentTreeHelper.js +97 -0
  66. package/dist/editor/control-center/ControlCenterMenu.js +59 -0
  67. package/dist/editor/control-center/IndexOverview.js +27 -0
  68. package/dist/editor/control-center/IndexSettings.js +106 -0
  69. package/dist/editor/control-center/Status.js +7 -0
  70. package/dist/editor/editor-warnings/ItemLocked.js +40 -0
  71. package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +16 -0
  72. package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +16 -0
  73. package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
  74. package/dist/editor/editor-warnings/ValidationErrors.js +27 -0
  75. package/dist/editor/field-types/AttachmentEditor.js +7 -0
  76. package/dist/editor/field-types/CheckboxEditor.js +32 -0
  77. package/dist/editor/field-types/DropLinkEditor.js +51 -0
  78. package/dist/editor/field-types/DropListEditor.js +58 -0
  79. package/dist/editor/field-types/ImageFieldEditor.js +36 -0
  80. package/dist/editor/field-types/InternalLinkFieldEditor.js +64 -0
  81. package/dist/editor/field-types/LinkFieldEditor.js +58 -0
  82. package/dist/editor/field-types/MultiLineText.js +35 -0
  83. package/dist/editor/field-types/PictureFieldEditor.js +59 -0
  84. package/dist/editor/field-types/RawEditor.js +33 -0
  85. package/dist/editor/field-types/ReactQuill.js +366 -0
  86. package/dist/editor/field-types/RichTextEditor.js +46 -0
  87. package/dist/editor/field-types/RichTextEditorComponent.js +72 -0
  88. package/dist/editor/field-types/SingleLineText.js +92 -0
  89. package/dist/editor/field-types/TreeListEditor.js +137 -0
  90. package/dist/editor/fieldTypes.js +2 -0
  91. package/dist/editor/media-selector/AiImageSearch.js +110 -0
  92. package/dist/editor/media-selector/AiImageSearchPrompt.js +58 -0
  93. package/dist/editor/media-selector/MediaSelector.js +11 -0
  94. package/dist/editor/media-selector/Preview.js +9 -0
  95. package/dist/editor/media-selector/Thumbnails.js +11 -0
  96. package/dist/editor/media-selector/TreeSelector.js +171 -0
  97. package/dist/editor/media-selector/UploadZone.js +80 -0
  98. package/dist/editor/menubar/ActionsMenu.js +33 -0
  99. package/dist/editor/menubar/ActiveUsers.js +13 -0
  100. package/dist/editor/menubar/ApproveAndPublish.js +13 -0
  101. package/dist/editor/menubar/BrowseHistory.js +14 -0
  102. package/dist/editor/menubar/ItemLanguageVersion.js +36 -0
  103. package/dist/editor/menubar/LanguageSelector.js +33 -0
  104. package/dist/editor/menubar/Menu.js +65 -0
  105. package/dist/editor/menubar/NavButtons.js +43 -0
  106. package/dist/editor/menubar/PageSelector.js +50 -0
  107. package/dist/editor/menubar/PageViewerControls.js +37 -0
  108. package/dist/editor/menubar/Separator.js +8 -0
  109. package/dist/editor/menubar/SiteInfo.js +26 -0
  110. package/dist/editor/menubar/User.js +18 -0
  111. package/dist/editor/menubar/VersionSelector.js +49 -0
  112. package/dist/editor/page-editor-chrome/CommentHighlighting.js +214 -0
  113. package/dist/editor/page-editor-chrome/CommentHighlightings.js +17 -0
  114. package/dist/editor/page-editor-chrome/FieldActionIndicator.js +27 -0
  115. package/dist/editor/page-editor-chrome/FieldActionIndicators.js +15 -0
  116. package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +27 -0
  117. package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +15 -0
  118. package/dist/editor/page-editor-chrome/FrameMenu.js +178 -0
  119. package/dist/editor/page-editor-chrome/FrameMenus.js +24 -0
  120. package/dist/editor/page-editor-chrome/InlineEditor.js +101 -0
  121. package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +35 -0
  122. package/dist/editor/page-editor-chrome/NoLayout.js +21 -0
  123. package/dist/editor/page-editor-chrome/PageEditorChrome.js +65 -0
  124. package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +109 -0
  125. package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +82 -0
  126. package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +147 -0
  127. package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
  128. package/dist/editor/page-viewer/EditorForm.js +130 -0
  129. package/dist/editor/page-viewer/MiniMap.js +257 -0
  130. package/dist/editor/page-viewer/PageViewer.js +64 -0
  131. package/dist/editor/page-viewer/PageViewerFrame.js +696 -0
  132. package/dist/editor/page-viewer/pageViewContext.js +117 -0
  133. package/dist/editor/pageModel.js +2 -0
  134. package/dist/editor/picture-shared.js +28 -0
  135. package/dist/editor/reviews/Comment.js +112 -0
  136. package/dist/editor/reviews/Comments.js +24 -0
  137. package/dist/editor/reviews/PreviewInfo.js +13 -0
  138. package/dist/editor/reviews/Reviews.js +165 -0
  139. package/dist/editor/reviews/reviewCommands.js +44 -0
  140. package/dist/editor/reviews/useReviews.js +48 -0
  141. package/dist/editor/services/aiService.js +99 -0
  142. package/dist/editor/services/componentDesignerService.js +79 -0
  143. package/dist/editor/services/contentService.js +104 -0
  144. package/dist/editor/services/editService.js +322 -0
  145. package/dist/editor/services/indexService.js +25 -0
  146. package/dist/editor/services/reviewsService.js +43 -0
  147. package/dist/editor/services/serviceHelper.js +67 -0
  148. package/dist/editor/services/systemService.js +7 -0
  149. package/dist/editor/services/translationService.js +15 -0
  150. package/dist/editor/services-server/api.js +119 -0
  151. package/dist/editor/services-server/graphQL.js +56 -0
  152. package/dist/editor/sidebar/ComponentPalette.js +55 -0
  153. package/dist/editor/sidebar/ComponentTree.js +362 -0
  154. package/dist/editor/sidebar/Debug.js +60 -0
  155. package/dist/editor/sidebar/DictionaryEditor.js +160 -0
  156. package/dist/editor/sidebar/EditHistory.js +74 -0
  157. package/dist/editor/sidebar/GraphQL.js +115 -0
  158. package/dist/editor/sidebar/Insert.js +24 -0
  159. package/dist/editor/sidebar/MainContentTree.js +52 -0
  160. package/dist/editor/sidebar/Performance.js +34 -0
  161. package/dist/editor/sidebar/Sessions.js +31 -0
  162. package/dist/editor/sidebar/Sidebar.js +15 -0
  163. package/dist/editor/sidebar/SidebarView.js +76 -0
  164. package/dist/editor/sidebar/Translations.js +160 -0
  165. package/dist/editor/sidebar/Validation.js +52 -0
  166. package/dist/editor/sidebar/ViewSelector.js +15 -0
  167. package/dist/editor/sidebar/Workbox.js +80 -0
  168. package/dist/editor/ui/CenteredMessage.js +7 -0
  169. package/dist/editor/ui/CopyToClipboardButton.js +17 -0
  170. package/dist/editor/ui/DialogButtons.js +7 -0
  171. package/dist/editor/ui/Icons.js +75 -0
  172. package/dist/editor/ui/ItemNameDialog.js +45 -0
  173. package/dist/editor/ui/ItemNameDialogNew.js +61 -0
  174. package/dist/editor/ui/ItemSearch.js +93 -0
  175. package/dist/editor/ui/PerfectTree.js +223 -0
  176. package/dist/editor/ui/Section.js +12 -0
  177. package/dist/editor/ui/SimpleIconButton.js +11 -0
  178. package/dist/editor/ui/SimpleMenu.js +9 -0
  179. package/dist/editor/ui/SimpleTable.js +11 -0
  180. package/dist/editor/ui/SimpleTabs.js +21 -0
  181. package/dist/editor/ui/SimpleToolbar.js +7 -0
  182. package/dist/editor/ui/Spinner.js +7 -0
  183. package/dist/editor/ui/Splitter.js +187 -0
  184. package/dist/editor/ui/StackedPanels.js +69 -0
  185. package/dist/editor/ui/Toolbar.js +7 -0
  186. package/dist/editor/utils/id-helper.js +7 -0
  187. package/dist/editor/utils/insertOptions.js +45 -0
  188. package/dist/editor/utils/itemutils.js +25 -0
  189. package/dist/editor/utils/useMemoDebug.js +20 -0
  190. package/dist/editor/utils.js +328 -0
  191. package/dist/editor/views/CompareView.js +147 -0
  192. package/dist/editor/views/EditView.js +17 -0
  193. package/dist/editor/views/ItemEditor.js +24 -0
  194. package/dist/editor/views/SingleEditView.js +25 -0
  195. package/dist/index.js +22 -0
  196. package/dist/page-wizard/PageWizard.js +62 -0
  197. package/dist/page-wizard/SelectWizard.js +43 -0
  198. package/dist/page-wizard/WizardSteps.js +71 -0
  199. package/dist/page-wizard/service.js +26 -0
  200. package/dist/page-wizard/startPageWizardCommand.js +23 -0
  201. package/dist/page-wizard/steps/BuildPageStep.js +138 -0
  202. package/dist/page-wizard/steps/CollectStep.js +124 -0
  203. package/dist/page-wizard/steps/ComponentTypesSelector.js +211 -0
  204. package/dist/page-wizard/steps/Components.js +94 -0
  205. package/dist/page-wizard/steps/CreatePage.js +142 -0
  206. package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +230 -0
  207. package/dist/page-wizard/steps/EditButton.js +7 -0
  208. package/dist/page-wizard/steps/FieldEditor.js +30 -0
  209. package/dist/page-wizard/steps/Generate.js +11 -0
  210. package/dist/page-wizard/steps/ImagesStep.js +159 -0
  211. package/dist/page-wizard/steps/LayoutStep.js +120 -0
  212. package/dist/page-wizard/steps/SelectStep.js +150 -0
  213. package/dist/page-wizard/steps/schema.js +140 -0
  214. package/dist/page-wizard/steps/usePageCreator.js +194 -0
  215. package/dist/splash-screen/NewPage.js +131 -0
  216. package/dist/splash-screen/SectionHeadline.js +9 -0
  217. package/dist/splash-screen/SplashScreen.js +81 -0
  218. package/dist/tour/Tour.js +321 -0
  219. package/dist/tour/default-tour.js +231 -0
  220. package/dist/tour/preview-tour.js +93 -0
  221. package/dist/tsconfig.build.tsbuildinfo +1 -0
  222. package/dist/types.js +2 -0
  223. package/eslint.config.mjs +4 -0
  224. package/images/bg-shape-black.webp +0 -0
  225. package/package.json +52 -0
  226. package/src/client-components/api.ts +6 -0
  227. package/src/client-components/index.ts +19 -0
  228. package/src/components/ActionButton.tsx +43 -0
  229. package/src/components/Error.tsx +57 -0
  230. package/src/config/config.tsx +737 -0
  231. package/src/config/types.ts +263 -0
  232. package/src/editor/ComponentInfo.tsx +77 -0
  233. package/src/editor/ConfirmationDialog.tsx +103 -0
  234. package/src/editor/ContentTree.tsx +654 -0
  235. package/src/editor/ContextMenu.tsx +155 -0
  236. package/src/editor/Editor.tsx +91 -0
  237. package/src/editor/EditorWarning.tsx +34 -0
  238. package/src/editor/EditorWarnings.tsx +33 -0
  239. package/src/editor/FieldEditorPopup.tsx +65 -0
  240. package/src/editor/FieldHistory.tsx +74 -0
  241. package/src/editor/FieldList.tsx +190 -0
  242. package/src/editor/FieldListField.tsx +387 -0
  243. package/src/editor/FieldListFieldWithFallbacks.tsx +211 -0
  244. package/src/editor/FloatingToolbar.tsx +163 -0
  245. package/src/editor/ImageEditor.tsx +129 -0
  246. package/src/editor/InsertMenu.tsx +332 -0
  247. package/src/editor/ItemInfo.tsx +90 -0
  248. package/src/editor/LinkEditorDialog.tsx +192 -0
  249. package/src/editor/MainLayout.tsx +94 -0
  250. package/src/editor/NewEditorClient.tsx +11 -0
  251. package/src/editor/PictureCropper.tsx +505 -0
  252. package/src/editor/PictureEditor.tsx +206 -0
  253. package/src/editor/PictureEditorDialog.tsx +381 -0
  254. package/src/editor/PublishDialog.ignore +74 -0
  255. package/src/editor/ScrollingContentTree.tsx +47 -0
  256. package/src/editor/Terminal.tsx +215 -0
  257. package/src/editor/Titlebar.tsx +23 -0
  258. package/src/editor/ai/AiPopup.tsx +59 -0
  259. package/src/editor/ai/AiResponseMessage.tsx +82 -0
  260. package/src/editor/ai/AiTerminal.tsx +450 -0
  261. package/src/editor/ai/AiToolCall.tsx +46 -0
  262. package/src/editor/ai/EditorAiTerminal.tsx +20 -0
  263. package/src/editor/ai/editorAiContext.ts +18 -0
  264. package/src/editor/client/DialogContext.tsx +49 -0
  265. package/src/editor/client/EditorClient.tsx +1831 -0
  266. package/src/editor/client/GenericDialog.tsx +50 -0
  267. package/src/editor/client/editContext.ts +330 -0
  268. package/src/editor/client/helpers.ts +44 -0
  269. package/src/editor/client/itemsRepository.ts +391 -0
  270. package/src/editor/client/operations.ts +610 -0
  271. package/src/editor/client/pageModelBuilder.ts +182 -0
  272. package/src/editor/commands/commands.ts +23 -0
  273. package/src/editor/commands/componentCommands.tsx +408 -0
  274. package/src/editor/commands/createVersionCommand.ts +33 -0
  275. package/src/editor/commands/deleteVersionCommand.ts +71 -0
  276. package/src/editor/commands/itemCommands.tsx +186 -0
  277. package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +201 -0
  278. package/src/editor/commands/undo.ts +39 -0
  279. package/src/editor/component-designer/ComponentDesigner.tsx +70 -0
  280. package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +11 -0
  281. package/src/editor/component-designer/ComponentDesignerMenu.tsx +91 -0
  282. package/src/editor/component-designer/ComponentEditor.tsx +97 -0
  283. package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +31 -0
  284. package/src/editor/component-designer/ComponentRenderingEditor.tsx +104 -0
  285. package/src/editor/component-designer/ComponentsDropdown.tsx +39 -0
  286. package/src/editor/component-designer/PlaceholdersEditor.tsx +183 -0
  287. package/src/editor/component-designer/RenderingsDropdown.tsx +36 -0
  288. package/src/editor/component-designer/TemplateEditor.tsx +236 -0
  289. package/src/editor/component-designer/aiContext.ts +23 -0
  290. package/src/editor/componentTreeHelper.tsx +114 -0
  291. package/src/editor/control-center/ControlCenterMenu.tsx +71 -0
  292. package/src/editor/control-center/IndexOverview.tsx +50 -0
  293. package/src/editor/control-center/IndexSettings.tsx +266 -0
  294. package/src/editor/control-center/Status.tsx +7 -0
  295. package/src/editor/editor-warnings/ItemLocked.tsx +63 -0
  296. package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +22 -0
  297. package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +23 -0
  298. package/src/editor/editor-warnings/NoWriteAccess.tsx +15 -0
  299. package/src/editor/editor-warnings/ValidationErrors.tsx +54 -0
  300. package/src/editor/field-types/AttachmentEditor.tsx +9 -0
  301. package/src/editor/field-types/CheckboxEditor.tsx +47 -0
  302. package/src/editor/field-types/DropLinkEditor.tsx +75 -0
  303. package/src/editor/field-types/DropListEditor.tsx +84 -0
  304. package/src/editor/field-types/ImageFieldEditor.tsx +65 -0
  305. package/src/editor/field-types/InternalLinkFieldEditor.tsx +112 -0
  306. package/src/editor/field-types/LinkFieldEditor.tsx +85 -0
  307. package/src/editor/field-types/MultiLineText.tsx +63 -0
  308. package/src/editor/field-types/PictureFieldEditor.tsx +121 -0
  309. package/src/editor/field-types/RawEditor.tsx +53 -0
  310. package/src/editor/field-types/ReactQuill.tsx +580 -0
  311. package/src/editor/field-types/RichTextEditor.tsx +22 -0
  312. package/src/editor/field-types/RichTextEditorComponent.tsx +108 -0
  313. package/src/editor/field-types/SingleLineText.tsx +150 -0
  314. package/src/editor/field-types/TreeListEditor.tsx +261 -0
  315. package/src/editor/fieldTypes.ts +140 -0
  316. package/src/editor/media-selector/AiImageSearch.tsx +186 -0
  317. package/src/editor/media-selector/AiImageSearchPrompt.tsx +95 -0
  318. package/src/editor/media-selector/MediaSelector.tsx +42 -0
  319. package/src/editor/media-selector/Preview.tsx +14 -0
  320. package/src/editor/media-selector/Thumbnails.tsx +48 -0
  321. package/src/editor/media-selector/TreeSelector.tsx +292 -0
  322. package/src/editor/media-selector/UploadZone.tsx +137 -0
  323. package/src/editor/menubar/ActionsMenu.tsx +47 -0
  324. package/src/editor/menubar/ActiveUsers.tsx +17 -0
  325. package/src/editor/menubar/ApproveAndPublish.tsx +18 -0
  326. package/src/editor/menubar/BrowseHistory.tsx +37 -0
  327. package/src/editor/menubar/ItemLanguageVersion.tsx +52 -0
  328. package/src/editor/menubar/LanguageSelector.tsx +152 -0
  329. package/src/editor/menubar/Menu.tsx +83 -0
  330. package/src/editor/menubar/NavButtons.tsx +74 -0
  331. package/src/editor/menubar/PageSelector.tsx +139 -0
  332. package/src/editor/menubar/PageViewerControls.tsx +99 -0
  333. package/src/editor/menubar/Separator.tsx +12 -0
  334. package/src/editor/menubar/SiteInfo.tsx +53 -0
  335. package/src/editor/menubar/User.tsx +27 -0
  336. package/src/editor/menubar/VersionSelector.tsx +143 -0
  337. package/src/editor/page-editor-chrome/CommentHighlighting.tsx +287 -0
  338. package/src/editor/page-editor-chrome/CommentHighlightings.tsx +35 -0
  339. package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +44 -0
  340. package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +23 -0
  341. package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +64 -0
  342. package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +35 -0
  343. package/src/editor/page-editor-chrome/FrameMenu.tsx +263 -0
  344. package/src/editor/page-editor-chrome/FrameMenus.tsx +48 -0
  345. package/src/editor/page-editor-chrome/InlineEditor.tsx +147 -0
  346. package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +61 -0
  347. package/src/editor/page-editor-chrome/NoLayout.tsx +36 -0
  348. package/src/editor/page-editor-chrome/PageEditorChrome.tsx +119 -0
  349. package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +154 -0
  350. package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +171 -0
  351. package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +233 -0
  352. package/src/editor/page-viewer/DeviceToolbar.tsx +70 -0
  353. package/src/editor/page-viewer/EditorForm.tsx +247 -0
  354. package/src/editor/page-viewer/MiniMap.tsx +351 -0
  355. package/src/editor/page-viewer/PageViewer.tsx +127 -0
  356. package/src/editor/page-viewer/PageViewerFrame.tsx +1030 -0
  357. package/src/editor/page-viewer/pageViewContext.ts +186 -0
  358. package/src/editor/pageModel.ts +191 -0
  359. package/src/editor/picture-shared.tsx +53 -0
  360. package/src/editor/reviews/Comment.tsx +265 -0
  361. package/src/editor/reviews/Comments.tsx +50 -0
  362. package/src/editor/reviews/PreviewInfo.tsx +35 -0
  363. package/src/editor/reviews/Reviews.tsx +280 -0
  364. package/src/editor/reviews/reviewCommands.tsx +47 -0
  365. package/src/editor/reviews/useReviews.tsx +70 -0
  366. package/src/editor/services/aiService.ts +155 -0
  367. package/src/editor/services/componentDesignerService.ts +151 -0
  368. package/src/editor/services/contentService.ts +159 -0
  369. package/src/editor/services/editService.ts +462 -0
  370. package/src/editor/services/indexService.ts +24 -0
  371. package/src/editor/services/reviewsService.ts +45 -0
  372. package/src/editor/services/serviceHelper.ts +95 -0
  373. package/src/editor/services/systemService.ts +5 -0
  374. package/src/editor/services/translationService.ts +21 -0
  375. package/src/editor/services-server/api.ts +150 -0
  376. package/src/editor/services-server/graphQL.ts +106 -0
  377. package/src/editor/sidebar/ComponentPalette.tsx +146 -0
  378. package/src/editor/sidebar/ComponentTree.tsx +512 -0
  379. package/src/editor/sidebar/ComponentTree2.tsxx +490 -0
  380. package/src/editor/sidebar/Debug.tsx +105 -0
  381. package/src/editor/sidebar/DictionaryEditor.tsx +261 -0
  382. package/src/editor/sidebar/EditHistory.tsx +134 -0
  383. package/src/editor/sidebar/GraphQL.tsx +164 -0
  384. package/src/editor/sidebar/Insert.tsx +35 -0
  385. package/src/editor/sidebar/MainContentTree.tsx +95 -0
  386. package/src/editor/sidebar/Performance.tsx +53 -0
  387. package/src/editor/sidebar/Sessions.tsx +35 -0
  388. package/src/editor/sidebar/Sidebar.tsx +20 -0
  389. package/src/editor/sidebar/SidebarView.tsx +150 -0
  390. package/src/editor/sidebar/Translations.tsx +276 -0
  391. package/src/editor/sidebar/Validation.tsx +102 -0
  392. package/src/editor/sidebar/ViewSelector.tsx +49 -0
  393. package/src/editor/sidebar/Workbox.tsx +209 -0
  394. package/src/editor/ui/CenteredMessage.tsx +7 -0
  395. package/src/editor/ui/CopyToClipboardButton.tsx +23 -0
  396. package/src/editor/ui/DialogButtons.tsx +11 -0
  397. package/src/editor/ui/Icons.tsx +585 -0
  398. package/src/editor/ui/ItemNameDialog.tsx +94 -0
  399. package/src/editor/ui/ItemNameDialogNew.tsx +118 -0
  400. package/src/editor/ui/ItemSearch.tsx +173 -0
  401. package/src/editor/ui/PerfectTree.tsx +550 -0
  402. package/src/editor/ui/Section.tsx +35 -0
  403. package/src/editor/ui/SimpleIconButton.tsx +43 -0
  404. package/src/editor/ui/SimpleMenu.tsx +48 -0
  405. package/src/editor/ui/SimpleTable.tsx +63 -0
  406. package/src/editor/ui/SimpleTabs.tsx +55 -0
  407. package/src/editor/ui/SimpleToolbar.tsx +7 -0
  408. package/src/editor/ui/Spinner.tsx +7 -0
  409. package/src/editor/ui/Splitter.tsx +247 -0
  410. package/src/editor/ui/StackedPanels.tsx +134 -0
  411. package/src/editor/ui/Toolbar.tsx +7 -0
  412. package/src/editor/utils/id-helper.ts +3 -0
  413. package/src/editor/utils/insertOptions.ts +69 -0
  414. package/src/editor/utils/itemutils.ts +29 -0
  415. package/src/editor/utils/useMemoDebug.ts +28 -0
  416. package/src/editor/utils.ts +435 -0
  417. package/src/editor/views/CompareView.tsx +256 -0
  418. package/src/editor/views/EditView.tsx +27 -0
  419. package/src/editor/views/ItemEditor.tsx +58 -0
  420. package/src/editor/views/SingleEditView.tsx +44 -0
  421. package/src/fonts/Geist-Black.woff2 +0 -0
  422. package/src/fonts/Geist-Bold.woff2 +0 -0
  423. package/src/fonts/Geist-ExtraBold.woff2 +0 -0
  424. package/src/fonts/Geist-ExtraLight.woff2 +0 -0
  425. package/src/fonts/Geist-Light.woff2 +0 -0
  426. package/src/fonts/Geist-Medium.woff2 +0 -0
  427. package/src/fonts/Geist-Regular.woff2 +0 -0
  428. package/src/fonts/Geist-SemiBold.woff2 +0 -0
  429. package/src/fonts/Geist-Thin.woff2 +0 -0
  430. package/src/fonts/Geist[wght].woff2 +0 -0
  431. package/src/index.ts +7 -0
  432. package/src/page-wizard/PageWizard.tsx +163 -0
  433. package/src/page-wizard/SelectWizard.tsx +109 -0
  434. package/src/page-wizard/WizardSteps.tsx +207 -0
  435. package/src/page-wizard/service.ts +35 -0
  436. package/src/page-wizard/startPageWizardCommand.ts +27 -0
  437. package/src/page-wizard/steps/BuildPageStep.tsx +266 -0
  438. package/src/page-wizard/steps/CollectStep.tsx +233 -0
  439. package/src/page-wizard/steps/ComponentTypesSelector.tsx +443 -0
  440. package/src/page-wizard/steps/Components.tsx +193 -0
  441. package/src/page-wizard/steps/CreatePage.tsx +285 -0
  442. package/src/page-wizard/steps/CreatePageAndLayoutStep.tsx +384 -0
  443. package/src/page-wizard/steps/EditButton.tsx +34 -0
  444. package/src/page-wizard/steps/FieldEditor.tsx +102 -0
  445. package/src/page-wizard/steps/Generate.tsx +32 -0
  446. package/src/page-wizard/steps/ImagesStep.tsx +318 -0
  447. package/src/page-wizard/steps/LayoutStep.tsx +228 -0
  448. package/src/page-wizard/steps/SelectStep.tsx +256 -0
  449. package/src/page-wizard/steps/schema.ts +180 -0
  450. package/src/page-wizard/steps/usePageCreator.ts +279 -0
  451. package/src/splash-screen/NewPage.tsx +232 -0
  452. package/src/splash-screen/SectionHeadline.tsx +21 -0
  453. package/src/splash-screen/SplashScreen.tsx +156 -0
  454. package/src/tour/Tour.tsx +558 -0
  455. package/src/tour/default-tour.tsx +300 -0
  456. package/src/tour/preview-tour.tsx +127 -0
  457. package/src/types.ts +302 -0
  458. package/styles.css +476 -0
  459. package/tsconfig.build.json +21 -0
  460. package/tsconfig.json +11 -0
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SplashScreen = SplashScreen;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const editContext_1 = require("../editor/client/editContext");
8
+ const SimpleTabs_1 = require("../editor/ui/SimpleTabs");
9
+ const ScrollingContentTree_1 = require("../editor/ScrollingContentTree");
10
+ const NewPage_1 = require("./NewPage");
11
+ const navigation_1 = require("next/navigation");
12
+ const SimpleIconButton_1 = require("../editor/ui/SimpleIconButton");
13
+ function SplashScreen() {
14
+ const savedHistory = typeof window !== "undefined"
15
+ ? localStorage.getItem("editor.browseHistory")
16
+ : null;
17
+ const [selectedPage, setSelectedPage] = (0, react_1.useState)(null);
18
+ const [activeTab, setActiveTab] = (0, react_1.useState)(0);
19
+ const editContext = (0, editContext_1.useEditContext)();
20
+ const recentPages = savedHistory
21
+ ? JSON.parse(savedHistory)
22
+ : [];
23
+ const searchParams = new URLSearchParams(window.location.search);
24
+ const [history, setHistory] = (0, react_1.useState)();
25
+ const router = (0, navigation_1.useRouter)();
26
+ const pathname = (0, navigation_1.usePathname)();
27
+ (0, react_1.useEffect)(() => {
28
+ const fetchItems = async () => {
29
+ const pages = await editContext?.itemsRepository.getItems(recentPages);
30
+ setHistory(pages);
31
+ };
32
+ fetchItems();
33
+ }, [editContext?.itemsRepository]);
34
+ (0, react_1.useEffect)(() => {
35
+ if (recentPages.length > 0 && recentPages[0])
36
+ setSelectedPage(recentPages[0]);
37
+ if (searchParams.get("create") === "1")
38
+ setActiveTab(1);
39
+ }, []);
40
+ (0, react_1.useEffect)(() => {
41
+ if (activeTab === 0) {
42
+ router.replace(pathname);
43
+ }
44
+ else {
45
+ router.replace(`${pathname}?create=1`);
46
+ }
47
+ }, [activeTab]);
48
+ if (searchParams.has("itemid"))
49
+ return;
50
+ const tabs = [
51
+ {
52
+ content: ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-1 gap-4 p-2 text-sm", children: [(0, jsx_runtime_1.jsx)("div", { className: "relative w-2/3", children: (0, jsx_runtime_1.jsx)(ScrollingContentTree_1.ScrollingContentTree, { selectedItemId: selectedPage?.id, onSelectionChange: (selection) => {
53
+ const selectedItem = selection[0];
54
+ if (selectedItem)
55
+ editContext?.loadItem({
56
+ id: selectedItem.id,
57
+ language: selectedItem.language ?? "en",
58
+ version: selectedItem.version,
59
+ });
60
+ } }) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex w-1/3 flex-col border-l pl-6", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-3 font-bold", children: "Recent Pages" }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsx)("ul", { className: "absolute inset-0 overflow-auto", children: history?.map((page, index) => ((0, jsx_runtime_1.jsxs)("li", { onMouseOver: () => setSelectedPage(page), onClick: () => {
61
+ editContext?.switchView("page-editor");
62
+ editContext?.loadItem({
63
+ id: page.id,
64
+ language: page.language ?? "en",
65
+ version: 0,
66
+ });
67
+ }, className: "flex cursor-pointer items-center gap-2 p-2 text-xs hover:bg-gray-100", children: [page.icon && ((0, jsx_runtime_1.jsx)("img", { src: page.icon, width: "16", height: "16" })), " ", page.name, " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-gray-500", children: ["(", page.language, ")"] })] }, index))) }) })] })] })),
68
+ label: "Open Page",
69
+ id: "open-page-tab",
70
+ },
71
+ {
72
+ content: ((0, jsx_runtime_1.jsx)("div", { className: "relative flex flex-1 flex-col", children: (0, jsx_runtime_1.jsx)(NewPage_1.NewPage, { selectedItemId: selectedPage?.id }) })),
73
+ label: "New Page",
74
+ id: "new-page-tab",
75
+ testId: "new-page-tab",
76
+ },
77
+ ];
78
+ return ((0, jsx_runtime_1.jsx)("div", { className: "flex h-full items-center justify-center bg-gray-100", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative h-3/4 w-2/3 space-y-8 rounded-lg bg-white p-6 p-8 shadow-lg", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex h-full flex-col", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 flex-col", children: (0, jsx_runtime_1.jsx)(SimpleTabs_1.SimpleTabs, { tabs: tabs, activeTab: activeTab, setActiveTab: setActiveTab }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex justify-end", children: (0, jsx_runtime_1.jsxs)("a", { className: "flex cursor-pointer items-center text-xs text-blue-600", onClick: () => editContext?.startTour(), children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-arrow-right mr-2" }), " Take Tour"] }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-0 right-0 p-2", children: (0, jsx_runtime_1.jsx)(SimpleIconButton_1.SimpleIconButton, { icon: "pi pi-times", onClick: () => editContext?.switchView(editContext.contentEditorItem?.hasLayout
79
+ ? "page-editor"
80
+ : "content-editor"), label: "Close" }) })] }) }));
81
+ }
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tour = Tour;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const client_components_1 = require("../client-components");
7
+ const utils_1 = require("primereact/utils");
8
+ function Tour({ tourStopCallback }) {
9
+ const [currentStep, setCurrentStep] = (0, react_1.useState)("start-tour");
10
+ const [show, setShow] = (0, react_1.useState)(true);
11
+ const editContext = (0, client_components_1.useEditContext)();
12
+ const [focusRect, setFocusRect] = (0, react_1.useState)(null);
13
+ const [pointToRect, setPointToRect] = (0, react_1.useState)(null);
14
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
15
+ const waitForElement = (selector, timeout = 0) => {
16
+ if (selector.startsWith("iframe:")) {
17
+ return waitForElementInIframe(selector.substring(7), timeout);
18
+ }
19
+ return new Promise((resolve) => {
20
+ const startTime = Date.now();
21
+ const checkForElement = () => {
22
+ const element = document.querySelector(selector);
23
+ if (element) {
24
+ let rect = element.getBoundingClientRect();
25
+ const extendFocus = step?.extendFocus || 10;
26
+ rect = new DOMRect(rect.left - extendFocus / 2, rect.top - extendFocus / 2, rect.width + extendFocus, rect.height + extendFocus);
27
+ resolve(rect);
28
+ }
29
+ else if (timeout > 0 && Date.now() - startTime >= timeout) {
30
+ resolve(undefined);
31
+ }
32
+ else {
33
+ requestAnimationFrame(checkForElement);
34
+ }
35
+ };
36
+ checkForElement();
37
+ });
38
+ };
39
+ const waitForElementInIframe = (selector, timeout = 0) => {
40
+ return new Promise((resolve, reject) => {
41
+ const startTime = Date.now();
42
+ const checkForElement = () => {
43
+ const iframe = document.querySelector("iframe.page-iframe");
44
+ if (iframe && iframe.contentDocument) {
45
+ const element = iframe.contentDocument.querySelector(selector);
46
+ if (element) {
47
+ const elementRect = element.getBoundingClientRect();
48
+ const iframeRect = iframe.getBoundingClientRect();
49
+ let rect = new DOMRect(elementRect.left + iframeRect.left, elementRect.top + iframeRect.top, elementRect.width, elementRect.height);
50
+ const extendFocus = step?.extendFocus || 10;
51
+ rect = new DOMRect(rect.left - extendFocus / 2, rect.top - extendFocus / 2, rect.width + extendFocus, rect.height + extendFocus);
52
+ resolve(rect);
53
+ }
54
+ else if (timeout > 0 && Date.now() - startTime >= timeout) {
55
+ resolve(undefined);
56
+ }
57
+ else {
58
+ requestAnimationFrame(checkForElement);
59
+ }
60
+ }
61
+ else if (Date.now() - startTime >= timeout) {
62
+ reject(new Error(`Timeout waiting for iframe: ${selector}`));
63
+ }
64
+ else {
65
+ requestAnimationFrame(checkForElement);
66
+ }
67
+ };
68
+ checkForElement();
69
+ });
70
+ };
71
+ const waitForElementToDisappear = (selector) => {
72
+ return new Promise((resolve) => {
73
+ const checkForElement = () => {
74
+ const element = document.querySelector(selector);
75
+ if (!element) {
76
+ resolve();
77
+ }
78
+ else {
79
+ requestAnimationFrame(checkForElement);
80
+ }
81
+ };
82
+ checkForElement();
83
+ });
84
+ };
85
+ const waitForInput = (selector, minNumberOfCharacters = 1) => {
86
+ return new Promise((resolve) => {
87
+ const checkForInput = () => {
88
+ const input = document.querySelector(selector);
89
+ let inputValue = "";
90
+ if (input?.getAttribute("contenteditable")) {
91
+ console.log("contenteditable", input.innerText);
92
+ inputValue = input.innerText;
93
+ }
94
+ else if (input &&
95
+ input.value.length >= minNumberOfCharacters) {
96
+ inputValue = input.value;
97
+ }
98
+ if (inputValue.length >= minNumberOfCharacters) {
99
+ console.log("input found", inputValue);
100
+ resolve();
101
+ }
102
+ else {
103
+ requestAnimationFrame(checkForInput);
104
+ }
105
+ };
106
+ checkForInput();
107
+ });
108
+ };
109
+ function setNativeValue(element, value) {
110
+ const valueSetter = Object.getOwnPropertyDescriptor(element.constructor.prototype, "value")?.set;
111
+ const prototype = Object.getPrototypeOf(element);
112
+ const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
113
+ if (valueSetter && valueSetter !== prototypeValueSetter) {
114
+ prototypeValueSetter?.call(element, value);
115
+ }
116
+ else {
117
+ valueSetter?.call(element, value);
118
+ }
119
+ const event = new Event("input", { bubbles: true });
120
+ element.dispatchEvent(event);
121
+ }
122
+ async function simulateTyping(element, text, interval = 35) {
123
+ let i = 0;
124
+ while (i <= text.length) {
125
+ const currentText = text.substring(0, i);
126
+ setNativeValue(element, currentText);
127
+ i++;
128
+ const randomDelay = interval * (0.5 + Math.random());
129
+ await delay(randomDelay);
130
+ }
131
+ }
132
+ /**
133
+ * Stops the tour and resets the state.
134
+ */
135
+ const stopTour = () => {
136
+ setCurrentStep("start-tour");
137
+ setFocusRect(null);
138
+ tourStopCallback();
139
+ };
140
+ const tours = editContext.configuration.tours;
141
+ const tour = tours[editContext.configuration.activeTour];
142
+ const tourSteps = tour.getSteps({
143
+ editContext: editContext,
144
+ nextStep: (stepId) => setCurrentStep(stepId),
145
+ stopTour: () => tourStopCallback(),
146
+ waitForElement,
147
+ waitForElementToDisappear,
148
+ setFocusRect,
149
+ delay,
150
+ waitForInput: waitForInput,
151
+ simulateTyping,
152
+ });
153
+ const step = tourSteps[currentStep];
154
+ if (!step)
155
+ return null;
156
+ (0, react_1.useEffect)(() => {
157
+ const runStep = async () => {
158
+ setShow(false);
159
+ setFocusRect(null);
160
+ await delay(500);
161
+ const step = tourSteps[currentStep];
162
+ if (!step)
163
+ return;
164
+ console.log("step", currentStep, step);
165
+ if (step.prepareAction) {
166
+ await step.prepareAction();
167
+ }
168
+ if (step.focusElement) {
169
+ const rect = await waitForElement(step.focusElement, 5000);
170
+ if (!rect)
171
+ setCurrentStep("error");
172
+ else
173
+ setFocusRect(rect);
174
+ }
175
+ setShow(true);
176
+ if (step.waitForUserInput) {
177
+ const nextStep = (await step.waitForUserInput()) || step.nextStep;
178
+ if (nextStep) {
179
+ setCurrentStep(nextStep);
180
+ }
181
+ else
182
+ console.log("no next step defined for step", currentStep);
183
+ }
184
+ else {
185
+ if (step.waitForElement) {
186
+ await waitForElement(step.waitForElement);
187
+ if (step.nextStep) {
188
+ setCurrentStep(step.nextStep);
189
+ }
190
+ }
191
+ }
192
+ };
193
+ runStep();
194
+ }, [currentStep]);
195
+ (0, react_1.useEffect)(() => {
196
+ const getPointTo = async () => {
197
+ let pointToRect = focusRect;
198
+ if (step.getPointTo) {
199
+ const pointTo = step.getPointTo();
200
+ if (pointTo) {
201
+ pointToRect = pointTo;
202
+ }
203
+ }
204
+ if (step.pointToElement) {
205
+ const rect = await waitForElement(step.pointToElement, 5000);
206
+ if (rect) {
207
+ pointToRect = rect;
208
+ }
209
+ }
210
+ setPointToRect(pointToRect);
211
+ };
212
+ getPointTo();
213
+ }, [focusRect, currentStep]);
214
+ if (!step) {
215
+ throw new Error(`Tour step ${currentStep} not found`);
216
+ }
217
+ const bubblePosition = step.bubblePosition || "right";
218
+ const bubbleStyle = {};
219
+ let boxStyle = {
220
+ position: "fixed",
221
+ left: "50%",
222
+ top: "50%",
223
+ transform: "translate(-50%, -50%)",
224
+ };
225
+ let arrowStyle = {};
226
+ if (pointToRect) {
227
+ if (bubblePosition === "right") {
228
+ boxStyle = {
229
+ position: "absolute",
230
+ left: pointToRect.left + pointToRect.width,
231
+ top: pointToRect.top - 10,
232
+ alignItems: "flex-start",
233
+ };
234
+ arrowStyle = {
235
+ marginLeft: "-20px",
236
+ };
237
+ bubbleStyle.marginLeft = "80px";
238
+ bubbleStyle.marginTop = "-20px";
239
+ }
240
+ if (bubblePosition === "left") {
241
+ boxStyle = {
242
+ position: "absolute",
243
+ right: window.innerWidth - pointToRect.left,
244
+ top: pointToRect.top + pointToRect.height / 2,
245
+ alignItems: "flex-end",
246
+ };
247
+ arrowStyle = {
248
+ marginRight: "-20px",
249
+ };
250
+ }
251
+ if (bubblePosition === "bottom") {
252
+ boxStyle = {
253
+ position: "absolute",
254
+ left: pointToRect.left + pointToRect.width / 2,
255
+ top: pointToRect.top + pointToRect.height,
256
+ transform: "translate(-50%, 0)",
257
+ };
258
+ if (step.flipArrow) {
259
+ arrowStyle = {
260
+ transform: "scaleX(-1)",
261
+ };
262
+ }
263
+ }
264
+ if (bubblePosition === "top-right") {
265
+ boxStyle = {
266
+ position: "absolute",
267
+ left: pointToRect.left + pointToRect.width,
268
+ bottom: window.innerHeight - pointToRect.top,
269
+ transform: "translate(-50%, 0)",
270
+ flexDirection: "column-reverse",
271
+ };
272
+ arrowStyle = {
273
+ transform: "rotate(180deg)",
274
+ };
275
+ if (step.flipArrow) {
276
+ arrowStyle = {
277
+ transform: "scaleX(-1)",
278
+ };
279
+ }
280
+ }
281
+ }
282
+ const arrowRotation = bubblePosition === "right" ? "-a-rotate-90" : "";
283
+ const overlayStyle = {
284
+ position: "fixed",
285
+ top: 0,
286
+ left: 0,
287
+ width: "100%",
288
+ height: "100%",
289
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
290
+ pointerEvents: "auto",
291
+ clipPath: focusRect
292
+ ? `polygon(0% 0%, 0% 100%, ${focusRect.left}px 100%, ${focusRect.left}px ${focusRect.top}px, ${focusRect.left + focusRect.width}px ${focusRect.top}px, ${focusRect.left + focusRect.width}px ${focusRect.top + focusRect.height}px, ${focusRect.left}px ${focusRect.top + focusRect.height}px, ${focusRect.left}px 100%, 100% 100%, 100% 0%)`
293
+ : "none",
294
+ // clipPath: focusPosition
295
+ // ? `path('M 0 0 H 100% V 100% H 0 Z M ${focusPosition.left}px ${focusPosition.top}px H ${focusPosition.left + focusPosition.width}px V ${focusPosition.top + focusPosition.height}px H ${focusPosition.left}px Z')`
296
+ // : 'none',
297
+ };
298
+ if (!show) {
299
+ return (0, jsx_runtime_1.jsx)("div", { className: "overlay", style: overlayStyle });
300
+ }
301
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "overlay", style: overlayStyle }), (0, jsx_runtime_1.jsxs)("div", { style: boxStyle, className: "text-gray-800 flex flex-col items-center fade-in", children: [focusRect && ((0, jsx_runtime_1.jsx)("svg", { width: "100px", height: "100px", viewBox: "0 -7.89 113.08 113.08", xmlns: "http://www.w3.org/2000/svg", className: (0, utils_1.classNames)("pointer-events-none", arrowRotation), style: arrowStyle, children: (0, jsx_runtime_1.jsx)("path", { style: { stroke: "#0000ff", fill: "#0000ff" }, d: "M20.1871 175C15.7485 172.891 13.0008 172.469 12.1553 170.992C8.98489 165.508 5.39173 160.024 3.70083 153.908C-1.37187 137.666 -0.737781 121.214 2.64402 104.762C8.35081 76.7092 21.0325 51.8201 36.8847 28.1966C38.5756 25.6655 40.0552 23.1344 41.7461 20.3924C41.7461 20.1814 41.5347 19.7596 41.112 19.1268C36.462 20.3923 31.6007 21.6579 26.9507 22.7125C24.4144 23.1344 21.4552 23.1344 18.9189 22.2907C17.4394 21.8688 15.3258 19.5486 15.3258 18.0722C15.3258 16.1739 16.8053 13.8537 18.0735 12.1663C19.1303 11.1117 21.0326 10.9008 22.7235 10.4789C35.4052 7.31508 48.087 3.72935 60.9801 0.776411C71.9709 -1.75468 75.564 1.83105 74.9299 12.5882C74.2959 23.7672 74.0845 34.9462 73.6618 45.9142C73.4505 49.289 72.8164 52.8747 72.3936 56.6714C63.5164 52.6638 63.5164 52.6638 60.346 18.494C47.0301 33.2588 38.1529 49.289 29.9098 65.7411C21.6666 82.1932 16.1712 99.489 13.2121 117.839C10.2531 136.823 13.8462 154.751 20.1871 175Z", fill: "#0D1927" }) })), (0, jsx_runtime_1.jsx)("style", { children: `
302
+ @import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&display=swap');
303
+ .handwritten {
304
+ font-family: 'Caveat', cursive;
305
+ }
306
+ .fade-background {
307
+ background: radial-gradient(circle, rgba(255,255,255,0.8) 60%, rgba(255,255,255,0) 90%);
308
+ }
309
+ .fade-in {
310
+ animation: fadeIn 0.5s ease-in-out;
311
+ }
312
+ @keyframes fadeIn {
313
+ from { opacity: 0; }
314
+ to { opacity: 1; }
315
+ }
316
+ ` }), (0, jsx_runtime_1.jsxs)("div", { className: `relative flex items-stretch justify-center bg-gray-50 rounded-lg border border-gray-800 gap-6 shadow-2xl`, style: bubbleStyle, children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs font-bold cursor-pointer flex items-center gap-2 absolute top-0 right-0 mr-2 mt-2", onClick: stopTour, children: (0, jsx_runtime_1.jsx)("i", { className: "pi pi-times" }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-center justify-center gap-2 bg-gray-200 p-6 rounded-l-lg", children: (0, jsx_runtime_1.jsx)(AlpacaIcon, {}) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end justify-center gap-3 p-4 ", children: [(0, jsx_runtime_1.jsxs)("div", { className: "opacity-100 text-2xl font-bold handwritten text-center flex flex-col items-center max-w-[450px]", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-4xl mb-4", children: step.title }), (0, jsx_runtime_1.jsx)("div", { children: step.description })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex gap-2", children: step.buttons &&
317
+ step.buttons.map((button, index) => ((0, jsx_runtime_1.jsx)("button", { onClick: button.onClick, className: button.className, children: button.label }, index))) })] })] })] })] }));
318
+ }
319
+ function AlpacaIcon() {
320
+ return ((0, jsx_runtime_1.jsxs)("svg", { height: "80px", width: "80px", version: "1.1", id: "Layer_1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", children: [(0, jsx_runtime_1.jsx)("path", { style: { fill: "#EBE4DD" }, d: "M102.989,153.011v153.011C119.613,428.825,184.332,506.115,256,506.115\r\n\ts136.387-77.29,153.012-200.092V153.011H102.989z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#D8CCBC" }, d: "M255.999,153.011v353.103H256c71.668,0,136.387-77.29,153.012-200.092V153.011H255.999z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#A58868" }, d: "M273.655,435.494h-35.31c0,41.195-17.007,41.195-29.425,41.195V512\r\n\tc16.246,0,34.206-4.021,47.08-18.162C268.873,507.979,286.834,512,303.08,512v-35.31C290.662,476.69,273.655,476.69,273.655,435.494\r\n\tz" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#947859" }, d: "M273.655,435.494H256v58.343C268.873,507.979,286.834,512,303.08,512v-35.31\r\n\tC290.662,476.69,273.655,476.69,273.655,435.494z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#EBE4DD" }, d: "M126.529,0C81.025,0,44.138,36.888,44.138,82.391s36.888,82.391,82.391,82.391V0z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#D8CCBC" }, d: "M385.471,164.782c45.503,0,82.391-36.888,82.391-82.391S430.975,0,385.471,0V164.782z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#BFA993" }, d: "M490.407,247.172c0.643-3.83,0.996-7.758,0.996-11.77c0-39.003-31.618-70.621-70.621-70.621\r\n\ts-70.621,31.618-70.621,70.621c0,4.012,0.352,7.94,0.995,11.77H490.407z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#EDEDED" }, d: "M420.782,306.023c39.003,0,70.621-31.618,70.621-70.621H350.161\r\n\tC350.161,274.405,381.779,306.023,420.782,306.023z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#454449" }, d: "M397.241,235.401c0,12.981,10.559,23.54,23.538,23.54h0.002c12.981,0.001,23.54-10.559,23.54-23.54\r\n\tH397.241z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#BFA993" }, d: "M160.844,247.172c0.643-3.83,0.995-7.758,0.995-11.77c0-39.003-31.618-70.621-70.621-70.621\r\n\tS20.598,196.4,20.598,235.402c0,4.012,0.352,7.94,0.995,11.77H160.844z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#EDEDED" }, d: "M91.218,306.023c39.003,0,70.621-31.618,70.621-70.621H20.598\r\n\tC20.598,274.405,52.216,306.023,91.218,306.023z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#454449" }, d: "M67.678,235.401c0,12.981,10.559,23.54,23.538,23.54h0.002c12.981,0.001,23.54-10.559,23.54-23.54\r\n\tH67.678z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#D8CCBC" }, d: "M391.356,107.187c0-15.527,4.902-33.778-5.082-46.69c-8.818-11.403-28.519-12.694-43.229-20.793\r\n\tc-12.822-7.059-23.38-23.527-39.415-27.235c-14.505-3.356-31.411,6.442-47.63,6.442c-16.218,0-33.125-9.796-47.631-6.442\r\n\tc-16.036,3.708-26.595,20.178-39.415,27.237c-14.71,8.099-34.41,9.391-43.227,20.792c-9.985,12.912-5.082,31.161-5.082,46.689\r\n\ts-4.902,33.778,5.082,46.69c8.818,11.403,28.519,12.693,43.229,20.793c12.821,7.059,23.379,23.527,39.413,27.235\r\n\tc14.505,3.356,31.412-6.442,47.63-6.442s33.125,9.796,47.632,6.442c16.034-3.708,26.592-20.176,39.413-27.237\r\n\tc14.709-8.099,34.411-9.391,43.228-20.792C396.259,140.965,391.356,122.715,391.356,107.187z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#BFA993" }, d: "M386.274,60.497c-8.818-11.403-28.519-12.694-43.229-20.793\r\n\tc-12.822-7.059-23.38-23.527-39.415-27.235c-14.505-3.356-31.411,6.442-47.63,6.442v176.552c16.218,0,33.125,9.796,47.632,6.442\r\n\tc16.034-3.708,26.592-20.176,39.413-27.237c14.709-8.099,34.411-9.391,43.228-20.792c9.985-12.912,5.082-31.161,5.082-46.689\r\n\tS396.259,73.409,386.274,60.497z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#58575D" }, d: "M293.664,406.069c-6.186,18.772-22.763,39.469-37.664,39.784\r\n\tc-14.901-0.315-31.478-21.012-37.664-39.784c-2.858-9.591,4.529-17.529,16.478-17.655c14.124,0,28.248,0,42.372,0\r\n\tC289.136,388.54,296.522,396.476,293.664,406.069z" }), (0, jsx_runtime_1.jsx)("path", { style: { fill: "#454449" }, d: "M277.186,388.414c-7.062,0-14.124,0-21.186,0v57.439c14.901-0.315,31.478-21.012,37.664-39.784\r\n\tC296.522,396.476,289.136,388.54,277.186,388.414z" })] }));
321
+ }
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultTourSteps = getDefaultTourSteps;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function getDefaultTourSteps({ editContext, nextStep, stopTour, waitForElement, waitForElementToDisappear, setFocusRect, delay, waitForInput, simulateTyping, }, config) {
6
+ const tourSteps = {
7
+ "start-tour": {
8
+ title: "Welcome to the AI Editor Tour!",
9
+ description: "I will show you around the editor and how to use the most important features.",
10
+ prepareAction: async () => {
11
+ editContext?.openSplashScreen();
12
+ },
13
+ buttons: [
14
+ {
15
+ label: ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-play" }), " Start Tour"] })),
16
+ onClick: () => {
17
+ nextStep("new-page");
18
+ },
19
+ className: "button button-primary mt-2",
20
+ },
21
+ {
22
+ label: ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-times" }), " No thanks"] })),
23
+ onClick: () => {
24
+ stopTour();
25
+ },
26
+ className: "button button-secondary mt-2",
27
+ },
28
+ ],
29
+ },
30
+ "new-page": {
31
+ description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Click on the ", (0, jsx_runtime_1.jsx)("b", { children: "New Page" }), " tab to create a new page"] })),
32
+ focusElement: "#new-page-tab",
33
+ waitForUserInput: async () => {
34
+ await waitForElement("#new-page-tab.active-tab");
35
+ },
36
+ nextStep: "pick-location",
37
+ },
38
+ "pick-location": {
39
+ description: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Select the ", (0, jsx_runtime_1.jsx)("b", { children: "Playground" }), " folder as the parent for your new page"] })),
40
+ focusElement: ".tour-pick-location",
41
+ waitForUserInput: async () => {
42
+ await new Promise((resolve) => {
43
+ const checkForElement = () => {
44
+ const elements = document.querySelectorAll(".p-highlight");
45
+ for (const element of elements) {
46
+ if (element.textContent?.trim() === "Playground") {
47
+ setFocusRect(element.getBoundingClientRect());
48
+ resolve();
49
+ return;
50
+ }
51
+ }
52
+ requestAnimationFrame(checkForElement);
53
+ };
54
+ checkForElement();
55
+ });
56
+ },
57
+ getPointTo: () => {
58
+ const elements = document.querySelectorAll(".p-treenode-label");
59
+ for (const element of elements) {
60
+ if (element.textContent?.trim() === "Playground") {
61
+ return element.getBoundingClientRect();
62
+ }
63
+ }
64
+ return undefined;
65
+ },
66
+ nextStep: "choose-template",
67
+ },
68
+ "choose-template": {
69
+ description: "Select a template for your page",
70
+ focusElement: ".tour-choose-template",
71
+ waitForUserInput: async () => {
72
+ await waitForElement(".tour-selected-template");
73
+ },
74
+ bubblePosition: "left",
75
+ nextStep: "enter-name",
76
+ },
77
+ "enter-name": {
78
+ description: "Enter a name for your page",
79
+ focusElement: "#new-page-name",
80
+ bubblePosition: "left",
81
+ waitForUserInput: async () => {
82
+ await waitForElement("#create-new-page-button:not(.p-disabled)");
83
+ },
84
+ nextStep: "create-page",
85
+ },
86
+ "create-page": {
87
+ description: "Click the Create button",
88
+ focusElement: "#create-new-page-button",
89
+ waitForUserInput: async () => {
90
+ await waitForElement("#insert-component-button");
91
+ },
92
+ nextStep: "ready-to-add-component",
93
+ },
94
+ "ready-to-add-component": {
95
+ description: "Wanna add a component to your beautiful empty page?",
96
+ buttons: [
97
+ {
98
+ label: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-arrow-right" }), " I'm ready, lets go!"] })),
99
+ onClick: () => nextStep("insert-component"),
100
+ },
101
+ ],
102
+ },
103
+ "insert-component": {
104
+ description: "Excellent, click on the plus button to insert a component.",
105
+ focusElement: "#insert-component-button",
106
+ waitForUserInput: async () => {
107
+ await waitForElement(".tour-component-palette");
108
+ },
109
+ nextStep: "drag-component",
110
+ },
111
+ "drag-component": {
112
+ description: `Drag and drop a ${config.firstComponentTemplateName} component to your page.`,
113
+ focusElement: `#insert-component-${config.firstComponentTemplateId}`,
114
+ waitForUserInput: async () => {
115
+ await waitForElement(".tour-placeholder-dropzone");
116
+ },
117
+ nextStep: "drop-component-on-placeholder",
118
+ },
119
+ "drop-component-on-placeholder": {
120
+ description: "Drop the component onto this placeholder!",
121
+ focusElement: ".tour-placeholder-dropzone",
122
+ bubblePosition: "left",
123
+ extendFocus: 70,
124
+ waitForUserInput: async () => {
125
+ await waitForElementToDisappear(".tour-placeholder-dropzone");
126
+ await delay(400);
127
+ if (!document.querySelector(".tour-component-palette")) {
128
+ return "enter-title";
129
+ }
130
+ return "drag-component";
131
+ },
132
+ nextStep: "enter-title",
133
+ },
134
+ "enter-title": {
135
+ description: `Excellent! Now lets fill in the fields. First enter a ${config.firstComponentTextFieldName}`,
136
+ focusElement: `[data-field-id='${config.firstComponentTextFieldId}']`,
137
+ waitForUserInput: async () => {
138
+ await delay(5000);
139
+ await waitForInput(`[data-field-id='${config.firstComponentTextFieldId}'] input`, 5);
140
+ },
141
+ nextStep: "see-content-update",
142
+ },
143
+ "see-content-update": {
144
+ description: "See how the content is automatically updating on your page?",
145
+ focusElement: `[data-field-id='${config.firstComponentTextFieldId}']`,
146
+ pointToElement: `iframe:[data-fieldid='${config.firstComponentTextFieldId}']`,
147
+ bubblePosition: "bottom",
148
+ flipArrow: true,
149
+ waitForUserInput: async () => {
150
+ await delay(5000);
151
+ await waitForInput(`[data-field-id='${config.firstComponentTextFieldId}'] input`, 5);
152
+ },
153
+ nextStep: "edit-content-inline",
154
+ },
155
+ "edit-content-inline": {
156
+ description: "You can also directly edit the content on the page. Click on the [Introduction] placeholder here and start typing!",
157
+ focusElement: `iframe:[data-fieldid='${config.firstComponentRichTextFieldId}']`,
158
+ bubblePosition: "bottom",
159
+ flipArrow: true,
160
+ waitForUserInput: async () => {
161
+ await delay(5000);
162
+ await waitForInput(`[data-field-id='${config.firstComponentRichTextFieldId}'] [contenteditable]`, 5);
163
+ },
164
+ nextStep: "ai-intro",
165
+ },
166
+ "ai-intro": {
167
+ description: "But hey, this is an AI editor, so why not let the AI do some of the work for you?",
168
+ buttons: [
169
+ {
170
+ label: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-arrow-right" }), " Great, show me!"] })),
171
+ onClick: () => nextStep("ai-sidebar"),
172
+ },
173
+ ],
174
+ },
175
+ "ai-sidebar": {
176
+ description: "Click on the AI sidebar to open the AI chat.",
177
+ focusElement: `[data-sidebarview-name='ai']`,
178
+ nextStep: "ai-terminal",
179
+ waitForElement: "[data-sidebarview-name='ai'].a-active",
180
+ },
181
+ "ai-terminal": {
182
+ description: "Let me take control and add tell the AI to add some more components.",
183
+ focusElement: `.tour-ai-terminal textarea`,
184
+ waitForUserInput: async () => {
185
+ await delay(1000);
186
+ const aiTerminal = document.querySelector(".tour-ai-terminal textarea");
187
+ if (aiTerminal) {
188
+ aiTerminal.focus();
189
+ await simulateTyping(aiTerminal, `Plase add three components of type ${config.firstComponentTemplateName} with some funny dummy content to the page.`);
190
+ }
191
+ },
192
+ bubblePosition: "top-right",
193
+ nextStep: "ai-submit",
194
+ },
195
+ "ai-submit": {
196
+ description: "Click on the Send button to submit the prompt to the AI.",
197
+ focusElement: ".tour-ai-terminal .tour-send-button",
198
+ bubblePosition: "top-right",
199
+ nextStep: "ai-watch-components-added",
200
+ waitForElement: ".tour-ai-terminal .a-prompt",
201
+ },
202
+ "ai-watch-components-added": {
203
+ description: "Watch how the AI adds the components to the page. This can take a few seconds.",
204
+ focusElement: ".tour-ai-terminal",
205
+ pointToElement: ".tour-ai-terminal .a-prompt",
206
+ waitForElement: ".tour-ai-response-message-changes",
207
+ nextStep: "congratulations",
208
+ },
209
+ congratulations: {
210
+ title: "Congratulations!",
211
+ description: "You have completed the tour and are now an AI Editor Pro!",
212
+ buttons: [
213
+ {
214
+ label: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-check" }), " Finish Tour"] })),
215
+ onClick: () => stopTour(),
216
+ className: "button button-primary mt-2",
217
+ },
218
+ ],
219
+ },
220
+ error: {
221
+ description: "Oops, something went wrong.",
222
+ buttons: [
223
+ {
224
+ label: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "pi pi-check" }), " Close"] })),
225
+ onClick: () => stopTour(),
226
+ },
227
+ ],
228
+ },
229
+ };
230
+ return tourSteps;
231
+ }