@aprovan/patchwork-editor 0.1.1-dev.6bd527d → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @aprovan/patchwork-editor@0.1.1 build /home/runner/work/patchwork/patchwork/packages/editor
2
+ > @aprovan/patchwork-editor@0.1.2 build /home/runner/work/patchwork/patchwork/packages/editor
3
3
  > tsup && tsc --declaration --emitDeclarationOnly --outDir dist --jsx react-jsx --lib ES2022,DOM --skipLibCheck src/index.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,5 +9,5 @@
9
9
  CLI Target: es2022
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/index.js 78.44 KB
13
- ESM ⚡️ Build success in 242ms
12
+ ESM dist/index.js 104.90 KB
13
+ ESM ⚡️ 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: VirtualFile[];
4
- activeFile: string;
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;
@@ -3,6 +3,7 @@ import type { EditSessionState, EditSessionActions, CompileFn } from "./types";
3
3
  export interface UseEditSessionOptions {
4
4
  originalCode?: string;
5
5
  originalProject?: VirtualProject;
6
+ initialActiveFile?: string;
6
7
  compile?: CompileFn;
7
8
  apiEndpoint?: string;
8
9
  }
@@ -1,5 +1,7 @@
1
- export { CodeBlockExtension } from './CodeBlockExtension';
2
- export { CodePreview } from './CodePreview';
3
- export { MarkdownEditor } from './MarkdownEditor';
4
- export { ServicesInspector, type ServiceInfo } from './ServicesInspector';
5
- export * from './edit';
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 './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, 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';
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";