@alpaca-editor/core 1.0.3938 → 1.0.3941

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 (357) hide show
  1. package/dist/components/ActionButton.d.ts +1 -0
  2. package/dist/components/ActionButton.js +2 -2
  3. package/dist/components/ActionButton.js.map +1 -1
  4. package/dist/editor/ContentTree.js +12 -8
  5. package/dist/editor/ContentTree.js.map +1 -1
  6. package/dist/editor/ContextMenu.d.ts +1 -1
  7. package/dist/editor/ContextMenu.js +17 -3
  8. package/dist/editor/ContextMenu.js.map +1 -1
  9. package/dist/editor/FieldActionsOverlay.d.ts +18 -0
  10. package/dist/editor/FieldActionsOverlay.js +139 -0
  11. package/dist/editor/FieldActionsOverlay.js.map +1 -0
  12. package/dist/editor/FieldHistory.d.ts +2 -1
  13. package/dist/editor/FieldHistory.js +11 -8
  14. package/dist/editor/FieldHistory.js.map +1 -1
  15. package/dist/editor/FieldListField.js +14 -17
  16. package/dist/editor/FieldListField.js.map +1 -1
  17. package/dist/editor/PictureCropper.js +65 -23
  18. package/dist/editor/PictureCropper.js.map +1 -1
  19. package/dist/editor/PictureEditor.js +43 -3
  20. package/dist/editor/PictureEditor.js.map +1 -1
  21. package/dist/editor/Titlebar.js +19 -10
  22. package/dist/editor/Titlebar.js.map +1 -1
  23. package/dist/editor/ai/AiTerminal.js +27 -41
  24. package/dist/editor/ai/AiTerminal.js.map +1 -1
  25. package/dist/editor/ai/GhostWriter.js +21 -2
  26. package/dist/editor/ai/GhostWriter.js.map +1 -1
  27. package/dist/editor/client/EditorClient.js +48 -18
  28. package/dist/editor/client/EditorClient.js.map +1 -1
  29. package/dist/editor/client/editContext.d.ts +1 -1
  30. package/dist/editor/client/editContext.js.map +1 -1
  31. package/dist/editor/client/itemsRepository.js +126 -90
  32. package/dist/editor/client/itemsRepository.js.map +1 -1
  33. package/dist/editor/commands/componentCommands.js +7 -3
  34. package/dist/editor/commands/componentCommands.js.map +1 -1
  35. package/dist/editor/media-selector/MediaFolderBrowser.d.ts +5 -0
  36. package/dist/editor/media-selector/MediaFolderBrowser.js +77 -0
  37. package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -0
  38. package/dist/editor/media-selector/MediaSelector.js +1 -1
  39. package/dist/editor/media-selector/MediaSelector.js.map +1 -1
  40. package/dist/editor/media-selector/Thumbnails.js +2 -2
  41. package/dist/editor/media-selector/index.d.ts +8 -0
  42. package/dist/editor/media-selector/index.js +9 -0
  43. package/dist/editor/media-selector/index.js.map +1 -0
  44. package/dist/editor/menubar/BrowseHistory.js +3 -4
  45. package/dist/editor/menubar/BrowseHistory.js.map +1 -1
  46. package/dist/editor/menubar/PageSelector.js +62 -10
  47. package/dist/editor/menubar/PageSelector.js.map +1 -1
  48. package/dist/editor/page-editor-chrome/FieldActionIndicator.js +1 -1
  49. package/dist/editor/page-editor-chrome/FieldActionIndicator.js.map +1 -1
  50. package/dist/editor/page-editor-chrome/useInlineAICompletion.js +37 -11
  51. package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
  52. package/dist/editor/page-viewer/PageViewerFrame.js +98 -2
  53. package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
  54. package/dist/editor/pageModel.d.ts +14 -0
  55. package/dist/editor/reviews/Comment.js +3 -2
  56. package/dist/editor/reviews/Comment.js.map +1 -1
  57. package/dist/editor/services/aiService.js +0 -1
  58. package/dist/editor/services/aiService.js.map +1 -1
  59. package/dist/editor/services/editService.d.ts +1 -1
  60. package/dist/editor/services/editService.js +2 -1
  61. package/dist/editor/services/editService.js.map +1 -1
  62. package/dist/editor/sidebar/ComponentTree.js +3 -4
  63. package/dist/editor/sidebar/ComponentTree.js.map +1 -1
  64. package/dist/editor/ui/Icons.js +1 -1
  65. package/dist/editor/ui/Icons.js.map +1 -1
  66. package/dist/editor/ui/ItemList.d.ts +16 -0
  67. package/dist/editor/ui/ItemList.js +19 -0
  68. package/dist/editor/ui/ItemList.js.map +1 -0
  69. package/dist/editor/ui/ItemSearch.js +2 -12
  70. package/dist/editor/ui/ItemSearch.js.map +1 -1
  71. package/dist/editor/ui/SimpleTabs.d.ts +1 -0
  72. package/dist/editor/ui/SimpleTabs.js +3 -3
  73. package/dist/editor/ui/SimpleTabs.js.map +1 -1
  74. package/dist/editor/ui/Splitter.js +61 -6
  75. package/dist/editor/ui/Splitter.js.map +1 -1
  76. package/dist/editor/views/MediaFolderEditView.d.ts +4 -0
  77. package/dist/editor/views/MediaFolderEditView.js +40 -0
  78. package/dist/editor/views/MediaFolderEditView.js.map +1 -0
  79. package/dist/editor/views/SingleEditView.js +9 -1
  80. package/dist/editor/views/SingleEditView.js.map +1 -1
  81. package/dist/revision.d.ts +2 -2
  82. package/dist/revision.js +2 -2
  83. package/dist/styles.css +64 -13
  84. package/package.json +8 -2
  85. package/.prettierrc +0 -3
  86. package/build.css +0 -3
  87. package/components.json +0 -21
  88. package/eslint.config.mjs +0 -4
  89. package/images/bg-shape-black.webp +0 -0
  90. package/images/wizard-bg.png +0 -0
  91. package/images/wizard-tour.png +0 -0
  92. package/images/wizard.png +0 -0
  93. package/src/client-components/api.ts +0 -6
  94. package/src/client-components/index.ts +0 -19
  95. package/src/components/ActionButton.tsx +0 -41
  96. package/src/components/Error.tsx +0 -57
  97. package/src/components/ui/CardConnector.tsx +0 -56
  98. package/src/components/ui/button.tsx +0 -62
  99. package/src/components/ui/card.tsx +0 -372
  100. package/src/components/ui/context-menu.tsx +0 -250
  101. package/src/config/config.tsx +0 -917
  102. package/src/config/types.ts +0 -286
  103. package/src/editor/ComponentInfo.tsx +0 -90
  104. package/src/editor/ConfirmationDialog.tsx +0 -103
  105. package/src/editor/ContentTree.tsx +0 -727
  106. package/src/editor/ContextMenu.tsx +0 -212
  107. package/src/editor/Editor.tsx +0 -90
  108. package/src/editor/EditorWarning.tsx +0 -34
  109. package/src/editor/EditorWarnings.tsx +0 -33
  110. package/src/editor/FieldEditorPopup.tsx +0 -65
  111. package/src/editor/FieldHistory.tsx +0 -74
  112. package/src/editor/FieldList.tsx +0 -190
  113. package/src/editor/FieldListField.tsx +0 -391
  114. package/src/editor/FieldListFieldWithFallbacks.tsx +0 -217
  115. package/src/editor/FloatingToolbar.tsx +0 -163
  116. package/src/editor/ImageEditor.tsx +0 -128
  117. package/src/editor/ItemInfo.tsx +0 -90
  118. package/src/editor/LinkEditorDialog.tsx +0 -196
  119. package/src/editor/MainLayout.tsx +0 -95
  120. package/src/editor/MobileLayout.tsx +0 -68
  121. package/src/editor/NewEditorClient.tsx +0 -11
  122. package/src/editor/PictureCropper.tsx +0 -503
  123. package/src/editor/PictureEditor.tsx +0 -212
  124. package/src/editor/PictureEditorDialog.tsx +0 -381
  125. package/src/editor/PublishDialog.ignore +0 -74
  126. package/src/editor/ScrollingContentTree.tsx +0 -67
  127. package/src/editor/Terminal.tsx +0 -227
  128. package/src/editor/Titlebar.tsx +0 -93
  129. package/src/editor/ai/AiPopup.tsx +0 -59
  130. package/src/editor/ai/AiResponseMessage.tsx +0 -106
  131. package/src/editor/ai/AiTerminal.tsx +0 -514
  132. package/src/editor/ai/AiToolCall.tsx +0 -61
  133. package/src/editor/ai/EditorAiTerminal.tsx +0 -20
  134. package/src/editor/ai/GhostWriter.tsx +0 -432
  135. package/src/editor/ai/aiPageModel.ts +0 -108
  136. package/src/editor/ai/editorAiContext.ts +0 -18
  137. package/src/editor/client/AboutDialog.tsx +0 -44
  138. package/src/editor/client/EditorClient.tsx +0 -2197
  139. package/src/editor/client/GenericDialog.tsx +0 -50
  140. package/src/editor/client/editContext.ts +0 -412
  141. package/src/editor/client/helpers.ts +0 -44
  142. package/src/editor/client/itemsRepository.ts +0 -538
  143. package/src/editor/client/operations.ts +0 -768
  144. package/src/editor/client/pageModelBuilder.ts +0 -219
  145. package/src/editor/commands/commands.ts +0 -22
  146. package/src/editor/commands/componentCommands.tsx +0 -424
  147. package/src/editor/commands/createVersionCommand.ts +0 -33
  148. package/src/editor/commands/deleteVersionCommand.ts +0 -71
  149. package/src/editor/commands/itemCommands.tsx +0 -351
  150. package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +0 -201
  151. package/src/editor/commands/localizeItem/LocalizeItemUtils.ts +0 -27
  152. package/src/editor/commands/undo.ts +0 -39
  153. package/src/editor/component-designer/ComponentDesigner.tsx +0 -70
  154. package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +0 -11
  155. package/src/editor/component-designer/ComponentDesignerMenu.tsx +0 -91
  156. package/src/editor/component-designer/ComponentEditor.tsx +0 -97
  157. package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +0 -31
  158. package/src/editor/component-designer/ComponentRenderingEditor.tsx +0 -104
  159. package/src/editor/component-designer/ComponentsDropdown.tsx +0 -39
  160. package/src/editor/component-designer/PlaceholdersEditor.tsx +0 -179
  161. package/src/editor/component-designer/RenderingsDropdown.tsx +0 -36
  162. package/src/editor/component-designer/TemplateEditor.tsx +0 -236
  163. package/src/editor/component-designer/aiContext.ts +0 -23
  164. package/src/editor/componentTreeHelper.tsx +0 -116
  165. package/src/editor/context-menu/CopyMoveMenu.tsx +0 -103
  166. package/src/editor/context-menu/InsertMenu.tsx +0 -347
  167. package/src/editor/control-center/About.tsx +0 -342
  168. package/src/editor/control-center/ControlCenterMenu.tsx +0 -76
  169. package/src/editor/control-center/IndexOverview.tsx +0 -50
  170. package/src/editor/control-center/IndexSettings.tsx +0 -266
  171. package/src/editor/control-center/Info.tsx +0 -104
  172. package/src/editor/control-center/QuotaInfo.tsx +0 -301
  173. package/src/editor/control-center/Status.tsx +0 -113
  174. package/src/editor/control-center/WebSocketMessages.tsx +0 -155
  175. package/src/editor/editor-warnings/ItemLocked.tsx +0 -63
  176. package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +0 -22
  177. package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +0 -23
  178. package/src/editor/editor-warnings/NoWriteAccess.tsx +0 -16
  179. package/src/editor/editor-warnings/ValidationErrors.tsx +0 -54
  180. package/src/editor/field-types/AttachmentEditor.tsx +0 -9
  181. package/src/editor/field-types/CheckboxEditor.tsx +0 -47
  182. package/src/editor/field-types/DropLinkEditor.tsx +0 -80
  183. package/src/editor/field-types/DropListEditor.tsx +0 -84
  184. package/src/editor/field-types/ImageFieldEditor.tsx +0 -65
  185. package/src/editor/field-types/InternalLinkFieldEditor.tsx +0 -117
  186. package/src/editor/field-types/LinkFieldEditor.tsx +0 -85
  187. package/src/editor/field-types/MultiLineText.tsx +0 -82
  188. package/src/editor/field-types/PictureFieldEditor.tsx +0 -121
  189. package/src/editor/field-types/RawEditor.tsx +0 -53
  190. package/src/editor/field-types/ReactQuill.tsx +0 -580
  191. package/src/editor/field-types/RichTextEditor.tsx +0 -22
  192. package/src/editor/field-types/RichTextEditorComponent.tsx +0 -127
  193. package/src/editor/field-types/SingleLineText.tsx +0 -174
  194. package/src/editor/field-types/TreeListEditor.tsx +0 -261
  195. package/src/editor/fieldTypes.ts +0 -140
  196. package/src/editor/media-selector/AiImageSearch.tsx +0 -185
  197. package/src/editor/media-selector/AiImageSearchPrompt.tsx +0 -94
  198. package/src/editor/media-selector/MediaSelector.tsx +0 -42
  199. package/src/editor/media-selector/Preview.tsx +0 -14
  200. package/src/editor/media-selector/Thumbnails.tsx +0 -48
  201. package/src/editor/media-selector/TreeSelector.tsx +0 -292
  202. package/src/editor/media-selector/UploadZone.tsx +0 -137
  203. package/src/editor/menubar/ActionsMenu.tsx +0 -94
  204. package/src/editor/menubar/ActiveUsers.tsx +0 -17
  205. package/src/editor/menubar/ApproveAndPublish.tsx +0 -18
  206. package/src/editor/menubar/BrowseHistory.tsx +0 -37
  207. package/src/editor/menubar/ItemLanguageVersion.tsx +0 -76
  208. package/src/editor/menubar/LanguageSelector.tsx +0 -226
  209. package/src/editor/menubar/Menu.tsx +0 -83
  210. package/src/editor/menubar/NavButtons.tsx +0 -74
  211. package/src/editor/menubar/PageSelector.tsx +0 -141
  212. package/src/editor/menubar/PageViewerControls.tsx +0 -120
  213. package/src/editor/menubar/PreviewSecondaryControls.tsx +0 -18
  214. package/src/editor/menubar/SecondaryControls.tsx +0 -45
  215. package/src/editor/menubar/Separator.tsx +0 -12
  216. package/src/editor/menubar/SiteInfo.tsx +0 -53
  217. package/src/editor/menubar/User.tsx +0 -27
  218. package/src/editor/menubar/VersionSelector.tsx +0 -142
  219. package/src/editor/page-editor-chrome/CommentHighlighting.tsx +0 -307
  220. package/src/editor/page-editor-chrome/CommentHighlightings.tsx +0 -35
  221. package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +0 -59
  222. package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +0 -23
  223. package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +0 -64
  224. package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +0 -35
  225. package/src/editor/page-editor-chrome/FrameMenu.tsx +0 -338
  226. package/src/editor/page-editor-chrome/FrameMenus.tsx +0 -48
  227. package/src/editor/page-editor-chrome/InlineEditor.tsx +0 -765
  228. package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +0 -61
  229. package/src/editor/page-editor-chrome/NoLayout.tsx +0 -36
  230. package/src/editor/page-editor-chrome/PageEditorChrome.tsx +0 -122
  231. package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +0 -161
  232. package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +0 -169
  233. package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +0 -315
  234. package/src/editor/page-editor-chrome/SuggestionHighlighting.tsx +0 -300
  235. package/src/editor/page-editor-chrome/SuggestionHighlightings.tsx +0 -40
  236. package/src/editor/page-editor-chrome/useInlineAICompletion.tsx +0 -791
  237. package/src/editor/page-viewer/DeviceToolbar.tsx +0 -70
  238. package/src/editor/page-viewer/EditorForm.tsx +0 -258
  239. package/src/editor/page-viewer/MiniMap.tsx +0 -362
  240. package/src/editor/page-viewer/PageViewer.tsx +0 -169
  241. package/src/editor/page-viewer/PageViewerFrame.tsx +0 -879
  242. package/src/editor/page-viewer/pageModelSkeletonBuilder.ts +0 -412
  243. package/src/editor/page-viewer/pageViewContext.ts +0 -186
  244. package/src/editor/pageModel.ts +0 -208
  245. package/src/editor/picture-shared.tsx +0 -53
  246. package/src/editor/reviews/Comment.tsx +0 -308
  247. package/src/editor/reviews/Comments.tsx +0 -125
  248. package/src/editor/reviews/DiffView.tsx +0 -109
  249. package/src/editor/reviews/PreviewInfo.tsx +0 -35
  250. package/src/editor/reviews/Reviews.tsx +0 -280
  251. package/src/editor/reviews/SuggestedEdit.tsx +0 -316
  252. package/src/editor/reviews/reviewCommands.tsx +0 -47
  253. package/src/editor/reviews/useReviews.tsx +0 -70
  254. package/src/editor/services/aiService.ts +0 -174
  255. package/src/editor/services/componentDesignerService.ts +0 -151
  256. package/src/editor/services/contentService.ts +0 -180
  257. package/src/editor/services/editService.ts +0 -486
  258. package/src/editor/services/indexService.ts +0 -24
  259. package/src/editor/services/reviewsService.ts +0 -53
  260. package/src/editor/services/serviceHelper.ts +0 -95
  261. package/src/editor/services/suggestedEditsService.ts +0 -39
  262. package/src/editor/services/systemService.ts +0 -5
  263. package/src/editor/services/translationService.ts +0 -21
  264. package/src/editor/services-server/api.ts +0 -150
  265. package/src/editor/services-server/graphQL.ts +0 -106
  266. package/src/editor/sidebar/ComponentPalette.tsx +0 -161
  267. package/src/editor/sidebar/ComponentTree.tsx +0 -548
  268. package/src/editor/sidebar/ComponentTree2.tsxx +0 -490
  269. package/src/editor/sidebar/Debug.tsx +0 -111
  270. package/src/editor/sidebar/DictionaryEditor.tsx +0 -261
  271. package/src/editor/sidebar/EditHistory.tsx +0 -134
  272. package/src/editor/sidebar/GraphQL.tsx +0 -164
  273. package/src/editor/sidebar/Insert.tsx +0 -35
  274. package/src/editor/sidebar/MainContentTree.tsx +0 -102
  275. package/src/editor/sidebar/Performance.tsx +0 -53
  276. package/src/editor/sidebar/Sessions.tsx +0 -35
  277. package/src/editor/sidebar/Sidebar.tsx +0 -20
  278. package/src/editor/sidebar/SidebarView.tsx +0 -152
  279. package/src/editor/sidebar/Translations.tsx +0 -295
  280. package/src/editor/sidebar/Validation.tsx +0 -102
  281. package/src/editor/sidebar/ViewSelector.tsx +0 -60
  282. package/src/editor/sidebar/Workbox.tsx +0 -209
  283. package/src/editor/ui/CenteredMessage.tsx +0 -7
  284. package/src/editor/ui/CopyMoveTargetSelectorDialog.tsx +0 -81
  285. package/src/editor/ui/CopyToClipboardButton.tsx +0 -24
  286. package/src/editor/ui/DialogButtons.tsx +0 -11
  287. package/src/editor/ui/Icons.tsx +0 -708
  288. package/src/editor/ui/ItemNameDialogNew.tsx +0 -118
  289. package/src/editor/ui/ItemSearch.tsx +0 -190
  290. package/src/editor/ui/PerfectTree.tsx +0 -571
  291. package/src/editor/ui/Section.tsx +0 -35
  292. package/src/editor/ui/SimpleIconButton.tsx +0 -54
  293. package/src/editor/ui/SimpleMenu.tsx +0 -40
  294. package/src/editor/ui/SimpleTable.tsx +0 -60
  295. package/src/editor/ui/SimpleTabs.tsx +0 -55
  296. package/src/editor/ui/SimpleToolbar.tsx +0 -7
  297. package/src/editor/ui/Spinner.tsx +0 -9
  298. package/src/editor/ui/Splitter.tsx +0 -314
  299. package/src/editor/ui/StackedPanels.tsx +0 -134
  300. package/src/editor/ui/Toolbar.tsx +0 -7
  301. package/src/editor/utils/id-helper.ts +0 -3
  302. package/src/editor/utils/insertOptions.ts +0 -69
  303. package/src/editor/utils/itemutils.ts +0 -29
  304. package/src/editor/utils/useMemoDebug.ts +0 -28
  305. package/src/editor/utils.ts +0 -486
  306. package/src/editor/views/CompareView.tsx +0 -245
  307. package/src/editor/views/EditView.tsx +0 -27
  308. package/src/editor/views/ItemEditor.tsx +0 -58
  309. package/src/editor/views/SingleEditView.tsx +0 -46
  310. package/src/fonts/Geist-Black.woff2 +0 -0
  311. package/src/fonts/Geist-Bold.woff2 +0 -0
  312. package/src/fonts/Geist-ExtraBold.woff2 +0 -0
  313. package/src/fonts/Geist-ExtraLight.woff2 +0 -0
  314. package/src/fonts/Geist-Light.woff2 +0 -0
  315. package/src/fonts/Geist-Medium.woff2 +0 -0
  316. package/src/fonts/Geist-Regular.woff2 +0 -0
  317. package/src/fonts/Geist-SemiBold.woff2 +0 -0
  318. package/src/fonts/Geist-Thin.woff2 +0 -0
  319. package/src/fonts/Geist[wght].woff2 +0 -0
  320. package/src/fonts/index.ts +0 -10
  321. package/src/index.ts +0 -23
  322. package/src/lib/safelist.tsx +0 -16
  323. package/src/lib/utils.ts +0 -6
  324. package/src/page-wizard/PageWizard.tsx +0 -139
  325. package/src/page-wizard/WizardBox.tsx +0 -4
  326. package/src/page-wizard/WizardBoxConnector.tsx +0 -56
  327. package/src/page-wizard/WizardSteps.tsx +0 -458
  328. package/src/page-wizard/service.ts +0 -35
  329. package/src/page-wizard/startPageWizardCommand.ts +0 -26
  330. package/src/page-wizard/steps/BuildPageStep.tsx +0 -259
  331. package/src/page-wizard/steps/CollectStep.tsx +0 -296
  332. package/src/page-wizard/steps/ComponentTypesSelector.tsx +0 -454
  333. package/src/page-wizard/steps/Components.tsx +0 -193
  334. package/src/page-wizard/steps/ContentStep.tsx +0 -890
  335. package/src/page-wizard/steps/EditButton.tsx +0 -34
  336. package/src/page-wizard/steps/FieldEditor.tsx +0 -102
  337. package/src/page-wizard/steps/Generate.tsx +0 -60
  338. package/src/page-wizard/steps/ImagesStep.tsx +0 -382
  339. package/src/page-wizard/steps/LayoutStep.tsx +0 -227
  340. package/src/page-wizard/steps/MetaDataStep.tsx +0 -173
  341. package/src/page-wizard/steps/SelectStep.tsx +0 -281
  342. package/src/page-wizard/steps/schema.ts +0 -180
  343. package/src/page-wizard/steps/usePageCreator.ts +0 -325
  344. package/src/page-wizard/usePageWizard.ts +0 -79
  345. package/src/revision.ts +0 -2
  346. package/src/splash-screen/NewPage.tsx +0 -294
  347. package/src/splash-screen/OpenPage.tsx +0 -113
  348. package/src/splash-screen/RecentPages.tsx +0 -123
  349. package/src/splash-screen/SectionHeadline.tsx +0 -21
  350. package/src/splash-screen/SplashScreen.tsx +0 -195
  351. package/src/tour/Tour.tsx +0 -566
  352. package/src/tour/default-tour.tsx +0 -301
  353. package/src/tour/preview-tour.tsx +0 -128
  354. package/src/types.ts +0 -335
  355. package/styles.css +0 -765
  356. package/tsconfig.build.json +0 -31
  357. package/tsconfig.json +0 -14
