@alpaca-editor/core 1.0.4018 → 1.0.4026
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.
- package/dist/components/SimpleLanguageSelector.d.ts +2 -1
- package/dist/components/SimpleLanguageSelector.js +9 -2
- package/dist/components/SimpleLanguageSelector.js.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +3 -1
- package/dist/components/ui/tooltip.js +2 -2
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/config/config.js +4 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +2 -0
- package/dist/editor/ContentTree.js +1 -1
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/ContextMenu.js +26 -0
- package/dist/editor/ContextMenu.js.map +1 -1
- package/dist/editor/FieldHistory.js +1 -1
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/FieldListField.js +2 -2
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/Terminal.js +3 -1
- package/dist/editor/Terminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +19 -10
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.js +63 -5
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/AiTerminal.js +7 -7
- package/dist/editor/ai/AiTerminal.js.map +1 -1
- package/dist/editor/ai/AiToolCall.js +3 -3
- package/dist/editor/ai/AiToolCall.js.map +1 -1
- package/dist/editor/client/EditorClient.js +5 -1
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +2 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.d.ts +1 -0
- package/dist/editor/client/operations.js +7 -0
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +1 -1
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/field-types/ImageFieldEditor.js +1 -1
- package/dist/editor/field-types/ImageFieldEditor.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/PictureFieldEditor.js +1 -1
- package/dist/editor/field-types/PictureFieldEditor.js.map +1 -1
- package/dist/editor/field-types/RawEditor.js +1 -1
- package/dist/editor/field-types/RawEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +16 -17
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/SingleLineText.js.map +1 -1
- package/dist/editor/field-types/richtext/components/SimpleDropdown.d.ts +18 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js +71 -0
- package/dist/editor/field-types/richtext/components/SimpleDropdown.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js +359 -0
- package/dist/editor/field-types/richtext/components/SimpleRichTextEditor.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.d.ts +16 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js +181 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbar.js.map +1 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.d.ts +9 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js +14 -0
- package/dist/editor/field-types/richtext/components/SimpleToolbarButton.js.map +1 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +4 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js +193 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -0
- package/dist/editor/field-types/richtext/index.d.ts +6 -5
- package/dist/editor/field-types/richtext/index.js +6 -5
- package/dist/editor/field-types/richtext/index.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +16 -16
- package/dist/editor/field-types/richtext/types.js +84 -84
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +5 -5
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +3 -2
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +14 -4
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.js +1 -0
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/page-wizard/PageWizard.d.ts +2 -0
- package/dist/page-wizard/PageWizard.js +6 -13
- package/dist/page-wizard/PageWizard.js.map +1 -1
- package/dist/page-wizard/WizardSteps.js +3 -1
- package/dist/page-wizard/WizardSteps.js.map +1 -1
- package/dist/page-wizard/service.d.ts +1 -0
- package/dist/page-wizard/service.js +7 -0
- package/dist/page-wizard/service.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +210 -33
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/FindItemsStep.js +11 -3
- package/dist/page-wizard/steps/FindItemsStep.js.map +1 -1
- package/dist/page-wizard/steps/LayoutStep.js +1 -1
- package/dist/page-wizard/steps/LayoutStep.js.map +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js +1 -1
- package/dist/page-wizard/steps/MetaDataStep.js.map +1 -1
- package/dist/page-wizard/steps/SchottSelectImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/SchottSelectImagesStep.js +55 -0
- package/dist/page-wizard/steps/SchottSelectImagesStep.js.map +1 -0
- package/dist/page-wizard/steps/StructureStep.js +20 -5
- package/dist/page-wizard/steps/StructureStep.js.map +1 -1
- package/dist/page-wizard/steps/TranslateStep.d.ts +2 -0
- package/dist/page-wizard/steps/TranslateStep.js +413 -0
- package/dist/page-wizard/steps/TranslateStep.js.map +1 -0
- package/dist/page-wizard/utils/dataAccessor.d.ts +7 -0
- package/dist/page-wizard/utils/dataAccessor.js +76 -0
- package/dist/page-wizard/utils/dataAccessor.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/NewPage.js +5 -4
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/OpenPage.js +2 -1
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -1
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/styles.css +57 -0
- package/package.json +5 -4
- package/src/components/SimpleLanguageSelector.tsx +11 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/tooltip.tsx +3 -2
- package/src/config/config.tsx +4 -0
- package/src/config/types.ts +6 -0
- package/src/editor/ContentTree.tsx +1 -1
- package/src/editor/ContextMenu.tsx +39 -0
- package/src/editor/FieldHistory.tsx +1 -1
- package/src/editor/FieldListField.tsx +2 -6
- package/src/editor/Terminal.tsx +5 -1
- package/src/editor/ai/Agents.tsx +27 -16
- package/src/editor/ai/AiResponseMessage.tsx +138 -23
- package/src/editor/ai/AiTerminal.tsx +43 -29
- package/src/editor/ai/AiToolCall.tsx +14 -4
- package/src/editor/client/EditorClient.tsx +9 -1
- package/src/editor/client/editContext.ts +2 -0
- package/src/editor/client/operations.ts +9 -0
- package/src/editor/commands/componentCommands.tsx +1 -1
- package/src/editor/field-types/ImageFieldEditor.tsx +1 -0
- package/src/editor/field-types/MultiLineText.tsx +1 -0
- package/src/editor/field-types/PictureFieldEditor.tsx +1 -0
- package/src/editor/field-types/RawEditor.tsx +1 -0
- package/src/editor/field-types/RichTextEditorComponent.tsx +27 -25
- package/src/editor/field-types/SingleLineText.tsx +1 -0
- package/src/editor/field-types/richtext/components/SimpleDropdown.tsx +165 -0
- package/src/editor/field-types/richtext/components/SimpleRichTextEditor.css +261 -0
- package/src/editor/field-types/richtext/components/SimpleRichTextEditor.tsx +505 -0
- package/src/editor/field-types/richtext/components/SimpleToolbar.tsx +362 -0
- package/src/editor/field-types/richtext/components/SimpleToolbarButton.tsx +36 -0
- package/src/editor/field-types/richtext/contextMenuFactory.tsx +264 -0
- package/src/editor/field-types/richtext/index.ts +6 -5
- package/src/editor/field-types/richtext/types.ts +168 -148
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +1 -1
- package/src/editor/page-editor-chrome/FrameMenu.tsx +16 -11
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +1 -1
- package/src/editor/page-viewer/PageViewerFrame.tsx +4 -3
- package/src/editor/services/agentService.ts +16 -5
- package/src/editor/services/aiService.ts +2 -0
- package/src/page-wizard/PageWizard.tsx +10 -13
- package/src/page-wizard/WizardSteps.tsx +3 -1
- package/src/page-wizard/service.ts +11 -0
- package/src/page-wizard/steps/ContentStep.tsx +376 -43
- package/src/page-wizard/steps/FindItemsStep.tsx +23 -3
- package/src/page-wizard/steps/LayoutStep.tsx +1 -1
- package/src/page-wizard/steps/MetaDataStep.tsx +1 -1
- package/src/page-wizard/steps/SchottSelectImagesStep.tsx +141 -0
- package/src/page-wizard/steps/StructureStep.tsx +40 -5
- package/src/page-wizard/steps/TranslateStep.tsx +772 -0
- package/src/page-wizard/utils/dataAccessor.ts +85 -0
- package/src/revision.ts +2 -2
- package/src/splash-screen/NewPage.tsx +18 -3
- package/src/splash-screen/OpenPage.tsx +14 -1
- package/src/splash-screen/RecentPages.tsx +4 -2
- package/tsconfig.build.json +1 -0
|
@@ -299,3 +299,88 @@ export function getFilteredInputData(
|
|
|
299
299
|
|
|
300
300
|
return result.value ?? data; // Return evaluated result or fall back to all data
|
|
301
301
|
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Processes a template string by replacing expressions wrapped in curly braces with their evaluated values
|
|
305
|
+
* @param template - The template string containing expressions like {data.items.map(x=>x.id)}
|
|
306
|
+
* @param data - The data object to evaluate expressions against
|
|
307
|
+
* @returns Object with the processed template and any errors encountered
|
|
308
|
+
*/
|
|
309
|
+
export function processPromptTemplate(
|
|
310
|
+
template: string,
|
|
311
|
+
data: any,
|
|
312
|
+
): DataAccessResult<string> {
|
|
313
|
+
if (!template) {
|
|
314
|
+
return { value: template };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
const errors: string[] = [];
|
|
319
|
+
let processedTemplate = template;
|
|
320
|
+
|
|
321
|
+
// Find all expressions wrapped in curly braces
|
|
322
|
+
const expressionRegex = /\{([^}]+)\}/g;
|
|
323
|
+
let match;
|
|
324
|
+
const replacements: { original: string; replacement: string }[] = [];
|
|
325
|
+
|
|
326
|
+
while ((match = expressionRegex.exec(template)) !== null) {
|
|
327
|
+
const fullMatch = match[0]; // The full match including braces: {expression}
|
|
328
|
+
const expression = match[1]?.trim(); // The expression inside braces
|
|
329
|
+
|
|
330
|
+
if (!expression) {
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Evaluate the expression
|
|
335
|
+
const evalResult = evaluateSingleExpression(expression, data);
|
|
336
|
+
|
|
337
|
+
if (evalResult.error) {
|
|
338
|
+
errors.push(`Expression "${expression}": ${evalResult.error}`);
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Convert the result to a string representation
|
|
343
|
+
let replacement: string;
|
|
344
|
+
try {
|
|
345
|
+
if (evalResult.value === undefined || evalResult.value === null) {
|
|
346
|
+
replacement = "";
|
|
347
|
+
} else if (typeof evalResult.value === "string") {
|
|
348
|
+
replacement = evalResult.value;
|
|
349
|
+
} else if (Array.isArray(evalResult.value)) {
|
|
350
|
+
replacement = JSON.stringify(evalResult.value);
|
|
351
|
+
} else if (typeof evalResult.value === "object") {
|
|
352
|
+
replacement = JSON.stringify(evalResult.value);
|
|
353
|
+
} else {
|
|
354
|
+
replacement = String(evalResult.value);
|
|
355
|
+
}
|
|
356
|
+
} catch (stringifyError) {
|
|
357
|
+
replacement = String(evalResult.value);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
replacements.push({ original: fullMatch, replacement });
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// If there are any errors, don't process the template at all
|
|
364
|
+
if (errors.length > 0) {
|
|
365
|
+
return {
|
|
366
|
+
value: undefined,
|
|
367
|
+
error: `Template processing failed:\n${errors.join("\n")}`,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// Apply all replacements
|
|
372
|
+
for (const { original, replacement } of replacements) {
|
|
373
|
+
processedTemplate = processedTemplate.replace(original, replacement);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return {
|
|
377
|
+
value: processedTemplate,
|
|
378
|
+
error: undefined,
|
|
379
|
+
};
|
|
380
|
+
} catch (error) {
|
|
381
|
+
return {
|
|
382
|
+
value: undefined,
|
|
383
|
+
error: `Failed to process template: ${error instanceof Error ? error.message : String(error)}`,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
}
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-07-
|
|
1
|
+
export const version = "1.0.4026";
|
|
2
|
+
export const buildDate = "2025-07-31 15:29:01";
|
|
@@ -23,7 +23,7 @@ import { Card } from "../components/ui/card";
|
|
|
23
23
|
import { CardConnector } from "../components/ui/CardConnector";
|
|
24
24
|
import { Logo } from "../editor/ui/Icons";
|
|
25
25
|
import { ActionButton } from "../components/ActionButton";
|
|
26
|
-
import { FilePenLine, Palette } from "lucide-react";
|
|
26
|
+
import { FilePenLine, Palette, X } from "lucide-react";
|
|
27
27
|
import { toast } from "sonner";
|
|
28
28
|
|
|
29
29
|
export function NewPage({ selectedItemId }: { selectedItemId?: string }) {
|
|
@@ -70,6 +70,7 @@ export function NewPage({ selectedItemId }: { selectedItemId?: string }) {
|
|
|
70
70
|
const loadItem = async () => {
|
|
71
71
|
const itemId =
|
|
72
72
|
selectedItemId ||
|
|
73
|
+
editContext?.contentEditorItem?.id ||
|
|
73
74
|
editContext?.configuration.editor.dialogs.newPage.expandTreeNode;
|
|
74
75
|
if (!itemId) return;
|
|
75
76
|
const item = await editContext!.itemsRepository.getItem({
|
|
@@ -80,7 +81,7 @@ export function NewPage({ selectedItemId }: { selectedItemId?: string }) {
|
|
|
80
81
|
if (item) setSelectedItem(item);
|
|
81
82
|
};
|
|
82
83
|
loadItem();
|
|
83
|
-
}, [selectedItemId]);
|
|
84
|
+
}, [selectedItemId, editContext?.contentEditorItem?.id]);
|
|
84
85
|
|
|
85
86
|
const isValidDebounced = useDebouncedCallback(async () => {
|
|
86
87
|
if (!selectedItem) return;
|
|
@@ -159,10 +160,22 @@ export function NewPage({ selectedItemId }: { selectedItemId?: string }) {
|
|
|
159
160
|
</div>
|
|
160
161
|
</div>
|
|
161
162
|
|
|
162
|
-
<div className="flex items-start">
|
|
163
|
+
<div className="flex items-start gap-2">
|
|
163
164
|
<ActionButton onClick={() => editContext?.switchView("open-page")}>
|
|
164
165
|
Open Existing
|
|
165
166
|
</ActionButton>
|
|
167
|
+
<ActionButton
|
|
168
|
+
onClick={() =>
|
|
169
|
+
editContext?.switchView(
|
|
170
|
+
editContext.previousViewName || "splash-screen",
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
variant="ghost"
|
|
174
|
+
className="p-2"
|
|
175
|
+
aria-label="Close"
|
|
176
|
+
>
|
|
177
|
+
<X className="h-4 w-4" />
|
|
178
|
+
</ActionButton>
|
|
166
179
|
</div>
|
|
167
180
|
</div>
|
|
168
181
|
<div className="flex flex-1 flex-col md:flex-row">
|
|
@@ -193,6 +206,8 @@ export function NewPage({ selectedItemId }: { selectedItemId?: string }) {
|
|
|
193
206
|
>
|
|
194
207
|
<ScrollingContentTree
|
|
195
208
|
selectedItemId={selectedItem?.id || selectedItemId}
|
|
209
|
+
expandedItemId={selectedItem?.id || selectedItemId}
|
|
210
|
+
scrollToSelected={true}
|
|
196
211
|
onSelectionChange={(selection) => {
|
|
197
212
|
const selected = selection[0] as ItemTreeNodeData;
|
|
198
213
|
if (selected) setSelectedItem(selected);
|
|
@@ -10,6 +10,7 @@ import { Card } from "../components/ui/card";
|
|
|
10
10
|
import { Logo, MagicEditIcon } from "../editor/ui/Icons";
|
|
11
11
|
import { ActionButton } from "../components/ActionButton";
|
|
12
12
|
import { RecentPages } from "./RecentPages";
|
|
13
|
+
import { X } from "lucide-react";
|
|
13
14
|
|
|
14
15
|
export function OpenPage() {
|
|
15
16
|
const savedHistory =
|
|
@@ -63,13 +64,25 @@ export function OpenPage() {
|
|
|
63
64
|
Browse your content structure or access recently viewed pages
|
|
64
65
|
</div>
|
|
65
66
|
</div>
|
|
66
|
-
<div className="flex items-start">
|
|
67
|
+
<div className="flex items-start gap-2">
|
|
67
68
|
<ActionButton
|
|
68
69
|
onClick={() => editContext?.switchView("new-page")}
|
|
69
70
|
isLoading={false}
|
|
70
71
|
>
|
|
71
72
|
Create New Page <MagicEditIcon />
|
|
72
73
|
</ActionButton>
|
|
74
|
+
<ActionButton
|
|
75
|
+
onClick={() =>
|
|
76
|
+
editContext?.switchView(
|
|
77
|
+
editContext.previousViewName || "splash-screen",
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
variant="ghost"
|
|
81
|
+
className="p-2"
|
|
82
|
+
aria-label="Close"
|
|
83
|
+
>
|
|
84
|
+
<X className="h-4 w-4" />
|
|
85
|
+
</ActionButton>
|
|
73
86
|
</div>
|
|
74
87
|
</div>
|
|
75
88
|
|
|
@@ -24,7 +24,9 @@ export function RecentPages() {
|
|
|
24
24
|
|
|
25
25
|
setIsLoading(true);
|
|
26
26
|
try {
|
|
27
|
+
console.log("recentPages", recentPages);
|
|
27
28
|
const pages = await editContext?.itemsRepository.getItems(recentPages);
|
|
29
|
+
console.log("pages", pages);
|
|
28
30
|
setHistory(pages);
|
|
29
31
|
} finally {
|
|
30
32
|
setIsLoading(false);
|
|
@@ -119,13 +121,13 @@ export function RecentPages() {
|
|
|
119
121
|
{isLoading && (
|
|
120
122
|
<div className="flex h-full flex-col items-center justify-center p-6 text-center">
|
|
121
123
|
<i className="pi pi-spin pi-spinner text-lg text-gray-400"></i>
|
|
122
|
-
<div className="mt-2 text-
|
|
124
|
+
<div className="mt-2 text-xs text-gray-500">
|
|
123
125
|
Loading recent pages...
|
|
124
126
|
</div>
|
|
125
127
|
</div>
|
|
126
128
|
)}
|
|
127
129
|
{!isLoading && (!history || history.length === 0) && (
|
|
128
|
-
<div className="p-6 text-center text-
|
|
130
|
+
<div className="p-6 text-center text-xs text-gray-500">
|
|
129
131
|
No recent pages found
|
|
130
132
|
</div>
|
|
131
133
|
)}
|