omnius 1.0.892 → 1.0.894

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.
@@ -2405,6 +2405,7 @@ var NativeCornerFrame = class {
2405
2405
  started = false;
2406
2406
  painted = false;
2407
2407
  geometry = "";
2408
+ closingDecoration;
2408
2409
  reduced = process.env["OMNIUS_TUI_REDUCE_MOTION"] === "1" || process.env["REDUCE_MOTION"] === "1";
2409
2410
  get animating() {
2410
2411
  return !this.disposed && (this.phase === "opening" || this.phase === "closing");
@@ -2413,7 +2414,7 @@ var NativeCornerFrame = class {
2413
2414
  return this.phase === "closing" || this.phase === "closed";
2414
2415
  }
2415
2416
  get bounds() {
2416
- return this.chrome;
2417
+ return this.closingDecoration?.bounds ?? this.chrome;
2417
2418
  }
2418
2419
  setColors(colors) {
2419
2420
  this.colors = colors;
@@ -2427,6 +2428,18 @@ var NativeCornerFrame = class {
2427
2428
  }
2428
2429
  };
2429
2430
  layout() {
2431
+ if (this.closingDecoration && !this.disposed) {
2432
+ const target2 = this.closingDecoration.target;
2433
+ const width2 = Math.round(Math.min(5, target2.width) + (target2.width - Math.min(5, target2.width)) * this.progress);
2434
+ const height2 = Math.round(Math.min(3, target2.height) + (target2.height - Math.min(3, target2.height)) * this.progress);
2435
+ const x = target2.x + Math.floor((target2.width - width2) / 2), y = target2.y + Math.floor((target2.height - height2) / 2);
2436
+ const geometry2 = `closing:${x}:${y}:${width2}:${height2}`;
2437
+ if (this.geometry === geometry2) return;
2438
+ this.geometry = geometry2;
2439
+ this.closingDecoration.bounds = { x, y, width: width2, height: height2 };
2440
+ this.renderer.requestRender();
2441
+ return;
2442
+ }
2430
2443
  if (this.disposed || this.panel.width < 1 || this.panel.height < 1) return;
2431
2444
  const target = this.panel;
2432
2445
  const width = Math.round(Math.min(5, target.width) + (target.width - Math.min(5, target.width)) * this.progress);
@@ -2466,10 +2479,19 @@ var NativeCornerFrame = class {
2466
2479
  };
2467
2480
  this.timer = setTimeout(advance, 16);
2468
2481
  }
2469
- close(done) {
2482
+ paintClosingDecoration = (buffer) => {
2483
+ if (this.closingDecoration && !this.disposed) drawCornerFrame(buffer, this.closingDecoration.bounds, this.colors, this.progress);
2484
+ };
2485
+ close(done, releaseInput = false) {
2470
2486
  if (this.closing || this.disposed) return;
2471
2487
  this.phase = "closing";
2472
2488
  this.panel.opacity = 0;
2489
+ if (releaseInput && !this.reduced) {
2490
+ const { x, y, width, height } = this.panel;
2491
+ const { x: cornerX, y: cornerY, width: cornerWidth, height: cornerHeight } = this.bounds;
2492
+ this.closingDecoration = { target: { x, y, width, height }, bounds: { x: cornerX, y: cornerY, width: cornerWidth, height: cornerHeight } };
2493
+ this.renderer.addPostProcessFn(this.paintClosingDecoration);
2494
+ }
2473
2495
  if (this.reduced) {
2474
2496
  this.phase = "closed";
2475
2497
  done();
@@ -2482,6 +2504,7 @@ var NativeCornerFrame = class {
2482
2504
  this.timer = void 0;
2483
2505
  this.panel.off(RenderableEvents2.DESTROYED, this.destroy);
2484
2506
  this.renderer.off(CliRenderEvents2.FRAME, this.onFrame);
2507
+ this.renderer.removePostProcessFn(this.paintClosingDecoration);
2485
2508
  this.chrome.destroyRecursively();
2486
2509
  };
2487
2510
  };
@@ -3279,6 +3302,7 @@ var NativeModalStack = class {
3279
3302
  restoreFocus;
3280
3303
  views = [];
3281
3304
  byId = /* @__PURE__ */ new Map();
3305
+ retiring = /* @__PURE__ */ new Map();
3282
3306
  pendingMedia = /* @__PURE__ */ new Set();
3283
3307
  trackMedia(promises) {
3284
3308
  for (const promise of promises) {
@@ -3308,6 +3332,8 @@ var NativeModalStack = class {
3308
3332
  existing.focus();
3309
3333
  return;
3310
3334
  }
3335
+ this.retiring.get(spec.id)?.destroy();
3336
+ this.retiring.delete(spec.id);
3311
3337
  if (this.active) this.active.root.visible = false;
3312
3338
  const view = new NativeModalView(this.context, spec, (id, result) => this.close(id, result, true));
3313
3339
  this.views.push(view);
@@ -3321,20 +3347,23 @@ var NativeModalStack = class {
3321
3347
  close(id, result, notify = false) {
3322
3348
  const view = this.byId.get(id);
3323
3349
  if (!view) return;
3350
+ const wasActive = view === this.active;
3351
+ this.byId.delete(id);
3352
+ this.views = this.views.filter((candidate) => candidate !== view);
3353
+ this.retiring.set(id, view);
3324
3354
  this.trackMedia(view.pauseMedia());
3325
3355
  view.frame.close(() => {
3326
- const wasActive = view === this.active;
3356
+ if (this.retiring.get(id) === view) this.retiring.delete(id);
3327
3357
  view.destroy();
3328
- this.byId.delete(id);
3329
- this.views = this.views.filter((candidate) => candidate !== view);
3330
- if (wasActive) {
3331
- if (this.active) {
3332
- this.active.root.visible = true;
3333
- this.active.focus();
3334
- } else this.restoreFocus();
3335
- }
3336
- if (notify) this.context.emit({ type: "modal-result", id, result });
3337
- });
3358
+ }, true);
3359
+ if (!view.root.isDestroyed) view.root.visible = false;
3360
+ if (wasActive) {
3361
+ if (this.active) {
3362
+ this.active.root.visible = true;
3363
+ this.active.focus();
3364
+ } else this.restoreFocus();
3365
+ }
3366
+ if (notify) this.context.emit({ type: "modal-result", id, result });
3338
3367
  }
3339
3368
  applyTheme() {
3340
3369
  for (const view of this.views) view.applyTheme();
@@ -3350,10 +3379,11 @@ var NativeModalStack = class {
3350
3379
  }
3351
3380
  destroy() {
3352
3381
  this.context.renderer.removePostProcessFn(this.dimUnderlay);
3353
- for (const view of this.views) {
3382
+ for (const view of [...this.views, ...this.retiring.values()]) {
3354
3383
  this.trackMedia(view.pauseMedia());
3355
3384
  view.destroy();
3356
3385
  }
3386
+ this.retiring.clear();
3357
3387
  this.views = [];
3358
3388
  this.byId.clear();
3359
3389
  }