@kubohiroya/turbowarp-plus-editor-git 0.0.0-stage → 0.8.0
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/LICENSE +373 -0
- package/README.ja.md +121 -0
- package/README.md +43 -2
- package/THIRD_PARTY_NOTICES.md +5 -0
- package/dist/THIRD_PARTY_NOTICES.md +1186 -0
- package/dist/block-diff-location.d.ts +22 -0
- package/dist/block-diff-preview.d.ts +33 -0
- package/dist/browser.d.ts +4 -0
- package/dist/connection-settings.d.ts +35 -0
- package/dist/file-diff-view.d.ts +18 -0
- package/dist/filesystem.d.ts +89 -0
- package/dist/github-pull-requests.d.ts +38 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +3563 -0
- package/dist/messages.d.ts +112 -0
- package/dist/mutation-fs.d.ts +58 -0
- package/dist/objectSpread2-Dkd68nJH.js +101 -0
- package/dist/project-asset-paths-KV715791.js +761 -0
- package/dist/project-asset-paths.d.ts +12 -0
- package/dist/project-assets.d.ts +19 -0
- package/dist/project-source-diff.d.ts +26 -0
- package/dist/project-source-diff.js +172 -0
- package/dist/project-source-patch.d.ts +39 -0
- package/dist/project-source-review-model.d.ts +23 -0
- package/dist/project-source-review.d.ts +38 -0
- package/dist/pull-request-panel.d.ts +8 -0
- package/dist/remote-operations.d.ts +5 -0
- package/dist/repository-BQkADJmK.js +17280 -0
- package/dist/repository.d.ts +71 -0
- package/dist/repository.js +1 -0
- package/dist/scratch-block-diff-renderer-xS8OYsRl.js +1830 -0
- package/dist/scratch-block-diff-renderer.d.ts +128 -0
- package/dist/smart-http-BmHEkE7K.js +303 -0
- package/dist/smart-http.d.ts +60 -0
- package/dist/smart-http.js +1 -0
- package/dist/style.css +138 -0
- package/package.json +65 -4
- package/src/block-diff-location.ts +63 -0
- package/src/block-diff-preview.tsx +117 -0
- package/src/browser.ts +5 -0
- package/src/connection-settings.tsx +103 -0
- package/src/file-diff-view.tsx +44 -0
- package/src/filesystem.ts +125 -0
- package/src/github-pull-requests.ts +229 -0
- package/src/index.tsx +352 -0
- package/src/messages.ts +64 -0
- package/src/mutation-fs.ts +204 -0
- package/src/project-asset-paths.ts +33 -0
- package/src/project-assets.ts +66 -0
- package/src/project-source-diff.css +108 -0
- package/src/project-source-diff.tsx +139 -0
- package/src/project-source-patch.ts +126 -0
- package/src/project-source-review-model.ts +116 -0
- package/src/project-source-review.tsx +250 -0
- package/src/pull-request-panel.tsx +134 -0
- package/src/remote-operations.ts +90 -0
- package/src/repository.ts +364 -0
- package/src/scratch-block-diff-renderer.ts +331 -0
- package/src/smart-http.ts +190 -0
- package/src/style.css +29 -0
- package/src/styles.d.ts +1 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +26 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BlockPart, BlockSide } from './project-source-patch.js';
|
|
2
|
+
export interface DiffSvgBlock {
|
|
3
|
+
type?: string;
|
|
4
|
+
getSvgRoot(): Element | null;
|
|
5
|
+
getInputTargetBlock?(name: string): DiffSvgBlock | null;
|
|
6
|
+
getField?(name: string): {
|
|
7
|
+
getSvgRoot(): Element | null;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export type ProjectBlockLocation = BlockSide & {
|
|
11
|
+
version: 'before' | 'after';
|
|
12
|
+
parts: readonly BlockPart[];
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
};
|
|
15
|
+
export type ProjectBlockLocator = (location: ProjectBlockLocation) => boolean | Promise<boolean>;
|
|
16
|
+
export interface ScratchBlockLocationWorkspace {
|
|
17
|
+
getBlockById(id: string): DiffSvgBlock | null;
|
|
18
|
+
centerOnBlock(id: string): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function markBlockLocation(block: DiffSvgBlock, parts: readonly BlockPart[]): (() => void) | undefined;
|
|
21
|
+
/** Resolve the matching project revision and target in the host before navigating its workspace. */
|
|
22
|
+
export declare function createScratchBlocksDiffLocator(resolveWorkspace: (location: ProjectBlockLocation) => ScratchBlockLocationWorkspace | null | Promise<ScratchBlockLocationWorkspace | null>): ProjectBlockLocator;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BlockPart, BlockSide } from './project-source-patch.js';
|
|
3
|
+
import type { BlockPreviewView, ProjectBlockRenderer, ScriptBlockMark } from './scratch-block-diff-renderer.js';
|
|
4
|
+
import type { ProjectAssetLoader, ProjectVersion } from './project-assets.js';
|
|
5
|
+
export type LocationStatus = 'locating' | 'located' | 'missingLocation';
|
|
6
|
+
type PreviewLabels = Record<'absent' | 'loading' | 'unavailable', string> & Partial<Record<LocationStatus | 'locate', string>>;
|
|
7
|
+
/** Keeps the previews of one comparison at the same zoom, height and scroll position while they are linked. */
|
|
8
|
+
export interface PreviewSync {
|
|
9
|
+
add(view: BlockPreviewView): () => void;
|
|
10
|
+
setLinked(linked: boolean): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createPreviewSync(): PreviewSync;
|
|
13
|
+
/** One sync group per comparison, with the checkbox that links or unlinks its previews. */
|
|
14
|
+
export declare function usePreviewSync(locale: string): {
|
|
15
|
+
sync: PreviewSync;
|
|
16
|
+
toggle: React.JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
export declare function BlockPreview({ side, title, parts, marks, renderBlock, withContext, labels, onLocate, locationStatus, version, loadAsset, sync }: {
|
|
19
|
+
side?: BlockSide;
|
|
20
|
+
title: string;
|
|
21
|
+
parts?: readonly BlockPart[];
|
|
22
|
+
marks?: readonly ScriptBlockMark[];
|
|
23
|
+
renderBlock: ProjectBlockRenderer;
|
|
24
|
+
withContext: boolean;
|
|
25
|
+
labels: PreviewLabels;
|
|
26
|
+
onLocate?: () => void;
|
|
27
|
+
locationStatus?: LocationStatus;
|
|
28
|
+
/** Which version this preview shows, for its costume thumbnail. */
|
|
29
|
+
version?: ProjectVersion;
|
|
30
|
+
loadAsset?: ProjectAssetLoader;
|
|
31
|
+
sync?: PreviewSync;
|
|
32
|
+
}): React.JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GetRemoteSession, RemoteOperation } from './remote-operations.js';
|
|
3
|
+
type Mode = 'desktop' | 'cloudflare';
|
|
4
|
+
type Status = 'disconnected' | 'connecting' | 'connected' | 'reauth-required';
|
|
5
|
+
export interface GitConnectionSettings {
|
|
6
|
+
modes: readonly Mode[];
|
|
7
|
+
getView(): {
|
|
8
|
+
mode: Mode | null;
|
|
9
|
+
state: {
|
|
10
|
+
status: Status;
|
|
11
|
+
account?: {
|
|
12
|
+
login: string;
|
|
13
|
+
};
|
|
14
|
+
expiresAt?: number;
|
|
15
|
+
};
|
|
16
|
+
proxyOrigin?: string;
|
|
17
|
+
write?: boolean;
|
|
18
|
+
authorization?: {
|
|
19
|
+
url: string;
|
|
20
|
+
userCode?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
select(mode: Mode): Promise<void>;
|
|
24
|
+
connect(remote: string, write?: boolean): Promise<void>;
|
|
25
|
+
refresh(): Promise<void>;
|
|
26
|
+
disconnect(): Promise<void>;
|
|
27
|
+
getSession?: GetRemoteSession;
|
|
28
|
+
}
|
|
29
|
+
export declare function ConnectionSettings({ settings, locale, readOrigin, runOperation }: {
|
|
30
|
+
settings: GitConnectionSettings;
|
|
31
|
+
locale: string;
|
|
32
|
+
readOrigin?: () => Promise<string | undefined>;
|
|
33
|
+
runOperation?: (operation: RemoteOperation) => Promise<void>;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FileChange, FileDiff } from './repository.js';
|
|
3
|
+
import type { labelsFor } from './messages.js';
|
|
4
|
+
import type { ProjectBlockRenderer } from './scratch-block-diff-renderer.js';
|
|
5
|
+
import type { ProjectAssetLoader } from './project-assets.js';
|
|
6
|
+
/** Project sources are the files the panel opens as projects. */
|
|
7
|
+
export declare const isProjectSource: (path: string) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Shows one changed file. Project sources are compared as blocks by default, with their text diff one switch away.
|
|
10
|
+
*/
|
|
11
|
+
export declare function FileDiffView({ change, diff, labels, locale, renderBlock, loadAsset }: {
|
|
12
|
+
change: FileChange;
|
|
13
|
+
diff: FileDiff | null;
|
|
14
|
+
labels: ReturnType<typeof labelsFor>;
|
|
15
|
+
locale: string;
|
|
16
|
+
renderBlock?: ProjectBlockRenderer;
|
|
17
|
+
loadAsset?: ProjectAssetLoader;
|
|
18
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export declare class GitPanelError extends Error {
|
|
2
|
+
code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed';
|
|
3
|
+
constructor(code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed', message?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare const fileError: (code: string, path: string) => Error & {
|
|
6
|
+
code: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const errorCode: (error: unknown) => string | undefined;
|
|
9
|
+
export declare function pathParts(path: string): string[];
|
|
10
|
+
export declare function fileStat(file: {
|
|
11
|
+
size: number;
|
|
12
|
+
lastModified: number;
|
|
13
|
+
} | null): {
|
|
14
|
+
isFile: () => boolean;
|
|
15
|
+
isDirectory: () => boolean;
|
|
16
|
+
isSymbolicLink: () => boolean;
|
|
17
|
+
size: number;
|
|
18
|
+
mode: number;
|
|
19
|
+
mtimeMs: number;
|
|
20
|
+
ctimeMs: number;
|
|
21
|
+
atimeMs: number;
|
|
22
|
+
birthtimeMs: number;
|
|
23
|
+
mtime: Date;
|
|
24
|
+
ctime: Date;
|
|
25
|
+
atime: Date;
|
|
26
|
+
birthtime: Date;
|
|
27
|
+
dev: number;
|
|
28
|
+
ino: number;
|
|
29
|
+
uid: number;
|
|
30
|
+
gid: number;
|
|
31
|
+
};
|
|
32
|
+
/** Adapt granted handles without exposing any filesystem mutation. */
|
|
33
|
+
export declare function createReadOnlyFs(root: FileSystemDirectoryHandle): {
|
|
34
|
+
clearReads(): void;
|
|
35
|
+
checkReads(): Promise<void>;
|
|
36
|
+
promises: {
|
|
37
|
+
readFile: (path: string, options?: string | {
|
|
38
|
+
encoding?: string;
|
|
39
|
+
}) => Promise<string | Uint8Array<ArrayBuffer>>;
|
|
40
|
+
stat: (path: string) => Promise<{
|
|
41
|
+
isFile: () => boolean;
|
|
42
|
+
isDirectory: () => boolean;
|
|
43
|
+
isSymbolicLink: () => boolean;
|
|
44
|
+
size: number;
|
|
45
|
+
mode: number;
|
|
46
|
+
mtimeMs: number;
|
|
47
|
+
ctimeMs: number;
|
|
48
|
+
atimeMs: number;
|
|
49
|
+
birthtimeMs: number;
|
|
50
|
+
mtime: Date;
|
|
51
|
+
ctime: Date;
|
|
52
|
+
atime: Date;
|
|
53
|
+
birthtime: Date;
|
|
54
|
+
dev: number;
|
|
55
|
+
ino: number;
|
|
56
|
+
uid: number;
|
|
57
|
+
gid: number;
|
|
58
|
+
}>;
|
|
59
|
+
lstat: (path: string) => Promise<{
|
|
60
|
+
isFile: () => boolean;
|
|
61
|
+
isDirectory: () => boolean;
|
|
62
|
+
isSymbolicLink: () => boolean;
|
|
63
|
+
size: number;
|
|
64
|
+
mode: number;
|
|
65
|
+
mtimeMs: number;
|
|
66
|
+
ctimeMs: number;
|
|
67
|
+
atimeMs: number;
|
|
68
|
+
birthtimeMs: number;
|
|
69
|
+
mtime: Date;
|
|
70
|
+
ctime: Date;
|
|
71
|
+
atime: Date;
|
|
72
|
+
birthtime: Date;
|
|
73
|
+
dev: number;
|
|
74
|
+
ino: number;
|
|
75
|
+
uid: number;
|
|
76
|
+
gid: number;
|
|
77
|
+
}>;
|
|
78
|
+
readdir(path: string): Promise<string[]>;
|
|
79
|
+
writeFile: (path: string) => Promise<never>;
|
|
80
|
+
unlink: (path: string) => Promise<never>;
|
|
81
|
+
mkdir: (path: string) => Promise<never>;
|
|
82
|
+
rmdir: (path: string) => Promise<never>;
|
|
83
|
+
symlink: (path: string) => Promise<never>;
|
|
84
|
+
chmod: (path: string) => Promise<never>;
|
|
85
|
+
readlink(): Promise<never>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare function readOptional(fs: ReturnType<typeof createReadOnlyFs>, path: string): Promise<Uint8Array | null>;
|
|
89
|
+
export declare const sameBytes: (left: Uint8Array | null, right: Uint8Array | null) => boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ProjectSourceReviewFile } from './project-source-review.js';
|
|
2
|
+
type ErrorCode = 'unavailable' | 'rateLimit' | 'failed' | 'changed' | 'tooManyFiles';
|
|
3
|
+
export declare class PullRequestError extends Error {
|
|
4
|
+
readonly code: ErrorCode;
|
|
5
|
+
constructor(code: ErrorCode);
|
|
6
|
+
}
|
|
7
|
+
export declare function gitHubRepositoryFromOrigin(origin: string | undefined): string | null;
|
|
8
|
+
export declare function createGitHubPullRequests(repository: string, send?: typeof fetch): {
|
|
9
|
+
list(page: number, signal: AbortSignal): Promise<{
|
|
10
|
+
items: {
|
|
11
|
+
number: number;
|
|
12
|
+
title: string;
|
|
13
|
+
}[];
|
|
14
|
+
more: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
load(number: number, signal: AbortSignal): Promise<{
|
|
17
|
+
files: ProjectSourceReviewFile[];
|
|
18
|
+
url: string;
|
|
19
|
+
author: string | undefined;
|
|
20
|
+
description: string;
|
|
21
|
+
base: {
|
|
22
|
+
sha: string;
|
|
23
|
+
ref: string;
|
|
24
|
+
repository: string | null;
|
|
25
|
+
};
|
|
26
|
+
head: {
|
|
27
|
+
sha: string;
|
|
28
|
+
ref: string;
|
|
29
|
+
repository: string | null;
|
|
30
|
+
};
|
|
31
|
+
state: "open" | "closed" | "merged" | "draft";
|
|
32
|
+
changedFiles: number;
|
|
33
|
+
number: number;
|
|
34
|
+
title: string;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
export type GitHubPullRequests = ReturnType<typeof createGitHubPullRequests>;
|
|
38
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GitConnectionSettings } from './connection-settings.js';
|
|
2
|
+
import type { ProjectBlockRenderer } from './scratch-block-diff-renderer.js';
|
|
3
|
+
export { createScratchBlocksDiffRenderer } from './scratch-block-diff-renderer.js';
|
|
4
|
+
export type { ScratchBlockDiffRendererOptions, ScratchBlocksPort } from './scratch-block-diff-renderer.js';
|
|
5
|
+
export { openRepository, createReadOnlyFs, GitPanelError } from './repository.js';
|
|
6
|
+
export type { Repository, Snapshot, FileChange, FileDiff } from './repository.js';
|
|
7
|
+
export interface GitHost {
|
|
8
|
+
connectionSettings?: GitConnectionSettings;
|
|
9
|
+
renderReviewBlock?: ProjectBlockRenderer;
|
|
10
|
+
openProject(directory: FileSystemDirectoryHandle, confirmReplace: () => boolean): Promise<'opened' | 'cancelled'>;
|
|
11
|
+
isProjectDirty(): boolean;
|
|
12
|
+
isProjectRunning?(): boolean;
|
|
13
|
+
subscribe?(listener: (event: 'loaded' | 'changed') => void): () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function mountGitPanel({ vm, document, host }: {
|
|
16
|
+
vm: object;
|
|
17
|
+
document: Document;
|
|
18
|
+
host: GitHost;
|
|
19
|
+
}): {
|
|
20
|
+
refresh: () => Promise<void>;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
} | null;
|
|
23
|
+
export declare function renderGitMenu(createElement: (component: any, props: any, ...children: any[]) => any, { vm, locale, MenuItem, MenuSection, onRequestClose }: {
|
|
24
|
+
vm: object;
|
|
25
|
+
locale?: string;
|
|
26
|
+
MenuItem: any;
|
|
27
|
+
MenuSection: any;
|
|
28
|
+
onRequestClose(): void;
|
|
29
|
+
}): any;
|