@parhelia/core 0.1.12231 → 0.1.12241
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/ui/button.d.ts +1 -1
- package/dist/editor/ConfirmationDialog.js +1 -1
- package/dist/editor/ConfirmationDialog.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.js +81 -93
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/client/EditorShell.js +2 -1
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/page-editor-chrome/InlineEditor.js +20 -7
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ type SelectButtonProps = BaseButtonProps & {
|
|
|
12
12
|
};
|
|
13
13
|
export type GenericButtonProps = BaseButtonProps & {
|
|
14
14
|
variant?: "default" | "defaultInverted" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
15
|
-
size?: "default" | "sm" | "xs" | "lg" | "icon" | "iconSm" | "iconXs";
|
|
15
|
+
size?: "default" | "sm" | "xs" | "xxs" | "lg" | "icon" | "iconSm" | "iconXs";
|
|
16
16
|
};
|
|
17
17
|
type ButtonProps = SelectButtonProps | GenericButtonProps;
|
|
18
18
|
declare function Button({ className, variant, size, asChild, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -27,7 +27,7 @@ const ConfirmationDialog = forwardRef((_props, ref) => {
|
|
|
27
27
|
setVisible(false);
|
|
28
28
|
};
|
|
29
29
|
const isDestructive = props?.acceptLabel === "Delete" || props?.acceptLabel === "Remove";
|
|
30
|
-
return (_jsx(Dialog, { open: visible, onOpenChange: setVisible, children: _jsx(DialogContent, { className: "gap-0 p-0 sm:max-w-[480px] max-h-[80vh] flex flex-col", "data-testid": "confirmation-dialog", children: _jsxs("div", { className: "flex flex-col pt-8 overflow-hidden", children: [_jsx("div", { className: "px-8 pb-4 overflow-y-auto max-h-[50vh]", children: _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: cn("flex size-10 shrink-0 items-center justify-center rounded-full", isDestructive ? "bg-red-50 text-red-600" : "bg-amber-50 text-amber-600"), children: props?.icon ? (props.icon) : (_jsx(AlertTriangle, { className: "size-5", strokeWidth: 2 })) }), _jsxs("div", { className: "flex flex-col gap-1 min-w-0 flex-1", children: [_jsx(DialogTitle, { className: "text-xl font-bold", children: props?.header || "Confirmation" }), _jsx("div", { className: "text-sm leading-relaxed text-muted-foreground mt-1", children: props?.message })] })] }) }), _jsxs(DialogFooter, { className: "bg-gray-50/50 mt-4 border-t px-8 py-6 sm:flex-wrap", children: [props?.showCancel && (_jsx(Button, { variant: "outline", onClick: handleCancel, className: "min-w-[100px] w-full sm:w-auto bg-white whitespace-normal break-words text-center max-w-full", children: "Cancel" })), props?.rejectLabel && (_jsx(Button, { variant: "outline", onClick: handleReject, className: "min-w-[100px] w-full sm:w-auto bg-white whitespace-normal break-words text-center max-w-full", children: props.rejectLabel })), showAccept && (_jsx(Button, { onClick: handleAccept, variant: props?.acceptLabel === "Delete" ? "destructive" : "default", className: "min-w-[100px] w-full sm:w-auto whitespace-normal break-words text-center max-w-full", children: props?.acceptLabel || "Yes" }))] })] }) }) }));
|
|
30
|
+
return (_jsx(Dialog, { open: visible, onOpenChange: setVisible, children: _jsx(DialogContent, { className: "gap-0 p-0 sm:max-w-[480px] max-h-[80vh] flex flex-col", "data-testid": "confirmation-dialog", children: _jsxs("div", { className: "flex flex-col pt-8 overflow-hidden", children: [_jsx("div", { className: "px-8 pb-4 overflow-y-auto max-h-[50vh]", children: _jsxs("div", { className: "flex items-start gap-4", children: [_jsx("div", { className: cn("flex size-10 shrink-0 items-center justify-center rounded-full", isDestructive ? "bg-red-50 text-red-600" : "bg-amber-50 text-amber-600"), children: props?.icon ? (props.icon) : (_jsx(AlertTriangle, { className: "size-5", strokeWidth: 2 })) }), _jsxs("div", { className: "flex flex-col gap-1 min-w-0 flex-1", children: [_jsx(DialogTitle, { className: "text-xl font-bold", "data-testid": "confirmation-dialog-title", children: props?.header || "Confirmation" }), _jsx("div", { className: "text-sm leading-relaxed text-muted-foreground mt-1", children: props?.message })] })] }) }), _jsxs(DialogFooter, { className: "bg-gray-50/50 mt-4 border-t px-8 py-6 sm:flex-wrap", children: [props?.showCancel && (_jsx(Button, { variant: "outline", onClick: handleCancel, className: "min-w-[100px] w-full sm:w-auto bg-white whitespace-normal break-words text-center max-w-full", children: "Cancel" })), props?.rejectLabel && (_jsx(Button, { variant: "outline", onClick: handleReject, className: "min-w-[100px] w-full sm:w-auto bg-white whitespace-normal break-words text-center max-w-full", children: props.rejectLabel })), showAccept && (_jsx(Button, { onClick: handleAccept, variant: props?.acceptLabel === "Delete" ? "destructive" : "default", className: "min-w-[100px] w-full sm:w-auto whitespace-normal break-words text-center max-w-full", children: props?.acceptLabel || "Yes" }))] })] }) }) }));
|
|
31
31
|
});
|
|
32
32
|
export default ConfirmationDialog;
|
|
33
33
|
//# sourceMappingURL=ConfirmationDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationDialog.js","sourceRoot":"","sources":["../../src/editor/ConfirmationDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,MAAM,EACN,aAAa,EAEb,WAAW,EACX,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAsBlC,MAAM,kBAAkB,GAAG,UAAU,CAGnC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;IAChB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ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C,oDAAoD,aACzE,KAAK,EAAE,UAAU,IAAI,CACpB,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,8FAA8F,uBAGjG,CACV,EACA,KAAK,EAAE,WAAW,IAAI,CACrB,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,8FAA8F,YAEvG,KAAK,CAAC,WAAW,GACX,CACV,EACA,UAAU,IAAI,CACb,KAAC,MAAM,IACL,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,KAAK,EAAE,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EACpE,SAAS,EAAC,qFAAqF,YAE9F,KAAK,EAAE,WAAW,IAAI,KAAK,GACrB,CACV,IACY,IACX,GACQ,GACT,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -2129,46 +2129,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2129
2129
|
})();
|
|
2130
2130
|
// Create context with top-level properties (what ContextInfoBar expects)
|
|
2131
2131
|
const localCtx = item && shouldSeedContext
|
|
2132
|
-
?
|
|
2133
|
-
items: [
|
|
2134
|
-
{
|
|
2135
|
-
id: item.id,
|
|
2136
|
-
language: item.language,
|
|
2137
|
-
version: item.version,
|
|
2138
|
-
name: editContext?.item?.name,
|
|
2139
|
-
path: editContext?.item?.path,
|
|
2140
|
-
},
|
|
2141
|
-
],
|
|
2142
|
-
components: editContext?.selection?.length && item
|
|
2143
|
-
? editContext.selection.map((componentId) => ({
|
|
2144
|
-
componentId,
|
|
2145
|
-
pageItem: {
|
|
2146
|
-
id: item.id,
|
|
2147
|
-
language: item.language,
|
|
2148
|
-
version: item.version,
|
|
2149
|
-
name: editContext?.item?.name,
|
|
2150
|
-
},
|
|
2151
|
-
}))
|
|
2152
|
-
: undefined,
|
|
2153
|
-
field: fieldsContext?.focusedField?.fieldId &&
|
|
2154
|
-
fieldsContext.focusedField?.item?.id
|
|
2155
|
-
? {
|
|
2156
|
-
fieldId: fieldsContext.focusedField.fieldId,
|
|
2157
|
-
fieldName: fieldsContext.focusedField
|
|
2158
|
-
.fieldName,
|
|
2159
|
-
item: {
|
|
2160
|
-
id: fieldsContext.focusedField.item.id,
|
|
2161
|
-
language: fieldsContext.focusedField.item.language ||
|
|
2162
|
-
editContext?.currentItemDescriptor?.language ||
|
|
2163
|
-
"en",
|
|
2164
|
-
version: fieldsContext.focusedField.item.version ??
|
|
2165
|
-
editContext?.currentItemDescriptor?.version ??
|
|
2166
|
-
0,
|
|
2167
|
-
name: editContext?.item?.name,
|
|
2168
|
-
},
|
|
2169
|
-
}
|
|
2170
|
-
: undefined,
|
|
2171
|
-
}
|
|
2132
|
+
? buildEditorContextPayload(item)
|
|
2172
2133
|
: null;
|
|
2173
2134
|
let nextMetadata = null;
|
|
2174
2135
|
if (initialMetadata) {
|
|
@@ -4022,66 +3983,93 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4022
3983
|
}
|
|
4023
3984
|
return context;
|
|
4024
3985
|
}, [collectVisibleTestIds]);
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
id: item.id,
|
|
4047
|
-
language: item.language,
|
|
4048
|
-
version: item.version,
|
|
4049
|
-
name: editContext?.item?.name,
|
|
4050
|
-
},
|
|
4051
|
-
}))
|
|
4052
|
-
: undefined,
|
|
4053
|
-
field: fieldsContext?.focusedField?.fieldId &&
|
|
4054
|
-
fieldsContext.focusedField?.item?.id
|
|
4055
|
-
? {
|
|
4056
|
-
fieldId: fieldsContext.focusedField.fieldId,
|
|
4057
|
-
fieldName: fieldsContext.focusedField.fieldName,
|
|
4058
|
-
item: {
|
|
4059
|
-
id: fieldsContext.focusedField.item.id,
|
|
4060
|
-
language: fieldsContext.focusedField.item.language ||
|
|
4061
|
-
editContext?.currentItemDescriptor?.language ||
|
|
4062
|
-
"en",
|
|
4063
|
-
version: fieldsContext.focusedField.item.version ??
|
|
4064
|
-
editContext?.currentItemDescriptor?.version ??
|
|
4065
|
-
0,
|
|
4066
|
-
name: editContext?.item?.name,
|
|
4067
|
-
},
|
|
3986
|
+
const buildPageContextItem = useCallback((item) => ({
|
|
3987
|
+
id: item.id,
|
|
3988
|
+
language: item.language,
|
|
3989
|
+
version: item.version,
|
|
3990
|
+
name: editContext?.item?.name,
|
|
3991
|
+
path: editContext?.item?.path,
|
|
3992
|
+
}), [editContext?.item?.name, editContext?.item?.path]);
|
|
3993
|
+
const buildComponentContext = useCallback((item) => {
|
|
3994
|
+
if (!editContext?.selection?.length)
|
|
3995
|
+
return undefined;
|
|
3996
|
+
return editContext.selection.map((componentId) => {
|
|
3997
|
+
let componentName;
|
|
3998
|
+
let componentType;
|
|
3999
|
+
let renderingItemId;
|
|
4000
|
+
if (editContext.page) {
|
|
4001
|
+
try {
|
|
4002
|
+
const component = getComponentById(componentId, editContext.page);
|
|
4003
|
+
componentName =
|
|
4004
|
+
component?.datasourceItem?.name || component?.name || undefined;
|
|
4005
|
+
componentType = component?.type || undefined;
|
|
4006
|
+
renderingItemId = component?.rendering?.id || undefined;
|
|
4068
4007
|
}
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4008
|
+
catch { }
|
|
4009
|
+
}
|
|
4010
|
+
return {
|
|
4011
|
+
componentId,
|
|
4012
|
+
componentName,
|
|
4013
|
+
componentType,
|
|
4014
|
+
renderingItemId,
|
|
4015
|
+
pageItem: buildPageContextItem(item),
|
|
4016
|
+
};
|
|
4017
|
+
});
|
|
4018
|
+
}, [buildPageContextItem, editContext?.page, editContext?.selection]);
|
|
4019
|
+
const buildFieldContext = useCallback(() => {
|
|
4020
|
+
const focusedField = fieldsContext?.focusedField;
|
|
4021
|
+
if (!focusedField?.fieldId || !focusedField?.item?.id)
|
|
4022
|
+
return undefined;
|
|
4023
|
+
const fieldItem = focusedField.item;
|
|
4024
|
+
const currentItem = editContext?.currentItemDescriptor;
|
|
4025
|
+
let fieldItemName = fieldItem.id === currentItem?.id ? editContext?.item?.name : undefined;
|
|
4026
|
+
if (!fieldItemName && editContext?.page) {
|
|
4027
|
+
try {
|
|
4028
|
+
const component = getComponentById(fieldItem.id, editContext.page);
|
|
4029
|
+
fieldItemName =
|
|
4030
|
+
component?.datasourceItem?.name || component?.name || undefined;
|
|
4031
|
+
}
|
|
4032
|
+
catch { }
|
|
4033
|
+
}
|
|
4034
|
+
return {
|
|
4035
|
+
fieldId: focusedField.fieldId,
|
|
4036
|
+
fieldName: focusedField.fieldName,
|
|
4037
|
+
item: {
|
|
4038
|
+
id: fieldItem.id,
|
|
4039
|
+
language: fieldItem.language || currentItem?.language || "en",
|
|
4040
|
+
version: fieldItem.version ?? currentItem?.version ?? 0,
|
|
4041
|
+
name: fieldItem.name || fieldItemName,
|
|
4042
|
+
},
|
|
4075
4043
|
};
|
|
4076
4044
|
}, [
|
|
4077
4045
|
editContext?.currentItemDescriptor,
|
|
4078
|
-
editContext?.selection,
|
|
4079
|
-
editContext?.workspaceId,
|
|
4080
4046
|
editContext?.item?.name,
|
|
4081
|
-
editContext?.
|
|
4082
|
-
editContext?.openSidebars,
|
|
4047
|
+
editContext?.page,
|
|
4083
4048
|
fieldsContext?.focusedField,
|
|
4084
4049
|
]);
|
|
4050
|
+
const buildEditorContextPayload = useCallback((item) => ({
|
|
4051
|
+
items: item ? [buildPageContextItem(item)] : undefined,
|
|
4052
|
+
currentItemId: item?.id,
|
|
4053
|
+
components: item ? buildComponentContext(item) : undefined,
|
|
4054
|
+
field: buildFieldContext(),
|
|
4055
|
+
activeWorkspace: editContext?.workspaceId,
|
|
4056
|
+
hasPageLoaded: !!editContext?.getActiveSlotContext()?.primaryPageViewContext?.page,
|
|
4057
|
+
openSidebars: editContext?.openSidebars,
|
|
4058
|
+
}), [
|
|
4059
|
+
buildComponentContext,
|
|
4060
|
+
buildFieldContext,
|
|
4061
|
+
buildPageContextItem,
|
|
4062
|
+
editContext,
|
|
4063
|
+
]);
|
|
4064
|
+
// Helper function to build current context from editor state
|
|
4065
|
+
const buildCurrentContext = useCallback(() => {
|
|
4066
|
+
// Return context even without item - we want view info regardless
|
|
4067
|
+
const item = editContext?.currentItemDescriptor;
|
|
4068
|
+
return buildEditorContextPayload(item);
|
|
4069
|
+
}, [
|
|
4070
|
+
buildEditorContextPayload,
|
|
4071
|
+
editContext?.currentItemDescriptor,
|
|
4072
|
+
]);
|
|
4085
4073
|
// Live context updates: watch for changes and update agent context when in "live" mode
|
|
4086
4074
|
const previousContextRef = useRef("");
|
|
4087
4075
|
useEffect(() => {
|