@kubohiroya/turbowarp-plus-editor-git 0.0.0-stage → 0.7.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.
Files changed (59) hide show
  1. package/LICENSE +373 -0
  2. package/README.ja.md +105 -0
  3. package/README.md +35 -2
  4. package/THIRD_PARTY_NOTICES.md +5 -0
  5. package/dist/THIRD_PARTY_NOTICES.md +1186 -0
  6. package/dist/block-diff-location.d.ts +22 -0
  7. package/dist/block-diff-preview.d.ts +17 -0
  8. package/dist/browser.d.ts +4 -0
  9. package/dist/connection-settings.d.ts +35 -0
  10. package/dist/file-diff-view.d.ts +16 -0
  11. package/dist/filesystem.d.ts +89 -0
  12. package/dist/github-pull-requests.d.ts +38 -0
  13. package/dist/index.d.ts +29 -0
  14. package/dist/index.js +3556 -0
  15. package/dist/libesm-OWRWzmu_.js +739 -0
  16. package/dist/messages.d.ts +112 -0
  17. package/dist/mutation-fs.d.ts +58 -0
  18. package/dist/objectSpread2-Dkd68nJH.js +101 -0
  19. package/dist/project-source-diff.d.ts +22 -0
  20. package/dist/project-source-diff.js +169 -0
  21. package/dist/project-source-patch.d.ts +39 -0
  22. package/dist/project-source-review-model.d.ts +20 -0
  23. package/dist/project-source-review.d.ts +34 -0
  24. package/dist/pull-request-panel.d.ts +8 -0
  25. package/dist/remote-operations.d.ts +5 -0
  26. package/dist/repository-DplMQiuo.js +17212 -0
  27. package/dist/repository.d.ts +61 -0
  28. package/dist/repository.js +1 -0
  29. package/dist/scratch-block-diff-renderer-CLYoOIB2.js +1464 -0
  30. package/dist/scratch-block-diff-renderer.d.ts +65 -0
  31. package/dist/smart-http-BmHEkE7K.js +303 -0
  32. package/dist/smart-http.d.ts +60 -0
  33. package/dist/smart-http.js +1 -0
  34. package/dist/style.css +109 -0
  35. package/package.json +60 -4
  36. package/src/block-diff-location.ts +63 -0
  37. package/src/block-diff-preview.tsx +36 -0
  38. package/src/browser.ts +5 -0
  39. package/src/connection-settings.tsx +103 -0
  40. package/src/file-diff-view.tsx +43 -0
  41. package/src/filesystem.ts +125 -0
  42. package/src/github-pull-requests.ts +162 -0
  43. package/src/index.tsx +349 -0
  44. package/src/messages.ts +64 -0
  45. package/src/mutation-fs.ts +204 -0
  46. package/src/project-source-diff.css +79 -0
  47. package/src/project-source-diff.tsx +132 -0
  48. package/src/project-source-patch.ts +126 -0
  49. package/src/project-source-review-model.ts +113 -0
  50. package/src/project-source-review.tsx +217 -0
  51. package/src/pull-request-panel.tsx +134 -0
  52. package/src/remote-operations.ts +90 -0
  53. package/src/repository.ts +308 -0
  54. package/src/scratch-block-diff-renderer.ts +213 -0
  55. package/src/smart-http.ts +190 -0
  56. package/src/style.css +29 -0
  57. package/src/styles.d.ts +1 -0
  58. package/tsconfig.json +18 -0
  59. package/vite.config.ts +26 -0
