@kubohiroya/turbowarp-plus-editor-workbench 0.15.0 → 0.17.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/NOTICE +26 -0
- package/README.ja.md +33 -0
- package/README.md +33 -0
- package/dist/backpack-script.d.ts +2 -0
- package/dist/backpack-script.js +23 -0
- package/dist/backpack.d.ts +60 -0
- package/dist/backpack.js +226 -0
- package/dist/browser-tab-title.d.ts +2 -0
- package/dist/browser-tab-title.js +5 -0
- package/dist/busy-cursor.d.ts +22 -0
- package/dist/busy-cursor.js +107 -0
- package/dist/debugger-breakpoints.d.ts +91 -0
- package/dist/debugger-breakpoints.js +310 -0
- package/dist/edit-menu.d.ts +57 -0
- package/dist/edit-menu.js +99 -0
- package/dist/info-menu.d.ts +39 -0
- package/dist/info-menu.js +157 -0
- package/dist/project-file-dialogs.d.ts +70 -0
- package/dist/project-file-dialogs.js +625 -0
- package/dist/project-file-menu.d.ts +43 -0
- package/dist/project-file-menu.js +90 -0
- package/dist/project-load-progress-view.d.ts +6 -0
- package/dist/project-load-progress-view.js +66 -0
- package/dist/project-load-progress.d.ts +26 -0
- package/dist/project-load-progress.js +104 -0
- package/dist/project-search-box.d.ts +43 -0
- package/dist/project-search-box.js +437 -0
- package/dist/project-size-approval.d.ts +10 -0
- package/dist/project-size-approval.js +64 -0
- package/dist/stage-controls-view.d.ts +45 -0
- package/dist/stage-controls-view.js +127 -0
- package/dist/stage-controls.d.ts +98 -0
- package/dist/stage-controls.js +110 -0
- package/package.json +101 -28
- package/src/backpack-script.ts +21 -0
- package/src/backpack.tsx +260 -0
- package/src/browser-tab-title.ts +6 -0
- package/src/busy-cursor.ts +108 -0
- package/src/debugger-breakpoints.ts +413 -0
- package/src/debugger-panel.css +13 -0
- package/src/edit-menu.css +42 -0
- package/src/edit-menu.tsx +139 -0
- package/src/info-menu.css +172 -0
- package/src/info-menu.tsx +221 -0
- package/src/project-file-dialogs.ts +654 -0
- package/src/project-file-menu.css +94 -0
- package/src/project-file-menu.tsx +137 -0
- package/src/project-load-progress-view.tsx +75 -0
- package/src/project-load-progress.css +57 -0
- package/src/project-load-progress.ts +118 -0
- package/src/project-search-box.tsx +469 -0
- package/src/project-search.css +116 -0
- package/src/project-size-approval.ts +74 -0
- package/src/stage-controls-view.tsx +178 -0
- package/src/stage-controls.css +192 -0
- package/src/stage-controls.ts +124 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const projectTitleFieldClassName = 'tw-info-menu__project-title-field';
|
|
3
|
+
export const projectTitleGroupClassName = 'tw-info-menu__project-title-group';
|
|
4
|
+
// Octicons mark-github-16 and law-16. See the distribution's NOTICE.
|
|
5
|
+
const githubPath = 'M6.766 11.328c-2.063-.25-3.516-1.734-3.516-3.656 0-.781.281-1.625.75-2.188-.203-.515-.172-1.609.063-2.062.625-.078 1.468.25 1.968.703.594-.187 1.219-.281 1.985-.281.765 0 1.39.094 1.953.265.484-.437 1.344-.765 1.969-.687.218.422.25 1.515.046 2.047.5.593.766 1.39.766 2.203 0 1.922-1.453 3.375-3.547 3.64.531.344.89 1.094.89 1.954v1.625c0 .468.391.734.86.547C13.781 14.359 16 11.53 16 8.03 16 3.61 12.406 0 7.984 0 3.563 0 0 3.61 0 8.031a7.88 7.88 0 0 0 5.172 7.422c.422.156.828-.125.828-.547v-1.25c-.219.094-.5.156-.75.156-1.031 0-1.64-.562-2.078-1.609-.172-.422-.36-.672-.719-.719-.187-.015-.25-.093-.25-.187 0-.188.313-.328.625-.328.453 0 .844.281 1.25.86.313.452.64.655 1.031.655s.641-.14 1-.5c.266-.265.47-.5.657-.656';
|
|
6
|
+
const licensePath = 'M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.245.245 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z';
|
|
7
|
+
const newTabIcon = (React.createElement("svg", { className: "tw-info-menu__new-tab-icon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" },
|
|
8
|
+
React.createElement("path", { d: "M8 3H3v10h10V8M10 3h3v3m0-3L7 9" })));
|
|
9
|
+
export function ProjectInfoMenu({ locale, version, logo, leading, displaySettings, renderRuntimeSettings, addons, advanced, githubConnection, aiAgents, openAbout, openPrivacy, sourceUrl = 'https://github.com/kubohiroya/turbowarp-plus-editor' }) {
|
|
10
|
+
const menu = React.useRef(null);
|
|
11
|
+
const trigger = React.useRef(null);
|
|
12
|
+
const displayTrigger = React.useRef(null);
|
|
13
|
+
const runtimeTrigger = React.useRef(null);
|
|
14
|
+
const displayList = React.useRef(null);
|
|
15
|
+
const [open, setOpen] = React.useState(false);
|
|
16
|
+
const [submenu, setSubmenu] = React.useState(null);
|
|
17
|
+
const japanese = /^ja(?:-|$)/i.test(locale);
|
|
18
|
+
const label = japanese ? 'TurboWarp Plus プロジェクト情報' : 'TurboWarp Plus project information';
|
|
19
|
+
const product = `TurboWarp Plus Editor ${version}`;
|
|
20
|
+
const displayLabel = japanese ? '表示設定' : 'Display settings';
|
|
21
|
+
const runtimeLabel = japanese ? '動作設定' : 'Runtime settings';
|
|
22
|
+
const newTabLabel = japanese ? '別のタブで開きます' : 'Opens in a new tab';
|
|
23
|
+
const aboutLabel = japanese ? `${product}について` : `About ${product}`;
|
|
24
|
+
const closeDisplay = displaySettings?.onClose;
|
|
25
|
+
const close = React.useCallback(() => {
|
|
26
|
+
if (submenu === 'display')
|
|
27
|
+
closeDisplay?.();
|
|
28
|
+
setSubmenu(null);
|
|
29
|
+
setOpen(false);
|
|
30
|
+
}, [submenu, closeDisplay]);
|
|
31
|
+
const closeAndFocus = React.useCallback(() => {
|
|
32
|
+
close();
|
|
33
|
+
trigger.current.focus({ preventScroll: true });
|
|
34
|
+
}, [close]);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
if (!open)
|
|
37
|
+
return;
|
|
38
|
+
const node = menu.current;
|
|
39
|
+
const dismiss = (event) => {
|
|
40
|
+
if (!node.contains(event.target))
|
|
41
|
+
close();
|
|
42
|
+
};
|
|
43
|
+
node.ownerDocument.addEventListener('pointerdown', dismiss, true);
|
|
44
|
+
return () => node.ownerDocument.removeEventListener('pointerdown', dismiss, true);
|
|
45
|
+
}, [open, close]);
|
|
46
|
+
// The native theme and language actions close the GUI settings menu when selected.
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
if (submenu === 'display' && !displaySettings?.open)
|
|
49
|
+
closeAndFocus();
|
|
50
|
+
}, [submenu, displaySettings?.open, closeAndFocus]);
|
|
51
|
+
React.useLayoutEffect(() => {
|
|
52
|
+
if (!displayList.current)
|
|
53
|
+
return;
|
|
54
|
+
// The reused GUI settings are list items whose click handlers live on the item or its content.
|
|
55
|
+
for (const item of displayList.current.querySelectorAll('li'))
|
|
56
|
+
item.tabIndex = 0;
|
|
57
|
+
}, [submenu]);
|
|
58
|
+
const RuntimeItem = React.useCallback(function RuntimeItem({ children, className, closeOnSelect, onClick }) {
|
|
59
|
+
return React.createElement("button", { className: className ? `tw-info-menu__entry ${className}` : 'tw-info-menu__entry', type: "button", onClick: event => {
|
|
60
|
+
if (closeOnSelect)
|
|
61
|
+
close();
|
|
62
|
+
onClick(event);
|
|
63
|
+
} }, children);
|
|
64
|
+
}, [close]);
|
|
65
|
+
const toggleSubmenu = (name) => {
|
|
66
|
+
if (submenu === 'display')
|
|
67
|
+
closeDisplay?.();
|
|
68
|
+
if (submenu === name) {
|
|
69
|
+
setSubmenu(null);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (name === 'display')
|
|
73
|
+
displaySettings.onOpen();
|
|
74
|
+
setSubmenu(name);
|
|
75
|
+
};
|
|
76
|
+
const action = (label, item, opensInNewTab = false) => item && (React.createElement("button", { className: "tw-info-menu__entry", type: "button", title: opensInNewTab ? newTabLabel : undefined, onClick: event => {
|
|
77
|
+
close();
|
|
78
|
+
item.onClick(event);
|
|
79
|
+
} },
|
|
80
|
+
typeof item.icon === 'string' ? React.createElement("img", { src: item.icon, alt: "", draggable: false }) : item.icon,
|
|
81
|
+
label,
|
|
82
|
+
opensInNewTab && newTabIcon));
|
|
83
|
+
const activateDisplayItem = (event) => {
|
|
84
|
+
if ((event.key !== 'Enter' && event.key !== ' ') || !(event.target instanceof HTMLLIElement))
|
|
85
|
+
return;
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
const content = event.target.firstElementChild;
|
|
88
|
+
(content instanceof HTMLElement ? content : event.target).click();
|
|
89
|
+
};
|
|
90
|
+
const className = leading ? `tw-info-menu tw-info-menu__leading` : 'tw-info-menu';
|
|
91
|
+
return React.createElement("details", { className: className, ref: menu, open: open, onKeyDown: event => {
|
|
92
|
+
if (event.key === ' ' &&
|
|
93
|
+
(event.target instanceof HTMLButtonElement || event.target === trigger.current)) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
event.stopPropagation();
|
|
96
|
+
if (!event.repeat)
|
|
97
|
+
event.target.click();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (event.key !== 'Escape' || !open)
|
|
101
|
+
return;
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
event.stopPropagation();
|
|
104
|
+
if (submenu) {
|
|
105
|
+
const button = submenu === 'display' ? displayTrigger : runtimeTrigger;
|
|
106
|
+
toggleSubmenu(submenu);
|
|
107
|
+
button.current.focus({ preventScroll: true });
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
closeAndFocus();
|
|
111
|
+
} },
|
|
112
|
+
React.createElement("summary", { ref: trigger, "aria-label": label, title: label, onClick: event => {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
if (open)
|
|
115
|
+
close();
|
|
116
|
+
else
|
|
117
|
+
setOpen(true);
|
|
118
|
+
} },
|
|
119
|
+
React.createElement("img", { src: logo, alt: "", draggable: false })),
|
|
120
|
+
React.createElement("nav", { "aria-label": label },
|
|
121
|
+
openAbout ? React.createElement("button", { className: `tw-info-menu__entry tw-info-menu__indented`, type: "button", onClick: () => {
|
|
122
|
+
close();
|
|
123
|
+
openAbout();
|
|
124
|
+
} }, aboutLabel) :
|
|
125
|
+
React.createElement("a", { className: `tw-info-menu__entry tw-info-menu__indented`, href: "./", target: "_blank", rel: "noreferrer", title: newTabLabel, onClick: close },
|
|
126
|
+
aboutLabel,
|
|
127
|
+
newTabIcon),
|
|
128
|
+
openPrivacy && React.createElement("button", { className: `tw-info-menu__entry tw-info-menu__indented`, type: "button", onClick: () => {
|
|
129
|
+
close();
|
|
130
|
+
openPrivacy();
|
|
131
|
+
} }, japanese ? 'プライバシー' : 'Privacy'),
|
|
132
|
+
displaySettings && React.createElement("div", { className: "tw-info-menu__branch" },
|
|
133
|
+
React.createElement("button", { className: `tw-info-menu__entry tw-info-menu__indented`, type: "button", ref: displayTrigger, "aria-expanded": submenu === 'display', onClick: () => toggleSubmenu('display') },
|
|
134
|
+
displayLabel,
|
|
135
|
+
React.createElement("span", { className: "tw-info-menu__caret", "aria-hidden": "true" })),
|
|
136
|
+
submenu === 'display' && React.createElement("ul", { className: `tw-info-menu__flyout tw-info-menu__display`, ref: displayList, "aria-label": displayLabel, onKeyDown: activateDisplayItem }, displaySettings.items)),
|
|
137
|
+
renderRuntimeSettings && React.createElement("div", { className: "tw-info-menu__branch" },
|
|
138
|
+
React.createElement("button", { className: `tw-info-menu__entry tw-info-menu__indented`, type: "button", ref: runtimeTrigger, "aria-expanded": submenu === 'runtime', onClick: () => toggleSubmenu('runtime') },
|
|
139
|
+
runtimeLabel,
|
|
140
|
+
React.createElement("span", { className: "tw-info-menu__caret", "aria-hidden": "true" })),
|
|
141
|
+
submenu === 'runtime' && React.createElement("div", { className: "tw-info-menu__flyout", role: "group", "aria-label": runtimeLabel }, renderRuntimeSettings(RuntimeItem))),
|
|
142
|
+
action(japanese ? 'アドオン' : 'Addons', addons, true),
|
|
143
|
+
action(japanese ? '高度な設定' : 'Advanced Settings', advanced),
|
|
144
|
+
action(japanese ? 'GitHub 接続設定…' : 'GitHub Connection Settings…', githubConnection),
|
|
145
|
+
action(japanese ? 'AI エージェント設定…' : 'AI agent settings…', aiAgents),
|
|
146
|
+
React.createElement("hr", { className: "tw-info-menu__divider" }),
|
|
147
|
+
React.createElement("a", { className: "tw-info-menu__entry", href: sourceUrl, target: "_blank", rel: "noreferrer", title: newTabLabel, onClick: close },
|
|
148
|
+
React.createElement("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" },
|
|
149
|
+
React.createElement("path", { d: githubPath })),
|
|
150
|
+
japanese ? 'ソースコード' : 'Source code',
|
|
151
|
+
newTabIcon),
|
|
152
|
+
React.createElement("a", { className: "tw-info-menu__entry", href: "credits.html", target: "_blank", rel: "noreferrer", title: newTabLabel, onClick: close },
|
|
153
|
+
React.createElement("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" },
|
|
154
|
+
React.createElement("path", { d: licensePath })),
|
|
155
|
+
japanese ? 'ライセンスとクレジット' : 'Licenses and credits',
|
|
156
|
+
newTabIcon)));
|
|
157
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { CreationInteraction, GitHubCreationAccount, GitHubRepositoryDraft, RepositoryCreationControls, RepositoryCreationProgress } from '@kubohiroya/turbowarp-plus-editor-git/project-repository-creation';
|
|
2
|
+
export type Action = () => void;
|
|
3
|
+
export type FolderActions = {
|
|
4
|
+
open: Action;
|
|
5
|
+
save?: Action;
|
|
6
|
+
detach: Action;
|
|
7
|
+
};
|
|
8
|
+
export type SaveFormat = 'current' | 'embedded' | 'folder';
|
|
9
|
+
type Serialize = <T>(run: () => T) => T;
|
|
10
|
+
export type SaveAsRequest = {
|
|
11
|
+
name: string;
|
|
12
|
+
format: 'current' | 'embedded';
|
|
13
|
+
} | {
|
|
14
|
+
name: string;
|
|
15
|
+
format: 'folder';
|
|
16
|
+
git?: GitHubRepositoryDraft;
|
|
17
|
+
};
|
|
18
|
+
export interface SaveAsFormOptions {
|
|
19
|
+
openCommit?: Action;
|
|
20
|
+
folder?: {
|
|
21
|
+
overwriteWarning?: string;
|
|
22
|
+
github?: {
|
|
23
|
+
connectForCreation(interaction: CreationInteraction): Promise<GitHubCreationAccount | null>;
|
|
24
|
+
licenses?: readonly {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}[];
|
|
28
|
+
publication?: RepositoryCreationControls;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface ProjectFileStorage {
|
|
33
|
+
canSave: boolean;
|
|
34
|
+
filename: string;
|
|
35
|
+
overwrite?: Action;
|
|
36
|
+
pick?: (filename: string) => Promise<FileSystemFileHandle>;
|
|
37
|
+
write(handle: FileSystemFileHandle, serialize: Serialize, current: () => boolean): Promise<void>;
|
|
38
|
+
download(filename: string, serialize: Serialize, current: () => boolean): Promise<void>;
|
|
39
|
+
finish(handle: FileSystemFileHandle | null, title: string, unchanged: boolean): void;
|
|
40
|
+
fail(error: unknown): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Saving over the last file or into the project folder first collects edits held by other windows,
|
|
44
|
+
* as Save As does, so a save that does not move the focus to the editor misses nothing. A failed
|
|
45
|
+
* collection reports the failure, does not save, and leaves those edits for a retry.
|
|
46
|
+
*/
|
|
47
|
+
export declare function collectBeforeSaving(storage: ProjectFileStorage, folder: FolderActions | undefined, collect: () => Promise<void>): {
|
|
48
|
+
storage: ProjectFileStorage;
|
|
49
|
+
folder: FolderActions;
|
|
50
|
+
};
|
|
51
|
+
export declare function projectSaveShortcut(storage: ProjectFileStorage, folder?: FolderActions, saveAs?: Action): void;
|
|
52
|
+
export declare function saveProjectAs(storage: ProjectFileStorage, name: string, { current, unchanged, serialize, committed, collect }: {
|
|
53
|
+
current(): boolean;
|
|
54
|
+
unchanged(): boolean;
|
|
55
|
+
serialize<T>(title: string, run: () => T): T;
|
|
56
|
+
committed(): void;
|
|
57
|
+
collect?(): Promise<void>;
|
|
58
|
+
}): Promise<boolean>;
|
|
59
|
+
export declare function renderSaveAsForm(document: Document, locale: string, storage: ProjectFileStorage, save: (request: SaveAsRequest, open: () => boolean, signal: AbortSignal) => Promise<boolean | RepositoryCreationProgress | null>, close: Action, { folder, openCommit }?: SaveAsFormOptions): HTMLFormElement;
|
|
60
|
+
export declare function renderExportView(document: Document, locale: string, close: Action, run: Action): HTMLDivElement;
|
|
61
|
+
export type ExtensionStorage = 'remote-non-cacheable' | 'remote-cacheable' | 'embedded-file' | 'embedded-data';
|
|
62
|
+
export declare function renderExtensionsForm(document: Document, locale: string, close: Action, add: Action | undefined, { list, change }: {
|
|
63
|
+
list(): Promise<{
|
|
64
|
+
id: string;
|
|
65
|
+
format?: ExtensionStorage;
|
|
66
|
+
editable?: boolean;
|
|
67
|
+
}[]>;
|
|
68
|
+
change(changes: Map<string, ExtensionStorage>): Promise<void>;
|
|
69
|
+
}): HTMLFormElement;
|
|
70
|
+
export {};
|