@kubohiroya/turbowarp-plus-editor-workbench 0.21.0 → 0.23.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/dist/extension-file-menu.d.ts +3 -0
- package/dist/extension-file-menu.js +6 -1
- package/dist/project-file-dialogs.d.ts +3 -0
- package/dist/project-file-menu.d.ts +1 -0
- package/dist/project-file-menu.js +10 -3
- package/package.json +1 -1
- package/src/extension-file-menu.ts +6 -1
- package/src/project-file-dialogs.ts +4 -1
- package/src/project-file-menu.tsx +13 -3
|
@@ -24,7 +24,12 @@ const glyphs = {
|
|
|
24
24
|
save: 'M4 3h13l3 3v15H4z M8 3v6h8V3 M8 21v-7h8v7',
|
|
25
25
|
copy: 'M8 8h12v13H8z M16 8V3H3v13h5',
|
|
26
26
|
remix: 'M18 8a7 7 0 1 0 0 8 M18 3v5h-5 M18 8l2-2',
|
|
27
|
-
|
|
27
|
+
// An SB3 file is one file: a page with an arrow, set apart from the folder of Open Folder….
|
|
28
|
+
open: 'M5 3h9l5 5v13H5z M14 3v5h5 M12 18v-7 M9 14l3-3 3 3',
|
|
29
|
+
'project-folder-open': 'M3 6h7l2 2h9l-2 11H3z M3 11h16',
|
|
30
|
+
'project-folder-open-browser': 'M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z M3 9h18 M6 6.5h.01 M8.5 6.5h.01 M11 6.5h.01',
|
|
31
|
+
// A remote Git repository: a cloud with an arrow down, fetched onto the device.
|
|
32
|
+
'git-open-remote': 'M7 18H6.5a4.5 4.5 0 0 1-.5-8.97A6 6 0 0 1 17.5 9a4.5 4.5 0 0 1 0 9H17 M12 12v9 M8.5 17.5 12 21l3.5-3.5',
|
|
28
33
|
'save-as': 'M4 3h13l3 3v15H4z M8 3v6h8V3 M9 17h6 M12 14v6',
|
|
29
34
|
download: 'M12 3v12 M7 10l5 5 5-5 M4 17v4h16v-4',
|
|
30
35
|
package: 'm12 3 8 4v10l-8 4-8-4V7z M4 7l8 4 8-4 M12 11v10 M8 5l8 4',
|
|
@@ -2,6 +2,9 @@ import type { CreationInteraction, GitHubCreationAccount, GitHubRepositoryDraft,
|
|
|
2
2
|
export type Action = () => void;
|
|
3
3
|
export type FolderActions = {
|
|
4
4
|
open: Action;
|
|
5
|
+
openBrowser?: Action;
|
|
6
|
+
/** Whether Open can pick a folder on the device; `false` in browsers without the folder picker (Safari, Firefox). */
|
|
7
|
+
deviceFolders?: boolean;
|
|
5
8
|
save?: Action;
|
|
6
9
|
detach: Action;
|
|
7
10
|
};
|
|
@@ -52,10 +52,10 @@ export default function ProjectFileMenu({ locale, MenuItem, MenuSection, close,
|
|
|
52
52
|
React.useLayoutEffect(() => workspace?.subscribeSave(redraw), [workspace]);
|
|
53
53
|
const tabShortcut = workspace?.saveScope === 'tab';
|
|
54
54
|
const mac = isMacPlatform();
|
|
55
|
-
const item = ([command, label, action, showShortcut]) => {
|
|
55
|
+
const item = ([command, label, action, showShortcut, unavailable]) => {
|
|
56
56
|
const run = action && (() => { close(); action(); });
|
|
57
57
|
return React.createElement(MenuItem, { key: command, command: command, onClick: run },
|
|
58
|
-
React.createElement("span", { className: "tw-project-file-menu__item", role: "button", "aria-disabled": !run || undefined, tabIndex: run ? 0 : -1, "aria-keyshortcuts": showShortcut ? (mac ? 'Meta+S' : 'Control+S') : undefined, style: !run ? { opacity: 0.5, cursor: 'default' } : undefined, onKeyDown: event => {
|
|
58
|
+
React.createElement("span", { className: "tw-project-file-menu__item", role: "button", "aria-disabled": !run || undefined, tabIndex: run ? 0 : -1, title: !run ? unavailable : undefined, "aria-keyshortcuts": showShortcut ? (mac ? 'Meta+S' : 'Control+S') : undefined, style: !run ? { opacity: 0.5, cursor: 'default' } : undefined, onKeyDown: event => {
|
|
59
59
|
if (!run || (event.key !== 'Enter' && event.key !== ' '))
|
|
60
60
|
return;
|
|
61
61
|
event.preventDefault();
|
|
@@ -71,7 +71,14 @@ export default function ProjectFileMenu({ locale, MenuItem, MenuSection, close,
|
|
|
71
71
|
e.newWindow && item(['window', ja ? '新しいウィンドウ' : 'New Window', e.newWindow]),
|
|
72
72
|
React.createElement(MenuSection, null,
|
|
73
73
|
item(['open', ja ? 'SB3ファイルを開く…' : 'Open SB3 File…', e.open]),
|
|
74
|
-
e.folder && item(['project-folder-open', ja ? '
|
|
74
|
+
e.folder && item(['project-folder-open', ja ? 'フォルダを開く…' : 'Open Folder…',
|
|
75
|
+
e.folder.deviceFolders === false ? undefined : e.folder.open, false,
|
|
76
|
+
ja ? 'このブラウザーでは端末のフォルダを開けません。Chrome か Edge を使うか、ブラウザーに保存したフォルダを開いてください。' :
|
|
77
|
+
'This browser cannot open folders on your device. Use Chrome or Edge, or open a folder saved in this browser.']),
|
|
78
|
+
e.folder?.openBrowser && item(['project-folder-open-browser',
|
|
79
|
+
ja ? 'ブラウザーに保存したフォルダを開く…' : 'Open Folder Saved in This Browser…', e.folder.openBrowser]),
|
|
80
|
+
e.openRemote && item(['git-open-remote',
|
|
81
|
+
ja ? 'Git のリモートリポジトリを開く…' : 'Open Remote Git Repository…', e.openRemote]),
|
|
75
82
|
e.git,
|
|
76
83
|
e.externalYaml),
|
|
77
84
|
React.createElement(MenuSection, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-plus-editor-workbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The TurboWarp Plus Editor workbench: layout, dockable sprite tabs, stage, debugger tab and file menu",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -34,7 +34,12 @@ const glyphs = {
|
|
|
34
34
|
save: 'M4 3h13l3 3v15H4z M8 3v6h8V3 M8 21v-7h8v7',
|
|
35
35
|
copy: 'M8 8h12v13H8z M16 8V3H3v13h5',
|
|
36
36
|
remix: 'M18 8a7 7 0 1 0 0 8 M18 3v5h-5 M18 8l2-2',
|
|
37
|
-
|
|
37
|
+
// An SB3 file is one file: a page with an arrow, set apart from the folder of Open Folder….
|
|
38
|
+
open: 'M5 3h9l5 5v13H5z M14 3v5h5 M12 18v-7 M9 14l3-3 3 3',
|
|
39
|
+
'project-folder-open': 'M3 6h7l2 2h9l-2 11H3z M3 11h16',
|
|
40
|
+
'project-folder-open-browser': 'M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z M3 9h18 M6 6.5h.01 M8.5 6.5h.01 M11 6.5h.01',
|
|
41
|
+
// A remote Git repository: a cloud with an arrow down, fetched onto the device.
|
|
42
|
+
'git-open-remote': 'M7 18H6.5a4.5 4.5 0 0 1-.5-8.97A6 6 0 0 1 17.5 9a4.5 4.5 0 0 1 0 9H17 M12 12v9 M8.5 17.5 12 21l3.5-3.5',
|
|
38
43
|
'save-as': 'M4 3h13l3 3v15H4z M8 3v6h8V3 M9 17h6 M12 14v6',
|
|
39
44
|
download: 'M12 3v12 M7 10l5 5 5-5 M4 17v4h16v-4',
|
|
40
45
|
package: 'm12 3 8 4v10l-8 4-8-4V7z M4 7l8 4 8-4 M12 11v10 M8 5l8 4',
|
|
@@ -3,7 +3,10 @@ import type {CreationInteraction, GitHubCreationAccount, GitHubRepositoryDraft,
|
|
|
3
3
|
RepositoryCreationProgress, RepositoryReceipt} from '@kubohiroya/turbowarp-plus-editor-git/project-repository-creation';
|
|
4
4
|
|
|
5
5
|
export type Action = () => void;
|
|
6
|
-
|
|
6
|
+
// `openBrowser` opens a folder kept in the browser (OPFS), where the host offers one.
|
|
7
|
+
export type FolderActions = {open: Action; openBrowser?: Action;
|
|
8
|
+
/** Whether Open can pick a folder on the device; `false` in browsers without the folder picker (Safari, Firefox). */
|
|
9
|
+
deviceFolders?: boolean; save?: Action; detach: Action};
|
|
7
10
|
export type SaveFormat = 'current' | 'embedded' | 'folder';
|
|
8
11
|
type Serialize = <T>(run: () => T) => T;
|
|
9
12
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {isMacPlatform} from '@kubohiroya/turbowarp-plus-editor-project-model/project-search-connections';
|
|
3
3
|
import type {Action, FolderActions, ProjectFileStorage} from './project-file-dialogs.js';
|
|
4
4
|
|
|
5
|
-
type Entry = [command: string, label: string, action: Action | undefined, showShortcut?: boolean];
|
|
5
|
+
type Entry = [command: string, label: string, action: Action | undefined, showShortcut?: boolean, unavailable?: string];
|
|
6
6
|
interface SaveWorkspace {
|
|
7
7
|
saveScope: 'project' | 'tab';
|
|
8
8
|
canSaveActive: boolean;
|
|
@@ -75,6 +75,7 @@ export default function ProjectFileMenu({locale, MenuItem, MenuSection, close, e
|
|
|
75
75
|
open: Action;
|
|
76
76
|
externalYaml?: React.ReactNode;
|
|
77
77
|
folder?: FolderActions;
|
|
78
|
+
openRemote?: Action;
|
|
78
79
|
storage: ProjectFileStorage;
|
|
79
80
|
saveAs?: Action;
|
|
80
81
|
saveCommit?: Action;
|
|
@@ -92,10 +93,11 @@ export default function ProjectFileMenu({locale, MenuItem, MenuSection, close, e
|
|
|
92
93
|
React.useLayoutEffect(() => workspace?.subscribeSave(redraw), [workspace]);
|
|
93
94
|
const tabShortcut = workspace?.saveScope === 'tab';
|
|
94
95
|
const mac = isMacPlatform();
|
|
95
|
-
const item = ([command, label, action, showShortcut]: Entry) => {
|
|
96
|
+
const item = ([command, label, action, showShortcut, unavailable]: Entry) => {
|
|
96
97
|
const run = action && (() => {close(); action();});
|
|
97
98
|
return <MenuItem key={command} command={command} onClick={run}>
|
|
98
99
|
<span className="tw-project-file-menu__item" role="button" aria-disabled={!run || undefined} tabIndex={run ? 0 : -1}
|
|
100
|
+
title={!run ? unavailable : undefined}
|
|
99
101
|
aria-keyshortcuts={showShortcut ? (mac ? 'Meta+S' : 'Control+S') : undefined}
|
|
100
102
|
style={!run ? {opacity: 0.5, cursor: 'default'} : undefined} onKeyDown={event => {
|
|
101
103
|
if (!run || (event.key !== 'Enter' && event.key !== ' ')) return;
|
|
@@ -111,7 +113,15 @@ export default function ProjectFileMenu({locale, MenuItem, MenuSection, close, e
|
|
|
111
113
|
{e.newWindow && item(['window', ja ? '新しいウィンドウ' : 'New Window', e.newWindow])}
|
|
112
114
|
<MenuSection>
|
|
113
115
|
{item(['open', ja ? 'SB3ファイルを開く…' : 'Open SB3 File…', e.open])}
|
|
114
|
-
{
|
|
116
|
+
{/* Safari and Firefox cannot pick folders on the device; the browser's folders have their own item. */}
|
|
117
|
+
{e.folder && item(['project-folder-open', ja ? 'フォルダを開く…' : 'Open Folder…',
|
|
118
|
+
e.folder.deviceFolders === false ? undefined : e.folder.open, false,
|
|
119
|
+
ja ? 'このブラウザーでは端末のフォルダを開けません。Chrome か Edge を使うか、ブラウザーに保存したフォルダを開いてください。' :
|
|
120
|
+
'This browser cannot open folders on your device. Use Chrome or Edge, or open a folder saved in this browser.'])}
|
|
121
|
+
{e.folder?.openBrowser && item(['project-folder-open-browser',
|
|
122
|
+
ja ? 'ブラウザーに保存したフォルダを開く…' : 'Open Folder Saved in This Browser…', e.folder.openBrowser])}
|
|
123
|
+
{e.openRemote && item(['git-open-remote',
|
|
124
|
+
ja ? 'Git のリモートリポジトリを開く…' : 'Open Remote Git Repository…', e.openRemote])}
|
|
115
125
|
{e.git}
|
|
116
126
|
{e.externalYaml}
|
|
117
127
|
</MenuSection>
|