@alpaca-editor/core 1.0.3845 → 1.0.3847

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 (79) hide show
  1. package/dist/config/config.js +55 -38
  2. package/dist/config/config.js.map +1 -1
  3. package/dist/config/types.d.ts +6 -1
  4. package/dist/editor/MainLayout.d.ts +3 -2
  5. package/dist/editor/MainLayout.js +13 -13
  6. package/dist/editor/MainLayout.js.map +1 -1
  7. package/dist/editor/MobileLayout.d.ts +2 -0
  8. package/dist/editor/MobileLayout.js +20 -0
  9. package/dist/editor/MobileLayout.js.map +1 -0
  10. package/dist/editor/Titlebar.js +28 -2
  11. package/dist/editor/Titlebar.js.map +1 -1
  12. package/dist/editor/ai/AiTerminal.js +1 -0
  13. package/dist/editor/ai/AiTerminal.js.map +1 -1
  14. package/dist/editor/client/AboutDialog.d.ts +2 -0
  15. package/dist/editor/client/AboutDialog.js +21 -0
  16. package/dist/editor/client/AboutDialog.js.map +1 -0
  17. package/dist/editor/client/EditorClient.js +27 -3
  18. package/dist/editor/client/EditorClient.js.map +1 -1
  19. package/dist/editor/client/editContext.d.ts +3 -0
  20. package/dist/editor/client/editContext.js.map +1 -1
  21. package/dist/editor/client/operations.js +1 -0
  22. package/dist/editor/client/operations.js.map +1 -1
  23. package/dist/editor/menubar/ActionsMenu.d.ts +3 -1
  24. package/dist/editor/menubar/ActionsMenu.js +35 -18
  25. package/dist/editor/menubar/ActionsMenu.js.map +1 -1
  26. package/dist/editor/menubar/ActiveUsers.js +1 -1
  27. package/dist/editor/menubar/ActiveUsers.js.map +1 -1
  28. package/dist/editor/menubar/ItemLanguageVersion.js +20 -15
  29. package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
  30. package/dist/editor/menubar/PageViewerControls.js +15 -15
  31. package/dist/editor/menubar/PageViewerControls.js.map +1 -1
  32. package/dist/editor/menubar/PreviewSecondaryControls.d.ts +1 -0
  33. package/dist/editor/menubar/PreviewSecondaryControls.js +11 -0
  34. package/dist/editor/menubar/PreviewSecondaryControls.js.map +1 -0
  35. package/dist/editor/menubar/SecondaryControls.d.ts +1 -0
  36. package/dist/editor/menubar/SecondaryControls.js +17 -0
  37. package/dist/editor/menubar/SecondaryControls.js.map +1 -0
  38. package/dist/editor/page-viewer/MiniMap.js +1 -1
  39. package/dist/editor/page-viewer/MiniMap.js.map +1 -1
  40. package/dist/editor/page-viewer/PageViewer.js +4 -1
  41. package/dist/editor/page-viewer/PageViewer.js.map +1 -1
  42. package/dist/editor/reviews/Comment.js +17 -2
  43. package/dist/editor/reviews/Comment.js.map +1 -1
  44. package/dist/editor/reviews/reviewCommands.js +2 -2
  45. package/dist/editor/reviews/reviewCommands.js.map +1 -1
  46. package/dist/editor/sidebar/ViewSelector.js +2 -1
  47. package/dist/editor/sidebar/ViewSelector.js.map +1 -1
  48. package/dist/editor/ui/SimpleTable.js +1 -1
  49. package/dist/editor/ui/SimpleTable.js.map +1 -1
  50. package/dist/editor/views/SingleEditView.js +1 -1
  51. package/dist/editor/views/SingleEditView.js.map +1 -1
  52. package/dist/revision.d.ts +2 -2
  53. package/dist/revision.js +2 -2
  54. package/dist/styles.css +12 -3
  55. package/package.json +1 -1
  56. package/src/config/config.tsx +50 -30
  57. package/src/config/types.ts +7 -1
  58. package/src/editor/MainLayout.tsx +22 -30
  59. package/src/editor/MobileLayout.tsx +45 -0
  60. package/src/editor/Titlebar.tsx +63 -2
  61. package/src/editor/ai/AiTerminal.tsx +1 -0
  62. package/src/editor/client/AboutDialog.tsx +44 -0
  63. package/src/editor/client/EditorClient.tsx +36 -3
  64. package/src/editor/client/editContext.ts +5 -0
  65. package/src/editor/client/operations.ts +1 -0
  66. package/src/editor/menubar/ActionsMenu.tsx +66 -20
  67. package/src/editor/menubar/ActiveUsers.tsx +2 -2
  68. package/src/editor/menubar/ItemLanguageVersion.tsx +49 -25
  69. package/src/editor/menubar/PageViewerControls.tsx +58 -52
  70. package/src/editor/menubar/PreviewSecondaryControls.tsx +18 -0
  71. package/src/editor/menubar/SecondaryControls.tsx +46 -0
  72. package/src/editor/page-viewer/MiniMap.tsx +1 -1
  73. package/src/editor/page-viewer/PageViewer.tsx +5 -0
  74. package/src/editor/reviews/Comment.tsx +19 -3
  75. package/src/editor/reviews/reviewCommands.tsx +3 -3
  76. package/src/editor/sidebar/ViewSelector.tsx +7 -1
  77. package/src/editor/ui/SimpleTable.tsx +1 -1
  78. package/src/editor/views/SingleEditView.tsx +3 -1
  79. package/src/revision.ts +2 -2
