@kubohiroya/turbowarp-title-menu 0.2.0 → 0.2.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 -1
- package/README.md +3 -2
- package/dist/turbowarp-title-menu.js +16 -2
- package/package.json +1 -1
- package/src/extension.ts +16 -2
package/README.ja.md
CHANGED
|
@@ -33,7 +33,7 @@ IndexedDBはoriginごとに分かれます。TurboWarp Web、TurboWarp Desktop
|
|
|
33
33
|
## インストール
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
pnpm add --save-exact @kubohiroya/turbowarp-title-menu@0.2.
|
|
36
|
+
pnpm add --save-exact @kubohiroya/turbowarp-title-menu@0.2.1
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
TurboWarpでは `dist/turbowarp-title-menu.js` をCustom Extensionとして読み込み、sandboxなしの実行を許可します。
|
|
@@ -203,6 +203,7 @@ IndexedDBに保管しているDSLファイルの件数を返します。
|
|
|
203
203
|
|---|---|
|
|
204
204
|
| 組み込みのメニュー項目 | `files`/`reload`/`about`/`close` は最初から登録されており、それぞれの動作を保ちます。同時にhatも発火します。`clear app menu actions` で外せます。 |
|
|
205
205
|
| メニューの変更 | 項目の追加や消去でメニューを作り直します。表示中だった場合は消えずに再表示します。 |
|
|
206
|
+
| 項目が0件のとき | 1件も登録されていない状態では `show application menu` は何もせず、すべて消すと表示中のメニューは閉じます。土台のprimitiveが0件のメニューを作れないため、自分の項目を入れる前に全消しするプロジェクトが途中で止まらないようにしています。 |
|
|
206
207
|
| ファイルの追加 | 「ファイルを追加」はファイル選択ダイアログを開き、選ばれた内容を保管します。開きはしません。使うときは「開く」を押します。 |
|
|
207
208
|
| 名前の変更 | 名前は一意です。他のファイルと同じ名前にしようとすると失敗し、どちらのファイルも変わりません。 |
|
|
208
209
|
| 削除 | 削除には確認のためもう一度クリックが必要です。開いているファイルを削除すると、開いている内容も解除されます。 |
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ The reviewed JavaScript build is committed to this repository, so users do not n
|
|
|
48
48
|
Install an exact version that you have reviewed:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
pnpm add --save-exact @kubohiroya/turbowarp-title-menu@0.2.
|
|
51
|
+
pnpm add --save-exact @kubohiroya/turbowarp-title-menu@0.2.1
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Load the standalone bundle from:
|
|
@@ -60,7 +60,7 @@ node_modules/@kubohiroya/turbowarp-title-menu/dist/turbowarp-title-menu.js
|
|
|
60
60
|
A version-pinned CDN URL is:
|
|
61
61
|
|
|
62
62
|
```text
|
|
63
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-title-menu@0.2.
|
|
63
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-title-menu@0.2.1/dist/turbowarp-title-menu.js
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Quick start
|
|
@@ -235,6 +235,7 @@ Returns the most recent DSL storage failure in the interface language, or an emp
|
|
|
235
235
|
| Official website | The title dialog opens the configured website URL in a new browser tab. |
|
|
236
236
|
| Built-in menu actions | `files`, `reload`, `about`, and `close` are pre-registered and keep their own behavior. They also start the hat, and `clear app menu actions` removes them. |
|
|
237
237
|
| Changing the menu | Adding or clearing an action rebuilds the menu. A menu that was on screen is shown again rather than disappearing. |
|
|
238
|
+
| An empty menu | `show application menu` does nothing while no action is registered, and clearing every action closes an open menu. The underlying primitive refuses to build a menu with no actions, so a project that clears the set before installing its own is not interrupted. |
|
|
238
239
|
| Adding a DSL file | `Add file` opens a browser file picker and stores the chosen source. It does not open the file; the operator presses `Open` when the project should use it. |
|
|
239
240
|
| Renaming | Names are unique. Renaming a file to a name another file already uses fails and leaves both files unchanged. |
|
|
240
241
|
| Deleting | Deleting asks for a second confirming click, and deleting the open file clears the opened source. |
|
|
@@ -1307,7 +1307,15 @@
|
|
|
1307
1307
|
showTitle() {
|
|
1308
1308
|
this.ensureTitleDialog().show(this.locale());
|
|
1309
1309
|
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Shows the application menu.
|
|
1312
|
+
*
|
|
1313
|
+
* An empty registry does nothing: the underlying primitive requires at least one action, and a
|
|
1314
|
+
* project that cleared the actions to install its own should not be interrupted by an error
|
|
1315
|
+
* between the two steps.
|
|
1316
|
+
*/
|
|
1310
1317
|
showMenu() {
|
|
1318
|
+
if (this.menuActions.length === 0) return;
|
|
1311
1319
|
this.ensureApplicationMenu().show(this.locale());
|
|
1312
1320
|
this.menuVisible = true;
|
|
1313
1321
|
}
|
|
@@ -1396,12 +1404,18 @@
|
|
|
1396
1404
|
*
|
|
1397
1405
|
* The app-shell primitive fixes its actions at construction, so a changed list means a new menu.
|
|
1398
1406
|
* A menu that was on screen is shown again, because a project that adds an action while the menu
|
|
1399
|
-
* is open should not have it silently disappear.
|
|
1407
|
+
* is open should not have it silently disappear. Clearing every action closes the menu instead,
|
|
1408
|
+
* because the primitive refuses to build one with no actions.
|
|
1400
1409
|
*/
|
|
1401
1410
|
rebuildMenu() {
|
|
1402
1411
|
this.applicationMenu?.dispose();
|
|
1403
1412
|
this.applicationMenu = null;
|
|
1404
|
-
if (this.menuVisible)
|
|
1413
|
+
if (!this.menuVisible) return;
|
|
1414
|
+
if (this.menuActions.length === 0) {
|
|
1415
|
+
this.menuVisible = false;
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
this.showMenu();
|
|
1405
1419
|
}
|
|
1406
1420
|
selectMenuAction(id) {
|
|
1407
1421
|
Scratch.vm?.runtime?.startHats?.(`${extensionConfig.id}_whenAppMenuActionSelected`, { ACTION: id });
|
package/package.json
CHANGED
package/src/extension.ts
CHANGED
|
@@ -81,7 +81,15 @@ export class TurboWarpTitleMenuExtension implements TurboWarpExtension {
|
|
|
81
81
|
this.ensureTitleDialog().show(this.locale());
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Shows the application menu.
|
|
86
|
+
*
|
|
87
|
+
* An empty registry does nothing: the underlying primitive requires at least one action, and a
|
|
88
|
+
* project that cleared the actions to install its own should not be interrupted by an error
|
|
89
|
+
* between the two steps.
|
|
90
|
+
*/
|
|
84
91
|
public showMenu(): void {
|
|
92
|
+
if (this.menuActions.length === 0) return;
|
|
85
93
|
this.ensureApplicationMenu().show(this.locale());
|
|
86
94
|
this.menuVisible = true;
|
|
87
95
|
}
|
|
@@ -187,12 +195,18 @@ export class TurboWarpTitleMenuExtension implements TurboWarpExtension {
|
|
|
187
195
|
*
|
|
188
196
|
* The app-shell primitive fixes its actions at construction, so a changed list means a new menu.
|
|
189
197
|
* A menu that was on screen is shown again, because a project that adds an action while the menu
|
|
190
|
-
* is open should not have it silently disappear.
|
|
198
|
+
* is open should not have it silently disappear. Clearing every action closes the menu instead,
|
|
199
|
+
* because the primitive refuses to build one with no actions.
|
|
191
200
|
*/
|
|
192
201
|
private rebuildMenu(): void {
|
|
193
202
|
this.applicationMenu?.dispose();
|
|
194
203
|
this.applicationMenu = null;
|
|
195
|
-
if (this.menuVisible)
|
|
204
|
+
if (!this.menuVisible) return;
|
|
205
|
+
if (this.menuActions.length === 0) {
|
|
206
|
+
this.menuVisible = false;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.showMenu();
|
|
196
210
|
}
|
|
197
211
|
|
|
198
212
|
private selectMenuAction(id: string): void {
|