@aprovan/patchwork-editor 0.1.2-dev.03aaf5b → 0.1.2-dev.ba8f277
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 +2 -2
- package/dist/components/CodePreview.d.ts +10 -1
- package/dist/components/MarkdownPreview.d.ts +8 -0
- package/dist/components/SaveStatusButton.d.ts +9 -0
- package/dist/components/ServicesInspector.d.ts +3 -4
- package/dist/components/WidgetPreview.d.ts +8 -0
- package/dist/components/edit/EditModal.d.ts +2 -1
- package/dist/components/edit/FileTree.d.ts +22 -3
- package/dist/components/edit/fileTypes.d.ts +2 -0
- package/dist/components/edit/useEditSession.d.ts +1 -0
- package/dist/components/index.d.ts +7 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +904 -176
- package/package.json +3 -3
- package/src/components/CodePreview.tsx +118 -160
- package/src/components/MarkdownPreview.tsx +147 -0
- package/src/components/SaveStatusButton.tsx +55 -0
- package/src/components/ServicesInspector.tsx +101 -37
- package/src/components/WidgetPreview.tsx +102 -0
- package/src/components/edit/EditModal.tsx +83 -26
- package/src/components/edit/FileTree.tsx +523 -28
- package/src/components/edit/api.ts +6 -1
- package/src/components/edit/fileTypes.ts +8 -0
- package/src/components/edit/useEditSession.ts +13 -3
- package/src/components/index.ts +7 -5
- package/src/index.ts +10 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -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[32m104.90 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 261ms
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '@aprovan/patchwork-compiler';
|
|
2
|
+
import type { VirtualProject } from '@aprovan/patchwork-compiler';
|
|
2
3
|
interface CodePreviewProps {
|
|
3
4
|
code: string;
|
|
4
5
|
compiler: Compiler | null;
|
|
@@ -8,6 +9,14 @@ interface CodePreviewProps {
|
|
|
8
9
|
services?: string[];
|
|
9
10
|
/** Optional file path from code block attributes (e.g., "components/calculator.tsx") */
|
|
10
11
|
filePath?: string;
|
|
12
|
+
/** Optional callback to open a shared edit session outside this component */
|
|
13
|
+
onOpenEditSession?: (session: {
|
|
14
|
+
projectId: string;
|
|
15
|
+
entryFile: string;
|
|
16
|
+
filePath?: string;
|
|
17
|
+
initialCode: string;
|
|
18
|
+
initialProject: VirtualProject;
|
|
19
|
+
}) => void;
|
|
11
20
|
}
|
|
12
|
-
export declare function CodePreview({ code: originalCode, compiler, services, filePath, entrypoint }: CodePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function CodePreview({ code: originalCode, compiler, services, filePath, entrypoint, onOpenEditSession, }: CodePreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
13
22
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface MarkdownPreviewProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange?: (value: string) => void;
|
|
4
|
+
editable?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function MarkdownPreview({ value, onChange, editable, className, }: MarkdownPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type SaveStatus = 'unsaved' | 'saving' | 'saved' | 'error';
|
|
2
|
+
interface SaveStatusButtonProps {
|
|
3
|
+
status: SaveStatus;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
tone: 'muted' | 'primary';
|
|
7
|
+
}
|
|
8
|
+
export declare function SaveStatusButton({ status, onClick, disabled, tone, }: SaveStatusButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -3,9 +3,7 @@ export interface ServiceInfo {
|
|
|
3
3
|
namespace: string;
|
|
4
4
|
procedure: string;
|
|
5
5
|
description: string;
|
|
6
|
-
parameters
|
|
7
|
-
jsonSchema: Record<string, unknown>;
|
|
8
|
-
};
|
|
6
|
+
parameters?: Record<string, unknown>;
|
|
9
7
|
}
|
|
10
8
|
interface ServicesInspectorProps {
|
|
11
9
|
namespaces: string[];
|
|
@@ -40,10 +38,11 @@ interface ServicesInspectorProps {
|
|
|
40
38
|
}>;
|
|
41
39
|
DialogContentComponent?: React.ComponentType<{
|
|
42
40
|
children: React.ReactNode;
|
|
41
|
+
className?: string;
|
|
43
42
|
}>;
|
|
44
43
|
DialogCloseComponent?: React.ComponentType<{
|
|
45
44
|
onClose?: () => void;
|
|
46
45
|
}>;
|
|
47
46
|
}
|
|
48
|
-
export declare function ServicesInspector({ namespaces, services, BadgeComponent, DialogComponent, }: ServicesInspectorProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function ServicesInspector({ namespaces, services, BadgeComponent, DialogComponent, DialogHeaderComponent, DialogContentComponent, DialogCloseComponent, }: ServicesInspectorProps): import("react/jsx-runtime").JSX.Element;
|
|
49
48
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Compiler } from '@aprovan/patchwork-compiler';
|
|
2
|
+
export interface WidgetPreviewProps {
|
|
3
|
+
code: string;
|
|
4
|
+
compiler: Compiler | null;
|
|
5
|
+
services?: string[];
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function WidgetPreview({ code, compiler, services, enabled, }: WidgetPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { type UseEditSessionOptions } from './useEditSession';
|
|
|
3
3
|
import type { VirtualProject } from '@aprovan/patchwork-compiler';
|
|
4
4
|
export interface EditModalProps extends UseEditSessionOptions {
|
|
5
5
|
isOpen: boolean;
|
|
6
|
+
initialTreePath?: string;
|
|
6
7
|
initialState?: Partial<{
|
|
7
8
|
showTree: boolean;
|
|
8
9
|
showPreview: boolean;
|
|
@@ -17,4 +18,4 @@ export interface EditModalProps extends UseEditSessionOptions {
|
|
|
17
18
|
previewError?: string | null;
|
|
18
19
|
previewLoading?: boolean;
|
|
19
20
|
}
|
|
20
|
-
export declare function EditModal({ isOpen, onClose, onSave, onSaveProject, renderPreview, renderLoading, renderError, previewError, previewLoading, initialState, hideFileTree, ...sessionOptions }: EditModalProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function EditModal({ isOpen, onClose, onSave, onSaveProject, renderPreview, renderLoading, renderError, previewError, previewLoading, initialTreePath, initialState, hideFileTree, ...sessionOptions }: EditModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { VirtualFile } from '@aprovan/patchwork-compiler';
|
|
3
|
+
export interface FileTreeEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
path: string;
|
|
6
|
+
isDir: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type FileTreeDirectoryLoader = (path: string) => Promise<FileTreeEntry[]>;
|
|
2
9
|
export interface FileTreeProps {
|
|
3
|
-
files
|
|
4
|
-
activeFile
|
|
10
|
+
files?: VirtualFile[];
|
|
11
|
+
activeFile?: string;
|
|
12
|
+
activePath?: string;
|
|
13
|
+
title?: string;
|
|
5
14
|
onSelectFile: (path: string) => void;
|
|
15
|
+
onSelectDirectory?: (path: string) => void;
|
|
6
16
|
onReplaceFile?: (path: string, content: string, encoding: 'utf8' | 'base64') => void;
|
|
17
|
+
onOpenInEditor?: (path: string, isDir: boolean) => void;
|
|
18
|
+
openInEditorMode?: 'files' | 'directories' | 'all';
|
|
19
|
+
openInEditorIcon?: ReactNode;
|
|
20
|
+
openInEditorTitle?: string;
|
|
21
|
+
pinnedPaths?: Map<string, boolean>;
|
|
22
|
+
onTogglePin?: (path: string, isDir: boolean) => void;
|
|
23
|
+
directoryLoader?: FileTreeDirectoryLoader;
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
reloadToken?: number;
|
|
7
26
|
}
|
|
8
|
-
export declare function FileTree({ files, activeFile, onSelectFile, onReplaceFile }: FileTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
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-runtime").JSX.Element;
|
|
@@ -8,6 +8,8 @@ export declare function getFileType(path: string): FileTypeInfo;
|
|
|
8
8
|
export declare function isCompilable(path: string): boolean;
|
|
9
9
|
export declare function isMediaFile(path: string): boolean;
|
|
10
10
|
export declare function isTextFile(path: string): boolean;
|
|
11
|
+
export declare function isMarkdownFile(path: string): boolean;
|
|
12
|
+
export declare function isPreviewable(path: string): boolean;
|
|
11
13
|
export declare function getLanguageFromExt(path: string): string | null;
|
|
12
14
|
export declare function getMimeType(path: string): string;
|
|
13
15
|
export declare function isImageFile(path: string): boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { CodeBlockExtension } from
|
|
2
|
-
export { CodePreview } from
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
1
|
+
export { CodeBlockExtension } from "./CodeBlockExtension";
|
|
2
|
+
export { CodePreview } from "./CodePreview";
|
|
3
|
+
export { WidgetPreview } from "./WidgetPreview";
|
|
4
|
+
export { MarkdownEditor } from "./MarkdownEditor";
|
|
5
|
+
export { MarkdownPreview } from "./MarkdownPreview";
|
|
6
|
+
export { ServicesInspector, type ServiceInfo } from "./ServicesInspector";
|
|
7
|
+
export * from "./edit";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CodeBlockExtension, CodePreview, MarkdownEditor, ServicesInspector, type ServiceInfo, } from
|
|
2
|
-
export { EditModal, EditHistory, FileTree, SaveConfirmDialog, CodeBlockView, MediaPreview, useEditSession, sendEditRequest, type EditModalProps, type UseEditSessionOptions, 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, isImageFile, isVideoFile, getLanguageFromExt, getMimeType, } from
|
|
3
|
-
export { extractCodeBlocks, findFirstCodeBlock, hasCodeBlock, getCodeBlockLanguages, extractProject, type TextPart, type CodePart, type ParsedPart, type ExtractOptions, parseCodeBlockAttributes, parseCodeBlocks, findDiffMarkers, sanitizeDiffMarkers, parseEditResponse, parseDiffs, applyDiffs, hasDiffBlocks, extractTextWithoutDiffs, extractSummary, type CodeBlockAttributes, type CodeBlock, type DiffBlock, type ParsedEditResponse, getVFSConfig, getVFSStore, saveProject, loadProject, listProjects, saveFile, isVFSAvailable, cn, } from
|
|
1
|
+
export { CodeBlockExtension, CodePreview, WidgetPreview, MarkdownEditor, MarkdownPreview, ServicesInspector, type ServiceInfo, } from "./components";
|
|
2
|
+
export { EditModal, EditHistory, FileTree, SaveConfirmDialog, CodeBlockView, MediaPreview, useEditSession, sendEditRequest, type EditModalProps, type UseEditSessionOptions, 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";
|
|
3
|
+
export { extractCodeBlocks, findFirstCodeBlock, hasCodeBlock, getCodeBlockLanguages, extractProject, type TextPart, type CodePart, type ParsedPart, type ExtractOptions, parseCodeBlockAttributes, parseCodeBlocks, findDiffMarkers, sanitizeDiffMarkers, parseEditResponse, parseDiffs, applyDiffs, hasDiffBlocks, extractTextWithoutDiffs, extractSummary, type CodeBlockAttributes, type CodeBlock, type DiffBlock, type ParsedEditResponse, getVFSConfig, getVFSStore, saveProject, loadProject, listProjects, saveFile, isVFSAvailable, cn, } from "./lib";
|