@kubohiroya/turbowarp-plus-editor-workbench 0.26.0 → 0.27.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 +2 -0
- package/dist/sprite-tabs.d.ts +7 -1
- package/dist/sprite-tabs.js +11 -1
- package/package.json +1 -1
- package/src/sprite-tabs.ts +17 -1
package/README.ja.md
CHANGED
|
@@ -242,6 +242,8 @@ Editor のルートから、`site/source.json` の GUI を `npm run build:pages`
|
|
|
242
242
|
|
|
243
243
|
スプライトの「呼び出し関係」では、図の方向を切り替える LR/TD と、関数・メッセージの表示を切り替えるボタンを縦ツールバーの下端に置く。方向と表示の選択はビューごとに管理し、分割した別ビューの選択を変えない。ホストが `renderToolbar` でツールバーを描く場合は、受け取る `actions.sectionControls` を `SpriteEditorToolbar` の `sectionControls` に渡す。図で選んだスクリプトは `openRelationScript` で開き、ホストが対象のスプライトとブロックへ移動する。
|
|
244
244
|
|
|
245
|
+
コードペインのアダプターに `relations` がある場合、「自由配置」にも同じ関数・メッセージの2ボタンを縦ツールバー下端に置く。表示状態の所有者はコードペインで、`getVisibility(paneId)`・`setVisibility(paneId, value)`・`subscribe(listener)` を使って描画へ反映する。関数だけ、メッセージだけ、両方、両方非表示を選べ、分割した別のペインや呼び出し関係パネルの設定は変えない。両方とも既定で表示する。アダプターにこの接続がなければボタンを追加しない。切り戻しは workbench と code-views の固定依存を導入前の版へ戻して再ビルドする。
|
|
246
|
+
|
|
245
247
|
## デバッガーのタブ
|
|
246
248
|
|
|
247
249
|
`attachDebuggerPanel(debugger, {document, vm})` は、デバッガーアドオンのウィンドウを Dockview のタブとして開く。ホストはアドオンのウィンドウ要素、アドオン自身の表示切り替え関数、GUI の言語を返す関数を渡す。ワークスペースがパネルを受け付けるときは「デバッガー」タブで開き、タブとデバッガーの開閉を連動させる。受け付けないときは従来どおり浮動ウィンドウのままにする。タブは一時パネルとして扱い、保存するレイアウトには含めない。
|
package/dist/sprite-tabs.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { WorkspaceLayoutStore, WorkspaceProjectIdentity } from './workspace
|
|
|
8
8
|
import type { ProjectScreenState } from './project-screen-state.ts';
|
|
9
9
|
import type { SpriteVariableEdit, SpriteVariableEditError } from '@kubohiroya/turbowarp-plus-editor-project-model/sprite-variable-edit';
|
|
10
10
|
import type { MessageRenameError } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-message-pane';
|
|
11
|
-
import type { FunctionKind, FunctionPaneData, MountFunctionEditor, OpenScriptOptions, ScriptEndpoint, SpriteFunction, SpriteHatScript } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-function-pane';
|
|
11
|
+
import type { FunctionKind, FunctionPaneData, FunctionRelationVisibility, MountFunctionEditor, OpenScriptOptions, ScriptEndpoint, SpriteFunction, SpriteHatScript } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-function-pane';
|
|
12
12
|
import type { MessageUse, ProjectMessage, TargetMessages } from '@kubohiroya/turbowarp-plus-editor-project-model/project-messages';
|
|
13
13
|
export { getDocumentWorkspace } from './document-workspace.ts';
|
|
14
14
|
export { createWorkspaceLayoutStore, workspaceLayoutDatabase, workspaceLayoutLimit } from './workspace-layout-store.ts';
|
|
@@ -53,6 +53,12 @@ export interface SpriteTabView {
|
|
|
53
53
|
readonly groupActive: boolean;
|
|
54
54
|
}
|
|
55
55
|
export interface SpriteTabAdapter<Snapshot = unknown> {
|
|
56
|
+
/** Optional per-pane filters supplied by the code view owner. */
|
|
57
|
+
relations?: {
|
|
58
|
+
getVisibility(paneId: string): FunctionRelationVisibility;
|
|
59
|
+
setVisibility(paneId: string, value: FunctionRelationVisibility): void;
|
|
60
|
+
subscribe(listener: () => void): () => void;
|
|
61
|
+
};
|
|
56
62
|
/** Read the state of the mounted surface; the host's selected target may have changed already. */
|
|
57
63
|
capture(view: SpriteTabView): Snapshot;
|
|
58
64
|
renderInactive(container: HTMLElement, view: SpriteTabView, snapshot: Snapshot | undefined): void | (() => void);
|
package/dist/sprite-tabs.js
CHANGED
|
@@ -1497,6 +1497,9 @@ function SpriteTabs(props) {
|
|
|
1497
1497
|
});
|
|
1498
1498
|
const [toolbarSlots, setToolbarSlots] = React.useState([]);
|
|
1499
1499
|
const [assetPreviewSlots, setAssetPreviewSlots] = React.useState([]);
|
|
1500
|
+
const [, refreshCodeRelations] = React.useReducer(value => value + 1, 0);
|
|
1501
|
+
const codeRelations = props.viewAdapter?.relations;
|
|
1502
|
+
React.useLayoutEffect(() => codeRelations?.subscribe(refreshCodeRelations), [codeRelations]);
|
|
1500
1503
|
// The functions pane remounts when its view switches sections; keep the view, order and flow each view chose.
|
|
1501
1504
|
const [functionSettings, setFunctionSettings] = React.useState(() => new Map());
|
|
1502
1505
|
const changeFunctionSettings = (id, patch) => setFunctionSettings(previous => {
|
|
@@ -1606,7 +1609,14 @@ function SpriteTabs(props) {
|
|
|
1606
1609
|
workspace?.activateView(view.id);
|
|
1607
1610
|
changeFunctionSettings(view.id, { relationVisibility });
|
|
1608
1611
|
}
|
|
1609
|
-
})) :
|
|
1612
|
+
})) : currentSection === 'code' && codeRelations ? React.createElement(FunctionRelationToggles, {
|
|
1613
|
+
locale: props.locale,
|
|
1614
|
+
value: codeRelations.getVisibility(view.id),
|
|
1615
|
+
onChange: (visibility) => {
|
|
1616
|
+
workspace?.activateView(view.id);
|
|
1617
|
+
codeRelations.setVisibility(view.id, visibility);
|
|
1618
|
+
}
|
|
1619
|
+
}) : undefined;
|
|
1610
1620
|
const actions = {
|
|
1611
1621
|
activate: () => { workspace?.activateView(view.id); },
|
|
1612
1622
|
setSection: (section) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-plus-editor-workbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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",
|
package/src/sprite-tabs.ts
CHANGED
|
@@ -72,6 +72,12 @@ export interface SpriteTabView {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export interface SpriteTabAdapter<Snapshot = unknown> {
|
|
75
|
+
/** Optional per-pane filters supplied by the code view owner. */
|
|
76
|
+
relations?: {
|
|
77
|
+
getVisibility(paneId: string): FunctionRelationVisibility;
|
|
78
|
+
setVisibility(paneId: string, value: FunctionRelationVisibility): void;
|
|
79
|
+
subscribe(listener: () => void): () => void;
|
|
80
|
+
};
|
|
75
81
|
/** Read the state of the mounted surface; the host's selected target may have changed already. */
|
|
76
82
|
capture(view: SpriteTabView): Snapshot;
|
|
77
83
|
renderInactive(container: HTMLElement, view: SpriteTabView, snapshot: Snapshot | undefined): void | (() => void);
|
|
@@ -1634,6 +1640,9 @@ function SpriteTabs<Snapshot>(props: SpriteTabsProps<Snapshot>) {
|
|
|
1634
1640
|
});
|
|
1635
1641
|
const [toolbarSlots, setToolbarSlots] = React.useState<readonly ToolbarSlot[]>([]);
|
|
1636
1642
|
const [assetPreviewSlots, setAssetPreviewSlots] = React.useState<readonly AssetPreviewSlot[]>([]);
|
|
1643
|
+
const [, refreshCodeRelations] = React.useReducer(value => value + 1, 0);
|
|
1644
|
+
const codeRelations = props.viewAdapter?.relations;
|
|
1645
|
+
React.useLayoutEffect(() => codeRelations?.subscribe(refreshCodeRelations), [codeRelations]);
|
|
1637
1646
|
// The functions pane remounts when its view switches sections; keep the view, order and flow each view chose.
|
|
1638
1647
|
const [functionSettings, setFunctionSettings] = React.useState(() => new Map<string, Partial<FunctionPaneSettings>>());
|
|
1639
1648
|
const changeFunctionSettings = (id: string, patch: Partial<FunctionPaneSettings>) => setFunctionSettings(previous => {
|
|
@@ -1747,7 +1756,14 @@ function SpriteTabs<Snapshot>(props: SpriteTabsProps<Snapshot>) {
|
|
|
1747
1756
|
workspace?.activateView(view.id);
|
|
1748
1757
|
changeFunctionSettings(view.id, {relationVisibility});
|
|
1749
1758
|
}
|
|
1750
|
-
})) :
|
|
1759
|
+
})) : currentSection === 'code' && codeRelations ? React.createElement(FunctionRelationToggles, {
|
|
1760
|
+
locale: props.locale,
|
|
1761
|
+
value: codeRelations.getVisibility(view.id),
|
|
1762
|
+
onChange: (visibility: FunctionRelationVisibility) => {
|
|
1763
|
+
workspace?.activateView(view.id);
|
|
1764
|
+
codeRelations.setVisibility(view.id, visibility);
|
|
1765
|
+
}
|
|
1766
|
+
}) : undefined;
|
|
1751
1767
|
const actions = {
|
|
1752
1768
|
activate: () => { workspace?.activateView(view.id); },
|
|
1753
1769
|
setSection: (section: number) => {
|