@signal9/era-ui 2.5.0 → 2.6.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.
@@ -61,6 +61,12 @@
61
61
  $effect(() => {
62
62
  wm.bounds = { width: w, height: h };
63
63
  });
64
+ // Viewport/chrome resizes re-fit the windows (untracked: relayout reads
65
+ // window state we must not subscribe to, or every drag would re-run this).
66
+ $effect(() => {
67
+ void wm.workArea;
68
+ untrack(() => wm.relayout());
69
+ });
64
70
  </script>
65
71
 
66
72
  <div
@@ -144,6 +144,13 @@ export declare class WindowManager {
144
144
  toggleMaximize(id: string): void;
145
145
  /** Un-maximize / un-snap back to the pre-change frame (or just un-minimize). */
146
146
  restore(id: string): void;
147
+ /** Re-fit windows after the desktop or its chrome resizes: maximized
148
+ * windows re-fill the work area; normal windows re-clamp so the bar stays
149
+ * below the top and at least dragKeep px stays reachable on every other
150
+ * side — the same fence the drag containment enforces, applied at rest.
151
+ * The Desktop calls this whenever the work area changes; chrome itself
152
+ * (the taskbar) never resizes with the viewport. */
153
+ relayout(): void;
147
154
  /** Half / quadrant tiling against the work area. */
148
155
  snap(id: string, zone: SnapZone): void;
149
156
  /** Create a workspace (optionally switching to it) and return its id. */
@@ -180,6 +180,30 @@ export class WindowManager {
180
180
  w.state = 'normal';
181
181
  this.focus(id);
182
182
  }
183
+ /** Re-fit windows after the desktop or its chrome resizes: maximized
184
+ * windows re-fill the work area; normal windows re-clamp so the bar stays
185
+ * below the top and at least dragKeep px stays reachable on every other
186
+ * side — the same fence the drag containment enforces, applied at rest.
187
+ * The Desktop calls this whenever the work area changes; chrome itself
188
+ * (the taskbar) never resizes with the viewport. */
189
+ relayout() {
190
+ const { x, y, width, height } = this.workArea;
191
+ if (!width || !height)
192
+ return;
193
+ for (const w of this.windows) {
194
+ if (w.state === 'maximized') {
195
+ w.pos = { x, y };
196
+ w.size = { width, height };
197
+ }
198
+ else {
199
+ const winW = w.size?.width ?? 0;
200
+ w.pos = {
201
+ x: Math.min(Math.max(w.pos.x, x + this.dragKeep - winW), x + width - this.dragKeep),
202
+ y: Math.min(Math.max(w.pos.y, y), y + height - this.dragKeep)
203
+ };
204
+ }
205
+ }
206
+ }
183
207
  /** Half / quadrant tiling against the work area. */
184
208
  snap(id, zone) {
185
209
  const w = this.#find(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signal9/era-ui",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev --host",
6
6
  "build": "vite build && npm run prepack",