@surdeddd/wmkit 0.7.2 → 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/README.md +37 -2
- package/README.ru.md +37 -2
- package/dist/angular.cjs +4 -3
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +2 -1
- package/dist/angular.d.ts +2 -1
- package/dist/angular.js +2 -1
- package/dist/angular.js.map +1 -1
- package/dist/binder-B625OrjD.d.cts +13 -0
- package/dist/binder-CpGY8Wye.d.ts +13 -0
- package/dist/chunk-5XVIC5LH.js +140 -0
- package/dist/chunk-5XVIC5LH.js.map +1 -0
- package/dist/chunk-BDHFXEJN.cjs +149 -0
- package/dist/chunk-BDHFXEJN.cjs.map +1 -0
- package/dist/{chunk-NJAI5R4J.cjs → chunk-DINVOL6Z.cjs} +48 -170
- package/dist/chunk-DINVOL6Z.cjs.map +1 -0
- package/dist/{chunk-FOWW4LXS.js → chunk-MGWCKHTZ.js} +29 -143
- package/dist/chunk-MGWCKHTZ.js.map +1 -0
- package/dist/devtools.cjs +330 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +43 -0
- package/dist/devtools.d.ts +43 -0
- package/dist/devtools.js +326 -0
- package/dist/devtools.js.map +1 -0
- package/dist/gestures.cjs +219 -0
- package/dist/gestures.cjs.map +1 -0
- package/dist/gestures.d.cts +19 -0
- package/dist/gestures.d.ts +19 -0
- package/dist/gestures.js +215 -0
- package/dist/gestures.js.map +1 -0
- package/dist/index.cjs +35 -34
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/react.cjs +4 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -1
- package/dist/{binder-DvQFmO3K.d.ts → shared-BBXgEeIa.d.ts} +22 -8
- package/dist/{binder-_L3Iww0u.d.cts → shared-DU_87nY9.d.cts} +22 -8
- package/dist/solid.cjs +4 -3
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +2 -1
- package/dist/solid.d.ts +2 -1
- package/dist/solid.js +2 -1
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs +4 -3
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/svelte.js +2 -1
- package/dist/svelte.js.map +1 -1
- package/dist/themes/amber.css +316 -0
- package/dist/themes/aqua.css +285 -0
- package/dist/themes/blueprint.css +303 -0
- package/dist/themes/brutalist.css +307 -0
- package/dist/themes/candy.css +277 -0
- package/dist/themes/carbon.css +297 -0
- package/dist/themes/forest.css +278 -0
- package/dist/themes/frost.css +279 -0
- package/dist/themes/glass.css +2 -1
- package/dist/themes/light.css +2 -1
- package/dist/themes/neon.css +289 -0
- package/dist/themes/noir.css +282 -0
- package/dist/themes/paper.css +258 -0
- package/dist/themes/synth.css +283 -0
- package/dist/themes/terminal.css +273 -0
- package/dist/vue.cjs +4 -3
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +2 -1
- package/dist/vue.d.ts +2 -1
- package/dist/vue.js +2 -1
- package/dist/vue.js.map +1 -1
- package/package.json +37 -1
- package/dist/chunk-FOWW4LXS.js.map +0 -1
- package/dist/chunk-NJAI5R4J.cjs.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkBDHFXEJN_cjs = require('./chunk-BDHFXEJN.cjs');
|
|
4
|
+
|
|
3
5
|
// src/core/emitter.ts
|
|
4
6
|
function createEmitter() {
|
|
5
7
|
const listeners = /* @__PURE__ */ new Map();
|
|
@@ -28,143 +30,6 @@ function createEmitter() {
|
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
// src/core/geometry.ts
|
|
32
|
-
function clamp(value, min, max) {
|
|
33
|
-
return Math.min(Math.max(value, min), max);
|
|
34
|
-
}
|
|
35
|
-
function clampSize(size, min, max) {
|
|
36
|
-
return {
|
|
37
|
-
width: clamp(size.width, min.width, max ? max.width : Number.POSITIVE_INFINITY),
|
|
38
|
-
height: clamp(size.height, min.height, max ? max.height : Number.POSITIVE_INFINITY)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function clampToViewport(bounds, viewport, minVisible) {
|
|
42
|
-
if (viewport.width <= 0 || viewport.height <= 0) return bounds;
|
|
43
|
-
const visibleX = Math.min(minVisible, bounds.width);
|
|
44
|
-
const visibleY = Math.min(minVisible, bounds.height);
|
|
45
|
-
const x = clamp(bounds.x, visibleX - bounds.width, Math.max(0, viewport.width - visibleX));
|
|
46
|
-
const y = clamp(bounds.y, 0, Math.max(0, viewport.height - visibleY));
|
|
47
|
-
return x === bounds.x && y === bounds.y ? bounds : { ...bounds, x, y };
|
|
48
|
-
}
|
|
49
|
-
function boundsEqual(a, b) {
|
|
50
|
-
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
51
|
-
}
|
|
52
|
-
function applyAspect(size, ratio, min, max, drive) {
|
|
53
|
-
if (!Number.isFinite(ratio) || ratio <= 0) return clampSize(size, min, max);
|
|
54
|
-
const maxWidth = max ? max.width : Number.POSITIVE_INFINITY;
|
|
55
|
-
const maxHeight = max ? max.height : Number.POSITIVE_INFINITY;
|
|
56
|
-
if (drive === "height") {
|
|
57
|
-
const height = clamp(
|
|
58
|
-
size.height,
|
|
59
|
-
Math.max(min.height, min.width / ratio),
|
|
60
|
-
Math.min(maxHeight, maxWidth / ratio)
|
|
61
|
-
);
|
|
62
|
-
return { width: height * ratio, height };
|
|
63
|
-
}
|
|
64
|
-
const width = clamp(
|
|
65
|
-
size.width,
|
|
66
|
-
Math.max(min.width, min.height * ratio),
|
|
67
|
-
Math.min(maxWidth, maxHeight * ratio)
|
|
68
|
-
);
|
|
69
|
-
return { width, height: width / ratio };
|
|
70
|
-
}
|
|
71
|
-
function zoneBounds(zone, viewport) {
|
|
72
|
-
const w = viewport.width;
|
|
73
|
-
const h = viewport.height;
|
|
74
|
-
const halfW = Math.round(w / 2);
|
|
75
|
-
const halfH = Math.round(h / 2);
|
|
76
|
-
const oneThird = Math.round(w / 3);
|
|
77
|
-
const twoThirds = Math.round(w * 2 / 3);
|
|
78
|
-
switch (zone) {
|
|
79
|
-
case "left-third":
|
|
80
|
-
return { x: 0, y: 0, width: oneThird, height: h };
|
|
81
|
-
case "center-third":
|
|
82
|
-
return { x: oneThird, y: 0, width: twoThirds - oneThird, height: h };
|
|
83
|
-
case "right-third":
|
|
84
|
-
return { x: twoThirds, y: 0, width: w - twoThirds, height: h };
|
|
85
|
-
case "left":
|
|
86
|
-
return { x: 0, y: 0, width: halfW, height: h };
|
|
87
|
-
case "right":
|
|
88
|
-
return { x: halfW, y: 0, width: w - halfW, height: h };
|
|
89
|
-
case "top":
|
|
90
|
-
return { x: 0, y: 0, width: w, height: halfH };
|
|
91
|
-
case "bottom":
|
|
92
|
-
return { x: 0, y: halfH, width: w, height: h - halfH };
|
|
93
|
-
case "top-left":
|
|
94
|
-
return { x: 0, y: 0, width: halfW, height: halfH };
|
|
95
|
-
case "top-right":
|
|
96
|
-
return { x: halfW, y: 0, width: w - halfW, height: halfH };
|
|
97
|
-
case "bottom-left":
|
|
98
|
-
return { x: 0, y: halfH, width: halfW, height: h - halfH };
|
|
99
|
-
case "bottom-right":
|
|
100
|
-
return { x: halfW, y: halfH, width: w - halfW, height: h - halfH };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function detectSnapZone(x, y, viewport, options = {}) {
|
|
104
|
-
const threshold = options.threshold ?? 12;
|
|
105
|
-
const cornerSize = options.cornerSize ?? 64;
|
|
106
|
-
const w = viewport.width;
|
|
107
|
-
const h = viewport.height;
|
|
108
|
-
if (w <= 0 || h <= 0) return null;
|
|
109
|
-
const nearLeft = x <= threshold;
|
|
110
|
-
const nearRight = x >= w - threshold;
|
|
111
|
-
const nearTop = y <= threshold;
|
|
112
|
-
const nearBottom = y >= h - threshold;
|
|
113
|
-
if (nearLeft || nearRight) {
|
|
114
|
-
const side = nearLeft ? "left" : "right";
|
|
115
|
-
if (y <= cornerSize) return `top-${side}`;
|
|
116
|
-
if (y >= h - cornerSize) return `bottom-${side}`;
|
|
117
|
-
return side;
|
|
118
|
-
}
|
|
119
|
-
if (nearTop) {
|
|
120
|
-
if (x <= cornerSize) return "top-left";
|
|
121
|
-
if (x >= w - cornerSize) return "top-right";
|
|
122
|
-
return "top";
|
|
123
|
-
}
|
|
124
|
-
if (nearBottom) {
|
|
125
|
-
if (x <= cornerSize) return "bottom-left";
|
|
126
|
-
if (x >= w - cornerSize) return "bottom-right";
|
|
127
|
-
return "bottom";
|
|
128
|
-
}
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
function nearestEdge(low, high, targetLow, targetHigh) {
|
|
132
|
-
return [targetLow - low, targetHigh - low, targetLow - high, targetHigh - high];
|
|
133
|
-
}
|
|
134
|
-
function magnetize(bounds, targets, threshold) {
|
|
135
|
-
const result = { x: bounds.x, y: bounds.y, snappedX: false, snappedY: false };
|
|
136
|
-
if (threshold <= 0 || targets.length === 0) return result;
|
|
137
|
-
let bestX = threshold + 1;
|
|
138
|
-
let bestY = threshold + 1;
|
|
139
|
-
for (const target of targets) {
|
|
140
|
-
for (const delta of nearestEdge(
|
|
141
|
-
bounds.x,
|
|
142
|
-
bounds.x + bounds.width,
|
|
143
|
-
target.x,
|
|
144
|
-
target.x + target.width
|
|
145
|
-
)) {
|
|
146
|
-
if (Math.abs(delta) <= threshold && Math.abs(delta) < Math.abs(bestX)) bestX = delta;
|
|
147
|
-
}
|
|
148
|
-
for (const delta of nearestEdge(
|
|
149
|
-
bounds.y,
|
|
150
|
-
bounds.y + bounds.height,
|
|
151
|
-
target.y,
|
|
152
|
-
target.y + target.height
|
|
153
|
-
)) {
|
|
154
|
-
if (Math.abs(delta) <= threshold && Math.abs(delta) < Math.abs(bestY)) bestY = delta;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (Math.abs(bestX) <= threshold) {
|
|
158
|
-
result.x = bounds.x + bestX;
|
|
159
|
-
result.snappedX = true;
|
|
160
|
-
}
|
|
161
|
-
if (Math.abs(bestY) <= threshold) {
|
|
162
|
-
result.y = bounds.y + bestY;
|
|
163
|
-
result.snappedY = true;
|
|
164
|
-
}
|
|
165
|
-
return result;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
33
|
// src/core/manager.ts
|
|
169
34
|
var LAYER_RANK = { normal: 0, floating: 1, modal: 2 };
|
|
170
35
|
var STAGES = ["normal", "minimized", "maximized", "snapped"];
|
|
@@ -348,7 +213,7 @@ function createWindowManager(options = {}) {
|
|
|
348
213
|
for (const id of members) {
|
|
349
214
|
if (id === effective.id) continue;
|
|
350
215
|
const member = windows[id];
|
|
351
|
-
if (boundsEqual(member.bounds, effective.bounds) && member.stage === effective.stage && member.snapZone === effective.snapZone && member.layer === effective.layer && member.workspace === effective.workspace) {
|
|
216
|
+
if (chunkBDHFXEJN_cjs.boundsEqual(member.bounds, effective.bounds) && member.stage === effective.stage && member.snapZone === effective.snapZone && member.layer === effective.layer && member.workspace === effective.workspace) {
|
|
352
217
|
continue;
|
|
353
218
|
}
|
|
354
219
|
setWindow({
|
|
@@ -413,8 +278,8 @@ function createWindowManager(options = {}) {
|
|
|
413
278
|
queueEvent(() => emitter.emit("focus", { window: win, previous }));
|
|
414
279
|
}
|
|
415
280
|
function normalizeSize(size, win, drive = "width") {
|
|
416
|
-
if (win.aspectRatio === null) return clampSize(size, win.minSize, win.maxSize);
|
|
417
|
-
return applyAspect(size, win.aspectRatio, win.minSize, win.maxSize, drive);
|
|
281
|
+
if (win.aspectRatio === null) return chunkBDHFXEJN_cjs.clampSize(size, win.minSize, win.maxSize);
|
|
282
|
+
return chunkBDHFXEJN_cjs.applyAspect(size, win.aspectRatio, win.minSize, win.maxSize, drive);
|
|
418
283
|
}
|
|
419
284
|
function positionForOpen(init) {
|
|
420
285
|
if (init.x !== void 0 && init.y !== void 0) return { x: init.x, y: init.y };
|
|
@@ -441,7 +306,7 @@ function createWindowManager(options = {}) {
|
|
|
441
306
|
width: init.width ?? defaultSize.width,
|
|
442
307
|
height: init.height ?? defaultSize.height
|
|
443
308
|
};
|
|
444
|
-
const size = aspectRatio === null ? clampSize(requested, minSize, maxSize) : applyAspect(
|
|
309
|
+
const size = aspectRatio === null ? chunkBDHFXEJN_cjs.clampSize(requested, minSize, maxSize) : chunkBDHFXEJN_cjs.applyAspect(
|
|
445
310
|
requested,
|
|
446
311
|
aspectRatio,
|
|
447
312
|
minSize,
|
|
@@ -450,7 +315,7 @@ function createWindowManager(options = {}) {
|
|
|
450
315
|
);
|
|
451
316
|
const position = positionForOpen(init);
|
|
452
317
|
let bounds = { ...position, ...size };
|
|
453
|
-
if (keepInViewport) bounds = clampToViewport(bounds, viewport, minVisible);
|
|
318
|
+
if (keepInViewport) bounds = chunkBDHFXEJN_cjs.clampToViewport(bounds, viewport, minVisible);
|
|
454
319
|
const requestedStage = init.stage ?? "normal";
|
|
455
320
|
const stage = requestedStage === "snapped" ? "normal" : requestedStage;
|
|
456
321
|
let win = {
|
|
@@ -571,7 +436,7 @@ function createWindowManager(options = {}) {
|
|
|
571
436
|
return { x: 0, y: 0, width: viewport.width, height: viewport.height };
|
|
572
437
|
}
|
|
573
438
|
function snapBounds(win, zone) {
|
|
574
|
-
const rect = zoneBounds(zone, viewport);
|
|
439
|
+
const rect = chunkBDHFXEJN_cjs.zoneBounds(zone, viewport);
|
|
575
440
|
const byWidth = normalizeSize(rect, win);
|
|
576
441
|
const size = byWidth.height > rect.height ? normalizeSize(rect, win, "height") : byWidth;
|
|
577
442
|
return {
|
|
@@ -656,7 +521,7 @@ function createWindowManager(options = {}) {
|
|
|
656
521
|
snapZone: null,
|
|
657
522
|
restoreBounds: null,
|
|
658
523
|
restoreStage: null,
|
|
659
|
-
bounds: keepInViewport ? clampToViewport(bounds, viewport, minVisible) : bounds
|
|
524
|
+
bounds: keepInViewport ? chunkBDHFXEJN_cjs.clampToViewport(bounds, viewport, minVisible) : bounds
|
|
660
525
|
};
|
|
661
526
|
});
|
|
662
527
|
if (result) focusUnlessBlocked(id);
|
|
@@ -672,7 +537,7 @@ function createWindowManager(options = {}) {
|
|
|
672
537
|
snapZone: null,
|
|
673
538
|
restoreBounds: null,
|
|
674
539
|
restoreStage: null,
|
|
675
|
-
bounds: keepInViewport ? clampToViewport(next, viewport, minVisible) : next
|
|
540
|
+
bounds: keepInViewport ? chunkBDHFXEJN_cjs.clampToViewport(next, viewport, minVisible) : next
|
|
676
541
|
};
|
|
677
542
|
});
|
|
678
543
|
if (result) focusUnlessBlocked(id);
|
|
@@ -697,8 +562,8 @@ function createWindowManager(options = {}) {
|
|
|
697
562
|
const win = windows[id];
|
|
698
563
|
if (win?.stage !== "normal") return false;
|
|
699
564
|
let bounds = { ...win.bounds, x, y };
|
|
700
|
-
if (keepInViewport) bounds = clampToViewport(bounds, viewport, minVisible);
|
|
701
|
-
if (boundsEqual(bounds, win.bounds)) return true;
|
|
565
|
+
if (keepInViewport) bounds = chunkBDHFXEJN_cjs.clampToViewport(bounds, viewport, minVisible);
|
|
566
|
+
if (chunkBDHFXEJN_cjs.boundsEqual(bounds, win.bounds)) return true;
|
|
702
567
|
const next = { ...win, bounds };
|
|
703
568
|
setWindow(next);
|
|
704
569
|
syncGroup(next);
|
|
@@ -718,9 +583,9 @@ function createWindowManager(options = {}) {
|
|
|
718
583
|
const drive = Math.abs(merged.height - win.bounds.height) > Math.abs(merged.width - win.bounds.width) ? "height" : "width";
|
|
719
584
|
const size = normalizeSize(merged, win, drive);
|
|
720
585
|
let bounds = { x: merged.x, y: merged.y, ...size };
|
|
721
|
-
if (keepInViewport) bounds = clampToViewport(bounds, viewport, minVisible);
|
|
586
|
+
if (keepInViewport) bounds = chunkBDHFXEJN_cjs.clampToViewport(bounds, viewport, minVisible);
|
|
722
587
|
const becameNormal = win.stage === "snapped";
|
|
723
|
-
if (boundsEqual(bounds, win.bounds) && !becameNormal) return true;
|
|
588
|
+
if (chunkBDHFXEJN_cjs.boundsEqual(bounds, win.bounds) && !becameNormal) return true;
|
|
724
589
|
const next = becameNormal ? { ...win, stage: "normal", snapZone: null, restoreBounds: null, bounds } : { ...win, bounds };
|
|
725
590
|
setWindow(next);
|
|
726
591
|
const synced = syncGroup(next);
|
|
@@ -1016,8 +881,8 @@ function createWindowManager(options = {}) {
|
|
|
1016
881
|
const synced = syncGroup(updated);
|
|
1017
882
|
queueEvent(() => emitter.emit("resize", { window: synced }));
|
|
1018
883
|
} else if (win.stage === "normal" && keepInViewport) {
|
|
1019
|
-
const bounds = clampToViewport(win.bounds, viewport, minVisible);
|
|
1020
|
-
if (!boundsEqual(bounds, win.bounds)) {
|
|
884
|
+
const bounds = chunkBDHFXEJN_cjs.clampToViewport(win.bounds, viewport, minVisible);
|
|
885
|
+
if (!chunkBDHFXEJN_cjs.boundsEqual(bounds, win.bounds)) {
|
|
1021
886
|
const updated = { ...win, bounds };
|
|
1022
887
|
setWindow(updated);
|
|
1023
888
|
syncGroup(updated);
|
|
@@ -1521,7 +1386,7 @@ function createDragStarter(ctx) {
|
|
|
1521
1386
|
pointerId: event.pointerId,
|
|
1522
1387
|
grabDX: point.x - startBounds.x,
|
|
1523
1388
|
grabDY: point.y - startBounds.y,
|
|
1524
|
-
grabRatio: clamp((point.x - startBounds.x) / startBounds.width, 0.05, 0.95),
|
|
1389
|
+
grabRatio: chunkBDHFXEJN_cjs.clamp((point.x - startBounds.x) / startBounds.width, 0.05, 0.95),
|
|
1525
1390
|
startBounds,
|
|
1526
1391
|
startStage: win.stage,
|
|
1527
1392
|
startZone: win.snapZone,
|
|
@@ -1538,8 +1403,7 @@ function createDragStarter(ctx) {
|
|
|
1538
1403
|
pendingX: 0,
|
|
1539
1404
|
pendingY: 0,
|
|
1540
1405
|
hasPending: false,
|
|
1541
|
-
finish: () =>
|
|
1542
|
-
}
|
|
1406
|
+
finish: (cancelled) => finish(cancelled)
|
|
1543
1407
|
};
|
|
1544
1408
|
const el = ctx.windowElement(id);
|
|
1545
1409
|
function armGroup(target2) {
|
|
@@ -1594,7 +1458,7 @@ function createDragStarter(ctx) {
|
|
|
1594
1458
|
if (other.groupId !== null && state.groups[other.groupId]?.activeId !== otherId) continue;
|
|
1595
1459
|
targets.push(other.bounds);
|
|
1596
1460
|
}
|
|
1597
|
-
const magnet = magnetize(
|
|
1461
|
+
const magnet = chunkBDHFXEJN_cjs.magnetize(
|
|
1598
1462
|
{ x: nextX, y: nextY, width: current.bounds.width, height: current.bounds.height },
|
|
1599
1463
|
targets,
|
|
1600
1464
|
ctx.magnetThreshold
|
|
@@ -1619,7 +1483,7 @@ function createDragStarter(ctx) {
|
|
|
1619
1483
|
}
|
|
1620
1484
|
if (ctx.snapEnabled && current.snappable) {
|
|
1621
1485
|
const viewport = wm.getState().viewport;
|
|
1622
|
-
const rawZone = detectSnapZone(session.pendingX, session.pendingY, viewport, ctx.snapDetect);
|
|
1486
|
+
const rawZone = chunkBDHFXEJN_cjs.detectSnapZone(session.pendingX, session.pendingY, viewport, ctx.snapDetect);
|
|
1623
1487
|
let zone = rawZone;
|
|
1624
1488
|
if (rawZone === "top") {
|
|
1625
1489
|
if (ctx.topEdge === "maximize") zone = current.maximizable ? "maximize" : null;
|
|
@@ -1628,7 +1492,7 @@ function createDragStarter(ctx) {
|
|
|
1628
1492
|
session.zone = zone;
|
|
1629
1493
|
if (zone) {
|
|
1630
1494
|
ctx.showPreview(
|
|
1631
|
-
zone === "maximize" ? { x: 0, y: 0, width: viewport.width, height: viewport.height } : zoneBounds(zone, viewport)
|
|
1495
|
+
zone === "maximize" ? { x: 0, y: 0, width: viewport.width, height: viewport.height } : chunkBDHFXEJN_cjs.zoneBounds(zone, viewport)
|
|
1632
1496
|
);
|
|
1633
1497
|
} else {
|
|
1634
1498
|
ctx.hidePreview();
|
|
@@ -1712,7 +1576,6 @@ function createDragStarter(ctx) {
|
|
|
1712
1576
|
else wm.endInteraction();
|
|
1713
1577
|
}
|
|
1714
1578
|
}
|
|
1715
|
-
session.finish = finish;
|
|
1716
1579
|
wm.beginInteraction();
|
|
1717
1580
|
ctx.claimDrag(session);
|
|
1718
1581
|
handle.setPointerCapture(event.pointerId);
|
|
@@ -1775,10 +1638,10 @@ function createResizeStarter(ctx) {
|
|
|
1775
1638
|
width: direction.includes("e") ? start.width + dx : direction.includes("w") ? start.width - dx : start.width,
|
|
1776
1639
|
height: direction.includes("s") ? start.height + dy : direction.includes("n") ? start.y + start.height - top : start.height
|
|
1777
1640
|
};
|
|
1778
|
-
let size = aspect === null ? clampSize(raw, minSize, maxSize) : applyAspect(raw, aspect, minSize, maxSize, drive);
|
|
1641
|
+
let size = aspect === null ? chunkBDHFXEJN_cjs.clampSize(raw, minSize, maxSize) : chunkBDHFXEJN_cjs.applyAspect(raw, aspect, minSize, maxSize, drive);
|
|
1779
1642
|
const available = start.y + start.height - floor;
|
|
1780
1643
|
if (direction.includes("n") && size.height > available) {
|
|
1781
|
-
size = applyAspect({ ...size, height: available }, aspect ?? 0, minSize, maxSize, "height");
|
|
1644
|
+
size = chunkBDHFXEJN_cjs.applyAspect({ ...size, height: available }, aspect ?? 0, minSize, maxSize, "height");
|
|
1782
1645
|
}
|
|
1783
1646
|
const next = {
|
|
1784
1647
|
x: direction.includes("w") ? start.x + start.width - size.width : start.x,
|
|
@@ -1966,6 +1829,10 @@ var SNAP_SHORTCUTS = {
|
|
|
1966
1829
|
};
|
|
1967
1830
|
var LANDMARK_TAGS = /* @__PURE__ */ new Set(["header", "footer", "aside", "nav"]);
|
|
1968
1831
|
var FOCUSABLE_SELECTOR = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1832
|
+
function defaultVariant(win) {
|
|
1833
|
+
const variant = win.meta.variant;
|
|
1834
|
+
return typeof variant === "string" && variant !== "" ? variant : null;
|
|
1835
|
+
}
|
|
1969
1836
|
function attachDesktop(wm, element, options = {}) {
|
|
1970
1837
|
const doc = element.ownerDocument;
|
|
1971
1838
|
const view = windowOf(element);
|
|
@@ -1990,6 +1857,7 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
1990
1857
|
const interactiveSelector = options.interactiveSelector ?? INTERACTIVE_SELECTOR;
|
|
1991
1858
|
const animationEnabled = options.animation !== false;
|
|
1992
1859
|
const animationOptions = typeof options.animation === "object" ? options.animation : {};
|
|
1860
|
+
const windowVariant = options.windowVariant ?? defaultVariant;
|
|
1993
1861
|
element.dataset.wmDesktop = "";
|
|
1994
1862
|
element.tabIndex = -1;
|
|
1995
1863
|
if (view.getComputedStyle(element).position === "static") {
|
|
@@ -2103,6 +1971,21 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
2103
1971
|
};
|
|
2104
1972
|
const startDrag = createDragStarter(ctx);
|
|
2105
1973
|
const startResize = createResizeStarter(ctx);
|
|
1974
|
+
if (options.gestures) {
|
|
1975
|
+
const gestureContext = {
|
|
1976
|
+
wm,
|
|
1977
|
+
doc,
|
|
1978
|
+
view,
|
|
1979
|
+
desktop: element,
|
|
1980
|
+
toLocal: (event) => ctx.toLocal(event),
|
|
1981
|
+
trackRect: () => ctx.trackRect(),
|
|
1982
|
+
windowElement: (id) => ctx.windowElement(id),
|
|
1983
|
+
busy: () => drag !== null,
|
|
1984
|
+
claim: (gesture) => ctx.claimDrag(gesture),
|
|
1985
|
+
release: (gesture) => ctx.releaseDrag(gesture)
|
|
1986
|
+
};
|
|
1987
|
+
for (const gesture of options.gestures) cleanup.push(gesture(gestureContext));
|
|
1988
|
+
}
|
|
2106
1989
|
if (options.autoViewport !== false) {
|
|
2107
1990
|
const applyViewport = () => wm.setViewport({ width: element.clientWidth, height: element.clientHeight });
|
|
2108
1991
|
applyViewport();
|
|
@@ -2121,6 +2004,9 @@ function attachDesktop(wm, element, options = {}) {
|
|
|
2121
2004
|
el.dataset.wmStage = win.stage;
|
|
2122
2005
|
el.dataset.wmLayer = win.layer;
|
|
2123
2006
|
el.dataset.wmWorkspace = String(win.workspace);
|
|
2007
|
+
const variant = windowVariant(win);
|
|
2008
|
+
if (variant === null) delete el.dataset.wmVariant;
|
|
2009
|
+
else el.dataset.wmVariant = variant;
|
|
2124
2010
|
if (win.groupId === null) {
|
|
2125
2011
|
delete el.dataset.wmGroup;
|
|
2126
2012
|
delete el.dataset.wmTab;
|
|
@@ -2524,22 +2410,14 @@ function createDesktopBinder(wm, options = {}) {
|
|
|
2524
2410
|
};
|
|
2525
2411
|
}
|
|
2526
2412
|
|
|
2527
|
-
exports.applyAspect = applyAspect;
|
|
2528
2413
|
exports.attachDesktop = attachDesktop;
|
|
2529
|
-
exports.boundsEqual = boundsEqual;
|
|
2530
|
-
exports.clamp = clamp;
|
|
2531
|
-
exports.clampSize = clampSize;
|
|
2532
|
-
exports.clampToViewport = clampToViewport;
|
|
2533
2414
|
exports.createAnnouncer = createAnnouncer;
|
|
2534
2415
|
exports.createDesktopBinder = createDesktopBinder;
|
|
2535
2416
|
exports.createEmitter = createEmitter;
|
|
2536
2417
|
exports.createWindowManager = createWindowManager;
|
|
2537
2418
|
exports.defaultMessages = defaultMessages;
|
|
2538
|
-
exports.detectSnapZone = detectSnapZone;
|
|
2539
2419
|
exports.flipFromTarget = flipFromTarget;
|
|
2540
2420
|
exports.flipToTarget = flipToTarget;
|
|
2541
|
-
exports.magnetize = magnetize;
|
|
2542
2421
|
exports.prefersReducedMotion = prefersReducedMotion;
|
|
2543
|
-
|
|
2544
|
-
//# sourceMappingURL=chunk-
|
|
2545
|
-
//# sourceMappingURL=chunk-NJAI5R4J.cjs.map
|
|
2422
|
+
//# sourceMappingURL=chunk-DINVOL6Z.cjs.map
|
|
2423
|
+
//# sourceMappingURL=chunk-DINVOL6Z.cjs.map
|