@kubohiroya/turbowarp-plus-editor-workbench 0.10.0 → 0.11.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.
@@ -86,6 +86,7 @@ export interface AgentSettingsDialogOptions {
86
86
  returnFocus?: HTMLElement | null;
87
87
  onSave?(settings: AgentSettings): void;
88
88
  desktop?: DesktopAiAgentsPort | null;
89
+ onDesktopSave?(): void;
89
90
  }
90
91
  export interface AgentSettingsDialog {
91
92
  element: HTMLElement;
@@ -95,5 +96,5 @@ export interface AgentSettingsDialog {
95
96
  * The settings dialog: turns the presets on and off, replaces their address, and adds or removes the
96
97
  * user's own services. It is plain DOM so that any part of the Editor can open it, with or without React.
97
98
  */
98
- export declare function openAgentSettingsDialog({ document: doc, locale, styles, storage, storageKey, returnFocus, onSave, desktop }: AgentSettingsDialogOptions): AgentSettingsDialog;
99
+ export declare function openAgentSettingsDialog({ document: doc, locale, styles, storage, storageKey, returnFocus, onSave, desktop, onDesktopSave }: AgentSettingsDialogOptions): AgentSettingsDialog;
99
100
  export {};
@@ -137,7 +137,7 @@ const urlProblems = { empty: 'urlEmpty', invalid: 'urlInvalid', 'not-https': 'ur
137
137
  * The settings dialog: turns the presets on and off, replaces their address, and adds or removes the
138
138
  * user's own services. It is plain DOM so that any part of the Editor can open it, with or without React.
139
139
  */
140
- export function openAgentSettingsDialog({ document: doc = globalThis.document, locale, styles = {}, storage = browserStorage(), storageKey = agentSettingsKey, returnFocus, onSave, desktop }) {
140
+ export function openAgentSettingsDialog({ document: doc = globalThis.document, locale, styles = {}, storage = browserStorage(), storageKey = agentSettingsKey, returnFocus, onSave, desktop, onDesktopSave }) {
141
141
  if (openDialog?.element.isConnected) {
142
142
  openDialog.element.querySelector(focusable)?.focus();
143
143
  return openDialog;
@@ -235,7 +235,7 @@ export function openAgentSettingsDialog({ document: doc = globalThis.document, l
235
235
  const status = make('p', { role: 'alert', class: styles.aiAgentDialogError, hidden: '' });
236
236
  const cancel = make('button', { type: 'button', class: styles.aiAgentDialogButton }, text('cancel'));
237
237
  const save = make('button', { type: 'submit', class: `${styles.aiAgentDialogButton ?? ''} ${styles.aiAgentDialogPrimary ?? ''}`.trim() }, text('save'));
238
- const form = make('form', { novalidate: '', class: styles.aiAgentDialogForm }, presetGroup, customGroup, desktop && desktopAgentSettings(doc, desktop, locale, styles), status, make('div', { class: styles.aiAgentDialogActions }, cancel, save));
238
+ const form = make('form', { novalidate: '', class: styles.aiAgentDialogForm }, presetGroup, customGroup, desktop && desktopAgentSettings(doc, desktop, locale, styles, onDesktopSave), status, make('div', { class: styles.aiAgentDialogActions }, cancel, save));
239
239
  const element = make('div', {
240
240
  role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': `${prefix}-title`,
241
241
  'aria-describedby': `${prefix}-description`, class: styles.aiAgentDialog
@@ -18,9 +18,14 @@ export interface AiAgentsOptions {
18
18
  */
19
19
  export declare function createAiAgents(React: any, { styles, storage, storageKey, open, desktop }?: AiAgentsOptions): {
20
20
  drawerMenu: DrawerMenu;
21
- openSettings: ({ locale, returnFocus }: {
21
+ renderPanel: ({ locale }: {
22
+ locale: string;
23
+ }) => any;
24
+ openSettings: ({ locale, returnFocus, onSave, onDesktopSave }: {
22
25
  locale: string;
23
26
  returnFocus?: HTMLElement | null;
27
+ onSave?: () => void;
28
+ onDesktopSave?: () => void;
24
29
  }) => import("./ai-agent-settings.ts").AgentSettingsDialog;
25
30
  settingsIcon: () => any;
26
31
  serviceIcon: (service?: AgentService) => any;
package/dist/ai-agents.js CHANGED
@@ -28,23 +28,29 @@ export function createAiAgents(React, { styles = {}, storage = browserStorage(),
28
28
  return svg(element('circle', { cx: 8, cy: 8, r: 6.25 }), element('path', { d: 'M1.75 8h12.5M8 1.75c-3 3.4-3 9.1 0 12.5M8 1.75c3 3.4 3 9.1 0 12.5' }));
29
29
  };
30
30
  const settingsIcon = () => svg(element('path', { d: agentsIconPath }));
31
- const openSettings = ({ locale, returnFocus }) => openAgentSettingsDialog({ document, locale, styles, storage, storageKey, returnFocus, desktop });
32
- function AgentMenu({ locale, close }) {
33
- const [services] = useState(() => enabledAgentServices(readAgentSettings(storage, storageKey)));
31
+ const openSettings = ({ locale, returnFocus, onSave, onDesktopSave }) => openAgentSettingsDialog({ document: returnFocus?.ownerDocument ?? document, locale, styles, storage,
32
+ storageKey, returnFocus, onSave, desktop, onDesktopSave });
33
+ function AgentList({ locale, close }) {
34
+ const [services, setServices] = useState(() => enabledAgentServices(readAgentSettings(storage, storageKey)));
34
35
  const [applications, setApplications] = useState([]);
35
36
  const [error, setError] = useState(null);
36
37
  const active = useRef(true);
38
+ const refreshApplications = async () => {
39
+ if (!desktop)
40
+ return;
41
+ const result = await agentRequest(() => desktop.list());
42
+ if (!active.current)
43
+ return;
44
+ if ('value' in result) {
45
+ setApplications(result.value.entries);
46
+ setError(null);
47
+ }
48
+ else
49
+ setError({ code: result.code });
50
+ };
37
51
  useEffect(() => {
38
52
  active.current = true;
39
- if (desktop)
40
- void agentRequest(() => desktop.list()).then(result => {
41
- if (!active.current)
42
- return;
43
- if ('value' in result)
44
- setApplications(result.value.entries);
45
- else
46
- setError({ code: result.code });
47
- });
53
+ void refreshApplications();
48
54
  return () => { active.current = false; };
49
55
  }, []);
50
56
  const list = useRef(null);
@@ -71,7 +77,7 @@ export function createAiAgents(React, { styles = {}, storage = browserStorage(),
71
77
  items[next]?.focus();
72
78
  };
73
79
  const item = (key, icon, text, onClick, title) => element('button', {
74
- key, type: 'button', role: 'menuitem', tabIndex: -1, className: styles.aiAgentMenuItem, title, onClick
80
+ key, type: 'button', role: close ? 'menuitem' : undefined, tabIndex: close ? -1 : undefined, className: styles.aiAgentMenuItem, title, onClick
75
81
  }, icon, element('span', null, text));
76
82
  const hasEntries = services.length + applications.length > 0;
77
83
  const launch = async (application) => {
@@ -80,29 +86,34 @@ export function createAiAgents(React, { styles = {}, storage = browserStorage(),
80
86
  if (!active.current)
81
87
  return;
82
88
  if ('value' in result)
83
- close();
89
+ close?.();
84
90
  else {
85
91
  const checked = checkAgentUrl(application.url);
86
92
  setError({ code: result.code, ...('url' in checked ? checked : {}) });
87
93
  }
88
94
  };
89
95
  return element(React.Fragment, null, error && element('p', { role: 'alert', className: styles.aiAgentMenuHint }, desktopAgentError(error.code, locale)), !hasEntries && element('p', { id: hintId.current, className: styles.aiAgentMenuHint }, agentText('empty', locale)), element('div', {
90
- role: 'menu', 'aria-label': label, ref: list, className: styles.aiAgentMenu, onKeyDown: move,
96
+ role: close ? 'menu' : 'group', 'aria-label': label, ref: list, className: styles.aiAgentMenu,
97
+ onKeyDown: close ? move : undefined,
91
98
  'aria-describedby': hasEntries ? undefined : hintId.current
92
99
  }, services.map(service => item(service.id, serviceIcon(service), service.name, () => {
93
100
  openAgentService(service, open);
94
- close();
101
+ close?.();
95
102
  }, newTab)), applications.map(application => item(`desktop-${application.id}`, settingsIcon(), application.name, () => void launch(application), desktopAgentText('opensApp', locale))), error?.url && item('fallback', serviceIcon(), desktopAgentText('openFallback', locale), () => {
96
103
  open(error.url, '_blank', 'noopener,noreferrer');
97
- close();
104
+ close?.();
98
105
  }, newTab), hasEntries && element('div', { role: 'separator', className: styles.aiAgentMenuSeparator }), item('settings', settingsIcon(), agentText('settings', locale), () => {
99
- close();
100
- openSettings({ locale, returnFocus: document.activeElement });
106
+ const doc = list.current.ownerDocument;
107
+ close?.();
108
+ openSettings({ locale, returnFocus: doc.activeElement,
109
+ onSave: close ? undefined : () => setServices(enabledAgentServices(readAgentSettings(storage, storageKey))),
110
+ onDesktopSave: close ? undefined : () => { void refreshApplications(); } });
101
111
  })));
102
112
  }
103
113
  const drawerMenu = {
104
- renderMenu: props => element(AgentMenu, props)
114
+ renderMenu: props => element(AgentList, props)
105
115
  };
106
- return { drawerMenu, openSettings, settingsIcon, serviceIcon };
116
+ return { drawerMenu, renderPanel: ({ locale }) => element(AgentList, { locale }),
117
+ openSettings, settingsIcon, serviceIcon };
107
118
  }
108
119
  let nextId = 0;
@@ -76,5 +76,5 @@ export declare const desktopAgentText: (key: keyof typeof strings, locale: strin
76
76
  export declare const desktopAgentError: (code: string, locale: string) => "プロジェクトフォルダ" | "Project folder" | "Desktop applications" | "デスクトップアプリ" | "Launches a desktop application" | "デスクトップアプリを起動します" | "Add an application" | "アプリを追加" | "Name" | "名前" | "Application" | "アプリ" | "Choose…" | "選択…" | "No application selected" | "アプリが選択されていません" | "Arguments (one per line)" | "引数(1 行に 1 つ)" | "Working directory" | "作業ディレクトリ" | "Fallback website (optional)" | "代わりに開く Web サイト(任意)" | "Open the website" | "Web サイトを開く" | "Enter an HTTPS address for the fallback website." | "代わりに開く Web サイトには HTTPS の URL を入力してください。" | "Available placeholders: {projectFolder}, {repository}, {branch}." | "使える置き換えは {projectFolder}・{repository}・{branch} です。" | "Choose project folder…" | "プロジェクトフォルダを選択…" | "Choose Git repository…" | "Git リポジトリを選択…" | "Git repository" | "Git リポジトリ" | "Branch" | "ブランチ" | "Expanded arguments" | "置き換え後の引数" | "Move up" | "上へ移動" | "Move down" | "下へ移動" | "Remove application" | "アプリを削除" | "Save applications" | "アプリの設定を保存" | "Application settings saved." | "アプリの設定を保存しました。" | "Try launching" | "試しに起動" | "Save the application before trying it." | "試しに起動するには、先にアプリの設定を保存してください。" | "Launch requested." | "アプリを起動しました。" | "Enter a name and choose an application for each entry." | "各項目の名前を入力し、アプリを選択してください。" | "The application settings changed. Reopen the settings and try again." | "アプリの設定が変更されました。設定を開き直してからやり直してください。" | "Another application operation is in progress." | "別のアプリ操作を実行中です。" | "The operation was cancelled." | "操作をキャンセルしました。" | "This application is no longer registered." | "このアプリは登録されていません。" | "Choose the folder or repository used by the launch arguments. A branch is required for {branch}." | "引数で使うフォルダまたはリポジトリを選択してください。{branch} にはブランチが必要です。" | "The working directory is unavailable." | "作業ディレクトリを利用できません。" | "The selected application is missing or cannot run." | "選択したアプリが見つからないか、起動できません。" | "The application could not start." | "アプリを起動できませんでした。" | "Desktop application settings are unavailable." | "デスクトップアプリの設定を利用できません。";
77
77
  export declare function agentRequest<T>(request: () => Promise<Result<T>>): Promise<Result<T>>;
78
78
  /** An optional section of the existing settings dialog. Its changes are saved by the Desktop host. */
79
- export declare function desktopAgentSettings(doc: Document, port: DesktopAiAgentsPort, locale: string, styles: Record<string, string>): HTMLFieldSetElement;
79
+ export declare function desktopAgentSettings(doc: Document, port: DesktopAiAgentsPort, locale: string, styles: Record<string, string>, onSave?: () => void): HTMLFieldSetElement;
80
80
  export {};
@@ -52,7 +52,7 @@ export async function agentRequest(request) {
52
52
  }
53
53
  }
54
54
  /** An optional section of the existing settings dialog. Its changes are saved by the Desktop host. */
55
- export function desktopAgentSettings(doc, port, locale, styles) {
55
+ export function desktopAgentSettings(doc, port, locale, styles, onSave) {
56
56
  const text = (key) => desktopAgentText(key, locale);
57
57
  const make = (tag, className, content) => {
58
58
  const node = doc.createElement(tag);
@@ -127,6 +127,7 @@ export function desktopAgentSettings(doc, port, locale, styles) {
127
127
  entries = value.entries.map(entry => ({ ...entry }));
128
128
  render();
129
129
  status.textContent = text('saved');
130
+ onSave?.();
130
131
  });
131
132
  });
132
133
  function render() {
@@ -1,3 +1,15 @@
1
+ interface DocumentPanelSession {
2
+ requestClose(): void;
3
+ dispose(): void;
4
+ save?(): void | Promise<void>;
5
+ readonly fileEdit?: {
6
+ directory: FileSystemDirectoryHandle;
7
+ path: string;
8
+ isDirty(): boolean;
9
+ readUnsaved?(): Uint8Array | undefined;
10
+ save(): Promise<void>;
11
+ };
12
+ }
1
13
  export interface DocumentPanelRequest {
2
14
  reference: {
3
15
  providerId: string;
@@ -7,6 +19,8 @@ export interface DocumentPanelRequest {
7
19
  /** What the tab shows. Without it the tab names the file and where it comes from. */
8
20
  title?: string;
9
21
  transient?: boolean;
22
+ /** Keeps this utility tab first while the host enables the project folder drawer. */
23
+ pinWithProjectFolder?: boolean;
10
24
  /**
11
25
  * Opens the tab beside the other open tabs of the same area, in one split panel. The first tab of an area
12
26
  * opens in a new split to the right of the active panel, so the area does not mix with the sprite tabs.
@@ -24,10 +38,7 @@ export interface DocumentPanelRequest {
24
38
  };
25
39
  /** Opens the tab behind the active one, as when many tabs are opened at once. */
26
40
  inactive?: boolean;
27
- mount(element: HTMLElement, close: () => void): {
28
- requestClose(): void;
29
- dispose(): void;
30
- };
41
+ mount(element: HTMLElement, close: () => void, onSaveAvailable?: () => void): DocumentPanelSession;
31
42
  }
32
43
  export declare const documentPanelTitle: ({ title, filename, reference: { providerId, documentId } }: DocumentPanelRequest) => string;
33
44
  interface DocumentPanelSource {
@@ -36,7 +47,20 @@ interface DocumentPanelSource {
36
47
  }
37
48
  export declare function getDocumentWorkspace(vm: object): {
38
49
  open(request: DocumentPanelRequest): boolean;
39
- connect(handler: NonNullable<(request: DocumentPanelRequest) => void>): () => void;
50
+ connect(handler: NonNullable<(request: DocumentPanelRequest) => void>, getActiveSession?: NonNullable<() => DocumentPanelSession | undefined>, getSessions?: NonNullable<() => Iterable<DocumentPanelSession | undefined>>): () => void;
51
+ setSaveScope(scope: "project" | "tab"): void;
52
+ readonly saveScope: "project" | "tab";
53
+ readonly canSaveActive: boolean;
54
+ saveActive(): void | Promise<void>;
55
+ fileEdits(): {
56
+ directory: FileSystemDirectoryHandle;
57
+ path: string;
58
+ isDirty(): boolean;
59
+ readUnsaved?(): Uint8Array | undefined;
60
+ save(): Promise<void>;
61
+ }[];
62
+ notifySave: () => void;
63
+ subscribeSave(listener: () => void): () => void;
40
64
  connectSource(next: DocumentPanelSource): () => void;
41
65
  resolve(reference: DocumentPanelRequest["reference"]): DocumentPanelRequest;
42
66
  subscribe(listener: () => void): () => void;
@@ -3,6 +3,11 @@ function createDocumentWorkspace() {
3
3
  let open;
4
4
  let source;
5
5
  const listeners = new Set();
6
+ let saveScope = 'project';
7
+ let activeSession;
8
+ let sessions;
9
+ const saveListeners = new Set();
10
+ const notifySave = () => saveListeners.forEach(listener => listener());
6
11
  const notify = () => listeners.forEach(listener => listener());
7
12
  return {
8
13
  open(request) {
@@ -11,10 +16,39 @@ function createDocumentWorkspace() {
11
16
  open(request);
12
17
  return true;
13
18
  },
14
- connect(handler) {
19
+ connect(handler, getActiveSession, getSessions) {
15
20
  open = handler;
16
- return () => { if (open === handler)
17
- open = undefined; };
21
+ activeSession = getActiveSession;
22
+ sessions = getSessions;
23
+ notifySave();
24
+ return () => {
25
+ if (open !== handler)
26
+ return;
27
+ open = undefined;
28
+ activeSession = undefined;
29
+ sessions = undefined;
30
+ notifySave();
31
+ };
32
+ },
33
+ setSaveScope(scope) {
34
+ if (scope === saveScope)
35
+ return;
36
+ saveScope = scope;
37
+ notifySave();
38
+ },
39
+ get saveScope() { return saveScope; },
40
+ get canSaveActive() { return Boolean(activeSession?.()?.save); },
41
+ saveActive() { return activeSession?.()?.save?.(); },
42
+ fileEdits() {
43
+ return Array.from(sessions?.() ?? []).flatMap(session => {
44
+ const file = session?.fileEdit;
45
+ return file?.isDirty() ? [file] : [];
46
+ });
47
+ },
48
+ notifySave,
49
+ subscribeSave(listener) {
50
+ saveListeners.add(listener);
51
+ return () => { saveListeners.delete(listener); };
18
52
  },
19
53
  connectSource(next) {
20
54
  source = next;
@@ -1,11 +1,13 @@
1
1
  import type { ReactNode } from 'react';
2
2
  /** The contents the left drawer can show. `sprites` is the GUI's sprite list and backdrop, always available. */
3
- export type DrawerViewId = 'sprites' | 'project' | 'git-history';
3
+ export type DrawerViewId = 'sprites' | 'project' | 'git-history' | 'agents';
4
4
  /** The contents a host supplies. */
5
5
  export type HostDrawerViewId = Exclude<DrawerViewId, 'sprites'>;
6
6
  export interface DrawerRenderProps {
7
7
  /** The Editor locale, for example `ja` or `en`. */
8
8
  locale: string;
9
+ /** The search text supplied by the drawer's search field. */
10
+ query?: string;
9
11
  }
10
12
  /** A drawer content supplied by the host. Its button appears only while the host supplies it. */
11
13
  export interface DrawerView {
@@ -18,6 +20,8 @@ export interface DrawerView {
18
20
  render(props: DrawerRenderProps): ReactNode;
19
21
  /** The view's own tools, shown where the sprite list shows search, pin and undock. */
20
22
  tools?(props: DrawerRenderProps): ReactNode;
23
+ /** The accessible name of the search field, if this view supports search. */
24
+ searchLabel?(locale: string): string;
21
25
  }
22
26
  export interface DrawerMenuRenderProps extends DrawerRenderProps {
23
27
  /** Close the menu and return focus to its button. */
@@ -34,6 +38,10 @@ export interface DrawerMenu {
34
38
  export interface DrawerViews {
35
39
  views?: readonly DrawerView[];
36
40
  agents?: DrawerMenu;
41
+ /** Reports the drawer view presented by the standard layout. */
42
+ onSelectionChange?(view: DrawerViewId): void;
43
+ /** Exposes the drawer's reveal action to other panels in the same Editor. */
44
+ registerReveal?(reveal: (id: HostDrawerViewId) => void): () => void;
37
45
  }
38
46
  export declare const drawerViewIds: readonly DrawerViewId[];
39
47
  declare const names: {
@@ -57,6 +65,7 @@ export declare const drawerViewKey: (storageKey: string) => string;
57
65
  /** The view selected last time, or `sprites`. The caller falls back to `sprites` while that view is unavailable. */
58
66
  export declare function readDrawerView(storage: DrawerStorage | null | undefined, storageKey: string | undefined): DrawerViewId;
59
67
  export declare function writeDrawerView(storage: DrawerStorage | null | undefined, storageKey: string | undefined, view: DrawerViewId): void;
68
+ export declare const projectFolderIconPath = "M1.5 4V13h13V5.5H8L6.5 3.5h-4A1 1 0 0 0 1.5 4.5Z";
60
69
  export declare function createDrawerViewBar(React: any, styles: any): ({ locale, views, agents, selected, onSelect }: {
61
70
  locale: any;
62
71
  views: any;
@@ -1,4 +1,4 @@
1
- export const drawerViewIds = ['sprites', 'project', 'git-history'];
1
+ export const drawerViewIds = ['sprites', 'project', 'git-history', 'agents'];
2
2
  const hostIds = new Set(drawerViewIds.slice(1));
3
3
  const names = {
4
4
  sprites: ['スプライト一覧', 'Sprites'],
@@ -51,6 +51,7 @@ export function writeDrawerView(storage, storageKey, view) {
51
51
  // Keep the drawer usable when persistence is denied.
52
52
  }
53
53
  }
54
+ export const projectFolderIconPath = 'M1.5 4V13h13V5.5H8L6.5 3.5h-4A1 1 0 0 0 1.5 4.5Z';
54
55
  let nextMenuId = 0;
55
56
  export function createDrawerViewBar(React, styles) {
56
57
  const { createElement: element, useLayoutEffect, useRef, useState } = React;
@@ -60,7 +61,7 @@ export function createDrawerViewBar(React, styles) {
60
61
  }, ...children);
61
62
  const icons = {
62
63
  sprites: () => svg(element('rect', { x: 2, y: 2, width: 5, height: 5, rx: 1 }), element('rect', { x: 9, y: 2, width: 5, height: 5, rx: 1 }), element('rect', { x: 2, y: 9, width: 12, height: 5, rx: 1 })),
63
- project: () => svg(element('path', { d: 'M1.5 4V13h13V5.5H8L6.5 3.5h-4A1 1 0 0 0 1.5 4.5Z' })),
64
+ project: () => svg(element('path', { d: projectFolderIconPath })),
64
65
  'git-history': () => svg(element('circle', { cx: 5, cy: 3.5, r: 1.5 }), element('circle', { cx: 5, cy: 12.5, r: 1.5 }), element('circle', { cx: 11, cy: 6.5, r: 1.5 }), element('path', { d: 'M5 5v6M11 8c0 2.5-6 1.5-6 3' })),
65
66
  agents: () => svg(element('path', { d: agentsIconPath }))
66
67
  };
@@ -116,7 +117,8 @@ export function createDrawerViewBar(React, styles) {
116
117
  ...views.map(view => ({ id: view.id, label: view.label ?? drawerLabel(view.id, locale),
117
118
  icon: view.icon ?? icons[view.id]() }))
118
119
  ];
119
- const count = entries.length + (agents ? 1 : 0);
120
+ const menu = entries.some(entry => entry.id === 'agents') ? undefined : agents;
121
+ const count = entries.length + (menu ? 1 : 0);
120
122
  const [focused, setFocused] = useState(() => Math.max(0, entries.findIndex(entry => entry.id === selected)));
121
123
  const current = Math.min(focused, count - 1);
122
124
  const move = (event, index) => {
@@ -146,8 +148,8 @@ export function createDrawerViewBar(React, styles) {
146
148
  onFocus: () => setFocused(index),
147
149
  onClick: () => onSelect(entry.id),
148
150
  onKeyDown: event => move(event, index)
149
- }, entry.icon)), agents && element(AgentMenu, {
150
- menu: agents, locale, button: agentButton,
151
+ }, entry.icon)), menu && element(AgentMenu, {
152
+ menu, locale, button: agentButton,
151
153
  tabIndex: current === entries.length ? 0 : -1,
152
154
  onFocus: () => setFocused(entries.length),
153
155
  onKeyDown: event => move(event, entries.length)
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { NativeAssetPanel } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
3
- import type { NativeAssetPanelRenderer, NativeAssetSelector, SpriteAssetKind, SpriteAssetLayout, SpriteAssetPreviewItem, SpriteVariable } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
3
+ import type { NativeAssetPanelRenderer, NativeAssetSelector, SpriteAssetKind, SpriteAssetLayout, SpriteAssetPreviewItem, SpriteVariable, SpriteVariablePaneProps } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
4
4
  import type { SpritePropertiesPanelProps } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-properties';
5
5
  import type { SpriteSearchResult } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-editor-toolbar';
6
6
  import type { DockviewStagePane } from './dockview-stage.ts';
@@ -177,6 +177,8 @@ type SpriteTabsProps<Snapshot> = Omit<TabOptions<Snapshot>, 'activateSection' |
177
177
  writeProperties?: SpritePropertiesPanelProps['onChange'];
178
178
  writeVariable?(targetId: string, id: string, value: SpriteVariable['value']): void;
179
179
  editVariable?(targetId: string, edit: SpriteVariableEdit): SpriteVariableEditError | void;
180
+ /** Wrap a variables pane while receiving its docked view and original target identities. */
181
+ wrapVariablePane?(viewId: string, targetId: string, editable: boolean, pane: React.ReactElement<SpriteVariablePaneProps>): React.ReactNode;
180
182
  /** What this target sends and receives. `scanTargetMessages` builds it from the runtime. */
181
183
  getMessages?(targetId: string): TargetMessages;
182
184
  /** Open the block that sends or receives a message. */