@alpaca-editor/core 1.0.4008 → 1.0.4010
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 +9 -0
- package/dist/components/SimpleLanguageSelector.js +50 -0
- package/dist/components/SimpleLanguageSelector.js.map +1 -0
- package/dist/config/config.js +6 -8
- package/dist/config/config.js.map +1 -1
- package/dist/editor/ContentTree.d.ts +3 -2
- package/dist/editor/ContentTree.js +4 -2
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.d.ts +2 -1
- package/dist/editor/Editor.js +2 -2
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/ScrollingContentTree.d.ts +2 -1
- package/dist/editor/ScrollingContentTree.js +7 -3
- package/dist/editor/ScrollingContentTree.js.map +1 -1
- package/dist/editor/client/EditorClient.d.ts +3 -1
- package/dist/editor/client/EditorClient.js +151 -64
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +3 -21
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.js +2 -1
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/componentTreeHelper.js.map +1 -1
- package/dist/editor/field-types/InternalLinkFieldEditor.js +18 -78
- package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +53 -27
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.js +1 -1
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +19 -2
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +2 -1
- package/dist/editor/services/contentService.js +6 -1
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/sidebar/MainContentTree.js +2 -2
- package/dist/editor/sidebar/MainContentTree.js.map +1 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +21 -19
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -1
- package/dist/editor/views/SingleEditView.js +1 -1
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/page-wizard/PageWizard.js +61 -41
- package/dist/page-wizard/PageWizard.js.map +1 -1
- package/dist/page-wizard/WizardSteps.js +29 -40
- package/dist/page-wizard/WizardSteps.js.map +1 -1
- package/dist/page-wizard/startPageWizardCommand.js +2 -3
- package/dist/page-wizard/startPageWizardCommand.js.map +1 -1
- package/dist/page-wizard/steps/CollectStep.js +12 -18
- package/dist/page-wizard/steps/CollectStep.js.map +1 -1
- package/dist/page-wizard/steps/ContentStep.js +10 -25
- package/dist/page-wizard/steps/ContentStep.js.map +1 -1
- package/dist/page-wizard/steps/Generate.d.ts +2 -1
- package/dist/page-wizard/steps/Generate.js +2 -2
- package/dist/page-wizard/steps/Generate.js.map +1 -1
- package/dist/page-wizard/steps/StructureStep.js +17 -2
- package/dist/page-wizard/steps/StructureStep.js.map +1 -1
- package/dist/page-wizard/utils/dataAccessor.d.ts +11 -0
- package/dist/page-wizard/utils/dataAccessor.js +19 -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/styles.css +10 -3
- package/package.json +1 -1
- package/src/components/SimpleLanguageSelector.tsx +98 -0
- package/src/config/config.tsx +8 -20
- package/src/editor/ContentTree.tsx +6 -3
- package/src/editor/Editor.tsx +5 -1
- package/src/editor/ScrollingContentTree.tsx +10 -4
- package/src/editor/client/EditorClient.tsx +259 -152
- package/src/editor/client/editContext.ts +29 -27
- package/src/editor/client/operations.ts +1 -1
- package/src/editor/componentTreeHelper.tsx +1 -0
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +71 -144
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +66 -39
- package/src/editor/page-viewer/PageViewer.tsx +1 -1
- package/src/editor/page-viewer/pageModelSkeletonBuilder.ts +22 -2
- package/src/editor/services/contentService.ts +9 -3
- package/src/editor/sidebar/MainContentTree.tsx +2 -0
- package/src/editor/ui/CopyMoveTargetSelectorDialog.tsx +52 -39
- package/src/editor/views/SingleEditView.tsx +1 -1
- package/src/index.ts +11 -0
- package/src/page-wizard/PageWizard.tsx +79 -47
- package/src/page-wizard/WizardSteps.tsx +47 -39
- package/src/page-wizard/startPageWizardCommand.ts +2 -3
- package/src/page-wizard/steps/CollectStep.tsx +26 -19
- package/src/page-wizard/steps/ContentStep.tsx +12 -31
- package/src/page-wizard/steps/Generate.tsx +3 -2
- package/src/page-wizard/steps/StructureStep.tsx +26 -3
- package/src/page-wizard/utils/dataAccessor.ts +26 -0
- package/src/revision.ts +2 -2
|
@@ -27,7 +27,7 @@ import { useThrottledCallback } from "use-debounce";
|
|
|
27
27
|
import { InputTextarea } from "primereact/inputtextarea";
|
|
28
28
|
import { InputText } from "primereact/inputtext";
|
|
29
29
|
import { LanguageSelector } from "../../editor/menubar/LanguageSelector";
|
|
30
|
-
import {
|
|
30
|
+
import { getFilteredInputData } from "../utils/dataAccessor";
|
|
31
31
|
|
|
32
32
|
import { WizardBox } from "../WizardBox";
|
|
33
33
|
import { Wand2, PanelsTopLeft, Settings, Blocks } from "lucide-react";
|
|
@@ -316,8 +316,9 @@ export function ContentStep({
|
|
|
316
316
|
if (!editContext) return;
|
|
317
317
|
|
|
318
318
|
const generatePageName = async () => {
|
|
319
|
-
const
|
|
320
|
-
step.fields
|
|
319
|
+
const pageNameInstructions =
|
|
320
|
+
step.fields.pageNamePrompt ||
|
|
321
|
+
"The item name should be a valid sitecore item name. Spaces are allowed but no special characters or Umlaute.";
|
|
321
322
|
|
|
322
323
|
setIsGenerating(true);
|
|
323
324
|
|
|
@@ -327,8 +328,7 @@ export function ContentStep({
|
|
|
327
328
|
const result = await executePrompt(
|
|
328
329
|
[
|
|
329
330
|
{
|
|
330
|
-
content: `${
|
|
331
|
-
The item name should be a valid sitecore item name. Spaces are allowed but no special characters or Umlaute.
|
|
331
|
+
content: `${pageNameInstructions?.trim()} Reply with a json object of type PageModel = { name: string; };
|
|
332
332
|
The language of the page is ${language}.
|
|
333
333
|
Input data: ${JSON.stringify(data)}`,
|
|
334
334
|
name: "system",
|
|
@@ -560,25 +560,7 @@ export function ContentStep({
|
|
|
560
560
|
console.log("Existing page model: ", existingPageModel);
|
|
561
561
|
|
|
562
562
|
// Filter input data based on "Input Properties" field if specified
|
|
563
|
-
const
|
|
564
|
-
const inputProperties = step.fields.inputProperties;
|
|
565
|
-
console.log("Input properties: ", inputProperties);
|
|
566
|
-
if (!inputProperties || !inputProperties.trim()) {
|
|
567
|
-
return data; // Return all data if no input properties specified
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// Use evaluateDataExpressionToObject to handle both simple properties and JavaScript expressions
|
|
571
|
-
const result = evaluateDataExpressionToObject(inputProperties, data);
|
|
572
|
-
|
|
573
|
-
if (result.error) {
|
|
574
|
-
console.warn("Error evaluating input properties:", result.error);
|
|
575
|
-
return data; // Fall back to all data if evaluation fails
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
return result.value ?? data; // Return evaluated result or fall back to all data
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
const inputData = getFilteredData();
|
|
563
|
+
const inputData = getFilteredInputData(step, data);
|
|
582
564
|
|
|
583
565
|
const prompt = [
|
|
584
566
|
{
|
|
@@ -604,9 +586,7 @@ export function ContentStep({
|
|
|
604
586
|
.map((c) => c.type)
|
|
605
587
|
.join(", ")}
|
|
606
588
|
Tell the user your reasoning in the message field.
|
|
607
|
-
|
|
608
|
-
If you dont have a matching image id, provide a description of a picture that you would like to use with a "generate:" prefix instead.
|
|
609
|
-
In any case the field value must start with "id:" or "generate:", nothing else. Do not inject json into picture fields even if the existing value is json.
|
|
589
|
+
|
|
610
590
|
The language of the page is ${editContextRef.current!.page!.item!.language}.
|
|
611
591
|
Input data: ${JSON.stringify(inputData)}`,
|
|
612
592
|
|
|
@@ -615,8 +595,9 @@ export function ContentStep({
|
|
|
615
595
|
},
|
|
616
596
|
];
|
|
617
597
|
|
|
598
|
+
console.log("PAGE WIZARD DATA: ", data);
|
|
599
|
+
console.log("PAGE WIZARD INPUTDATA: ", inputData);
|
|
618
600
|
console.log("PAGE WIZARD PROMPT: ", prompt?.[0]?.content);
|
|
619
|
-
console.log("PAGE WIZARD DATA: ", inputData);
|
|
620
601
|
console.log("PAGE WIZARD page fields: ", schema.pageFields);
|
|
621
602
|
console.log("PAGE WIZARD schema: ", filteredSchema);
|
|
622
603
|
|
|
@@ -650,7 +631,7 @@ export function ContentStep({
|
|
|
650
631
|
const lastMessage = result.messages[result.messages.length - 1];
|
|
651
632
|
if (lastMessage && lastMessage.content) {
|
|
652
633
|
const finalLayout = JSON.parse(lastMessage.content);
|
|
653
|
-
console.log("RESULT LAYOUT: ",
|
|
634
|
+
console.log("RESULT LAYOUT: ", finalLayout);
|
|
654
635
|
setPageModel((prev) => mergeLayout(prev, finalLayout));
|
|
655
636
|
}
|
|
656
637
|
}
|
|
@@ -698,8 +679,8 @@ export function ContentStep({
|
|
|
698
679
|
<div className="flex flex-col items-stretch">
|
|
699
680
|
<div className="relative flex-1">
|
|
700
681
|
{isGenerating ? (
|
|
701
|
-
<div className="flex h-full items-center justify-center">
|
|
702
|
-
<Generate title="Generating page name..." />
|
|
682
|
+
<div className="flex h-full items-center justify-center pb-4">
|
|
683
|
+
<Generate title="Generating page name..." size="medium" />
|
|
703
684
|
</div>
|
|
704
685
|
) : (
|
|
705
686
|
<>
|
|
@@ -3,9 +3,10 @@ import { Logo } from "../../editor/ui/Icons";
|
|
|
3
3
|
|
|
4
4
|
interface GenerateProps {
|
|
5
5
|
title: string;
|
|
6
|
+
size?: "medium" | "large";
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
function Generate({ title }: GenerateProps) {
|
|
9
|
+
function Generate({ title, size }: GenerateProps) {
|
|
9
10
|
return (
|
|
10
11
|
<>
|
|
11
12
|
<style>
|
|
@@ -40,7 +41,7 @@ function Generate({ title }: GenerateProps) {
|
|
|
40
41
|
"animate-fadeIn flex h-full flex-col items-center justify-center transition-all duration-300",
|
|
41
42
|
)}
|
|
42
43
|
>
|
|
43
|
-
<div className="md:mb-20">
|
|
44
|
+
<div className={size === "medium" ? "md:mb-5" : "md:mb-20"}>
|
|
44
45
|
<div className="flex items-center justify-center">
|
|
45
46
|
<div className="h-48 w-48 animate-pulse md:h-64 md:w-64">
|
|
46
47
|
<div className="magic-logo h-full w-full">
|
|
@@ -6,7 +6,7 @@ import { createWizardAiContext } from "../service";
|
|
|
6
6
|
import { ActionButton } from "../../components/ActionButton";
|
|
7
7
|
import Generate from "./Generate";
|
|
8
8
|
import { WizardBox } from "../WizardBox";
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
import { Settings, Layout, ChevronDown, ChevronRight } from "lucide-react";
|
|
11
11
|
import { InputTextarea } from "primereact/inputtextarea";
|
|
12
12
|
import { evaluateDataExpression, setDataProperty } from "../utils/dataAccessor";
|
|
@@ -15,6 +15,7 @@ type StructureElement = {
|
|
|
15
15
|
type: string;
|
|
16
16
|
content: string;
|
|
17
17
|
description?: string;
|
|
18
|
+
headline?: string;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export function StructureStep({
|
|
@@ -79,6 +80,28 @@ export function StructureStep({
|
|
|
79
80
|
}
|
|
80
81
|
}, [data, inputProperties]);
|
|
81
82
|
|
|
83
|
+
// Auto-execute structure generation on component mount if no existing structure
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const { value: existingStructure } = evaluateDataExpression(
|
|
86
|
+
inputProperties,
|
|
87
|
+
data,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Only auto-execute if:
|
|
91
|
+
// 1. No existing structure
|
|
92
|
+
// 2. We have edit context
|
|
93
|
+
// 3. We have system instructions configured
|
|
94
|
+
// 4. Not already loading
|
|
95
|
+
if (
|
|
96
|
+
!existingStructure &&
|
|
97
|
+
editContext &&
|
|
98
|
+
step.fields.systemInstructions &&
|
|
99
|
+
!loading
|
|
100
|
+
) {
|
|
101
|
+
generateStructure();
|
|
102
|
+
}
|
|
103
|
+
}, [editContext, step.fields.systemInstructions]); // Dependencies that indicate readiness
|
|
104
|
+
|
|
82
105
|
// Generate structure using AI
|
|
83
106
|
const generateStructure = async () => {
|
|
84
107
|
if (!editContext) {
|
|
@@ -207,7 +230,7 @@ ${JSON.stringify(data)}`;
|
|
|
207
230
|
};
|
|
208
231
|
|
|
209
232
|
if (loading) {
|
|
210
|
-
return <Generate title="
|
|
233
|
+
return <Generate title="Analyzing content..." />;
|
|
211
234
|
}
|
|
212
235
|
|
|
213
236
|
return (
|
|
@@ -298,7 +321,7 @@ ${JSON.stringify(data)}`;
|
|
|
298
321
|
>
|
|
299
322
|
{element.description && (
|
|
300
323
|
<p className="text-sm font-medium text-gray-700">
|
|
301
|
-
{element.description}
|
|
324
|
+
{element.headline || element.description}
|
|
302
325
|
</p>
|
|
303
326
|
)}
|
|
304
327
|
<p className="text-xs text-blue-600 hover:text-blue-800">
|
|
@@ -273,3 +273,29 @@ export function useDataExpression<T = any>(
|
|
|
273
273
|
): DataAccessResult<T> {
|
|
274
274
|
return evaluateDataExpression<T>(expression, data);
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Filters input data based on the "inputProperties" field from a wizard step
|
|
279
|
+
* @param step - The wizard step containing the inputProperties field
|
|
280
|
+
* @param data - The data object to filter
|
|
281
|
+
* @returns Filtered data object or original data if no input properties specified
|
|
282
|
+
*/
|
|
283
|
+
export function getFilteredInputData(
|
|
284
|
+
step: { fields: { [key: string]: string } },
|
|
285
|
+
data: any,
|
|
286
|
+
): any {
|
|
287
|
+
const inputProperties = step.fields.inputProperties;
|
|
288
|
+
if (!inputProperties || !inputProperties.trim()) {
|
|
289
|
+
return data; // Return all data if no input properties specified
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Use evaluateDataExpressionToObject to handle both simple properties and JavaScript expressions
|
|
293
|
+
const result = evaluateDataExpressionToObject(inputProperties, data);
|
|
294
|
+
|
|
295
|
+
if (result.error) {
|
|
296
|
+
console.warn("Error evaluating input properties:", result.error);
|
|
297
|
+
return data; // Fall back to all data if evaluation fails
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return result.value ?? data; // Return evaluated result or fall back to all data
|
|
301
|
+
}
|
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.4010";
|
|
2
|
+
export const buildDate = "2025-07-22 01:46:42";
|