@@ -0,0 +1,112 @@
1
+ export declare const messages: {
2
+ en: {
3
+ pullRequests: string;
4
+ localChanges: string;
5
+ title: string;
6
+ menu: string;
7
+ close: string;
8
+ choose: string;
9
+ refresh: string;
10
+ empty: string;
11
+ repository: string;
12
+ project: string;
13
+ none: string;
14
+ root: string;
15
+ open: string;
16
+ reload: string;
17
+ up: string;
18
+ browse: string;
19
+ replace: string;
20
+ dirty: string;
21
+ saved: string;
22
+ staged: string;
23
+ unstaged: string;
24
+ untracked: string;
25
+ commit: string;
26
+ history: string;
27
+ worktree: string;
28
+ clean: string;
29
+ branches: string;
30
+ unborn: string;
31
+ detached: string;
32
+ select: string;
33
+ binary: string;
34
+ large: string;
35
+ bytes: string;
36
+ mode: string;
37
+ permissions: string;
38
+ unchanged: string;
39
+ loading: string;
40
+ invalid: string;
41
+ changed: string;
42
+ outdated: string;
43
+ unsupported: string;
44
+ pullUnsafe: string;
45
+ diverged: string;
46
+ session: string;
47
+ pushUnknown: string;
48
+ pushRefresh: string;
49
+ rollbackFailed: string;
50
+ remoteFailed: string;
51
+ remoteDone: string;
52
+ pulledProject: string;
53
+ confirmPush: string;
54
+ failed: string;
55
+ };
56
+ ja: {
57
+ pullRequests: string;
58
+ localChanges: string;
59
+ title: string;
60
+ menu: string;
61
+ close: string;
62
+ choose: string;
63
+ refresh: string;
64
+ empty: string;
65
+ repository: string;
66
+ project: string;
67
+ none: string;
68
+ root: string;
69
+ open: string;
70
+ reload: string;
71
+ up: string;
72
+ browse: string;
73
+ replace: string;
74
+ dirty: string;
75
+ saved: string;
76
+ staged: string;
77
+ unstaged: string;
78
+ untracked: string;
79
+ commit: string;
80
+ history: string;
81
+ worktree: string;
82
+ clean: string;
83
+ branches: string;
84
+ unborn: string;
85
+ detached: string;
86
+ select: string;
87
+ binary: string;
88
+ large: string;
89
+ bytes: string;
90
+ mode: string;
91
+ permissions: string;
92
+ unchanged: string;
93
+ loading: string;
94
+ invalid: string;
95
+ changed: string;
96
+ outdated: string;
97
+ unsupported: string;
98
+ pullUnsafe: string;
99
+ diverged: string;
100
+ session: string;
101
+ pushUnknown: string;
102
+ pushRefresh: string;
103
+ rollbackFailed: string;
104
+ remoteFailed: string;
105
+ remoteDone: string;
106
+ pulledProject: string;
107
+ confirmPush: string;
108
+ failed: string;
109
+ };
110
+ };
111
+ export type Labels = typeof messages.en;
112
+ export declare const labelsFor: (locale: string) => Labels;
@@ -0,0 +1,58 @@
1
+ export declare function createMutationFs(root: FileSystemDirectoryHandle, worktree: boolean): {
2
+ fs: {
3
+ promises: {
4
+ readFile(raw: string, options?: string | {
5
+ encoding?: string;
6
+ }): Promise<string | Uint8Array<ArrayBuffer>>;
7
+ writeFile(raw: string, bytes: string | Uint8Array, options?: {
8
+ mode?: number;
9
+ }): Promise<undefined>;
10
+ mkdir(raw: string): Promise<undefined>;
11
+ unlink: (path: string) => Promise<undefined>;
12
+ rmdir: (path: string) => Promise<undefined>;
13
+ readdir: (raw: string) => Promise<string[]>;
14
+ stat: (raw: string) => Promise<{
15
+ isFile: () => boolean;
16
+ isDirectory: () => boolean;
17
+ isSymbolicLink: () => boolean;
18
+ size: number;
19
+ mode: number;
20
+ mtimeMs: number;
21
+ ctimeMs: number;
22
+ atimeMs: number;
23
+ birthtimeMs: number;
24
+ mtime: Date;
25
+ ctime: Date;
26
+ atime: Date;
27
+ birthtime: Date;
28
+ dev: number;
29
+ ino: number;
30
+ uid: number;
31
+ gid: number;
32
+ }>;
33
+ lstat: (raw: string) => Promise<{
34
+ isFile: () => boolean;
35
+ isDirectory: () => boolean;
36
+ isSymbolicLink: () => boolean;
37
+ size: number;
38
+ mode: number;
39
+ mtimeMs: number;
40
+ ctimeMs: number;
41
+ atimeMs: number;
42
+ birthtimeMs: number;
43
+ mtime: Date;
44
+ ctime: Date;
45
+ atime: Date;
46
+ birthtime: Date;
47
+ dev: number;
48
+ ino: number;
49
+ uid: number;
50
+ gid: number;
51
+ }>;
52
+ readlink: () => Promise<never>;
53
+ symlink: (path: string) => Promise<never>;
54
+ chmod: (path: string) => Promise<never>;
55
+ };
56
+ };
57
+ commit(guard: () => void): Promise<void>;
58
+ };
@@ -0,0 +1,101 @@
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res, err) => () => {
9
+ if (err) throw err[0];
10
+ try {
11
+ return fn && (res = fn(fn = 0)), res;
12
+ } catch (e) {
13
+ throw err = [e], e;
14
+ }
15
+ };
16
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
32
+ function _typeof(o) {
33
+ "@babel/helpers - typeof";
34
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
35
+ return typeof o;
36
+ } : function(o) {
37
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
38
+ }, _typeof(o);
39
+ }
40
+ var init_typeof = __esmMin((() => {}));
41
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
42
+ function toPrimitive(t, r) {
43
+ if ("object" != _typeof(t) || !t) return t;
44
+ var e = t[Symbol.toPrimitive];
45
+ if (void 0 !== e) {
46
+ var i = e.call(t, r || "default");
47
+ if ("object" != _typeof(i)) return i;
48
+ throw new TypeError("@@toPrimitive must return a primitive value.");
49
+ }
50
+ return ("string" === r ? String : Number)(t);
51
+ }
52
+ var init_toPrimitive = __esmMin((() => {
53
+ init_typeof();
54
+ }));
55
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
56
+ function toPropertyKey(t) {
57
+ var i = toPrimitive(t, "string");
58
+ return "symbol" == _typeof(i) ? i : i + "";
59
+ }
60
+ var init_toPropertyKey = __esmMin((() => {
61
+ init_typeof();
62
+ init_toPrimitive();
63
+ }));
64
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
65
+ function _defineProperty(e, r, t) {
66
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
67
+ value: t,
68
+ enumerable: !0,
69
+ configurable: !0,
70
+ writable: !0
71
+ }) : e[r] = t, e;
72
+ }
73
+ var init_defineProperty = __esmMin((() => {
74
+ init_toPropertyKey();
75
+ }));
76
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
77
+ function ownKeys(e, r) {
78
+ var t = Object.keys(e);
79
+ if (Object.getOwnPropertySymbols) {
80
+ var o = Object.getOwnPropertySymbols(e);
81
+ r && (o = o.filter(function(r) {
82
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
83
+ })), t.push.apply(t, o);
84
+ }
85
+ return t;
86
+ }
87
+ function _objectSpread2(e) {
88
+ for (var r = 1; r < arguments.length; r++) {
89
+ var t = null != arguments[r] ? arguments[r] : {};
90
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
91
+ _defineProperty(e, r, t[r]);
92
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
93
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
94
+ });
95
+ }
96
+ return e;
97
+ }
98
+ var init_objectSpread2 = __esmMin((() => {
99
+ init_defineProperty();
100
+ }));
101
+ export { __toESM as i, init_objectSpread2 as n, __commonJSMin as r, _objectSpread2 as t };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import type { ProjectBlockLocator } from './block-diff-location.js';
3
+ import type { ProjectBlockRenderer } from './scratch-block-diff-renderer.js';
4
+ import './project-source-diff.css';
5
+ export { createGitHubPullRequests, gitHubRepositoryFromOrigin } from './github-pull-requests.js';
6
+ export { ProjectSourceComparison, ProjectSourceReview } from './project-source-review.js';
7
+ export type { ProjectSourceComparisonProps, ProjectSourceReviewFile, ProjectSourceReviewProps } from './project-source-review.js';
8
+ export { createScratchBlocksDiffLocator } from './block-diff-location.js';
9
+ export type { ProjectBlockLocation, ProjectBlockLocator, ScratchBlockLocationWorkspace } from './block-diff-location.js';
10
+ export type { BlockPart } from './project-source-patch.js';
11
+ export { createProjectSourceDiff } from './project-source-patch.js';
12
+ export { createScratchBlocksDiffRenderer } from './scratch-block-diff-renderer.js';
13
+ export type { ProjectBlockRenderer, ScratchBlockDiffRendererOptions, ScratchBlocksPort } from './scratch-block-diff-renderer.js';
14
+ export interface ProjectSourceBlockDiffProps {
15
+ patch: string;
16
+ /** Supply the original JSON if the unified patch omits context. */
17
+ beforeSource?: string;
18
+ renderBlock: ProjectBlockRenderer;
19
+ locateBlock?: ProjectBlockLocator;
20
+ locale?: string;
21
+ }
22
+ export declare function ProjectSourceBlockDiff({ patch, beforeSource, renderBlock, locateBlock, locale }: ProjectSourceBlockDiffProps): React.JSX.Element;
@@ -0,0 +1,169 @@
1
+ import { a as gitHubRepositoryFromOrigin, c as compareProjectBlocks, d as BlockPreview, i as createGitHubPullRequests, l as createProjectSourceDiff, n as createScratchBlocksDiffLocator, o as ProjectSourceComparison, s as ProjectSourceReview, t as createScratchBlocksDiffRenderer, u as readProjectSourceDiff } from "./scratch-block-diff-renderer-CLYoOIB2.js";
2
+ import { n as init_objectSpread2, t as _objectSpread2 } from "./objectSpread2-Dkd68nJH.js";
3
+ import React, { useEffect, useMemo, useRef, useState } from "react";
4
+ // src/project-source-diff.tsx
5
+ init_objectSpread2();
6
+ var en = {
7
+ title: "Block changes",
8
+ before: "Before",
9
+ after: "After",
10
+ added: "Added",
11
+ removed: "Removed",
12
+ updated: "Changed",
13
+ inputs: "Inputs",
14
+ fields: "Fields",
15
+ opcode: "Block type",
16
+ mutation: "Block shape",
17
+ position: "Position",
18
+ connection: "Connections",
19
+ properties: "Other block properties",
20
+ absent: "No block on this side",
21
+ omitted: (count) => `${count} unchanged blocks omitted from the change list`,
22
+ context: "Highlight in the surrounding script",
23
+ more: "Show more changes",
24
+ noChanges: "No block changes.",
25
+ locate: "Highlight in Editor",
26
+ locating: "Finding the block in the Editor…",
27
+ located: "Highlighted in the Editor.",
28
+ missingLocation: "This version or block is unavailable in the Editor. Open its surrounding script here.",
29
+ partLegend: "Orange outlines mark changed inputs and fields.",
30
+ otherChanges: "The project also has changes outside its block code.",
31
+ invalid: "This diff could not be read. Use a full-context project diff, or provide the original project.",
32
+ loading: "Rendering blocks…",
33
+ unavailable: "This block could not be rendered. Check the block definitions available in the host."
34
+ };
35
+ var ja = {
36
+ title: "ブロックの変更",
37
+ before: "変更前",
38
+ after: "変更後",
39
+ added: "追加",
40
+ removed: "削除",
41
+ updated: "変更",
42
+ inputs: "入力値",
43
+ fields: "フィールド",
44
+ opcode: "ブロックの種類",
45
+ mutation: "ブロックの形",
46
+ position: "位置",
47
+ connection: "つなぎ方",
48
+ properties: "その他のブロック属性",
49
+ absent: "この側にはブロックがありません",
50
+ omitted: (count) => `変更のないブロック ${count} 個を一覧から省略`,
51
+ context: "元のスクリプト内で強調",
52
+ more: "続きを表示",
53
+ noChanges: "ブロックの変更はありません。",
54
+ locate: "編集画面で強調",
55
+ locating: "編集画面でブロックを検索中…",
56
+ located: "編集画面で強調しました。",
57
+ missingLocation: "編集画面に該当する版またはブロックがありません。元のスクリプトをここで展開できます。",
58
+ partLegend: "オレンジの枠は、変更された入力欄やフィールドです。",
59
+ otherChanges: "ブロックのコード以外にも作品の変更があります。",
60
+ invalid: "差分を読み込めません。全体の文脈を含む差分を使うか、変更前の作品を指定してください。",
61
+ loading: "ブロックを描画中…",
62
+ unavailable: "ブロックを描画できません。ホストのブロック定義を確認してください。"
63
+ };
64
+ var propertyLabels = /* @__PURE__ */ new Map([
65
+ ["inputs", "inputs"],
66
+ ["fields", "fields"],
67
+ ["opcode", "opcode"],
68
+ ["mutation", "mutation"],
69
+ ["x", "position"],
70
+ ["y", "position"],
71
+ ["next", "connection"],
72
+ ["parent", "connection"],
73
+ ["topLevel", "connection"]
74
+ ]);
75
+ function ChangeCard({ change, renderBlock, labels, onLocate, location }) {
76
+ var _change$after;
77
+ const [withContext, setWithContext] = useState(false);
78
+ const notes = [...new Set(change.fields.map((field) => {
79
+ var _propertyLabels$get;
80
+ return labels[(_propertyLabels$get = propertyLabels.get(field)) !== null && _propertyLabels$get !== void 0 ? _propertyLabels$get : "properties"];
81
+ }))];
82
+ const name = ((_change$after = change.after) !== null && _change$after !== void 0 ? _change$after : change.before).target.name;
83
+ return /* @__PURE__ */ React.createElement("article", { className: `twgit-block-diff-card twgit-block-diff-${change.kind}` }, /* @__PURE__ */ React.createElement("header", null, /* @__PURE__ */ React.createElement("h3", null, /* @__PURE__ */ React.createElement("span", null, labels[change.kind]), " ", name), !!notes.length && /* @__PURE__ */ React.createElement("p", null, notes.join(" · ")), !!change.parts.length && /* @__PURE__ */ React.createElement("p", { className: "twgit-block-diff-legend" }, labels.partLegend)), /* @__PURE__ */ React.createElement("div", { className: "twgit-block-diff-sides" }, ["before", "after"].map((version) => /* @__PURE__ */ React.createElement(BlockPreview, {
84
+ key: version,
85
+ side: change[version],
86
+ title: labels[version],
87
+ renderBlock,
88
+ withContext,
89
+ labels,
90
+ parts: change.parts,
91
+ onLocate: onLocate && (() => onLocate(version)),
92
+ locationStatus: (location === null || location === void 0 ? void 0 : location.version) === version ? location.status : void 0
93
+ }))), /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("input", {
94
+ type: "checkbox",
95
+ checked: withContext,
96
+ onChange: (event) => setWithContext(event.currentTarget.checked)
97
+ }), " ", labels.context));
98
+ }
99
+ var pageSize = 12;
100
+ var empty = {
101
+ changes: [],
102
+ unchanged: 0,
103
+ otherChanges: false
104
+ };
105
+ function ProjectSourceBlockDiff({ patch, beforeSource, renderBlock, locateBlock, locale = "en" }) {
106
+ const labels = locale.startsWith("ja") ? ja : en;
107
+ const result = useMemo(() => {
108
+ try {
109
+ const projects = readProjectSourceDiff(patch, beforeSource);
110
+ return projects ? compareProjectBlocks(...projects) : empty;
111
+ } catch (_unused) {
112
+ return null;
113
+ }
114
+ }, [patch, beforeSource]);
115
+ const [page, setPage] = useState({
116
+ result,
117
+ visible: pageSize
118
+ });
119
+ const request = useRef();
120
+ const [location, setLocation] = useState();
121
+ useEffect(() => () => {
122
+ var _request$current;
123
+ return (_request$current = request.current) === null || _request$current === void 0 ? void 0 : _request$current.abort();
124
+ }, [result, locateBlock]);
125
+ const locate = async (change, version) => {
126
+ var _request$current2;
127
+ const side = change[version];
128
+ if (!side || !locateBlock) return;
129
+ (_request$current2 = request.current) === null || _request$current2 === void 0 || _request$current2.abort();
130
+ const controller = new AbortController();
131
+ request.current = controller;
132
+ const selected = {
133
+ result,
134
+ key: change.key,
135
+ version,
136
+ locator: locateBlock
137
+ };
138
+ setLocation(_objectSpread2(_objectSpread2({}, selected), {}, { status: "locating" }));
139
+ let found = false;
140
+ try {
141
+ found = await locateBlock(_objectSpread2(_objectSpread2({}, side), {}, {
142
+ version,
143
+ parts: change.parts,
144
+ signal: controller.signal
145
+ }));
146
+ } catch (_unused2) {}
147
+ if (!controller.signal.aborted) setLocation(_objectSpread2(_objectSpread2({}, selected), {}, { status: found ? "located" : "missingLocation" }));
148
+ };
149
+ if (!result) return /* @__PURE__ */ React.createElement("p", { role: "alert" }, labels.invalid);
150
+ const visible = page.result === result ? page.visible : pageSize;
151
+ return /* @__PURE__ */ React.createElement("section", {
152
+ className: "twgit-block-diff",
153
+ "aria-label": labels.title
154
+ }, /* @__PURE__ */ React.createElement("h2", null, labels.title, " · ", result.changes.length), result.unchanged > 0 && /* @__PURE__ */ React.createElement("p", null, labels.omitted(result.unchanged)), result.otherChanges && /* @__PURE__ */ React.createElement("p", null, labels.otherChanges), !result.changes.length && /* @__PURE__ */ React.createElement("p", null, labels.noChanges), result.changes.slice(0, visible).map((change) => /* @__PURE__ */ React.createElement(ChangeCard, {
155
+ key: change.key,
156
+ change,
157
+ renderBlock,
158
+ labels,
159
+ onLocate: locateBlock && ((version) => void locate(change, version)),
160
+ location: (location === null || location === void 0 ? void 0 : location.result) === result && location.locator === locateBlock && location.key === change.key ? location : void 0
161
+ })), visible < result.changes.length && /* @__PURE__ */ React.createElement("button", {
162
+ type: "button",
163
+ onClick: () => setPage({
164
+ result,
165
+ visible: visible + pageSize
166
+ })
167
+ }, labels.more));
168
+ }
169
+ export { ProjectSourceBlockDiff, ProjectSourceComparison, ProjectSourceReview, createGitHubPullRequests, createProjectSourceDiff, createScratchBlocksDiffLocator, createScratchBlocksDiffRenderer, gitHubRepositoryFromOrigin };
@@ -0,0 +1,39 @@
1
+ export type BlockTable = Record<string, unknown>;
2
+ export interface ProjectTarget {
3
+ name: string;
4
+ isStage: boolean;
5
+ blocks: BlockTable;
6
+ }
7
+ export type ProjectSource = Record<string, unknown> & {
8
+ targets: ProjectTarget[];
9
+ };
10
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
11
+ /** Reads one version of a project.source.json. `null` stands for a version in which the file does not exist. */
12
+ export declare function parseProjectSource(source: string | null): ProjectSource;
13
+ /** Keep the original lines and include enough context to render both sides from the patch alone. */
14
+ export declare function createProjectSourceDiff(before: string, after: string): string;
15
+ export declare function readProjectSourceDiff(patch: string, beforeSource?: string): [ProjectSource, ProjectSource] | null;
16
+ export declare function equal(a: unknown, b: unknown): boolean;
17
+ export declare const targetKey: (target: ProjectTarget) => string;
18
+ export interface BlockSide {
19
+ target: ProjectTarget;
20
+ id: string;
21
+ }
22
+ export interface BlockPart {
23
+ kind: 'input' | 'field';
24
+ name: string;
25
+ }
26
+ export type BlockChangeKind = 'added' | 'removed' | 'updated';
27
+ export interface BlockChange {
28
+ key: string;
29
+ before?: BlockSide;
30
+ after?: BlockSide;
31
+ kind: BlockChangeKind;
32
+ fields: string[];
33
+ parts: BlockPart[];
34
+ }
35
+ export declare function compareProjectBlocks(before: ProjectSource, after: ProjectSource): {
36
+ changes: BlockChange[];
37
+ unchanged: number;
38
+ otherChanges: boolean;
39
+ };
@@ -0,0 +1,20 @@
1
+ import type { BlockSide, ProjectSource } from './project-source-patch.js';
2
+ import type { ScriptBlockMark } from './scratch-block-diff-renderer.js';
3
+ export interface ScriptReviewSide extends BlockSide {
4
+ marks: ScriptBlockMark[];
5
+ }
6
+ export interface ScriptReview {
7
+ id: string;
8
+ before: ScriptReviewSide[];
9
+ after: ScriptReviewSide[];
10
+ }
11
+ export interface TargetReview {
12
+ name: string;
13
+ isStage: boolean;
14
+ scripts: ScriptReview[];
15
+ properties: string[];
16
+ }
17
+ export declare function compareProjectForReview(before: ProjectSource, after: ProjectSource): {
18
+ targets: TargetReview[];
19
+ properties: string[];
20
+ };
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import type { ProjectBlockRenderer } from './scratch-block-diff-renderer.js';
3
+ export type ProjectSourceReviewFile = {
4
+ path: string;
5
+ summary?: string;
6
+ previousPath?: string;
7
+ unavailable?: boolean;
8
+ } & ({
9
+ patch: string;
10
+ beforeSource?: string;
11
+ } | {
12
+ status: 'added' | 'removed' | 'updated';
13
+ });
14
+ export interface ProjectSourceReviewProps {
15
+ title: string;
16
+ description?: string;
17
+ verification?: readonly string[];
18
+ files: readonly ProjectSourceReviewFile[];
19
+ renderBlock: ProjectBlockRenderer;
20
+ locale?: string;
21
+ }
22
+ export interface ProjectSourceComparisonProps {
23
+ /** The earlier project.source.json, or `null` when the file did not exist yet. */
24
+ before: string | null;
25
+ /** The later project.source.json, or `null` when the file was removed. */
26
+ after: string | null;
27
+ renderBlock: ProjectBlockRenderer;
28
+ locale?: string;
29
+ /** Shown after an explanation when either version cannot be read as a project. Without it, only an error is shown. */
30
+ fallback?: React.ReactNode;
31
+ }
32
+ /** Compares two versions of a project.source.json by stage, sprite and script, as the pull request review does. */
33
+ export declare function ProjectSourceComparison({ before, after, renderBlock, locale, fallback }: ProjectSourceComparisonProps): React.JSX.Element;
34
+ export declare function ProjectSourceReview({ title, description, verification, files, renderBlock, locale }: ProjectSourceReviewProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ProjectBlockRenderer } from './scratch-block-diff-renderer.js';
3
+ import type { Repository } from './repository.js';
4
+ export declare function PullRequestReviewPanel({ repository, locale, renderBlock }: {
5
+ repository: Repository;
6
+ locale: string;
7
+ renderBlock: ProjectBlockRenderer;
8
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { GitSmartHttpOptions } from './smart-http.js';
2
+ export type RemoteOperation = 'fetch' | 'pull' | 'push';
3
+ export type RemoteSession = NonNullable<Awaited<ReturnType<GitSmartHttpOptions['getSession']>>>;
4
+ export type GetRemoteSession = (remote: string, write: boolean) => Promise<RemoteSession | null>;
5
+ export declare function runRemoteOperation(root: FileSystemDirectoryHandle, operation: RemoteOperation, getSession: GetRemoteSession, guard: () => void, signal?: AbortSignal): Promise<void>;