@@ -0,0 +1,46 @@
1
+ import { useEditContext } from "../client/editContext";
2
+ import { ItemLanguageVersion } from "./ItemLanguageVersion";
3
+ import { ActiveUsers } from "./ActiveUsers";
4
+ import { ActionsMenu } from "./ActionsMenu";
5
+ import { Separator } from "../menubar/Separator";
6
+ import { ArrowRightIcon } from "../ui/Icons";
7
+ export function SecondaryControls() {
8
+ const editContext = useEditContext();
9
+
10
+ if (editContext?.isMobile) {
11
+ return (
12
+ <div className="flex flex-col items-end gap-4">
13
+ <div className="flex flex-col gap-2">
14
+ <Headline title="Current Page" />
15
+ <ItemLanguageVersion />
16
+ </div>
17
+ <div className="flex flex-col gap-2">
18
+ <Headline title="Active Users" />
19
+ <ActiveUsers />
20
+ </div>
21
+ <div className="flex flex-col gap-2">
22
+ <Headline title="Actions" />
23
+ <ActionsMenu isMobile={true} />
24
+ </div>
25
+ </div>
26
+ );
27
+ }
28
+
29
+ return (
30
+ <div className="flex items-center gap-2">
31
+ <ItemLanguageVersion />
32
+ <Separator size="large" />
33
+ <ActiveUsers />
34
+ <Separator size="large" />
35
+ <ActionsMenu isMobile={false} />
36
+ </div>
37
+ );
38
+ }
39
+
40
+ function Headline({ title }: { title: string }) {
41
+ return (
42
+ <div className="flex flex-col items-end gap-2">
43
+ <div className="text-sm font-bold text-gray-300">{title}</div>
44
+ </div>
45
+ );
46
+ }
@@ -291,7 +291,7 @@ export function MiniMap({
291
291
 
292
292
  return (
293
293
  <div
294
- className="relative z-50 overflow-hidden bg-white"
294
+ className="relative overflow-hidden bg-white"
295
295
  ref={minimapContainerRef}
296
296
  style={{
297
297
  height: "100%",
@@ -128,10 +128,15 @@ export function PageViewer({
128
128
  />,
129
129
  );
130
130
 
131
+ if (editContext?.isMobile) {
132
+ panels.reverse();
133
+ }
134
+
131
135
  return (
132
136
  <Allotment
133
137
  proportionalLayout={false}
134
138
  ref={allotmentRef}
139
+ vertical={editContext?.isMobile}
135
140
  onChange={(newSizes) => {
136
141
  if (!newSizes || newSizes.length === 0) return;
137
142
  if (showFormEditor && newSizes[0]) {
@@ -70,6 +70,24 @@ export function Comment({ comment }: { comment: CommentType }) {
70
70
 
71
71
  const canResolve = !comment.isNew && !editContext?.readonly;
72
72
 
73
+ const getHiddenSystemPrompt = (comment: CommentType) => {
74
+ let prompt =
75
+ "Please make suggestions how to resolve a review comment. Ask the user whether you should apply the suggested changes.";
76
+ if (comment.itemId) {
77
+ prompt += "\n\nItemId: " + comment.itemId;
78
+ }
79
+ if (comment.itemName) {
80
+ prompt += "\n\nItem name: " + comment.itemName;
81
+ }
82
+ if (comment.itemId) {
83
+ prompt += "\n\nItemId: " + comment.itemId;
84
+ }
85
+ if (comment.fieldName) {
86
+ prompt += "\n\nField name: " + comment.fieldName;
87
+ }
88
+ return prompt;
89
+ };
90
+
73
91
  const renderHeader = () => {
74
92
  const overlayPanelRef = useRef<OverlayPanel>(null);
75
93
  const deleteOverlayPanelRef = useRef<OverlayPanel>(null);
@@ -160,14 +178,12 @@ export function Comment({ comment }: { comment: CommentType }) {
160
178
  icon="pi pi-sparkles"
161
179
  label="AI"
162
180
  onClick={async (event) => {
163
- console.log("showing ai popup", comment.text);
164
181
  editContext?.showAiPopup(event as any, {
165
182
  initialPrompt:
166
183
  'Please help me resolve this comment: "' +
167
184
  comment.text +
168
185
  '"',
169
- hiddenSystemPrompt:
170
- "Please make suggestions how to resolve a review comment. Ask the user whether you should apply the suggested changes.",
186
+ hiddenSystemPrompt: getHiddenSystemPrompt(comment),
171
187
  });
172
188
  }}
173
189
  />
@@ -4,7 +4,7 @@ import { approveReview, rejectReview } from "../services/reviewsService";
4
4
  export const approveReviewCommand: Command<CommandData> = {
5
5
  id: "approveReview",
6
6
  label: "Approve Page",
7
- icon: <i className="pi pi-check text-green-500 mr-3" />,
7
+ icon: <i className="pi pi-check text-green-500" />,
8
8
  execute: async (context: CommandContext<CommandData>) => {
9
9
  if (!context.editContext.currentItemDescriptor) {
10
10
  return;
@@ -22,7 +22,7 @@ export const approveReviewCommand: Command<CommandData> = {
22
22
  export const rejectReviewCommand: Command<CommandData> = {
23
23
  id: "rejectReview",
24
24
  label: "Reject Page",
25
- icon: <i className="pi pi-times text-red-500 mr-3" />,
25
+ icon: <i className="pi pi-times text-red-500" />,
26
26
  execute: async (context: CommandContext<CommandData>) => {
27
27
  if (!context.editContext.currentItemDescriptor) {
28
28
  return;
@@ -41,7 +41,7 @@ export const rejectReviewCommand: Command<CommandData> = {
41
41
  function isReviewer(context: CommandContext<CommandData>) {
42
42
  return (
43
43
  context.editContext.reviews.reviews.find(
44
- (x) => x.reviewerEmail === context.editContext.user?.email
44
+ (x) => x.reviewerEmail === context.editContext.user?.email,
45
45
  ) !== undefined
46
46
  );
47
47
  }
@@ -1,6 +1,7 @@
1
1
  import { classNames } from "primereact/utils";
2
2
 
3
3
  import { useEditContext } from "../client/editContext";
4
+ import { cn } from "../../lib/utils";
4
5
 
5
6
  export function ViewSelector() {
6
7
  const editContext = useEditContext();
@@ -9,7 +10,12 @@ export function ViewSelector() {
9
10
  editContext?.configuration.editor.views.filter((x) => !x.hidden) ?? [];
10
11
 
11
12
  return (
12
- <div className="z-10 flex max-w-11 flex-col items-center gap-4 bg-gray-100 p-2 shadow-md">
13
+ <div
14
+ className={cn(
15
+ "z-10 flex items-center gap-4 bg-gray-100 p-2 shadow-md",
16
+ editContext?.isMobile ? "flex-row justify-around" : "max-w-11 flex-col",
17
+ )}
18
+ >
13
19
  {views
14
20
  .filter((x) => x.icon)
15
21
  .map((x, i) => (
@@ -26,7 +26,7 @@ export function SimpleTable<T>({
26
26
  <thead className="border-b border-neutral-200 font-medium">
27
27
  <tr>
28
28
  {columns.map((col, index) => (
29
- <th key={index} className="px-2 py-3">
29
+ <th key={index} className="px-1.5 py-1.5">
30
30
  {col.header}
31
31
  </th>
32
32
  ))}
@@ -35,7 +35,9 @@ export function SingleEditView({
35
35
  return (
36
36
  <PageViewer
37
37
  pageViewContext={pageViewContext}
38
- showFormEditor={true}
38
+ showFormEditor={
39
+ editContext?.viewName == "page-editor" || !editContext?.isMobile
40
+ }
39
41
  compareView={compareView}
40
42
  name={name}
41
43
  followEditsDefault={true}
package/src/revision.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = "1.0.3845";
2
- export const buildDate = "2025-04-25 14:06:12";
1
+ export const version = "1.0.3847";
2
+ export const buildDate = "2025-04-26 11:32:40";