@kubohiroya/turbowarp-plus-editor-workbench 0.6.0 → 0.8.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/dist/dockview-stage.d.ts +9 -0
- package/dist/dockview-stage.js +29 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/sprite-layout-menu.d.ts +1 -0
- package/dist/sprite-layout-menu.js +2 -1
- package/dist/sprite-tabs.js +46 -16
- package/dist/stage-drawer-drag.d.ts +5 -0
- package/dist/stage-drawer-drag.js +137 -0
- package/dist/stage-launcher.d.ts +11 -5
- package/dist/stage-launcher.js +52 -70
- package/dist/stage-resize-handle.d.ts +26 -0
- package/dist/stage-resize-handle.js +53 -0
- package/dist/stage-surface.d.ts +12 -3
- package/dist/stage-surface.js +25 -6
- package/dist/standard-layout.d.ts +10 -2
- package/dist/standard-layout.js +117 -26
- package/dist/target-tab-menu.d.ts +5 -1
- package/dist/target-tab-menu.js +7 -3
- package/dist/workspace-layout.d.ts +13 -0
- package/dist/workspace-layout.js +16 -0
- package/package.json +1 -1
- package/src/dockview-stage.ts +34 -3
- package/src/editor.css +145 -19
- package/src/index.ts +1 -0
- package/src/sprite-layout-menu.ts +3 -1
- package/src/sprite-tabs.ts +44 -15
- package/src/stage-drawer-drag.ts +138 -0
- package/src/stage-launcher.ts +60 -80
- package/src/stage-resize-handle.ts +47 -0
- package/src/stage-surface.ts +30 -7
- package/src/standard-layout.ts +114 -25
- package/src/target-tab-menu.ts +8 -3
- package/src/workspace-layout.ts +28 -0
package/src/workspace-layout.ts
CHANGED
|
@@ -14,6 +14,17 @@ export interface WindowPosition {left: number; top: number; width: number; heigh
|
|
|
14
14
|
/** Panels that were open in one separate window when the layout was saved. */
|
|
15
15
|
export interface SavedPopout {panels: string[]; position?: WindowPosition}
|
|
16
16
|
|
|
17
|
+
/** Coordinates along the drawer's available travel, with at least one axis at an edge. */
|
|
18
|
+
export interface StageDrawerPosition {x: number; y: number}
|
|
19
|
+
|
|
20
|
+
export interface StageDrawerLayout {
|
|
21
|
+
open: boolean;
|
|
22
|
+
/** Keep the drawer selected after it folds into the edge. */
|
|
23
|
+
selected: boolean;
|
|
24
|
+
position?: StageDrawerPosition;
|
|
25
|
+
width?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
export interface WorkspaceLayout {
|
|
18
29
|
version: 1;
|
|
19
30
|
project: string;
|
|
@@ -21,6 +32,7 @@ export interface WorkspaceLayout {
|
|
|
21
32
|
activeGroup: string;
|
|
22
33
|
editingView?: string;
|
|
23
34
|
panels: Record<string, PanelReference>;
|
|
35
|
+
stageDrawer?: StageDrawerLayout;
|
|
24
36
|
/** Separate windows are restored docked; the user reopens each one. */
|
|
25
37
|
popouts?: SavedPopout[];
|
|
26
38
|
}
|
|
@@ -191,11 +203,27 @@ export function readWorkspaceLayout(raw: string, project?: string): WorkspaceLay
|
|
|
191
203
|
if (editingView !== undefined && (!validId(editingView) || panels[editingView]?.kind !== 'sprite')) return;
|
|
192
204
|
const popouts = readPopouts(input.popouts, panels);
|
|
193
205
|
if (!popouts) return;
|
|
206
|
+
const stageDrawer = readStageDrawer(input.stageDrawer);
|
|
194
207
|
return {version: 1, project: input.project, grid: {root, width, height, orientation}, activeGroup: input.activeGroup,
|
|
195
208
|
editingView: typeof editingView === 'string' ? editingView : undefined, panels,
|
|
209
|
+
...(stageDrawer && {stageDrawer}),
|
|
196
210
|
...(popouts.length && {popouts})};
|
|
197
211
|
}
|
|
198
212
|
|
|
213
|
+
function readStageDrawer(input: unknown): StageDrawerLayout | undefined {
|
|
214
|
+
if (!record(input) || typeof input.open !== 'boolean' || typeof input.selected !== 'boolean') return;
|
|
215
|
+
const {position, width} = input;
|
|
216
|
+
const fraction = (value: unknown): value is number => size(value) && value <= 1;
|
|
217
|
+
const edge = (value: number) => value === 0 || value === 1;
|
|
218
|
+
return {
|
|
219
|
+
open: input.open,
|
|
220
|
+
selected: input.open || input.selected,
|
|
221
|
+
...(size(width) && width > 0 && {width}),
|
|
222
|
+
...(record(position) && fraction(position.x) && fraction(position.y) &&
|
|
223
|
+
(edge(position.x) || edge(position.y)) && {position: {x: position.x, y: position.y}})
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
199
227
|
function readPopouts(input: unknown, panels: WorkspaceLayout['panels']): SavedPopout[] | undefined {
|
|
200
228
|
if (input === undefined) return [];
|
|
201
229
|
if (!Array.isArray(input) || input.length > limit) return;
|