@kubohiroya/turbowarp-plus-editor-workbench 0.29.0 → 0.29.1
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/README.ja.md +2 -0
- package/dist/project-catalog-dialog.js +13 -1
- package/dist/project-catalog-host.d.ts +1 -1
- package/dist/project-catalog-host.js +2 -2
- package/dist/project-catalog.d.ts +2 -0
- package/dist/project-file-menu.d.ts +2 -1
- package/dist/project-file-menu.js +7 -7
- package/dist/project-tools/integration.d.ts +1 -1
- package/dist/project-tools/integration.js +1 -1
- package/package.json +3 -2
- package/src/project-catalog-dialog.ts +11 -1
- package/src/project-catalog-host.ts +2 -2
- package/src/project-catalog.css +2 -0
- package/src/project-catalog.ts +2 -0
- package/src/project-file-menu.tsx +6 -5
- package/src/project-tools/integration.ts +2 -1
package/README.ja.md
CHANGED
|
@@ -6,6 +6,8 @@ TurboWarp Plus Editor の作業画面。分割レイアウト、Plus 標準配
|
|
|
6
6
|
|
|
7
7
|
## プロジェクト一覧
|
|
8
8
|
|
|
9
|
+
一覧上部の「新しいプロジェクトを作成…」は、登録がないときもファイルメニューと共通の新規作成へ進む。ホストはメニューから渡される作成コールバックを `projectCatalog` の第4引数へ渡す。一覧を閉じてから作成ダイアログを開き、作成先の選択・未保存変更の確認は既存の処理を利用する。
|
|
10
|
+
|
|
9
11
|
`project-catalog` は SB3、手元のフォルダ、ブラウザー保存、リモート Git と作業コピーを共通の登録として扱う。`project-catalog-dialog` と `project-catalog.css` が一覧・並び替え・開く・除外・保存データ削除・2種類の改名を提供する。`project-catalog-host` が既存のファイル保存、作品情報、project-folder と Git の接続口へつなぐ。Editor は `createProjectTools` の `catalogEnvironment` にファイルハンドルの読み取りと変更購読を渡し、`bindProjectCatalogFolder` でフォルダとリモート操作を渡す。`projectFileOpened` は読み込み成功後だけ呼ぶ。
|
|
10
12
|
|
|
11
13
|
カタログは IndexedDB の `twPlusProjectCatalog` に保存する。作品名を識別子に使わず、ファイルハンドル・OPFS の ID で照合する。同じリモートの別作業コピーは別登録のまま保持する。以前の画面配置に残ったハンドルと既存 OPFS 作品を取り込み、「一覧から除外」した作品は再取り込みで戻さない。最終利用日時は正常に開いた場合だけ更新する。
|
|
@@ -122,6 +122,18 @@ export function openProjectCatalog(document, host, locale = 'en') {
|
|
|
122
122
|
element.addEventListener('click', action);
|
|
123
123
|
return element;
|
|
124
124
|
};
|
|
125
|
+
const header = document.createElement('div');
|
|
126
|
+
header.className = 'tw-project-catalog__header';
|
|
127
|
+
header.append(heading);
|
|
128
|
+
if (host.createProject)
|
|
129
|
+
header.append(button(label('新しいプロジェクトを作成…', 'Create New Project…'), 'create', () => {
|
|
130
|
+
if (busy || !alive)
|
|
131
|
+
return;
|
|
132
|
+
dialog.close();
|
|
133
|
+
// Dispose before opening the next dialog so the queued close event cannot steal its focus.
|
|
134
|
+
dispose();
|
|
135
|
+
host.createProject();
|
|
136
|
+
}));
|
|
125
137
|
const rename = (project, target) => {
|
|
126
138
|
editor.replaceChildren();
|
|
127
139
|
editor.hidden = false;
|
|
@@ -222,7 +234,7 @@ export function openProjectCatalog(document, host, locale = 'en') {
|
|
|
222
234
|
const [by, direction] = order.value.split(':');
|
|
223
235
|
sort = await host.store.sort({ by, direction });
|
|
224
236
|
}));
|
|
225
|
-
dialog.append(
|
|
237
|
+
dialog.append(header, removalNote, orderLabel, status, error, list, editor, close);
|
|
226
238
|
document.body.append(dialog);
|
|
227
239
|
dialog.showModal();
|
|
228
240
|
close.focus();
|
|
@@ -45,6 +45,6 @@ export declare function createProjectCatalogRuntime(ports: CatalogRuntimePorts):
|
|
|
45
45
|
bindFolder(value: CatalogFolderPorts): void;
|
|
46
46
|
fileOpened(file: File | null): void;
|
|
47
47
|
capture: () => void;
|
|
48
|
-
show(locale: string, fileStorage: ProjectFileStorage): void;
|
|
48
|
+
show(locale: string, fileStorage: ProjectFileStorage, createProject?: () => void): void;
|
|
49
49
|
dispose(): void;
|
|
50
50
|
};
|
|
@@ -314,10 +314,10 @@ export function createProjectCatalogRuntime(ports) {
|
|
|
314
314
|
schedule();
|
|
315
315
|
},
|
|
316
316
|
capture: schedule,
|
|
317
|
-
show(locale, fileStorage) {
|
|
317
|
+
show(locale, fileStorage, createProject) {
|
|
318
318
|
storage = fileStorage;
|
|
319
319
|
dialog?.();
|
|
320
|
-
dialog = openProjectCatalog(document, host(locale), locale);
|
|
320
|
+
dialog = openProjectCatalog(document, { ...host(locale), createProject }, locale);
|
|
321
321
|
},
|
|
322
322
|
dispose() {
|
|
323
323
|
alive = false;
|
|
@@ -46,6 +46,8 @@ export interface CatalogOperations {
|
|
|
46
46
|
}
|
|
47
47
|
export interface CatalogHost {
|
|
48
48
|
store: ProjectCatalogStore;
|
|
49
|
+
/** Opens the host's existing new-project flow after the catalog is dismissed. */
|
|
50
|
+
createProject?(): void;
|
|
49
51
|
refresh(): Promise<void>;
|
|
50
52
|
operations(project: CatalogProject): CatalogOperations;
|
|
51
53
|
}
|
|
@@ -35,7 +35,8 @@ export default function ProjectFileMenu({ locale, MenuItem, MenuSection, close,
|
|
|
35
35
|
newProject?: NewProjectChoices;
|
|
36
36
|
newWindow?: Action;
|
|
37
37
|
open: Action;
|
|
38
|
-
|
|
38
|
+
/** Receives the same creation command as Create New Project, including its destination choices. */
|
|
39
|
+
catalog?: (createProject: Action) => void;
|
|
39
40
|
externalYaml?: React.ReactNode;
|
|
40
41
|
folder?: FolderActions;
|
|
41
42
|
openRemote?: Action;
|
|
@@ -71,16 +71,16 @@ export default function ProjectFileMenu({ locale, MenuItem, MenuSection, close,
|
|
|
71
71
|
};
|
|
72
72
|
const e = entries;
|
|
73
73
|
const createIn = e.createIn;
|
|
74
|
-
const createNew = createIn ?
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const createNew = createIn ? () => {
|
|
75
|
+
if (typeof document === 'undefined')
|
|
76
|
+
return;
|
|
77
|
+
void openNewProjectDialog(document, locale, { ...e.newProject, create: e.create, createIn });
|
|
78
|
+
} : e.create;
|
|
79
79
|
return React.createElement(React.Fragment, null,
|
|
80
|
-
item(createNew),
|
|
80
|
+
item(['new', ja ? `新しいプロジェクトを作成${createIn ? '…' : ''}` : `Create New Project${createIn ? '…' : ''}`, createNew]),
|
|
81
81
|
e.newWindow && item(['window', ja ? '新しいウィンドウ' : 'New Window', e.newWindow]),
|
|
82
82
|
React.createElement(MenuSection, null,
|
|
83
|
-
e.catalog && item(['projects', ja ? 'プロジェクト一覧…' : 'Projects…', e.catalog]),
|
|
83
|
+
e.catalog && item(['projects', ja ? 'プロジェクト一覧…' : 'Projects…', () => e.catalog(createNew)]),
|
|
84
84
|
item(['open', ja ? 'SB3ファイルを開く…' : 'Open SB3 File…', e.open]),
|
|
85
85
|
e.folder && item(['project-folder-open', ja ? 'フォルダを開く…' : 'Open Folder…',
|
|
86
86
|
e.folder.deviceFolders === false ? undefined : e.folder.open, false,
|
|
@@ -69,6 +69,6 @@ export declare function createProjectTools({ installEditorExtensionHost, install
|
|
|
69
69
|
}) => React.CElement<null, React.Component<null, any, any>>;
|
|
70
70
|
projectToolsOwnKeyEvent: (event: any) => boolean;
|
|
71
71
|
bindProjectCatalogFolder: (vm: object, ports: CatalogFolderPorts) => any;
|
|
72
|
-
projectCatalog: (vm: object, locale: string, storage: ProjectFileStorage) => any;
|
|
72
|
+
projectCatalog: (vm: object, locale: string, storage: ProjectFileStorage, createProject?: () => void) => any;
|
|
73
73
|
projectFileOpened: (vm: object, file: File | null) => any;
|
|
74
74
|
};
|
|
@@ -361,7 +361,7 @@ export function createProjectTools({ installEditorExtensionHost, installProjectP
|
|
|
361
361
|
};
|
|
362
362
|
const projectToolsOwnKeyEvent = event => Boolean(event.target?.closest?.('[data-project-tools]'));
|
|
363
363
|
const bindProjectCatalogFolder = (vm, ports) => projects.get(vm)?.catalog?.bindFolder(ports);
|
|
364
|
-
const projectCatalog = (vm, locale, storage) => projects.get(vm)?.catalog?.show(locale, storage);
|
|
364
|
+
const projectCatalog = (vm, locale, storage, createProject) => projects.get(vm)?.catalog?.show(locale, storage, createProject);
|
|
365
365
|
const projectFileOpened = (vm, file) => projects.get(vm)?.catalog?.fileOpened(file);
|
|
366
366
|
return { installProjectToolsHost, projectScreenState, loadedProjectTitle, restoreProjectTitle, isProjectLoading, subscribeProjectLoad, projectSaveName, setProjectSaveName, createFolderFromCurrentProject, projectFileActions, projectCreation, renderFileMenu, projectToolsOwnKeyEvent,
|
|
367
367
|
bindProjectCatalogFolder, projectCatalog, projectFileOpened };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-plus-editor-workbench",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.1",
|
|
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",
|
|
@@ -226,7 +226,8 @@
|
|
|
226
226
|
"@kubohiroya/turbowarp-extension-loader": "0.11.1",
|
|
227
227
|
"@kubohiroya/turbowarp-plus-editor-project-folder": "0.20.1",
|
|
228
228
|
"@kubohiroya/turbowarp-plus-editor-code-views": "0.22.1",
|
|
229
|
-
"@kubohiroya/turbowarp-extension-security-dialog": "0.9.0"
|
|
229
|
+
"@kubohiroya/turbowarp-extension-security-dialog": "0.9.0",
|
|
230
|
+
"esbuild": "0.25.12"
|
|
230
231
|
},
|
|
231
232
|
"repository": {
|
|
232
233
|
"type": "git",
|
|
@@ -99,6 +99,16 @@ export function openProjectCatalog(document: Document, host: CatalogHost, locale
|
|
|
99
99
|
if (action) element.addEventListener('click', action);
|
|
100
100
|
return element;
|
|
101
101
|
};
|
|
102
|
+
const header = document.createElement('div');
|
|
103
|
+
header.className = 'tw-project-catalog__header';
|
|
104
|
+
header.append(heading);
|
|
105
|
+
if (host.createProject) header.append(button(label('新しいプロジェクトを作成…', 'Create New Project…'), 'create', () => {
|
|
106
|
+
if (busy || !alive) return;
|
|
107
|
+
dialog.close();
|
|
108
|
+
// Dispose before opening the next dialog so the queued close event cannot steal its focus.
|
|
109
|
+
dispose();
|
|
110
|
+
host.createProject!();
|
|
111
|
+
}));
|
|
102
112
|
const rename = (project: CatalogProject, target: 'title' | 'storageName') => {
|
|
103
113
|
editor.replaceChildren(); editor.hidden = false;
|
|
104
114
|
const operations = host.operations(project);
|
|
@@ -187,7 +197,7 @@ export function openProjectCatalog(document: Document, host: CatalogHost, locale
|
|
|
187
197
|
const [by, direction] = order.value.split(':') as [CatalogSort['by'], CatalogSort['direction']];
|
|
188
198
|
sort = await host.store.sort({by, direction});
|
|
189
199
|
}));
|
|
190
|
-
dialog.append(
|
|
200
|
+
dialog.append(header, removalNote, orderLabel, status, error, list, editor, close);
|
|
191
201
|
document.body.append(dialog); dialog.showModal(); close.focus();
|
|
192
202
|
void run(async () => {
|
|
193
203
|
await host.refresh(); sort = await host.store.sort(); order.value = `${sort.by}:${sort.direction}`;
|
|
@@ -286,9 +286,9 @@ export function createProjectCatalogRuntime(ports: CatalogRuntimePorts) {
|
|
|
286
286
|
schedule();
|
|
287
287
|
},
|
|
288
288
|
capture: schedule,
|
|
289
|
-
show(locale: string, fileStorage: ProjectFileStorage) {
|
|
289
|
+
show(locale: string, fileStorage: ProjectFileStorage, createProject?: () => void) {
|
|
290
290
|
storage = fileStorage;
|
|
291
|
-
dialog?.(); dialog = openProjectCatalog(document, host(locale), locale);
|
|
291
|
+
dialog?.(); dialog = openProjectCatalog(document, {...host(locale), createProject}, locale);
|
|
292
292
|
},
|
|
293
293
|
dispose() {
|
|
294
294
|
alive = false; view.clearTimeout(timer); stopLoad(); stopLocation?.();
|
package/src/project-catalog.css
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
font: .875rem/1.5 system-ui, sans-serif;
|
|
12
12
|
}
|
|
13
13
|
.tw-project-catalog h2 {margin-top: 0; font-size: 1.25rem;}
|
|
14
|
+
.tw-project-catalog__header {display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem;}
|
|
15
|
+
.tw-project-catalog__header h2 {margin: 0;}
|
|
14
16
|
.tw-project-catalog ul {list-style: none; padding: 0; display: grid; gap: .75rem;}
|
|
15
17
|
.tw-project-catalog li {border: 1px solid GrayText; border-radius: .375rem; padding: .75rem; overflow-wrap: anywhere;}
|
|
16
18
|
.tw-project-catalog li p {margin: .25rem 0;}
|
package/src/project-catalog.ts
CHANGED
|
@@ -142,6 +142,8 @@ export interface CatalogOperations {
|
|
|
142
142
|
}
|
|
143
143
|
export interface CatalogHost {
|
|
144
144
|
store: ProjectCatalogStore;
|
|
145
|
+
/** Opens the host's existing new-project flow after the catalog is dismissed. */
|
|
146
|
+
createProject?(): void;
|
|
145
147
|
refresh(): Promise<void>;
|
|
146
148
|
operations(project: CatalogProject): CatalogOperations;
|
|
147
149
|
}
|
|
@@ -87,7 +87,8 @@ export default function ProjectFileMenu({locale, MenuItem, MenuSection, close, e
|
|
|
87
87
|
newProject?: NewProjectChoices;
|
|
88
88
|
newWindow?: Action;
|
|
89
89
|
open: Action;
|
|
90
|
-
|
|
90
|
+
/** Receives the same creation command as Create New Project, including its destination choices. */
|
|
91
|
+
catalog?: (createProject: Action) => void;
|
|
91
92
|
externalYaml?: React.ReactNode;
|
|
92
93
|
folder?: FolderActions;
|
|
93
94
|
openRemote?: Action;
|
|
@@ -130,15 +131,15 @@ export default function ProjectFileMenu({locale, MenuItem, MenuSection, close, e
|
|
|
130
131
|
};
|
|
131
132
|
const e = entries;
|
|
132
133
|
const createIn = e.createIn;
|
|
133
|
-
const createNew:
|
|
134
|
+
const createNew: Action = createIn ? () => {
|
|
134
135
|
if (typeof document === 'undefined') return;
|
|
135
136
|
void openNewProjectDialog(document, locale, {...e.newProject, create: e.create, createIn});
|
|
136
|
-
}
|
|
137
|
+
} : e.create;
|
|
137
138
|
return <>
|
|
138
|
-
{item(createNew)}
|
|
139
|
+
{item(['new', ja ? `新しいプロジェクトを作成${createIn ? '…' : ''}` : `Create New Project${createIn ? '…' : ''}`, createNew])}
|
|
139
140
|
{e.newWindow && item(['window', ja ? '新しいウィンドウ' : 'New Window', e.newWindow])}
|
|
140
141
|
<MenuSection>
|
|
141
|
-
{e.catalog && item(['projects', ja ? 'プロジェクト一覧…' : 'Projects…', e.catalog])}
|
|
142
|
+
{e.catalog && item(['projects', ja ? 'プロジェクト一覧…' : 'Projects…', () => e.catalog!(createNew)])}
|
|
142
143
|
{item(['open', ja ? 'SB3ファイルを開く…' : 'Open SB3 File…', e.open])}
|
|
143
144
|
{/* Safari and Firefox cannot pick folders on the device; the browser's folders have their own item. */}
|
|
144
145
|
{e.folder && item(['project-folder-open', ja ? 'フォルダを開く…' : 'Open Folder…',
|
|
@@ -378,7 +378,8 @@ export function createProjectTools({installEditorExtensionHost, installProjectPr
|
|
|
378
378
|
const projectToolsOwnKeyEvent = event => Boolean(event.target?.closest?.('[data-project-tools]'));
|
|
379
379
|
|
|
380
380
|
const bindProjectCatalogFolder = (vm: object, ports: CatalogFolderPorts) => projects.get(vm)?.catalog?.bindFolder(ports);
|
|
381
|
-
const projectCatalog = (vm: object, locale: string, storage: ProjectFileStorage) =>
|
|
381
|
+
const projectCatalog = (vm: object, locale: string, storage: ProjectFileStorage, createProject?: () => void) =>
|
|
382
|
+
projects.get(vm)?.catalog?.show(locale, storage, createProject);
|
|
382
383
|
const projectFileOpened = (vm: object, file: File | null) => projects.get(vm)?.catalog?.fileOpened(file);
|
|
383
384
|
return {installProjectToolsHost, projectScreenState, loadedProjectTitle, restoreProjectTitle, isProjectLoading, subscribeProjectLoad, projectSaveName, setProjectSaveName, createFolderFromCurrentProject, projectFileActions, projectCreation, renderFileMenu, projectToolsOwnKeyEvent,
|
|
384
385
|
bindProjectCatalogFolder, projectCatalog, projectFileOpened};
|