@surdeddd/wmkit 0.6.0 → 0.7.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/README.md +1 -1
- package/README.ru.md +1 -1
- package/dist/angular.cjs +3 -3
- package/dist/angular.d.cts +2 -2
- package/dist/angular.d.ts +2 -2
- package/dist/angular.js +1 -1
- package/dist/{binder-CkmOoo1U.d.ts → binder-DvQFmO3K.d.ts} +1 -1
- package/dist/{binder-CQzQJdVj.d.cts → binder-_L3Iww0u.d.cts} +1 -1
- package/dist/{chunk-DYZQY3BE.cjs → chunk-E47Q36LM.cjs} +36 -4
- package/dist/chunk-E47Q36LM.cjs.map +1 -0
- package/dist/{chunk-3HLKVOSI.js → chunk-VQ3TLK3N.js} +36 -4
- package/dist/chunk-VQ3TLK3N.js.map +1 -0
- package/dist/index.cjs +18 -18
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/persist.d.cts +1 -1
- package/dist/persist.d.ts +1 -1
- package/dist/popout.d.cts +1 -1
- package/dist/popout.d.ts +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/solid.cjs +3 -3
- package/dist/solid.d.cts +2 -2
- package/dist/solid.d.ts +2 -2
- package/dist/solid.js +1 -1
- package/dist/svelte.cjs +3 -3
- package/dist/svelte.d.cts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +1 -1
- package/dist/{types-LP7Inhxx.d.cts → types-jG2lHGcA.d.cts} +2 -0
- package/dist/{types-LP7Inhxx.d.ts → types-jG2lHGcA.d.ts} +2 -0
- package/dist/vue.cjs +3 -3
- package/dist/vue.d.cts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HLKVOSI.js.map +0 -1
- package/dist/chunk-DYZQY3BE.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- 🪟 **Full window lifecycle** — open, close, focus, minimize, maximize, restore, drag, 8-direction resize
|
|
16
16
|
- 🧠 **Headless core** — a serializable state machine plus a DOM controller; bring your own markup or use the glass theme
|
|
17
17
|
- ⚛️ **Official adapters** — `@surdeddd/wmkit/react`, `/vue`, `/svelte`, `/solid`, `/angular`, all thin sugar over one core
|
|
18
|
-
- 🗃️ **Tab groups** — drop one titlebar onto another and the windows share a frame, dockview style
|
|
18
|
+
- 🗃️ **Tab groups** — drop one titlebar onto another and the windows share a frame, dockview style; the tab order is yours to reorder
|
|
19
19
|
- ⊞ **Snap zones** — halves, quarters, thirds and drag-to-top maximize with a live preview
|
|
20
20
|
- 🧲 **Magnetism** — window edges align to neighbours and the viewport while dragging
|
|
21
21
|
- ↩️ **Undo/redo** — every mutation is one step; a whole drag collapses into a single history entry
|
package/README.ru.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- 🪟 **Полный жизненный цикл окна** — открытие, закрытие, фокус, сворачивание, разворачивание, восстановление, drag, ресайз в 8 направлениях
|
|
12
12
|
- 🧠 **Headless-ядро** — сериализуемая стейт-машина плюс DOM-контроллер; своя разметка или готовая стеклянная тема
|
|
13
13
|
- ⚛️ **Родные адаптеры** — `@surdeddd/wmkit/react`, `/vue`, `/svelte`, `/solid`, `/angular`, тонкий сахар над одним ядром
|
|
14
|
-
- 🗃️ **Вкладочные группы** — бросьте заголовок на заголовок, и окна начнут делить одну
|
|
14
|
+
- 🗃️ **Вкладочные группы** — бросьте заголовок на заголовок, и окна начнут делить одну рамку; порядок вкладок можно менять
|
|
15
15
|
- ⊞ **Snap-зоны** — половины, четверти, трети и максимизация от верхнего края с живым превью
|
|
16
16
|
- 🧲 **Магнетизм** — края окна прилипают к соседям и вьюпорту при перетаскивании
|
|
17
17
|
- ↩️ **Undo/redo** — каждая мутация = один шаг; целый drag схлопывается в одну запись истории
|
package/dist/angular.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkE47Q36LM_cjs = require('./chunk-E47Q36LM.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 = chunkE47Q36LM_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 = chunkE47Q36LM_cjs.createDesktopBinder(wm, options);
|
|
32
32
|
onDestroy(() => binder.destroy());
|
|
33
33
|
return {
|
|
34
34
|
binder,
|
package/dist/angular.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal } from '@angular/core';
|
|
2
|
-
import { W as WindowManager, M as ManagerOptions, a as ManagerState, b as WindowState } from './types-
|
|
3
|
-
import { D as DesktopBinder, W as WindowAttachOptions, a as DesktopOptions } from './binder-
|
|
2
|
+
import { W as WindowManager, M as ManagerOptions, a as ManagerState, b as WindowState } from './types-jG2lHGcA.cjs';
|
|
3
|
+
import { D as DesktopBinder, W as WindowAttachOptions, a as DesktopOptions } from './binder-_L3Iww0u.cjs';
|
|
4
4
|
|
|
5
5
|
declare function useWindowManager(options?: ManagerOptions): WindowManager;
|
|
6
6
|
declare function useWmState(wm: WindowManager): Signal<ManagerState>;
|
package/dist/angular.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal } from '@angular/core';
|
|
2
|
-
import { W as WindowManager, M as ManagerOptions, a as ManagerState, b as WindowState } from './types-
|
|
3
|
-
import { D as DesktopBinder, W as WindowAttachOptions, a as DesktopOptions } from './binder-
|
|
2
|
+
import { W as WindowManager, M as ManagerOptions, a as ManagerState, b as WindowState } from './types-jG2lHGcA.js';
|
|
3
|
+
import { D as DesktopBinder, W as WindowAttachOptions, a as DesktopOptions } from './binder-DvQFmO3K.js';
|
|
4
4
|
|
|
5
5
|
declare function useWindowManager(options?: ManagerOptions): WindowManager;
|
|
6
6
|
declare function useWmState(wm: WindowManager): Signal<ManagerState>;
|
package/dist/angular.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as Size, B as Bounds, g as SnapZone, W as WindowManager, b as WindowState } from './types-
|
|
1
|
+
import { f as Size, B as Bounds, g as SnapZone, W as WindowManager, b as WindowState } from './types-jG2lHGcA.js';
|
|
2
2
|
|
|
3
3
|
declare function clamp(value: number, min: number, max: number): number;
|
|
4
4
|
declare function clampSize(size: Size, min: Size, max: Size | null): Size;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as Size, B as Bounds, g as SnapZone, W as WindowManager, b as WindowState } from './types-
|
|
1
|
+
import { f as Size, B as Bounds, g as SnapZone, W as WindowManager, b as WindowState } from './types-jG2lHGcA.cjs';
|
|
2
2
|
|
|
3
3
|
declare function clamp(value: number, min: number, max: number): number;
|
|
4
4
|
declare function clampSize(size: Size, min: Size, max: Size | null): Size;
|
|
@@ -285,8 +285,7 @@ function createWindowManager(options = {}) {
|
|
|
285
285
|
}
|
|
286
286
|
function blockOf(id) {
|
|
287
287
|
const win = windows[id];
|
|
288
|
-
|
|
289
|
-
return [...membersOf(win.groupId).filter((entry) => entry !== id), id];
|
|
288
|
+
return win.groupId === null ? [id] : membersOf(win.groupId);
|
|
290
289
|
}
|
|
291
290
|
function raise(id) {
|
|
292
291
|
const win = windows[id];
|
|
@@ -895,6 +894,37 @@ function createWindowManager(options = {}) {
|
|
|
895
894
|
commit();
|
|
896
895
|
return true;
|
|
897
896
|
}
|
|
897
|
+
function moveTab(id, index) {
|
|
898
|
+
const win = windows[id];
|
|
899
|
+
if (!win?.groupId || !Number.isFinite(index)) return false;
|
|
900
|
+
const members = membersOf(win.groupId);
|
|
901
|
+
const from = members.indexOf(id);
|
|
902
|
+
const target = Math.max(0, Math.min(members.length - 1, Math.trunc(index)));
|
|
903
|
+
if (from === -1 || from === target) return false;
|
|
904
|
+
const reordered = [...members];
|
|
905
|
+
reordered.splice(from, 1);
|
|
906
|
+
reordered.splice(target, 0, id);
|
|
907
|
+
const next = [...order];
|
|
908
|
+
let cursor = 0;
|
|
909
|
+
for (let i = 0; i < next.length; i += 1) {
|
|
910
|
+
if (!members.includes(next[i])) continue;
|
|
911
|
+
next[i] = reordered[cursor++];
|
|
912
|
+
}
|
|
913
|
+
order = next;
|
|
914
|
+
emitGroup(win.groupId, null);
|
|
915
|
+
queueEvent(() => emitter.emit("order", { order }));
|
|
916
|
+
commit();
|
|
917
|
+
return true;
|
|
918
|
+
}
|
|
919
|
+
function cycleTab(direction = 1) {
|
|
920
|
+
const win = focusedId ? windows[focusedId] : void 0;
|
|
921
|
+
if (!win?.groupId) return null;
|
|
922
|
+
const members = membersOf(win.groupId);
|
|
923
|
+
const current = members.indexOf(activeTabs[win.groupId]);
|
|
924
|
+
const index = (current + direction + members.length) % members.length;
|
|
925
|
+
const next = members[index];
|
|
926
|
+
return activateTab(next) ? next : null;
|
|
927
|
+
}
|
|
898
928
|
function groupMembers(groupId) {
|
|
899
929
|
return membersOf(groupId).map((id) => windows[id]);
|
|
900
930
|
}
|
|
@@ -1303,6 +1333,8 @@ function createWindowManager(options = {}) {
|
|
|
1303
1333
|
group: (ids) => transact(() => group(ids)),
|
|
1304
1334
|
ungroup: (id) => transact(() => ungroup(id)),
|
|
1305
1335
|
activateTab: (id) => transact(() => activateTab(id)),
|
|
1336
|
+
moveTab: (id, index) => transact(() => moveTab(id, index)),
|
|
1337
|
+
cycleTab: (direction) => transact(() => cycleTab(direction)),
|
|
1306
1338
|
groupMembers,
|
|
1307
1339
|
batch: (run) => transact(run),
|
|
1308
1340
|
serialize,
|
|
@@ -2488,5 +2520,5 @@ exports.flipToTarget = flipToTarget;
|
|
|
2488
2520
|
exports.magnetize = magnetize;
|
|
2489
2521
|
exports.prefersReducedMotion = prefersReducedMotion;
|
|
2490
2522
|
exports.zoneBounds = zoneBounds;
|
|
2491
|
-
//# sourceMappingURL=chunk-
|
|
2492
|
-
//# sourceMappingURL=chunk-
|
|
2523
|
+
//# sourceMappingURL=chunk-E47Q36LM.cjs.map
|
|
2524
|
+
//# sourceMappingURL=chunk-E47Q36LM.cjs.map
|