@@ -1,315 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { useEditContext } from "../client/editContext";
3
-
4
- import { getAllPlaceholders } from "../componentTreeHelper";
5
- import { findComponentRect } from "../utils";
6
- import { PlaceholderDropZone } from "./PlaceholderDropZone";
7
- import { Placeholder, Component } from "../pageModel";
8
-
9
- export function PlaceholderDropZones({
10
- scale,
11
- iframe,
12
- size,
13
- }: {
14
- scale?: number;
15
- iframe?: HTMLIFrameElement | null;
16
- size: "large" | "small";
17
- }) {
18
- const [placeholders, setPlaceholders] = useState<Placeholder[]>([]);
19
- const editContext = useEditContext();
20
- const pageViewContext = editContext?.pageView;
21
-
22
- useEffect(() => {
23
- if (!pageViewContext?.page) return;
24
- setPlaceholders(getAllPlaceholders(pageViewContext.page!));
25
- }, [pageViewContext?.page]);
26
-
27
- if (
28
- !pageViewContext ||
29
- (!editContext?.dragObject && !editContext.selectedForInsertion) ||
30
- !placeholders
31
- )
32
- return null;
33
-
34
- const matchingPlaceholders = placeholders.filter(
35
- (x) =>
36
- x.parentComponent?.id === editContext.selectedForInsertion ||
37
- x.insertOptions?.find(
38
- (y) =>
39
- y.typeId === editContext.selectedForInsertion ||
40
- y.typeId === editContext.dragObject?.typeId ||
41
- y.typeId === editContext.dragObject?.templateId ||
42
- y.compatibleTypeIds?.find(
43
- (z) => z == editContext.dragObject?.typeId,
44
- ) !== undefined ||
45
- y.typeId === editContext.dragObject?.templateId ||
46
- y.compatibleTypeIds?.find(
47
- (z) => z == editContext.dragObject?.templateId,
48
- ) !== undefined,
49
- ),
50
- );
51
-
52
- if (!iframe) return;
53
-
54
- const zones: {
55
- placeholder: Placeholder;
56
- position: { x: number; y: number };
57
- index: number;
58
- element: Element;
59
- anchor: "top" | "bottom" | "left" | "right";
60
- description?: string | null;
61
- }[] = [];
62
-
63
- const scrollHeight =
64
- editContext.pageView.editorIframeRef?.current?.contentWindow?.document
65
- .documentElement.scrollHeight || 0;
66
-
67
- matchingPlaceholders.forEach((placeholder) => {
68
- let placeholderElement = iframe!.contentWindow?.document.body.querySelector(
69
- "[data-placeholder-start='" + placeholder.key + "']",
70
- );
71
-
72
- if (!placeholderElement && placeholder.components.length > 0) {
73
- placeholderElement = placeholder.components[0]?.firstDOMElement;
74
- }
75
-
76
- if (!placeholderElement) return;
77
-
78
- const prev = getPreviousElement(placeholderElement);
79
-
80
- const nextOrParent =
81
- getNextElement(placeholderElement) || placeholderElement.parentElement;
82
-
83
- let orientation = placeholderElement?.getAttribute("data-orientation");
84
-
85
- if (!orientation)
86
- orientation = detectOrientation(
87
- placeholderElement,
88
- placeholder.components,
89
- );
90
-
91
- const rect = (prev ?? nextOrParent)!.getBoundingClientRect();
92
- const zoom = pageViewContext.zoom;
93
-
94
- const position =
95
- orientation === "horizontal"
96
- ? {
97
- x: (prev ? rect.x + rect.width : rect.x) * zoom,
98
- y: (rect.y + rect.height / 2) * zoom,
99
- }
100
- : {
101
- x: (rect.x + rect.width / 2) * zoom,
102
- y: (prev ? rect.y + rect.height : rect.y) * zoom,
103
- };
104
-
105
- let index = 0;
106
-
107
- const description = placeholderElement.getAttribute("data-description");
108
-
109
- let anchor: "top" | "bottom" | "left" | "right" = "top";
110
-
111
- if (prev && orientation === "horizontal") {
112
- anchor = "right";
113
- }
114
- if (prev && orientation !== "horizontal") {
115
- anchor = "bottom";
116
- }
117
- if (!prev && orientation === "horizontal") {
118
- anchor = "left";
119
- }
120
- if (!prev && orientation !== "horizontal") {
121
- anchor = "top";
122
- }
123
-
124
- zones.push({
125
- placeholder,
126
- position,
127
- index,
128
- element: prev ?? nextOrParent!,
129
- anchor,
130
- description,
131
- });
132
-
133
- placeholder.components.forEach((component) => {
134
- const componentRect = findComponentRect(iframe, component);
135
- if (!componentRect) return;
136
-
137
- const position = getPositionFromRect(
138
- componentRect.rect,
139
- pageViewContext.zoom,
140
- orientation,
141
- );
142
-
143
- index++;
144
-
145
- zones.push({
146
- placeholder,
147
- position,
148
- index,
149
- anchor: orientation === "horizontal" ? "right" : "bottom",
150
- element: componentRect.elements[componentRect.elements.length - 1]!,
151
- });
152
- });
153
-
154
- // let nextElement = placeholderElement?.nextElementSibling;
155
- // while (nextElement) {
156
- // nextElement = nextElement?.nextElementSibling;
157
- // if (nextElement) {
158
- // if (
159
- // nextElement.getAttribute("data-placeholder-end") === placeholder.key
160
- // ) {
161
- // break;
162
- // }
163
-
164
- // if (nextElement.getAttribute("data-component-end")) {
165
- // const componentRect = findComponentRect(
166
- // iframe,
167
- // (nextElement.getAttribute("data-component-end") ||
168
- // nextElement.getAttribute("data-dropzone"))!,
169
- // );
170
- // if (!componentRect) continue;
171
- // const position = getPositionFromRect(
172
- // componentRect.rect,
173
- // pageViewContext.zoom,
174
- // orientation,
175
- // );
176
- // index++;
177
- // zones.push({
178
- // placeholder,
179
- // position,
180
- // index,
181
- // anchor: orientation === "horizontal" ? "right" : "bottom",
182
- // element: componentRect.elements[componentRect.elements.length - 1]!,
183
- // });
184
- // } else if (nextElement.getAttribute("data-dropzone")) {
185
- // const rect = nextElement.getBoundingClientRect();
186
- // const position = getPositionFromRect(rect, pageViewContext.zoom);
187
- // index++;
188
- // zones.push({
189
- // placeholder,
190
- // position,
191
- // index,
192
- // anchor: orientation === "horizontal" ? "left" : "top",
193
- // element: nextElement,
194
- // });
195
- // }
196
- // }
197
- // }
198
- });
199
-
200
- return zones.map((zone, index) => {
201
- const x = Math.min(
202
- pageViewContext.viewport.width - 20,
203
- Math.max(20, zone.position.x * (scale || 1)),
204
- );
205
- const y = Math.min(
206
- scrollHeight - 20,
207
- Math.max(20 - pageViewContext.scroll, zone.position.y * (scale || 1)),
208
- );
209
-
210
- return (
211
- <PlaceholderDropZone
212
- key={index}
213
- placeholder={zone.placeholder}
214
- spotPosition={{
215
- x,
216
- y,
217
- }}
218
- index={zone.index}
219
- size={size}
220
- spotPositionElement={zone.element}
221
- spotPositionAnchor={zone.anchor}
222
- parentName={zone.placeholder.parentComponent?.name}
223
- description={zone.description || undefined}
224
- />
225
- );
226
- });
227
- }
228
-
229
- function getPreviousElement(element: Element): Element | null {
230
- let prev = element.previousElementSibling;
231
- while (prev && prev.tagName === "SCRIPT") {
232
- prev = prev.previousElementSibling;
233
- }
234
- return prev;
235
- }
236
-
237
- function getNextElement(element: Element): Element | null {
238
- let next = element.nextElementSibling;
239
-
240
- while (next && next.tagName === "SCRIPT") {
241
- next = next.nextElementSibling;
242
- }
243
- return next;
244
- }
245
-
246
- function getPositionFromRect(
247
- rect: { x: number; y: number; width: number; height: number },
248
- zoom: number,
249
- orientation?: string | null,
250
- ) {
251
- const position =
252
- orientation === "horizontal"
253
- ? {
254
- x: rect.x + rect.width * zoom,
255
- y: (rect.y + rect.height / 2) * zoom,
256
- }
257
- : {
258
- x: (rect.x + rect.width / 2) * zoom,
259
- y: rect.y + rect.height * zoom,
260
- };
261
-
262
- return position;
263
- }
264
-
265
- function detectOrientation(
266
- placeholderElement: Element,
267
- components: Component[],
268
- ): "horizontal" | "vertical" {
269
- // Check parent element for flex/grid direction
270
- const parentElement = placeholderElement.parentElement;
271
- if (parentElement) {
272
- const parentStyle = window.getComputedStyle(parentElement);
273
- const display = parentStyle.getPropertyValue("display");
274
-
275
- // Check for flex direction
276
- if (display === "flex" || display === "inline-flex") {
277
- const flexDirection = parentStyle.getPropertyValue("flex-direction");
278
- if (flexDirection === "row" || "row-reverse") {
279
- return "horizontal";
280
- }
281
- if (flexDirection === "column" || "column-reverse") {
282
- return "vertical";
283
- }
284
- }
285
-
286
- // Check for grid layout
287
- if (display === "grid" || display === "inline-grid") {
288
- const gridAutoFlow = parentStyle.getPropertyValue("grid-auto-flow");
289
- if (gridAutoFlow.includes("column")) {
290
- return "horizontal";
291
- }
292
- if (gridAutoFlow.includes("row")) {
293
- return "vertical";
294
- }
295
- }
296
- }
297
-
298
- // Analyze sibling positions if available
299
- if (components.length > 1) {
300
- const prevRect = components[0]?.firstDOMElement?.getBoundingClientRect();
301
- const nextRect = components[1]?.firstDOMElement?.getBoundingClientRect();
302
-
303
- if (!prevRect || !nextRect) return "horizontal";
304
-
305
- // Compare the position differences
306
- const horizontalDiff = Math.abs(nextRect.x - prevRect.x);
307
- const verticalDiff = Math.abs(nextRect.y - prevRect.y);
308
-
309
- // If horizontal difference is greater, it's likely a horizontal layout
310
- return horizontalDiff > verticalDiff ? "horizontal" : "vertical";
311
- }
312
-
313
- // Default to vertical if we can't determine
314
- return "vertical";
315
- }
@@ -1,300 +0,0 @@
1
- import {
2
- useEditContext,
3
- useModifiedFieldsContext,
4
- } from "../client/editContext";
5
- import { findFieldElement } from "../utils";
6
- import { SuggestedEdit } from "../../types";
7
- import { useState } from "react";
8
- import { useEffect } from "react";
9
- import { classNames } from "primereact/utils";
10
- import { UserRoundPen } from "lucide-react";
11
- import * as DiffLib from "diff";
12
-
13
- export function SuggestionHighlighting({
14
- suggestion,
15
- scale,
16
- iframe,
17
- }: {
18
- suggestion: SuggestedEdit;
19
- scale: number;
20
- iframe: HTMLIFrameElement;
21
- }) {
22
- const editContext = useEditContext();
23
- const modifiedFields = useModifiedFieldsContext();
24
- const [ranges, setRanges] = useState<Array<[number, number]>>([]);
25
- const [textContent, setTextContent] = useState<string>("");
26
-
27
- useEffect(() => {
28
- const findRanges = async () => {
29
- if (!editContext) return;
30
-
31
- const field = await editContext.itemsRepository.getField({
32
- item: {
33
- id: suggestion.itemId,
34
- language: suggestion.mainItemLanguage,
35
- version: suggestion.mainItemVersion,
36
- },
37
- fieldId: suggestion.fieldId,
38
- });
39
-
40
- const modifiedField = modifiedFields?.modifiedFields.find(
41
- (x) =>
42
- x.fieldId === field?.id &&
43
- x.item.id === suggestion.itemId &&
44
- x.item.language === suggestion.mainItemLanguage &&
45
- x.item.version === suggestion.mainItemVersion,
46
- );
47
-
48
- // Calculate the actual differences between oldValue and newValue
49
- const oldValue = suggestion.oldValue || field?.rawValue || "";
50
- const newValue = modifiedField?.value || suggestion.newValue || "";
51
-
52
- // If values are identical, no need to highlight
53
- if (oldValue === newValue) {
54
- setRanges([]);
55
- return;
56
- }
57
-
58
- // Save oldValue for use in the component
59
- setTextContent(oldValue);
60
-
61
- // Use the diff library to find the changed parts - using diffChars for more precise matching
62
- const diffResult = DiffLib.diffChars(oldValue, newValue);
63
-
64
- const changeRanges: Array<[number, number]> = [];
65
- let positionInOld = 0;
66
-
67
- // Process the diff result to find all change ranges
68
- for (const part of diffResult) {
69
- if (part.removed) {
70
- // If a part is removed, highlight it in the original text
71
- changeRanges.push([positionInOld, positionInOld + part.value.length]);
72
- positionInOld += part.value.length;
73
- } else if (part.added) {
74
- // For added parts, mark the insertion point
75
- if (changeRanges.length > 0) {
76
- const lastRange = changeRanges[changeRanges.length - 1];
77
- if (lastRange && lastRange[1] === positionInOld) {
78
- // If this addition comes right after a removal, the previous range already covers the position
79
- continue;
80
- }
81
- }
82
- // Mark the insertion point for new content
83
- changeRanges.push([positionInOld, positionInOld]);
84
- } else {
85
- // Unchanged part, just advance the position
86
- positionInOld += part.value.length;
87
- }
88
- }
89
-
90
- // Merge adjacent or overlapping ranges
91
- const mergedRanges: Array<[number, number]> = [];
92
-
93
- if (changeRanges.length > 0) {
94
- changeRanges.sort((a, b) => a[0] - b[0]);
95
-
96
- // Start with the first range
97
- const firstRange = changeRanges[0];
98
- if (!firstRange) {
99
- setRanges([]);
100
- return;
101
- }
102
-
103
- let currentRange: [number, number] = [...firstRange];
104
-
105
- // Process the rest of the ranges
106
- for (let i = 1; i < changeRanges.length; i++) {
107
- const nextRange = changeRanges[i];
108
-
109
- // Skip undefined ranges
110
- if (!nextRange) continue;
111
-
112
- // If the next range starts very close to the end of the current range, merge them
113
- if (nextRange[0] <= currentRange[1] + 3) {
114
- // Allow slightly larger gaps (3 chars) for better highlighting
115
- // Extend the current range
116
- currentRange[1] = Math.max(currentRange[1], nextRange[1]);
117
- } else {
118
- // Save the current range and start a new one
119
- mergedRanges.push([currentRange[0], currentRange[1]]);
120
- currentRange = [...nextRange];
121
- }
122
- }
123
-
124
- // Add the last range
125
- mergedRanges.push([currentRange[0], currentRange[1]]);
126
- }
127
-
128
- // Set ranges to highlight the changed parts
129
- setRanges(mergedRanges);
130
- };
131
-
132
- findRanges();
133
- }, [editContext, modifiedFields?.modifiedFields, suggestion]);
134
-
135
- if (!editContext) return null;
136
-
137
- if (!suggestion.fieldId) return null;
138
-
139
- const fieldElement = findFieldElement(iframe, {
140
- item: {
141
- id: suggestion.itemId,
142
- language: suggestion.mainItemLanguage,
143
- version: suggestion.mainItemVersion,
144
- },
145
- fieldId: suggestion.fieldId,
146
- });
147
-
148
- if (!fieldElement) return null;
149
-
150
- // Process each range and collect all DOM rectangles
151
- const allRects: Array<DOMRect> = [];
152
-
153
- ranges.forEach((range) => {
154
- if (range[0] !== undefined && range[1] !== undefined) {
155
- // For insertion points (zero-length ranges), expand to include at least one character
156
- // to make it visible
157
- const start = range[0];
158
- const end =
159
- range[0] === range[1]
160
- ? Math.min(range[0] + 1, textContent.length)
161
- : range[1];
162
-
163
- if (start < end) {
164
- const startData = getTextNodeAtPosition(fieldElement, start);
165
- const endData = getTextNodeAtPosition(fieldElement, end);
166
-
167
- if (startData && endData) {
168
- try {
169
- const textRange = document.createRange();
170
- textRange.setStart(startData.node, startData.offset);
171
- textRange.setEnd(endData.node, endData.offset);
172
-
173
- const rangeRects = textRange.getClientRects();
174
- // Convert DOMRectList to Array
175
- for (let i = 0; i < rangeRects.length; i++) {
176
- const rect = rangeRects[i];
177
- if (rect) {
178
- allRects.push(rect);
179
- }
180
- }
181
- } catch (e) {
182
- console.error("Error creating range", e);
183
- }
184
- }
185
- }
186
- }
187
- });
188
-
189
- // If no rects were found, fall back to highlighting the entire field
190
- if (allRects.length === 0 && ranges.length > 0) {
191
- const fallbackRect = fieldElement.getBoundingClientRect();
192
- allRects.push(fallbackRect);
193
- }
194
-
195
- const iframeRect = iframe.getBoundingClientRect();
196
-
197
- return (
198
- <>
199
- {allRects.map((rect, index) => (
200
- <div
201
- key={index}
202
- style={{
203
- position: "absolute",
204
- top: rect.top * scale,
205
- left: rect.left * scale,
206
- width: rect.width * scale,
207
- height: rect.height * scale,
208
- pointerEvents: "none",
209
- }}
210
- >
211
- {index === 0 && (
212
- <div
213
- className={classNames(
214
- "pointer-events-auto absolute h-5 w-5 cursor-pointer",
215
- rect.top * scale < 18 ? "top-0" : "top-[-18px]",
216
- (rect.left + rect.width) * scale > iframeRect.width - 18
217
- ? "right-0"
218
- : "right-[-18px]",
219
- )}
220
- onClick={() => {
221
- editContext.select([suggestion.itemId]);
222
- editContext.setFocusedField(
223
- {
224
- item: {
225
- id: suggestion.itemId,
226
- language: suggestion.mainItemLanguage,
227
- version: suggestion.mainItemVersion,
228
- },
229
- fieldId: suggestion.fieldId,
230
- },
231
- true,
232
- );
233
- }}
234
- >
235
- <UserRoundPen
236
- className="rounded-full bg-emerald-400/70 p-1 text-white"
237
- size={20}
238
- />
239
- </div>
240
- )}
241
- {/* <div
242
- className="bg-emerald-400/30"
243
- style={{
244
- width: "100%",
245
- height: "100%",
246
- }}
247
- ></div> */}
248
- </div>
249
- ))}
250
- </>
251
- );
252
- }
253
-
254
- // Improved function to find text node at a given character position
255
- function getTextNodeAtPosition(
256
- root: Node,
257
- targetOffset: number,
258
- ): { node: Text; offset: number } | null {
259
- // Handle edge cases
260
- if (targetOffset < 0) return null;
261
-
262
- // Get all text nodes in order
263
- const textNodes: Text[] = [];
264
- const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null);
265
-
266
- let node: Text | null;
267
- while ((node = walker.nextNode() as Text | null)) {
268
- if (node) textNodes.push(node);
269
- }
270
-
271
- let currentOffset = 0;
272
- // Walk through all text nodes to find the one containing our target position
273
- for (const node of textNodes) {
274
- const nodeLength = node.textContent?.length || 0;
275
-
276
- // If this node contains our target position
277
- if (currentOffset + nodeLength >= targetOffset) {
278
- return {
279
- node: node,
280
- offset: targetOffset - currentOffset,
281
- };
282
- }
283
-
284
- currentOffset += nodeLength;
285
- }
286
-
287
- // If we've gone through all nodes and haven't found the position
288
- // Return the last position in the last text node
289
- if (textNodes.length > 0) {
290
- const lastNode = textNodes[textNodes.length - 1];
291
- if (lastNode) {
292
- return {
293
- node: lastNode,
294
- offset: lastNode.textContent?.length || 0,
295
- };
296
- }
297
- }
298
-
299
- return null;
300
- }
@@ -1,40 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { useEditContext } from "../client/editContext";
3
-
4
- import { SuggestionHighlighting } from "./SuggestionHighlighting";
5
-
6
- import { SuggestedEdit } from "../../types";
7
-
8
- export function SuggestionHighlightings({
9
- scale,
10
- iframe,
11
- }: {
12
- scale: number;
13
- iframe: HTMLIFrameElement;
14
- }) {
15
- const editContext = useEditContext();
16
-
17
- const [suggestions, setSuggestions] = useState<SuggestedEdit[]>([]);
18
-
19
- useEffect(() => {
20
- setSuggestions(
21
- editContext?.suggestedEdits.filter((x) => x.status === "Pending") || [],
22
- );
23
- }, [editContext?.comments, editContext?.suggestedEdits]);
24
-
25
- return (
26
- <>
27
- {editContext?.showSuggestedEdits &&
28
- suggestions
29
- .filter((x) => x.status !== "approved" && x.status !== "rejected")
30
- .map((suggestion) => (
31
- <SuggestionHighlighting
32
- iframe={iframe}
33
- scale={scale}
34
- key={suggestion.id}
35
- suggestion={suggestion}
36
- />
37
- ))}
38
- </>
39
- );
40
- }