@surdeddd/wmkit 0.7.0 → 0.7.2
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/angular.cjs +3 -3
- package/dist/angular.js +1 -1
- package/dist/{chunk-VQ3TLK3N.js → chunk-FOWW4LXS.js} +51 -30
- package/dist/chunk-FOWW4LXS.js.map +1 -0
- package/dist/{chunk-E47Q36LM.cjs → chunk-NJAI5R4J.cjs} +51 -30
- package/dist/chunk-NJAI5R4J.cjs.map +1 -0
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.js +1 -1
- package/dist/solid.cjs +3 -3
- package/dist/solid.js +1 -1
- package/dist/svelte.cjs +3 -3
- package/dist/svelte.js +1 -1
- package/dist/vue.cjs +3 -3
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-E47Q36LM.cjs.map +0 -1
- package/dist/chunk-VQ3TLK3N.js.map +0 -1
package/dist/angular.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNJAI5R4J_cjs = require('./chunk-NJAI5R4J.cjs');
|
|
4
4
|
var core = require('@angular/core');
|
|
5
5
|
|
|
6
6
|
function onDestroy(dispose) {
|
|
@@ -13,7 +13,7 @@ function onDestroy(dispose) {
|
|
|
13
13
|
destroyRef?.onDestroy(dispose);
|
|
14
14
|
}
|
|
15
15
|
function useWindowManager(options) {
|
|
16
|
-
const wm =
|
|
16
|
+
const wm = chunkNJAI5R4J_cjs.createWindowManager(options);
|
|
17
17
|
onDestroy(() => wm.destroy());
|
|
18
18
|
return wm;
|
|
19
19
|
}
|
|
@@ -28,7 +28,7 @@ function useWmWindow(wm, id) {
|
|
|
28
28
|
return core.computed(() => state().windows[id]);
|
|
29
29
|
}
|
|
30
30
|
function createDesktop(wm, options) {
|
|
31
|
-
const binder =
|
|
31
|
+
const binder = chunkNJAI5R4J_cjs.createDesktopBinder(wm, options);
|
|
32
32
|
onDestroy(() => binder.destroy());
|
|
33
33
|
return {
|
|
34
34
|
binder,
|
package/dist/angular.js
CHANGED
|
@@ -1025,6 +1025,7 @@ function createWindowManager(options = {}) {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
function applyEntry(entry) {
|
|
1028
|
+
const previousWindows = windows;
|
|
1028
1029
|
windows = entry.windows;
|
|
1029
1030
|
order = [...entry.order];
|
|
1030
1031
|
modalCount = countModals();
|
|
@@ -1036,6 +1037,16 @@ function createWindowManager(options = {}) {
|
|
|
1036
1037
|
if (workspace !== previousWorkspace) {
|
|
1037
1038
|
queueEvent(() => emitter.emit("workspace", { workspace, previous: previousWorkspace }));
|
|
1038
1039
|
}
|
|
1040
|
+
for (const id of Object.keys(previousWindows)) {
|
|
1041
|
+
if (windows[id]) continue;
|
|
1042
|
+
const closed = previousWindows[id];
|
|
1043
|
+
queueEvent(() => emitter.emit("close", { window: closed }));
|
|
1044
|
+
}
|
|
1045
|
+
for (const id of order) {
|
|
1046
|
+
if (previousWindows[id]) continue;
|
|
1047
|
+
const opened = windows[id];
|
|
1048
|
+
queueEvent(() => emitter.emit("open", { window: opened }));
|
|
1049
|
+
}
|
|
1039
1050
|
reflowViewport();
|
|
1040
1051
|
commit();
|
|
1041
1052
|
}
|
|
@@ -1986,7 +1997,7 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
1986
1997
|
const registry = /* @__PURE__ */ new Map();
|
|
1987
1998
|
const cleanup = [];
|
|
1988
1999
|
let lastOrder = null;
|
|
1989
|
-
let
|
|
2000
|
+
let focusedEl = null;
|
|
1990
2001
|
let drag = null;
|
|
1991
2002
|
let groupTargetId = null;
|
|
1992
2003
|
let groupTargetEl = null;
|
|
@@ -2173,16 +2184,11 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
2173
2184
|
}
|
|
2174
2185
|
}
|
|
2175
2186
|
if (orderChanged) applyStacking(state.order);
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
if (state.focusedId) {
|
|
2182
|
-
const next = registry.get(state.focusedId);
|
|
2183
|
-
if (next) next.element.dataset.wmFocused = "";
|
|
2184
|
-
}
|
|
2185
|
-
lastFocused = state.focusedId;
|
|
2187
|
+
const wanted = state.focusedId ? registry.get(state.focusedId)?.element ?? null : null;
|
|
2188
|
+
if (wanted !== focusedEl) {
|
|
2189
|
+
if (focusedEl) delete focusedEl.dataset.wmFocused;
|
|
2190
|
+
focusedEl = wanted;
|
|
2191
|
+
if (focusedEl) focusedEl.dataset.wmFocused = "";
|
|
2186
2192
|
}
|
|
2187
2193
|
lastOrder = state.order;
|
|
2188
2194
|
}
|
|
@@ -2412,23 +2418,31 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
2412
2418
|
};
|
|
2413
2419
|
windowElement.addEventListener("keydown", onModalTrap);
|
|
2414
2420
|
attached.cleanup.push(() => windowElement.removeEventListener("keydown", onModalTrap));
|
|
2421
|
+
let detached = false;
|
|
2415
2422
|
const detach = () => {
|
|
2423
|
+
if (detached) return;
|
|
2424
|
+
detached = true;
|
|
2416
2425
|
if (drag?.id === id) endDrag(true);
|
|
2417
2426
|
for (const dispose of attached.cleanup) dispose();
|
|
2418
2427
|
for (const resizeHandle of attached.handles) resizeHandle.remove();
|
|
2419
2428
|
registry.delete(id);
|
|
2429
|
+
if (registry.get(id)?.element !== windowElement) delete windowElement.dataset.wmWindow;
|
|
2430
|
+
delete windowElement.dataset.wmFocused;
|
|
2431
|
+
delete windowElement.dataset.wmTabTarget;
|
|
2432
|
+
if (focusedEl === windowElement) focusedEl = null;
|
|
2433
|
+
if (groupTargetEl === windowElement) {
|
|
2434
|
+
groupTargetId = null;
|
|
2435
|
+
groupTargetEl = null;
|
|
2436
|
+
}
|
|
2420
2437
|
};
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
attached.cleanup.push(stopOnClose);
|
|
2428
|
-
}
|
|
2438
|
+
const stopOnClose = wm.on("close", ({ window: closed }) => {
|
|
2439
|
+
if (closed.id !== id) return;
|
|
2440
|
+
detach();
|
|
2441
|
+
if (windowOptions.removeOnClose) windowElement.remove();
|
|
2442
|
+
});
|
|
2443
|
+
attached.cleanup.push(stopOnClose);
|
|
2429
2444
|
registry.set(id, attached);
|
|
2430
2445
|
lastOrder = null;
|
|
2431
|
-
lastFocused = null;
|
|
2432
2446
|
syncAll();
|
|
2433
2447
|
if (wm.getState().focusedId === id && !windowElement.contains(doc.activeElement)) {
|
|
2434
2448
|
windowElement.focus({ preventScroll: true });
|
|
@@ -2456,7 +2470,7 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
2456
2470
|
// src/dom/binder.ts
|
|
2457
2471
|
function createDesktopBinder(wm, options = {}) {
|
|
2458
2472
|
let controller = null;
|
|
2459
|
-
let
|
|
2473
|
+
let stops = [];
|
|
2460
2474
|
const entries = /* @__PURE__ */ new Set();
|
|
2461
2475
|
function attachEntry(entry) {
|
|
2462
2476
|
if (controller && !entry.detach && wm.get(entry.id)) {
|
|
@@ -2464,8 +2478,8 @@ function createDesktopBinder(wm, options = {}) {
|
|
|
2464
2478
|
}
|
|
2465
2479
|
}
|
|
2466
2480
|
function unbindDesktop() {
|
|
2467
|
-
|
|
2468
|
-
|
|
2481
|
+
for (const stop of stops) stop();
|
|
2482
|
+
stops = [];
|
|
2469
2483
|
for (const entry of entries) entry.detach = null;
|
|
2470
2484
|
controller?.destroy();
|
|
2471
2485
|
controller = null;
|
|
@@ -2476,11 +2490,18 @@ function createDesktopBinder(wm, options = {}) {
|
|
|
2476
2490
|
bindDesktop(element) {
|
|
2477
2491
|
if (controller) throw new Error("wmkit: desktop is already bound");
|
|
2478
2492
|
controller = attachDesktop(wm, element, options);
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2493
|
+
stops.push(
|
|
2494
|
+
wm.on("open", ({ window: win }) => {
|
|
2495
|
+
for (const entry of entries) {
|
|
2496
|
+
if (entry.id === win.id) attachEntry(entry);
|
|
2497
|
+
}
|
|
2498
|
+
}),
|
|
2499
|
+
wm.on("close", ({ window: win }) => {
|
|
2500
|
+
for (const entry of entries) {
|
|
2501
|
+
if (entry.id === win.id) entry.detach = null;
|
|
2502
|
+
}
|
|
2503
|
+
})
|
|
2504
|
+
);
|
|
2484
2505
|
for (const entry of entries) attachEntry(entry);
|
|
2485
2506
|
return unbindDesktop;
|
|
2486
2507
|
},
|
|
@@ -2502,5 +2523,5 @@ function createDesktopBinder(wm, options = {}) {
|
|
|
2502
2523
|
}
|
|
2503
2524
|
|
|
2504
2525
|
export { applyAspect, attachDesktop, boundsEqual, clamp, clampSize, clampToViewport, createAnnouncer, createDesktopBinder, createEmitter, createWindowManager, defaultMessages, detectSnapZone, flipFromTarget, flipToTarget, magnetize, prefersReducedMotion, zoneBounds };
|
|
2505
|
-
//# sourceMappingURL=chunk-
|
|
2506
|
-
//# sourceMappingURL=chunk-
|
|
2526
|
+
//# sourceMappingURL=chunk-FOWW4LXS.js.map
|
|
2527
|
+
//# sourceMappingURL=chunk-FOWW4LXS.js.map
|