@kubohiroya/turbowarp-plus-editor-workbench 0.27.1 → 0.28.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/README.ja.md +4 -0
- package/dist/editor-tabs.js +14 -2
- package/dist/sprite-tabs.d.ts +1 -0
- package/dist/sprite-tabs.js +1 -0
- package/package.json +4 -4
- package/src/editor-tabs.tsx +14 -3
- package/src/sprite-tabs.ts +2 -1
package/README.ja.md
CHANGED
|
@@ -242,6 +242,10 @@ Editor のルートから、`site/source.json` の GUI を `npm run build:pages`
|
|
|
242
242
|
|
|
243
243
|
スプライトの「呼び出し関係」では、図の方向を切り替える LR/TD と、関数・メッセージの表示を切り替えるボタンを縦ツールバーの下端に置く。方向と表示の選択はビューごとに管理し、分割した別ビューの選択を変えない。ホストが `renderToolbar` でツールバーを描く場合は、受け取る `actions.sectionControls` を `SpriteEditorToolbar` の `sectionControls` に渡す。図で選んだスクリプトは `openRelationScript` で開き、ホストが対象のスプライトとブロックへ移動する。
|
|
244
244
|
|
|
245
|
+
`createEditorTabLayout` は自由配置のブロックメニューから、対象を含むスクリプトを右の個別編集ビューで開く。一覧を開く項目は左をハット・関数一覧へ、呼び出し関係を開く項目は左を図へ切り替えて対象を中央に置く。
|
|
246
|
+
|
|
247
|
+
外部のメニューから対象スクリプトへ中央フォーカスする場合は、`selectedScript` の `{targetId, id}` に更新するたびに異なる `focusRequest` の数値を添える。対象のペインの `SpriteFunctionPane` へ同じ要求を渡し、関係図の移動や強調は図を所有するパッケージが行う。切り戻す場合は `focusRequest` を渡さない。
|
|
248
|
+
|
|
245
249
|
コードペインのアダプターに `relations` がある場合、「自由配置」にも同じ関数・メッセージの2ボタンを縦ツールバー下端に置く。表示状態の所有者はコードペインで、`getVisibility(paneId)`・`setVisibility(paneId, value)`・`subscribe(listener)` を使って描画へ反映する。関数だけ、メッセージだけ、両方、両方非表示を選べ、分割した別のペインや呼び出し関係パネルの設定は変えない。両方とも既定で表示する。アダプターにこの接続がなければボタンを追加しない。切り戻しは workbench と code-views の固定依存を導入前の版へ戻して再ビルドする。
|
|
246
250
|
|
|
247
251
|
## デバッガーのタブ
|
package/dist/editor-tabs.js
CHANGED
|
@@ -168,7 +168,7 @@ export function createEditorTabLayout({ desktopCodeEnabled, openDesktopCode, sty
|
|
|
168
168
|
const scriptViewRef = React.useRef(scriptView);
|
|
169
169
|
scriptViewRef.current = scriptView;
|
|
170
170
|
// A function or hat script picked in the functions sections shows there. `block` asks to show one of its blocks.
|
|
171
|
-
const openScriptView = (targetId, id, block) => {
|
|
171
|
+
const openScriptView = (targetId, id, block, centerInCalls = false) => {
|
|
172
172
|
const views = spriteTabs.controller.current;
|
|
173
173
|
if (!views)
|
|
174
174
|
return;
|
|
@@ -202,7 +202,8 @@ export function createEditorTabLayout({ desktopCodeEnabled, openDesktopCode, sty
|
|
|
202
202
|
}));
|
|
203
203
|
views.setViewSection(shown, codeTab);
|
|
204
204
|
views.activateView(shown);
|
|
205
|
-
setSelectedScript(current => current?.targetId === targetId && current.id === id ? current :
|
|
205
|
+
setSelectedScript(current => !centerInCalls && current?.targetId === targetId && current.id === id ? current :
|
|
206
|
+
{ targetId, id, ...(centerInCalls && { focusRequest: (current?.focusRequest ?? 0) + 1 }) });
|
|
206
207
|
if (block) {
|
|
207
208
|
requestAnimationFrame(() => {
|
|
208
209
|
const workspace = getScratchBlocks()?.getMainWorkspace();
|
|
@@ -429,6 +430,17 @@ export function createEditorTabLayout({ desktopCodeEnabled, openDesktopCode, sty
|
|
|
429
430
|
if (!fn)
|
|
430
431
|
return;
|
|
431
432
|
openScriptViewRef.current(target.id, fn.id);
|
|
433
|
+
},
|
|
434
|
+
scriptEditor: {
|
|
435
|
+
vm, locale,
|
|
436
|
+
open(scriptId, blockId, section) {
|
|
437
|
+
const views = spriteTabs.controller.current;
|
|
438
|
+
const current = views?.currentView();
|
|
439
|
+
if (!current || !vm.editingTarget)
|
|
440
|
+
return;
|
|
441
|
+
views.setViewSection(current.id, spriteEditorSections.indexOf(section));
|
|
442
|
+
openScriptViewRef.current(vm.editingTarget.id, scriptId, blockId, section === 'calls');
|
|
443
|
+
}
|
|
432
444
|
}
|
|
433
445
|
});
|
|
434
446
|
};
|
package/dist/sprite-tabs.d.ts
CHANGED
|
@@ -234,6 +234,7 @@ type SpriteTabsProps<Snapshot> = Omit<TabOptions<Snapshot>, 'activateSection' |
|
|
|
234
234
|
selectedScript?: {
|
|
235
235
|
targetId: string;
|
|
236
236
|
id: string;
|
|
237
|
+
focusRequest?: number;
|
|
237
238
|
};
|
|
238
239
|
/**
|
|
239
240
|
* Make a new function of this name in the target: a standard custom block, whose block text is the name,
|
package/dist/sprite-tabs.js
CHANGED
|
@@ -1709,6 +1709,7 @@ function SpriteTabs(props) {
|
|
|
1709
1709
|
((hat, options) => props.openScript(targetId, hat, options)),
|
|
1710
1710
|
onOpenRelationScript: props.openRelationScript,
|
|
1711
1711
|
selectedId: props.selectedScript?.targetId === targetId ? props.selectedScript.id : undefined,
|
|
1712
|
+
focusRequest: props.selectedScript?.targetId === targetId ? props.selectedScript.focusRequest : undefined,
|
|
1712
1713
|
onCreate: props.createFunction && (async (functionKind, name) => {
|
|
1713
1714
|
const created = await props.createFunction(targetId, functionKind, name);
|
|
1714
1715
|
// Show the new function now rather than at the next project change.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-plus-editor-workbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.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",
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"@turbowarp/jszip": "3.12.0",
|
|
213
213
|
"@kubohiroya/turbowarp-extension-loader": "0.11.1",
|
|
214
214
|
"@kubohiroya/turbowarp-plus-editor-project-folder": "0.20.1",
|
|
215
|
-
"@kubohiroya/turbowarp-plus-editor-code-views": "0.
|
|
215
|
+
"@kubohiroya/turbowarp-plus-editor-code-views": "0.22.0",
|
|
216
216
|
"@kubohiroya/turbowarp-extension-security-dialog": "0.9.0"
|
|
217
217
|
},
|
|
218
218
|
"repository": {
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
},
|
|
222
222
|
"dependencies": {
|
|
223
223
|
"@kubohiroya/turbowarp-plus-editor-project-model": "0.2.0",
|
|
224
|
-
"@kubohiroya/turbowarp-plus-editor-sprite-panes": "0.
|
|
224
|
+
"@kubohiroya/turbowarp-plus-editor-sprite-panes": "0.11.0",
|
|
225
225
|
"@kubohiroya/turbowarp-script-transfer": "0.1.5",
|
|
226
226
|
"dockview": "8.8.3"
|
|
227
227
|
},
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
"@turbowarp/jszip": ">=3.12.0 <4",
|
|
235
235
|
"@kubohiroya/turbowarp-extension-loader": ">=0.11.1 <0.12.0",
|
|
236
236
|
"@kubohiroya/turbowarp-plus-editor-project-folder": ">=0.20.1 <0.21.0",
|
|
237
|
-
"@kubohiroya/turbowarp-plus-editor-code-views": ">=0.
|
|
237
|
+
"@kubohiroya/turbowarp-plus-editor-code-views": ">=0.22.0 <0.23.0",
|
|
238
238
|
"@kubohiroya/turbowarp-extension-security-dialog": ">=0.9.0 <0.10.0"
|
|
239
239
|
},
|
|
240
240
|
"peerDependenciesMeta": {
|
package/src/editor-tabs.tsx
CHANGED
|
@@ -211,14 +211,14 @@ export function createEditorTabLayout({desktopCodeEnabled, openDesktopCode, styl
|
|
|
211
211
|
get screenState() { return projectScreenState(vm); }
|
|
212
212
|
} : undefined, [multiView, vm]);
|
|
213
213
|
// The script shown beside the sprite, which the list of hats and functions highlights.
|
|
214
|
-
const [selectedScript, setSelectedScript] = React.useState<{targetId: string; id: string}>();
|
|
214
|
+
const [selectedScript, setSelectedScript] = React.useState<{targetId: string; id: string; focusRequest?: number}>();
|
|
215
215
|
// The code view beside the sprite that shows one script at a time: the code area itself, without the other
|
|
216
216
|
// scripts and without the section buttons.
|
|
217
217
|
const [scriptView, setScriptView] = React.useState<{viewId: string; targetId: string}>();
|
|
218
218
|
const scriptViewRef = React.useRef(scriptView);
|
|
219
219
|
scriptViewRef.current = scriptView;
|
|
220
220
|
// A function or hat script picked in the functions sections shows there. `block` asks to show one of its blocks.
|
|
221
|
-
const openScriptView = (targetId: string, id: string, block?: string) => {
|
|
221
|
+
const openScriptView = (targetId: string, id: string, block?: string, centerInCalls = false) => {
|
|
222
222
|
const views = spriteTabs.controller.current;
|
|
223
223
|
if (!views) return;
|
|
224
224
|
let viewId = scriptViewRef.current?.targetId === targetId &&
|
|
@@ -249,7 +249,8 @@ export function createEditorTabLayout({desktopCodeEnabled, openDesktopCode, styl
|
|
|
249
249
|
}));
|
|
250
250
|
views.setViewSection(shown, codeTab);
|
|
251
251
|
views.activateView(shown);
|
|
252
|
-
setSelectedScript(current => current?.targetId === targetId && current.id === id ? current :
|
|
252
|
+
setSelectedScript(current => !centerInCalls && current?.targetId === targetId && current.id === id ? current :
|
|
253
|
+
{targetId, id, ...(centerInCalls && {focusRequest: (current?.focusRequest ?? 0) + 1})});
|
|
253
254
|
if (block) {
|
|
254
255
|
requestAnimationFrame(() => {
|
|
255
256
|
const workspace = getScratchBlocks()?.getMainWorkspace();
|
|
@@ -469,6 +470,16 @@ export function createEditorTabLayout({desktopCodeEnabled, openDesktopCode, styl
|
|
|
469
470
|
const fn = target && readTargetFunctions(target).functions.find(item => item.id === functionId);
|
|
470
471
|
if (!fn) return;
|
|
471
472
|
openScriptViewRef.current(target.id, fn.id);
|
|
473
|
+
},
|
|
474
|
+
scriptEditor: {
|
|
475
|
+
vm, locale,
|
|
476
|
+
open(scriptId, blockId, section) {
|
|
477
|
+
const views = spriteTabs.controller.current;
|
|
478
|
+
const current = views?.currentView();
|
|
479
|
+
if (!current || !vm.editingTarget) return;
|
|
480
|
+
views.setViewSection(current.id, spriteEditorSections.indexOf(section));
|
|
481
|
+
openScriptViewRef.current(vm.editingTarget.id, scriptId, blockId, section === 'calls');
|
|
482
|
+
}
|
|
472
483
|
}
|
|
473
484
|
});
|
|
474
485
|
};
|
package/src/sprite-tabs.ts
CHANGED
|
@@ -1578,7 +1578,7 @@ type SpriteTabsProps<Snapshot> = Omit<TabOptions<Snapshot>, 'activateSection' |
|
|
|
1578
1578
|
/** Open a script chosen in the relationship graph, including one on another target. */
|
|
1579
1579
|
openRelationScript?(endpoint: ScriptEndpoint): void;
|
|
1580
1580
|
/** The function or hat script shown beside the sprite, which the list of hats and functions highlights. */
|
|
1581
|
-
selectedScript?: {targetId: string; id: string};
|
|
1581
|
+
selectedScript?: {targetId: string; id: string; focusRequest?: number};
|
|
1582
1582
|
/**
|
|
1583
1583
|
* Make a new function of this name in the target: a standard custom block, whose block text is the name,
|
|
1584
1584
|
* or a TurboWarp-Plus named function. Resolves with the id of the new hat, or with nothing when nothing
|
|
@@ -1849,6 +1849,7 @@ function SpriteTabs<Snapshot>(props: SpriteTabsProps<Snapshot>) {
|
|
|
1849
1849
|
((hat: SpriteHatScript, options?: OpenScriptOptions) => props.openScript!(targetId, hat, options)),
|
|
1850
1850
|
onOpenRelationScript: props.openRelationScript,
|
|
1851
1851
|
selectedId: props.selectedScript?.targetId === targetId ? props.selectedScript.id : undefined,
|
|
1852
|
+
focusRequest: props.selectedScript?.targetId === targetId ? props.selectedScript.focusRequest : undefined,
|
|
1852
1853
|
onCreate: props.createFunction && (async (functionKind: FunctionKind, name: string) => {
|
|
1853
1854
|
const created = await props.createFunction!(targetId, functionKind, name);
|
|
1854
1855
|
// Show the new function now rather than at the next project change.
|