dockview-core 6.1.1 → 6.2.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.
@@ -180,10 +180,20 @@ var OverlayRenderContainer = /** @class */ (function (_super) {
180
180
  focusContainer.style.top = "".concat(top, "px");
181
181
  focusContainer.style.width = "".concat(width, "px");
182
182
  focusContainer.style.height = "".concat(height, "px");
183
- // Reveal after the first position is applied (was hidden to
184
- // prevent a flash at 0,0 before the initial layout fires).
185
- if (focusContainer.style.visibility === 'hidden') {
183
+ // Sync visibility/pointer-events with the panel's current
184
+ // visibility at paint time. visibilityChanged() may have
185
+ // flipped to hidden between scheduling this rAF and now;
186
+ // unconditionally clearing `visibility:hidden` here would
187
+ // leave a hidden panel visually visible at a stale position,
188
+ // because onDidDimensionsChange skips non-visible panels and
189
+ // never recomputes their box on subsequent resizes.
190
+ if (panel.api.isVisible) {
186
191
  focusContainer.style.visibility = '';
192
+ focusContainer.style.pointerEvents = '';
193
+ }
194
+ else {
195
+ focusContainer.style.visibility = 'hidden';
196
+ focusContainer.style.pointerEvents = 'none';
187
197
  }
188
198
  (0, dom_1.toggleClass)(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
189
199
  });
@@ -11,6 +11,13 @@ export type PopoutWindowOptions = {
11
11
  window: Window;
12
12
  }) => void;
13
13
  } & Box;
14
+ /**
15
+ * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
16
+ * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
17
+ * execute in a context the browser still associates with the opener via
18
+ * `window.opener`.
19
+ */
20
+ export declare function assertSameOriginPopoutUrl(url: string): void;
14
21
  export declare class PopoutWindow extends CompositeDisposable {
15
22
  private readonly target;
16
23
  private readonly className;
@@ -68,9 +68,29 @@ var __read = (this && this.__read) || function (o, n) {
68
68
  };
69
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
70
  exports.PopoutWindow = void 0;
71
+ exports.assertSameOriginPopoutUrl = assertSameOriginPopoutUrl;
71
72
  var dom_1 = require("./dom");
72
73
  var events_1 = require("./events");
73
74
  var lifecycle_1 = require("./lifecycle");
75
+ /**
76
+ * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
77
+ * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
78
+ * execute in a context the browser still associates with the opener via
79
+ * `window.opener`.
80
+ */
81
+ function assertSameOriginPopoutUrl(url) {
82
+ var resolved;
83
+ try {
84
+ resolved = new URL(url, window.location.href);
85
+ }
86
+ catch (_a) {
87
+ throw new Error("dockview: invalid popout URL: ".concat(url));
88
+ }
89
+ var protocolOk = resolved.protocol === 'http:' || resolved.protocol === 'https:';
90
+ if (!protocolOk || resolved.origin !== window.location.origin) {
91
+ throw new Error("dockview: popout URL must be same-origin http(s); got: ".concat(url));
92
+ }
93
+ }
74
94
  var PopoutWindow = /** @class */ (function (_super) {
75
95
  __extends(PopoutWindow, _super);
76
96
  function PopoutWindow(target, className, options) {
@@ -131,6 +151,7 @@ var PopoutWindow = /** @class */ (function (_super) {
131
151
  throw new Error('instance of popout window is already open');
132
152
  }
133
153
  url = "".concat(this.options.url);
154
+ assertSameOriginPopoutUrl(url);
134
155
  features = Object.entries({
135
156
  top: this.options.top,
136
157
  left: this.options.left,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 6.1.1
3
+ * @version 6.2.2
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -11422,10 +11422,20 @@
11422
11422
  focusContainer.style.top = `${top}px`;
11423
11423
  focusContainer.style.width = `${width}px`;
11424
11424
  focusContainer.style.height = `${height}px`;
11425
- // Reveal after the first position is applied (was hidden to
11426
- // prevent a flash at 0,0 before the initial layout fires).
11427
- if (focusContainer.style.visibility === 'hidden') {
11425
+ // Sync visibility/pointer-events with the panel's current
11426
+ // visibility at paint time. visibilityChanged() may have
11427
+ // flipped to hidden between scheduling this rAF and now;
11428
+ // unconditionally clearing `visibility:hidden` here would
11429
+ // leave a hidden panel visually visible at a stale position,
11430
+ // because onDidDimensionsChange skips non-visible panels and
11431
+ // never recomputes their box on subsequent resizes.
11432
+ if (panel.api.isVisible) {
11428
11433
  focusContainer.style.visibility = '';
11434
+ focusContainer.style.pointerEvents = '';
11435
+ }
11436
+ else {
11437
+ focusContainer.style.visibility = 'hidden';
11438
+ focusContainer.style.pointerEvents = 'none';
11429
11439
  }
11430
11440
  toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');
11431
11441
  });
@@ -11569,6 +11579,25 @@
11569
11579
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
11570
11580
  };
11571
11581
 
11582
+ /**
11583
+ * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
11584
+ * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
11585
+ * execute in a context the browser still associates with the opener via
11586
+ * `window.opener`.
11587
+ */
11588
+ function assertSameOriginPopoutUrl(url) {
11589
+ let resolved;
11590
+ try {
11591
+ resolved = new URL(url, window.location.href);
11592
+ }
11593
+ catch (_a) {
11594
+ throw new Error(`dockview: invalid popout URL: ${url}`);
11595
+ }
11596
+ const protocolOk = resolved.protocol === 'http:' || resolved.protocol === 'https:';
11597
+ if (!protocolOk || resolved.origin !== window.location.origin) {
11598
+ throw new Error(`dockview: popout URL must be same-origin http(s); got: ${url}`);
11599
+ }
11600
+ }
11572
11601
  class PopoutWindow extends CompositeDisposable {
11573
11602
  get window() {
11574
11603
  var _a, _b;
@@ -11620,6 +11649,7 @@
11620
11649
  throw new Error('instance of popout window is already open');
11621
11650
  }
11622
11651
  const url = `${this.options.url}`;
11652
+ assertSameOriginPopoutUrl(url);
11623
11653
  const features = Object.entries({
11624
11654
  top: this.options.top,
11625
11655
  left: this.options.left,