@kubohiroya/turbowarp-plus-editor-workbench 0.19.0 → 0.19.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/dist/sprite-tabs.js +12 -0
- package/package.json +3 -3
- package/src/sprite-tabs.ts +11 -0
package/dist/sprite-tabs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { createDockview, DefaultTab, themeLight } from 'dockview';
|
|
4
|
+
import { connectOpenerDocument } from '@kubohiroya/turbowarp-plus-editor-windows/opener-document';
|
|
4
5
|
import { createSpriteLayoutMenu } from "./sprite-layout-menu.js";
|
|
5
6
|
import { NativeAssetPanel, SpriteAssetPane } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
|
|
6
7
|
import { SpriteEditorToolbar, spriteEditorSections } from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-editor-toolbar';
|
|
@@ -174,6 +175,8 @@ export function mountSpriteTabs(root, content, options) {
|
|
|
174
175
|
const openingGroups = new Set();
|
|
175
176
|
/** Panels that were in a separate window when the layout was saved, until the user reopens them. */
|
|
176
177
|
const reopenable = new Map();
|
|
178
|
+
// Each open panel window, connected to this document while it is open.
|
|
179
|
+
const openerConnections = new Map();
|
|
177
180
|
const originalTargets = () => vm.runtime.targets.filter(target => target.isOriginal);
|
|
178
181
|
// Whether tabs stand in a column at the left of each split. It is the user's preference for every project.
|
|
179
182
|
let verticalTabs = false;
|
|
@@ -382,7 +385,13 @@ export function mountSpriteTabs(root, content, options) {
|
|
|
382
385
|
doc.documentElement.lang = document.documentElement.lang;
|
|
383
386
|
doc.documentElement.style.cssText = document.documentElement.style.cssText;
|
|
384
387
|
doc.body.className = `${document.body.className} ${popouts.className ?? ''}`;
|
|
388
|
+
// Dockview copied the styles present now; views opened later bring their own.
|
|
389
|
+
openerConnections.set(child, connectOpenerDocument(doc, { opener: document, mirrorNewStyles: true }));
|
|
385
390
|
}, { once: true });
|
|
391
|
+
},
|
|
392
|
+
onWillClose({ window: child }) {
|
|
393
|
+
openerConnections.get(child)?.();
|
|
394
|
+
openerConnections.delete(child);
|
|
386
395
|
}
|
|
387
396
|
})
|
|
388
397
|
.then(opened => { if (opened)
|
|
@@ -1439,6 +1448,9 @@ export function mountSpriteTabs(root, content, options) {
|
|
|
1439
1448
|
disposeView(view);
|
|
1440
1449
|
content.remove();
|
|
1441
1450
|
dockview.dispose();
|
|
1451
|
+
for (const disconnect of openerConnections.values())
|
|
1452
|
+
disconnect();
|
|
1453
|
+
openerConnections.clear();
|
|
1442
1454
|
}
|
|
1443
1455
|
};
|
|
1444
1456
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-plus-editor-workbench",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
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",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@kubohiroya/turbowarp-plus-editor-git": "0.22.0",
|
|
129
|
-
"@kubohiroya/turbowarp-plus-editor-windows": "0.2.
|
|
129
|
+
"@kubohiroya/turbowarp-plus-editor-windows": "0.2.1",
|
|
130
130
|
"@playwright/test": "1.64.1",
|
|
131
131
|
"@types/react": "18.3.31",
|
|
132
132
|
"@types/react-dom": "18.3.7",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
},
|
|
149
149
|
"peerDependencies": {
|
|
150
150
|
"@kubohiroya/turbowarp-plus-editor-git": ">=0.21.0 <0.23.0",
|
|
151
|
-
"@kubohiroya/turbowarp-plus-editor-windows": ">=0.2.
|
|
151
|
+
"@kubohiroya/turbowarp-plus-editor-windows": ">=0.2.1 <0.3.0",
|
|
152
152
|
"react": ">=16.14",
|
|
153
153
|
"react-dom": ">=16.14"
|
|
154
154
|
},
|
package/src/sprite-tabs.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import {createPortal} from 'react-dom';
|
|
3
3
|
import {createDockview, DefaultTab, themeLight} from 'dockview';
|
|
4
4
|
import type {DockviewGroupPanel, GroupPanelPartInitParameters, IDockviewPanel, SerializedDockview} from 'dockview';
|
|
5
|
+
import {connectOpenerDocument} from '@kubohiroya/turbowarp-plus-editor-windows/opener-document';
|
|
5
6
|
import {createSpriteLayoutMenu} from './sprite-layout-menu.ts';
|
|
6
7
|
import {NativeAssetPanel, SpriteAssetPane} from '@kubohiroya/turbowarp-plus-editor-sprite-panes/sprite-asset-pane';
|
|
7
8
|
import type {NativeAssetPanelRenderer, NativeAssetSelector, SpriteAssetKind, SpriteAssetLayout, SpriteAssetPreviewItem,
|
|
@@ -341,6 +342,8 @@ export function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElemen
|
|
|
341
342
|
const openingGroups = new Set<string>();
|
|
342
343
|
/** Panels that were in a separate window when the layout was saved, until the user reopens them. */
|
|
343
344
|
const reopenable = new Map<string, SavedPopout>();
|
|
345
|
+
// Each open panel window, connected to this document while it is open.
|
|
346
|
+
const openerConnections = new Map<Window, () => void>();
|
|
344
347
|
const originalTargets = () => vm.runtime.targets.filter(target => target.isOriginal);
|
|
345
348
|
// Whether tabs stand in a column at the left of each split. It is the user's preference for every project.
|
|
346
349
|
let verticalTabs = false;
|
|
@@ -531,7 +534,13 @@ export function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElemen
|
|
|
531
534
|
doc.documentElement.lang = document.documentElement.lang;
|
|
532
535
|
doc.documentElement.style.cssText = document.documentElement.style.cssText;
|
|
533
536
|
doc.body.className = `${document.body.className} ${popouts.className ?? ''}`;
|
|
537
|
+
// Dockview copied the styles present now; views opened later bring their own.
|
|
538
|
+
openerConnections.set(child, connectOpenerDocument(doc, {opener: document, mirrorNewStyles: true}));
|
|
534
539
|
}, {once: true});
|
|
540
|
+
},
|
|
541
|
+
onWillClose({window: child}) {
|
|
542
|
+
openerConnections.get(child)?.();
|
|
543
|
+
openerConnections.delete(child);
|
|
535
544
|
}
|
|
536
545
|
})
|
|
537
546
|
.then(opened => { if (opened) reopenable.delete(panel.id); })
|
|
@@ -1504,6 +1513,8 @@ export function mountSpriteTabs<Snapshot>(root: HTMLElement, content: HTMLElemen
|
|
|
1504
1513
|
for (const view of views.values()) disposeView(view);
|
|
1505
1514
|
content.remove();
|
|
1506
1515
|
dockview.dispose();
|
|
1516
|
+
for (const disconnect of openerConnections.values()) disconnect();
|
|
1517
|
+
openerConnections.clear();
|
|
1507
1518
|
}
|
|
1508
1519
|
};
|
|
1509
1520
|
}
|