@aprovan/patchwork-editor 0.1.2-dev.68f15f3 → 0.1.2-dev.78c0b14
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/.turbo/turbo-build.log +3 -3
- package/dist/components/CodePreview.d.ts +2 -3
- package/dist/components/MarkdownEditor.d.ts +1 -1
- package/dist/components/MarkdownPreview.d.ts +1 -1
- package/dist/components/SaveStatusButton.d.ts +1 -1
- package/dist/components/ServicesInspector.d.ts +1 -1
- package/dist/components/WidgetPreview.d.ts +1 -1
- package/dist/components/edit/CodeBlockView.d.ts +1 -1
- package/dist/components/edit/EditHistory.d.ts +1 -1
- package/dist/components/edit/EditModal.d.ts +1 -1
- package/dist/components/edit/FileTree.d.ts +1 -1
- package/dist/components/edit/MediaPreview.d.ts +1 -1
- package/dist/components/edit/SaveConfirmDialog.d.ts +1 -1
- package/dist/components/edit/index.d.ts +1 -0
- package/dist/components/edit/useEditSession.d.ts +1 -1
- package/dist/components/edit/useProjectState.d.ts +17 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +414 -403
- package/dist/lib/vfs.d.ts +2 -3
- package/package.json +6 -4
- package/src/components/CodePreview.tsx +7 -10
- package/src/components/MarkdownEditor.tsx +3 -3
- package/src/components/MarkdownPreview.tsx +2 -2
- package/src/components/ServicesInspector.tsx +1 -1
- package/src/components/WidgetPreview.tsx +1 -1
- package/src/components/edit/CodeBlockView.tsx +6 -2
- package/src/components/edit/EditHistory.tsx +1 -1
- package/src/components/edit/EditModal.tsx +6 -6
- package/src/components/edit/FileTree.tsx +2 -3
- package/src/components/edit/MediaPreview.tsx +1 -1
- package/src/components/edit/index.ts +4 -0
- package/src/components/edit/useEditSession.ts +19 -109
- package/src/components/edit/useProjectState.ts +122 -0
- package/src/index.ts +15 -18
- package/src/lib/code-extractor.ts +1 -1
- package/src/lib/vfs.ts +4 -5
- package/tsconfig.json +2 -1
- package/dist/components/index.d.ts +0 -7
- package/dist/lib/index.d.ts +0 -4
- package/src/components/index.ts +0 -7
- package/src/lib/index.ts +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
> @aprovan/patchwork-editor@0.1.2 build /home/runner/work/patchwork/patchwork/packages/editor
|
|
3
|
-
> tsup && tsc
|
|
3
|
+
> tsup && tsc -p tsconfig.json --emitDeclarationOnly
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m105.26 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 981ms
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Compiler } from '@aprovan/patchwork-compiler';
|
|
2
|
-
import type { VirtualProject } from '@aprovan/patchwork-compiler';
|
|
1
|
+
import type { Compiler, VirtualProject } from '@aprovan/patchwork-compiler';
|
|
3
2
|
interface CodePreviewProps {
|
|
4
3
|
code: string;
|
|
5
4
|
compiler: Compiler | null;
|
|
@@ -18,5 +17,5 @@ interface CodePreviewProps {
|
|
|
18
17
|
initialProject: VirtualProject;
|
|
19
18
|
}) => void;
|
|
20
19
|
}
|
|
21
|
-
export declare function CodePreview({ code: originalCode, compiler, services, filePath, entrypoint, onOpenEditSession, }: CodePreviewProps): import("react
|
|
20
|
+
export declare function CodePreview({ code: originalCode, compiler, services, filePath, entrypoint, onOpenEditSession, }: CodePreviewProps): import("react").JSX.Element;
|
|
22
21
|
export {};
|
|
@@ -6,5 +6,5 @@ interface MarkdownEditorProps {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function MarkdownEditor({ value, onChange, onSubmit, placeholder, disabled, className, }: MarkdownEditorProps): import("react
|
|
9
|
+
export declare function MarkdownEditor({ value, onChange, onSubmit, placeholder, disabled, className, }: MarkdownEditorProps): import("react").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -4,5 +4,5 @@ interface MarkdownPreviewProps {
|
|
|
4
4
|
editable?: boolean;
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function MarkdownPreview({ value, onChange, editable, className, }: MarkdownPreviewProps): import("react
|
|
7
|
+
export declare function MarkdownPreview({ value, onChange, editable, className, }: MarkdownPreviewProps): import("react").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -5,5 +5,5 @@ interface SaveStatusButtonProps {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
tone: 'muted' | 'primary';
|
|
7
7
|
}
|
|
8
|
-
export declare function SaveStatusButton({ status, onClick, disabled, tone, }: SaveStatusButtonProps): import("react
|
|
8
|
+
export declare function SaveStatusButton({ status, onClick, disabled, tone, }: SaveStatusButtonProps): import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -44,5 +44,5 @@ interface ServicesInspectorProps {
|
|
|
44
44
|
onClose?: () => void;
|
|
45
45
|
}>;
|
|
46
46
|
}
|
|
47
|
-
export declare function ServicesInspector({ namespaces, services, BadgeComponent, DialogComponent, DialogHeaderComponent, DialogContentComponent, DialogCloseComponent, }: ServicesInspectorProps): import("react
|
|
47
|
+
export declare function ServicesInspector({ namespaces, services, BadgeComponent, DialogComponent, DialogHeaderComponent, DialogContentComponent, DialogCloseComponent, }: ServicesInspectorProps): import("react").JSX.Element | null;
|
|
48
48
|
export {};
|
|
@@ -5,4 +5,4 @@ export interface WidgetPreviewProps {
|
|
|
5
5
|
services?: string[];
|
|
6
6
|
enabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function WidgetPreview({ code, compiler, services, enabled, }: WidgetPreviewProps): import("react
|
|
8
|
+
export declare function WidgetPreview({ code, compiler, services, enabled, }: WidgetPreviewProps): import("react").JSX.Element;
|
|
@@ -4,4 +4,4 @@ export interface CodeBlockViewProps {
|
|
|
4
4
|
editable?: boolean;
|
|
5
5
|
onChange?: (content: string) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare function CodeBlockView({ content, language, editable, onChange }: CodeBlockViewProps): import("react
|
|
7
|
+
export declare function CodeBlockView({ content, language, editable, onChange }: CodeBlockViewProps): import("react").JSX.Element;
|
|
@@ -6,5 +6,5 @@ interface EditHistoryProps {
|
|
|
6
6
|
pendingPrompt?: string | null;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function EditHistory({ entries, streamingNotes, isStreaming, pendingPrompt, className, }: EditHistoryProps): import("react
|
|
9
|
+
export declare function EditHistory({ entries, streamingNotes, isStreaming, pendingPrompt, className, }: EditHistoryProps): import("react").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -18,4 +18,4 @@ export interface EditModalProps extends UseEditSessionOptions {
|
|
|
18
18
|
previewError?: string | null;
|
|
19
19
|
previewLoading?: boolean;
|
|
20
20
|
}
|
|
21
|
-
export declare function EditModal({ isOpen, onClose, onSave, onSaveProject, renderPreview, renderLoading, renderError, previewError, previewLoading, initialTreePath, initialState, hideFileTree, ...sessionOptions }: EditModalProps): import("react
|
|
21
|
+
export declare function EditModal({ isOpen, onClose, onSave, onSaveProject, renderPreview, renderLoading, renderError, previewError, previewLoading, initialTreePath, initialState, hideFileTree, ...sessionOptions }: EditModalProps): import("react").JSX.Element | null;
|
|
@@ -24,4 +24,4 @@ export interface FileTreeProps {
|
|
|
24
24
|
pageSize?: number;
|
|
25
25
|
reloadToken?: number;
|
|
26
26
|
}
|
|
27
|
-
export declare function FileTree({ files, activeFile, activePath, title, onSelectFile, onSelectDirectory, onReplaceFile, onOpenInEditor, openInEditorMode, openInEditorIcon, openInEditorTitle, pinnedPaths, onTogglePin, directoryLoader, pageSize, reloadToken, }: FileTreeProps): import("react
|
|
27
|
+
export declare function FileTree({ files, activeFile, activePath, title, onSelectFile, onSelectDirectory, onReplaceFile, onOpenInEditor, openInEditorMode, openInEditorIcon, openInEditorTitle, pinnedPaths, onTogglePin, directoryLoader, pageSize, reloadToken, }: FileTreeProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ export interface MediaPreviewProps {
|
|
|
3
3
|
mimeType: string;
|
|
4
4
|
fileName: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function MediaPreview({ content, mimeType, fileName }: MediaPreviewProps): import("react
|
|
6
|
+
export declare function MediaPreview({ content, mimeType, fileName }: MediaPreviewProps): import("react").JSX.Element;
|
|
@@ -6,4 +6,4 @@ export interface SaveConfirmDialogProps {
|
|
|
6
6
|
onDiscard: () => void;
|
|
7
7
|
onCancel: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare function SaveConfirmDialog({ isOpen, isSaving, error, onSave, onDiscard, onCancel, }: SaveConfirmDialogProps): import("react
|
|
9
|
+
export declare function SaveConfirmDialog({ isOpen, isSaving, error, onSave, onDiscard, onCancel, }: SaveConfirmDialogProps): import("react").JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { VirtualProject } from "@aprovan/patchwork-compiler";
|
|
2
1
|
import type { EditSessionState, EditSessionActions, CompileFn } from "./types";
|
|
2
|
+
import type { VirtualProject } from "@aprovan/patchwork-compiler";
|
|
3
3
|
export interface UseEditSessionOptions {
|
|
4
4
|
originalCode?: string;
|
|
5
5
|
originalProject?: VirtualProject;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EditHistoryEntry, EditSessionState } from "./types";
|
|
2
|
+
import type { VirtualProject } from "@aprovan/patchwork-compiler";
|
|
3
|
+
export interface UseProjectStateOptions {
|
|
4
|
+
originalCode?: string;
|
|
5
|
+
originalProject?: VirtualProject;
|
|
6
|
+
initialActiveFile?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useProjectState(options: UseProjectStateOptions): Omit<EditSessionState, "isApplying" | "error" | "streamingNotes" | "pendingPrompt"> & {
|
|
9
|
+
setProject: React.Dispatch<React.SetStateAction<VirtualProject>>;
|
|
10
|
+
setActiveFile: React.Dispatch<React.SetStateAction<string>>;
|
|
11
|
+
history: EditHistoryEntry[];
|
|
12
|
+
setHistory: React.Dispatch<React.SetStateAction<EditHistoryEntry[]>>;
|
|
13
|
+
revert: () => void;
|
|
14
|
+
updateActiveFile: (content: string) => void;
|
|
15
|
+
replaceFile: (path: string, content: string, encoding?: "utf8" | "base64") => void;
|
|
16
|
+
currentCode: string;
|
|
17
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
export { CodeBlockExtension
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { CodeBlockExtension } from "./components/CodeBlockExtension";
|
|
2
|
+
export { CodePreview } from "./components/CodePreview";
|
|
3
|
+
export { WidgetPreview } from "./components/WidgetPreview";
|
|
4
|
+
export { MarkdownEditor } from "./components/MarkdownEditor";
|
|
5
|
+
export { MarkdownPreview } from "./components/MarkdownPreview";
|
|
6
|
+
export { ServicesInspector, type ServiceInfo } from "./components/ServicesInspector";
|
|
7
|
+
export { EditModal, EditHistory, FileTree, SaveConfirmDialog, CodeBlockView, MediaPreview, useEditSession, useProjectState, sendEditRequest, type EditModalProps, type UseEditSessionOptions, type UseProjectStateOptions, type EditHistoryEntry, type EditSessionState, type EditSessionActions, type EditRequest, type EditResponse, type CompileResult, type CompileFn, type EditApiOptions, type FileTreeProps, type SaveConfirmDialogProps, type CodeBlockViewProps, type MediaPreviewProps, type FileCategory, type FileTypeInfo, type FileEncoding, getActiveContent, getFiles, getFileType, isCompilable, isMediaFile, isTextFile, isMarkdownFile, isPreviewable, isImageFile, isVideoFile, getLanguageFromExt, getMimeType, } from "./components/edit";
|
|
8
|
+
export { extractCodeBlocks, findFirstCodeBlock, hasCodeBlock, getCodeBlockLanguages, extractProject, type TextPart, type CodePart, type ParsedPart, type ExtractOptions, } from "./lib/code-extractor";
|
|
9
|
+
export { parseCodeBlockAttributes, parseCodeBlocks, findDiffMarkers, sanitizeDiffMarkers, parseEditResponse, parseDiffs, applyDiffs, hasDiffBlocks, extractTextWithoutDiffs, extractSummary, type CodeBlockAttributes, type CodeBlock, type DiffBlock, type ParsedEditResponse, } from "./lib/diff";
|
|
10
|
+
export { getVFSConfig, getVFSStore, saveProject, loadProject, listProjects, saveFile, isVFSAvailable, } from "./lib/vfs";
|
|
11
|
+
export { cn } from "./lib/utils";
|