@kubohiroya/turbowarp-plus-editor-workbench 0.3.1 → 0.4.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 +42 -0
- package/README.md +42 -0
- package/dist/ai-agent-settings.d.ts +97 -0
- package/dist/ai-agent-settings.js +316 -0
- package/dist/ai-agents.d.ts +24 -0
- package/dist/ai-agents.js +75 -0
- package/dist/document-workspace.d.ts +17 -0
- package/dist/drawer-views.d.ts +66 -0
- package/dist/drawer-views.js +152 -0
- package/dist/sprite-layout-menu.d.ts +3 -0
- package/dist/sprite-layout-menu.js +21 -8
- package/dist/sprite-tabs.d.ts +20 -0
- package/dist/sprite-tabs.js +171 -22
- package/dist/standard-layout.d.ts +4 -1
- package/dist/standard-layout.js +57 -13
- package/dist/target-tab-menu.d.ts +29 -0
- package/dist/target-tab-menu.js +76 -0
- package/dist/workspace-layout.d.ts +1 -0
- package/dist/workspace-layout.js +6 -2
- package/package.json +5 -1
- package/src/ai-agent-settings.ts +380 -0
- package/src/ai-agents.ts +95 -0
- package/src/document-workspace.ts +12 -0
- package/src/drawer-views.ts +203 -0
- package/src/editor.css +270 -0
- package/src/sprite-layout-menu.css +71 -0
- package/src/sprite-layout-menu.ts +27 -8
- package/src/sprite-tabs.ts +156 -22
- package/src/standard-layout.ts +67 -17
- package/src/target-tab-menu.ts +99 -0
- package/src/workspace-layout.ts +6 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
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';
|
|
4
|
+
/** The contents a host supplies. */
|
|
5
|
+
export type HostDrawerViewId = Exclude<DrawerViewId, 'sprites'>;
|
|
6
|
+
export interface DrawerRenderProps {
|
|
7
|
+
/** The Editor locale, for example `ja` or `en`. */
|
|
8
|
+
locale: string;
|
|
9
|
+
}
|
|
10
|
+
/** A drawer content supplied by the host. Its button appears only while the host supplies it. */
|
|
11
|
+
export interface DrawerView {
|
|
12
|
+
id: HostDrawerViewId;
|
|
13
|
+
/** The button's name. Defaults to the package's Japanese or English name for `id`. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** A 16 px inline icon drawn with `currentColor`. Defaults to the package's icon for `id`. */
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
/** The content. Rendered only while the view is selected. */
|
|
18
|
+
render(props: DrawerRenderProps): ReactNode;
|
|
19
|
+
/** The view's own tools, shown where the sprite list shows search, pin and undock. */
|
|
20
|
+
tools?(props: DrawerRenderProps): ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export interface DrawerMenuRenderProps extends DrawerRenderProps {
|
|
23
|
+
/** Close the menu and return focus to its button. */
|
|
24
|
+
close(): void;
|
|
25
|
+
}
|
|
26
|
+
/** The AI agent menu supplied by the host. Opening it does not change the drawer's content. */
|
|
27
|
+
export interface DrawerMenu {
|
|
28
|
+
label?: string;
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
/** The menu content, normally one `role="menu"` element with `menuitem` children. */
|
|
31
|
+
renderMenu(props: DrawerMenuRenderProps): ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/** What the host passes to `StandardLayout` as `drawerViews`. */
|
|
34
|
+
export interface DrawerViews {
|
|
35
|
+
views?: readonly DrawerView[];
|
|
36
|
+
agents?: DrawerMenu;
|
|
37
|
+
}
|
|
38
|
+
export declare const drawerViewIds: readonly DrawerViewId[];
|
|
39
|
+
declare const names: {
|
|
40
|
+
readonly sprites: readonly ["スプライト一覧", "Sprites"];
|
|
41
|
+
readonly project: readonly ["プロジェクトフォルダ", "Project folder"];
|
|
42
|
+
readonly 'git-history': readonly ["Git 履歴", "Git history"];
|
|
43
|
+
readonly agents: readonly ["AI エージェント", "AI agents"];
|
|
44
|
+
readonly bar: readonly ["ドロワーの表示", "Drawer views"];
|
|
45
|
+
};
|
|
46
|
+
/** The AI agent button's sparkle, also used beside the host's entry for the AI agent settings. */
|
|
47
|
+
export declare const agentsIconPath = "M8 1.5 9.4 6.6 14.5 8 9.4 9.4 8 14.5 6.6 9.4 1.5 8 6.6 6.6Z";
|
|
48
|
+
export declare const isJapanese: (locale: string) => boolean;
|
|
49
|
+
export declare const drawerLabel: (id: keyof typeof names, locale: string) => "スプライト一覧" | "Sprites" | "プロジェクトフォルダ" | "Project folder" | "Git 履歴" | "Git history" | "AI エージェント" | "AI agents" | "ドロワーの表示" | "Drawer views";
|
|
50
|
+
/** The supported host views in button order, without unknown or repeated ids. */
|
|
51
|
+
export declare function availableDrawerViews(drawerViews: DrawerViews | undefined): DrawerView[];
|
|
52
|
+
/** The bar is shown only when the host supplies something besides the sprite list. */
|
|
53
|
+
export declare const hasDrawerBar: (drawerViews: DrawerViews | undefined) => boolean;
|
|
54
|
+
type DrawerStorage = Pick<Storage, 'getItem' | 'setItem'>;
|
|
55
|
+
export declare const drawerViewKey: (storageKey: string) => string;
|
|
56
|
+
/** The view selected last time, or `sprites`. The caller falls back to `sprites` while that view is unavailable. */
|
|
57
|
+
export declare function readDrawerView(storage: DrawerStorage | null | undefined, storageKey: string | undefined): DrawerViewId;
|
|
58
|
+
export declare function writeDrawerView(storage: DrawerStorage | null | undefined, storageKey: string | undefined, view: DrawerViewId): void;
|
|
59
|
+
export declare function createDrawerViewBar(React: any, styles: any): ({ locale, views, agents, selected, onSelect }: {
|
|
60
|
+
locale: any;
|
|
61
|
+
views: any;
|
|
62
|
+
agents: any;
|
|
63
|
+
selected: any;
|
|
64
|
+
onSelect: any;
|
|
65
|
+
}) => any;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export const drawerViewIds = ['sprites', 'project', 'git-history'];
|
|
2
|
+
const hostIds = new Set(drawerViewIds.slice(1));
|
|
3
|
+
const names = {
|
|
4
|
+
sprites: ['スプライト一覧', 'Sprites'],
|
|
5
|
+
project: ['プロジェクトフォルダ', 'Project folder'],
|
|
6
|
+
'git-history': ['Git 履歴', 'Git history'],
|
|
7
|
+
agents: ['AI エージェント', 'AI agents'],
|
|
8
|
+
bar: ['ドロワーの表示', 'Drawer views']
|
|
9
|
+
};
|
|
10
|
+
/** The AI agent button's sparkle, also used beside the host's entry for the AI agent settings. */
|
|
11
|
+
export const agentsIconPath = 'M8 1.5 9.4 6.6 14.5 8 9.4 9.4 8 14.5 6.6 9.4 1.5 8 6.6 6.6Z';
|
|
12
|
+
export const isJapanese = (locale) => /^ja(?:-|$)/i.test(locale ?? '');
|
|
13
|
+
export const drawerLabel = (id, locale) => names[id][isJapanese(locale) ? 0 : 1];
|
|
14
|
+
/** The supported host views in button order, without unknown or repeated ids. */
|
|
15
|
+
export function availableDrawerViews(drawerViews) {
|
|
16
|
+
const views = drawerViews?.views ?? [];
|
|
17
|
+
return drawerViewIds.slice(1).flatMap(id => {
|
|
18
|
+
const view = views.find(candidate => candidate && candidate.id === id && hostIds.has(candidate.id) &&
|
|
19
|
+
typeof candidate.render === 'function');
|
|
20
|
+
return view ? [view] : [];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** The bar is shown only when the host supplies something besides the sprite list. */
|
|
24
|
+
export const hasDrawerBar = (drawerViews) => availableDrawerViews(drawerViews).length > 0 || typeof drawerViews?.agents?.renderMenu === 'function';
|
|
25
|
+
export const drawerViewKey = (storageKey) => `${storageKey}.drawer`;
|
|
26
|
+
/** The view selected last time, or `sprites`. The caller falls back to `sprites` while that view is unavailable. */
|
|
27
|
+
export function readDrawerView(storage, storageKey) {
|
|
28
|
+
if (!storage || !storageKey)
|
|
29
|
+
return 'sprites';
|
|
30
|
+
try {
|
|
31
|
+
const saved = JSON.parse(storage.getItem(drawerViewKey(storageKey)) ?? 'null');
|
|
32
|
+
if (saved?.version === 1 && drawerViewIds.includes(saved.view))
|
|
33
|
+
return saved.view;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Storage can be unavailable or contain obsolete data.
|
|
37
|
+
}
|
|
38
|
+
return 'sprites';
|
|
39
|
+
}
|
|
40
|
+
export function writeDrawerView(storage, storageKey, view) {
|
|
41
|
+
if (!storage || !storageKey)
|
|
42
|
+
return;
|
|
43
|
+
try {
|
|
44
|
+
storage.setItem(drawerViewKey(storageKey), JSON.stringify({ version: 1, view }));
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Keep the drawer usable when persistence is denied.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
let nextMenuId = 0;
|
|
51
|
+
export function createDrawerViewBar(React, styles) {
|
|
52
|
+
const { createElement: element, useLayoutEffect, useRef, useState } = React;
|
|
53
|
+
const svg = (...children) => element('svg', {
|
|
54
|
+
'aria-hidden': true, focusable: false, width: 16, height: 16, viewBox: '0 0 16 16',
|
|
55
|
+
fill: 'none', stroke: 'currentColor', strokeWidth: 1.3, strokeLinecap: 'round', strokeLinejoin: 'round'
|
|
56
|
+
}, ...children);
|
|
57
|
+
const icons = {
|
|
58
|
+
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 })),
|
|
59
|
+
project: () => svg(element('path', { d: 'M1.5 4V13h13V5.5H8L6.5 3.5h-4A1 1 0 0 0 1.5 4.5Z' })),
|
|
60
|
+
'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' })),
|
|
61
|
+
agents: () => svg(element('path', { d: agentsIconPath }))
|
|
62
|
+
};
|
|
63
|
+
function AgentMenu({ menu, locale, button, onFocus, onKeyDown, tabIndex }) {
|
|
64
|
+
const [open, setOpen] = useState(false);
|
|
65
|
+
const popup = useRef(null);
|
|
66
|
+
const id = useRef(null);
|
|
67
|
+
if (!id.current)
|
|
68
|
+
id.current = `plus-drawer-agents-${++nextMenuId}`;
|
|
69
|
+
const label = menu.label ?? drawerLabel('agents', locale);
|
|
70
|
+
const close = (focus = true) => {
|
|
71
|
+
setOpen(false);
|
|
72
|
+
if (focus)
|
|
73
|
+
button.current?.focus();
|
|
74
|
+
};
|
|
75
|
+
useLayoutEffect(() => {
|
|
76
|
+
if (!open)
|
|
77
|
+
return;
|
|
78
|
+
const node = popup.current;
|
|
79
|
+
node?.querySelector('[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], button, a[href], input')
|
|
80
|
+
?.focus({ preventScroll: true });
|
|
81
|
+
const doc = node?.ownerDocument;
|
|
82
|
+
const outside = event => {
|
|
83
|
+
if (!node.contains(event.target) && !button.current?.contains(event.target))
|
|
84
|
+
close(false);
|
|
85
|
+
};
|
|
86
|
+
doc?.addEventListener('pointerdown', outside, true);
|
|
87
|
+
return () => doc?.removeEventListener('pointerdown', outside, true);
|
|
88
|
+
}, [open]);
|
|
89
|
+
return element('div', { className: styles.drawerAgents }, element('button', {
|
|
90
|
+
type: 'button', ref: button, tabIndex, 'aria-label': label, title: label,
|
|
91
|
+
'aria-haspopup': 'menu', 'aria-expanded': open, 'aria-controls': open ? id.current : undefined,
|
|
92
|
+
'data-drawer-view': 'agents',
|
|
93
|
+
onClick: () => setOpen(value => !value),
|
|
94
|
+
onFocus, onKeyDown
|
|
95
|
+
}, menu.icon ?? icons.agents()), open && element('div', {
|
|
96
|
+
id: id.current, ref: popup, className: styles.drawerAgentsMenu,
|
|
97
|
+
onKeyDown: event => {
|
|
98
|
+
if (event.key !== 'Escape')
|
|
99
|
+
return;
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
close();
|
|
103
|
+
}
|
|
104
|
+
}, menu.renderMenu({ locale, close: () => close() })));
|
|
105
|
+
}
|
|
106
|
+
/** The row of icon buttons at the top of the left drawer. */
|
|
107
|
+
return function DrawerViewBar({ locale, views, agents, selected, onSelect }) {
|
|
108
|
+
const bar = useRef(null);
|
|
109
|
+
const agentButton = useRef(null);
|
|
110
|
+
const entries = [
|
|
111
|
+
{ id: 'sprites', label: drawerLabel('sprites', locale), icon: icons.sprites() },
|
|
112
|
+
...views.map(view => ({ id: view.id, label: view.label ?? drawerLabel(view.id, locale),
|
|
113
|
+
icon: view.icon ?? icons[view.id]() }))
|
|
114
|
+
];
|
|
115
|
+
const count = entries.length + (agents ? 1 : 0);
|
|
116
|
+
const [focused, setFocused] = useState(() => Math.max(0, entries.findIndex(entry => entry.id === selected)));
|
|
117
|
+
const current = Math.min(focused, count - 1);
|
|
118
|
+
const move = (event, index) => {
|
|
119
|
+
const buttons = bar.current.querySelectorAll('[data-drawer-view]');
|
|
120
|
+
const rtl = bar.current.ownerDocument.defaultView.getComputedStyle(bar.current).direction === 'rtl';
|
|
121
|
+
const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];
|
|
122
|
+
let next;
|
|
123
|
+
if (event.key === 'Home')
|
|
124
|
+
next = 0;
|
|
125
|
+
else if (event.key === 'End')
|
|
126
|
+
next = count - 1;
|
|
127
|
+
else if (step)
|
|
128
|
+
next = (index + step + count) % count;
|
|
129
|
+
else
|
|
130
|
+
return;
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
setFocused(next);
|
|
133
|
+
buttons[next]?.focus();
|
|
134
|
+
};
|
|
135
|
+
return element('div', {
|
|
136
|
+
className: styles.drawerViewBar, role: 'toolbar', ref: bar,
|
|
137
|
+
'aria-label': drawerLabel('bar', locale)
|
|
138
|
+
}, entries.map((entry, index) => element('button', {
|
|
139
|
+
key: entry.id, type: 'button', 'data-drawer-view': entry.id,
|
|
140
|
+
'aria-label': entry.label, title: entry.label, 'aria-pressed': entry.id === selected,
|
|
141
|
+
tabIndex: index === current ? 0 : -1,
|
|
142
|
+
onFocus: () => setFocused(index),
|
|
143
|
+
onClick: () => onSelect(entry.id),
|
|
144
|
+
onKeyDown: event => move(event, index)
|
|
145
|
+
}, entry.icon)), agents && element(AgentMenu, {
|
|
146
|
+
menu: agents, locale, button: agentButton,
|
|
147
|
+
tabIndex: current === entries.length ? 0 : -1,
|
|
148
|
+
onFocus: () => setFocused(entries.length),
|
|
149
|
+
onKeyDown: event => move(event, entries.length)
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -8,6 +8,9 @@ interface SpriteLayoutCommands {
|
|
|
8
8
|
canOpenPanel?(): boolean;
|
|
9
9
|
openPalette?(): void;
|
|
10
10
|
canOpenPalette?(): boolean;
|
|
11
|
+
/** Whether the tabs stand in a column at the left of each split panel instead of a row above it. */
|
|
12
|
+
verticalTabs?(): boolean;
|
|
13
|
+
setVerticalTabs?(vertical: boolean): void;
|
|
11
14
|
}
|
|
12
15
|
export declare function createSpriteLayoutMenu(document: Document, locale: string, commands: SpriteLayoutCommands): {
|
|
13
16
|
element: HTMLDivElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const labels = {
|
|
2
2
|
ja: ['編集パネルのレイアウト', 'パネルを横に分割', 'パネルを縦に分割', 'この分割パネルを閉じる',
|
|
3
|
-
'パネルを別画面で開く', 'ブロックパレットを別画面で開く'],
|
|
3
|
+
'パネルを別画面で開く', 'ブロックパレットを別画面で開く', 'タブを垂直に並べて表示', 'タブを水平に並べて表示'],
|
|
4
4
|
en: ['Editor panel layout', 'Split right', 'Split below', 'Close this split',
|
|
5
|
-
'Open panel in another window', 'Open block palette in another window']
|
|
5
|
+
'Open panel in another window', 'Open block palette in another window', 'Show tabs vertically', 'Show tabs horizontally']
|
|
6
6
|
};
|
|
7
7
|
function createIcon(document, path) {
|
|
8
8
|
const ns = 'http://www.w3.org/2000/svg';
|
|
@@ -20,7 +20,7 @@ function createIcon(document, path) {
|
|
|
20
20
|
return icon;
|
|
21
21
|
}
|
|
22
22
|
export function createSpriteLayoutMenu(document, locale, commands) {
|
|
23
|
-
const [title, right, below, closeLabel, panelLabel, paletteLabel] = /^ja(?:-|$)/i.test(locale) ? labels.ja : labels.en;
|
|
23
|
+
const [title, right, below, closeLabel, panelLabel, paletteLabel, verticalLabel, horizontalLabel] = /^ja(?:-|$)/i.test(locale) ? labels.ja : labels.en;
|
|
24
24
|
const element = document.createElement('div');
|
|
25
25
|
element.className = 'tw-plus-sprite-layout-menu';
|
|
26
26
|
const trigger = document.createElement('button');
|
|
@@ -42,21 +42,32 @@ export function createSpriteLayoutMenu(document, locale, commands) {
|
|
|
42
42
|
{ label: closeLabel, run: commands.close, enabled: commands.canClose, path: 'm4.5 4.5 7 7m0-7-7 7' },
|
|
43
43
|
{ label: panelLabel, run: commands.openPanel, enabled: commands.canOpenPanel, path: 'M7 3H3v10h10V9m-5-1 5-5m-4 0h4v4' },
|
|
44
44
|
{ label: paletteLabel, run: commands.openPalette, enabled: commands.canOpenPalette,
|
|
45
|
-
path: 'M7 4H3v3h2v2H3v3h7v-2h2V9m-3-2 4-4m-3 0h3v3' }
|
|
45
|
+
path: 'M7 4H3v3h2v2H3v3h7v-2h2V9m-3-2 4-4m-3 0h3v3' },
|
|
46
|
+
...(commands.verticalTabs && commands.setVerticalTabs ? [{
|
|
47
|
+
label: verticalLabel, run: () => commands.setVerticalTabs(!commands.verticalTabs()),
|
|
48
|
+
path: 'M2.5 3.5h11v9h-11zM6 3.5v9M2.5 6h3.5m-3.5 2.5h3.5',
|
|
49
|
+
// The item names the arrangement it switches to.
|
|
50
|
+
current: () => commands.verticalTabs() ?
|
|
51
|
+
{ label: horizontalLabel, path: 'M2.5 3.5h11v9h-11zM2.5 6.5h11M6 3.5v3m3.5-3v3' } : undefined
|
|
52
|
+
}] : [])
|
|
46
53
|
];
|
|
47
|
-
const entries = items.flatMap(({ label, run, enabled, path }) => {
|
|
54
|
+
const entries = items.flatMap(({ label, run, enabled, path, current }) => {
|
|
48
55
|
if (!run)
|
|
49
56
|
return [];
|
|
50
57
|
const item = document.createElement('button');
|
|
51
58
|
item.type = 'button';
|
|
52
|
-
|
|
59
|
+
const render = () => {
|
|
60
|
+
const shown = current?.() ?? { label, path };
|
|
61
|
+
item.replaceChildren(createIcon(document, shown.path), shown.label);
|
|
62
|
+
};
|
|
63
|
+
render();
|
|
53
64
|
item.tabIndex = -1;
|
|
54
65
|
item.setAttribute('role', 'menuitem');
|
|
55
66
|
item.addEventListener('click', () => {
|
|
56
67
|
close(true);
|
|
57
68
|
run();
|
|
58
69
|
});
|
|
59
|
-
return [{ item, enabled }];
|
|
70
|
+
return [{ item, enabled, render: current && render }];
|
|
60
71
|
});
|
|
61
72
|
const buttons = entries.map(({ item }) => item);
|
|
62
73
|
popup.append(...buttons);
|
|
@@ -83,8 +94,10 @@ export function createSpriteLayoutMenu(document, locale, commands) {
|
|
|
83
94
|
if (openedIn)
|
|
84
95
|
return;
|
|
85
96
|
openedIn = trigger.ownerDocument;
|
|
86
|
-
for (const { item, enabled } of entries)
|
|
97
|
+
for (const { item, enabled, render } of entries) {
|
|
87
98
|
item.disabled = enabled?.() === false;
|
|
99
|
+
render?.();
|
|
100
|
+
}
|
|
88
101
|
topLayer = typeof popup.showPopover === 'function';
|
|
89
102
|
if (topLayer) {
|
|
90
103
|
popup.setAttribute('popover', 'manual');
|
package/dist/sprite-tabs.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { getDocumentWorkspace } from './document-workspace.ts';
|
|
|
11
11
|
export type { SpriteAssetKind, SpriteAssetPreviewItem } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
|
|
12
12
|
export { editSpriteVariable } from '@kubohiroya/turbowarp-plus-editor-project-model/sprite-variable-edit';
|
|
13
13
|
export { useDockviewStage } from './dockview-stage.ts';
|
|
14
|
+
export { SpriteTargetTabsContext, useTargetTabMenu } from './target-tab-menu.ts';
|
|
14
15
|
interface CostumeAsset {
|
|
15
16
|
encodeDataURI(): string;
|
|
16
17
|
}
|
|
@@ -132,6 +133,11 @@ declare const renameLabels: {
|
|
|
132
133
|
type RenameLabels = typeof renameLabels.en;
|
|
133
134
|
export declare function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElement, options: TabOptions<Snapshot>): {
|
|
134
135
|
select: (id: string) => void;
|
|
136
|
+
selectFromList: (id?: string) => void;
|
|
137
|
+
targetTabs: (id?: string) => {
|
|
138
|
+
id: string;
|
|
139
|
+
title: string;
|
|
140
|
+
}[];
|
|
135
141
|
openStage: () => void;
|
|
136
142
|
closeStage: () => void;
|
|
137
143
|
split: (direction: SpriteSplitDirection, id?: string) => string;
|
|
@@ -182,6 +188,11 @@ export declare function useSpriteTabs<Snapshot>({ available, enabled, locale, ..
|
|
|
182
188
|
}): {
|
|
183
189
|
controller: React.MutableRefObject<{
|
|
184
190
|
select: (id: string) => void;
|
|
191
|
+
selectFromList: (id?: string) => void;
|
|
192
|
+
targetTabs: (id?: string) => {
|
|
193
|
+
id: string;
|
|
194
|
+
title: string;
|
|
195
|
+
}[];
|
|
185
196
|
openStage: () => void;
|
|
186
197
|
closeStage: () => void;
|
|
187
198
|
split: (direction: SpriteSplitDirection, id?: string) => string;
|
|
@@ -196,6 +207,15 @@ export declare function useSpriteTabs<Snapshot>({ available, enabled, locale, ..
|
|
|
196
207
|
views: () => SpriteTabView[];
|
|
197
208
|
dispose(): void;
|
|
198
209
|
}>;
|
|
210
|
+
listTabs: {
|
|
211
|
+
locale: string;
|
|
212
|
+
list: (id?: string) => {
|
|
213
|
+
id: string;
|
|
214
|
+
title: string;
|
|
215
|
+
}[];
|
|
216
|
+
select: (id?: string) => void;
|
|
217
|
+
activate: (id: string) => boolean;
|
|
218
|
+
};
|
|
199
219
|
assetSelections: Readonly<Record<SpriteAssetKind, SpriteAssetSelection>>;
|
|
200
220
|
context: {
|
|
201
221
|
selectedId: string;
|