@hpcc-js/phosphor 2.16.7 → 2.16.9

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/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  })(this, (function (exports, common) { 'use strict';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/phosphor";
8
- var PKG_VERSION = "2.16.7";
9
- var BUILD_VERSION = "2.104.14";
8
+ var PKG_VERSION = "2.16.9";
9
+ var BUILD_VERSION = "2.104.20";
10
10
 
11
11
  // Copyright (c) Jupyter Development Team.
12
12
  // Distributed under the terms of the Modified BSD License.
@@ -3082,6 +3082,8 @@
3082
3082
  * ### Notes
3083
3083
  * The callback function must be synchronous.
3084
3084
  *
3085
+ * @deprecated This feature will be removed in Lumino 2.
3086
+ *
3085
3087
  * @param fn The callback during which the signal is blocked
3086
3088
  */
3087
3089
  Signal.prototype.block = function (fn) {
@@ -3147,6 +3149,8 @@
3147
3149
  * ### Notes
3148
3150
  * The callback function must be synchronous.
3149
3151
  *
3152
+ * @deprecated This feature will be removed in Lumino 2.
3153
+ *
3150
3154
  * @param sender The signals sender
3151
3155
  * @param fn The callback during which all signals are blocked
3152
3156
  */
@@ -10825,30 +10829,20 @@
10825
10829
  if (this._hiddenMode === value) {
10826
10830
  return;
10827
10831
  }
10828
- this._hiddenMode = value;
10829
- switch (value) {
10830
- case Widget.HiddenMode.Display:
10831
- this.node.style.willChange = 'auto';
10832
- break;
10833
- case Widget.HiddenMode.Scale:
10834
- this.node.style.willChange = 'transform';
10835
- break;
10832
+ if (this.isHidden) {
10833
+ // Reset styles set by previous mode.
10834
+ this._toggleHidden(false);
10836
10835
  }
10836
+ if (value == Widget.HiddenMode.Scale) {
10837
+ this.node.style.willChange = 'transform';
10838
+ }
10839
+ else {
10840
+ this.node.style.willChange = 'auto';
10841
+ }
10842
+ this._hiddenMode = value;
10837
10843
  if (this.isHidden) {
10838
- if (value === Widget.HiddenMode.Display) {
10839
- this.addClass('lm-mod-hidden');
10840
- /* <DEPRECATED> */
10841
- this.addClass('p-mod-hidden');
10842
- /* </DEPRECATED> */
10843
- this.node.style.transform = '';
10844
- }
10845
- else {
10846
- this.node.style.transform = 'scale(0)';
10847
- this.removeClass('lm-mod-hidden');
10848
- /* <DEPRECATED> */
10849
- this.removeClass('p-mod-hidden');
10850
- /* </DEPRECATED> */
10851
- }
10844
+ // Set styles for new mode.
10845
+ this._toggleHidden(true);
10852
10846
  }
10853
10847
  },
10854
10848
  enumerable: true,
@@ -11072,15 +11066,7 @@
11072
11066
  }
11073
11067
  this.clearFlag(Widget.Flag.IsHidden);
11074
11068
  this.node.removeAttribute('aria-hidden');
11075
- if (this.hiddenMode === Widget.HiddenMode.Display) {
11076
- this.removeClass('lm-mod-hidden');
11077
- /* <DEPRECATED> */
11078
- this.removeClass('p-mod-hidden');
11079
- /* </DEPRECATED> */
11080
- }
11081
- else {
11082
- this.node.style.transform = '';
11083
- }
11069
+ this._toggleHidden(false);
11084
11070
  if (this.isAttached && (!this.parent || this.parent.isVisible)) {
11085
11071
  MessageLoop.sendMessage(this, Widget.Msg.AfterShow);
11086
11072
  }
@@ -11106,15 +11092,7 @@
11106
11092
  }
11107
11093
  this.setFlag(Widget.Flag.IsHidden);
11108
11094
  this.node.setAttribute('aria-hidden', 'true');
11109
- if (this.hiddenMode === Widget.HiddenMode.Display) {
11110
- this.addClass('lm-mod-hidden');
11111
- /* <DEPRECATED> */
11112
- this.addClass('p-mod-hidden');
11113
- /* </DEPRECATED> */
11114
- }
11115
- else {
11116
- this.node.style.transform = 'scale(0)';
11117
- }
11095
+ this._toggleHidden(true);
11118
11096
  if (this.isAttached && (!this.parent || this.parent.isVisible)) {
11119
11097
  MessageLoop.sendMessage(this, Widget.Msg.AfterHide);
11120
11098
  }
@@ -11376,6 +11354,42 @@
11376
11354
  * The default implementation of this handler is a no-op.
11377
11355
  */
11378
11356
  Widget.prototype.onChildRemoved = function (msg) { };
11357
+ Widget.prototype._toggleHidden = function (hidden) {
11358
+ if (hidden) {
11359
+ switch (this._hiddenMode) {
11360
+ case Widget.HiddenMode.Display:
11361
+ this.addClass('lm-mod-hidden');
11362
+ /* <DEPRECATED> */
11363
+ this.addClass('p-mod-hidden');
11364
+ /* </DEPRECATED> */
11365
+ break;
11366
+ case Widget.HiddenMode.Scale:
11367
+ this.node.style.transform = 'scale(0)';
11368
+ break;
11369
+ case Widget.HiddenMode.ContentVisibility:
11370
+ this.node.style.contentVisibility = 'hidden';
11371
+ this.node.style.zIndex = '-1';
11372
+ break;
11373
+ }
11374
+ }
11375
+ else {
11376
+ switch (this._hiddenMode) {
11377
+ case Widget.HiddenMode.Display:
11378
+ this.removeClass('lm-mod-hidden');
11379
+ /* <DEPRECATED> */
11380
+ this.removeClass('p-mod-hidden');
11381
+ /* </DEPRECATED> */
11382
+ break;
11383
+ case Widget.HiddenMode.Scale:
11384
+ this.node.style.transform = '';
11385
+ break;
11386
+ case Widget.HiddenMode.ContentVisibility:
11387
+ this.node.style.contentVisibility = '';
11388
+ this.node.style.zIndex = '';
11389
+ break;
11390
+ }
11391
+ }
11392
+ };
11379
11393
  return Widget;
11380
11394
  }());
11381
11395
  /**
@@ -11392,6 +11406,10 @@
11392
11406
  * Hide the widget by setting the `transform` to `'scale(0)'`.
11393
11407
  */
11394
11408
  HiddenMode[HiddenMode["Scale"] = 1] = "Scale";
11409
+ /**
11410
+ *Hide the widget by setting the `content-visibility` to `'hidden'`.
11411
+ */
11412
+ HiddenMode[HiddenMode["ContentVisibility"] = 2] = "ContentVisibility";
11395
11413
  })(Widget.HiddenMode || (Widget.HiddenMode = {}));
11396
11414
  (function (Flag) {
11397
11415
  /**
@@ -20310,16 +20328,24 @@
20310
20328
  }
20311
20329
  // Using transform create an additional layer in the pixel pipeline
20312
20330
  // to limit the number of layer, it is set only if there is more than one widget.
20313
- if (this._hiddenMode === Widget.HiddenMode.Scale &&
20314
- refNode.tabBar.titles.length > 0) {
20315
- if (refNode.tabBar.titles.length == 1) {
20331
+ if (this._hiddenMode === Widget.HiddenMode.Scale) {
20332
+ if (refNode.tabBar.titles.length === 0) {
20333
+ // Singular tab should use display mode to limit number of layers.
20334
+ widget.hiddenMode = Widget.HiddenMode.Display;
20335
+ }
20336
+ else if (refNode.tabBar.titles.length == 1) {
20337
+ // If we are adding a second tab, switch the existing tab back to scale.
20316
20338
  var existingWidget = refNode.tabBar.titles[0].owner;
20317
20339
  existingWidget.hiddenMode = Widget.HiddenMode.Scale;
20318
20340
  }
20319
- widget.hiddenMode = Widget.HiddenMode.Scale;
20341
+ else {
20342
+ // For the third and subsequent tabs no special action is needed.
20343
+ widget.hiddenMode = Widget.HiddenMode.Scale;
20344
+ }
20320
20345
  }
20321
20346
  else {
20322
- widget.hiddenMode = Widget.HiddenMode.Display;
20347
+ // For all other modes just propagate the current mode.
20348
+ widget.hiddenMode = this._hiddenMode;
20323
20349
  }
20324
20350
  // Insert the widget's tab relative to the target index.
20325
20351
  refNode.tabBar.insertTab(index + (after ? 1 : 0), widget.title);
@@ -21752,6 +21778,8 @@
21752
21778
  DockPanel.prototype._evtDragLeave = function (event) {
21753
21779
  // Mark the event as handled.
21754
21780
  event.preventDefault();
21781
+ if (this._tabsConstrained && event.source !== this)
21782
+ return;
21755
21783
  event.stopPropagation();
21756
21784
  // The new target might be a descendant, so we might still handle the drop.
21757
21785
  // Hide asynchronously so that if a lm-dragover event bubbles up to us, the
@@ -21764,7 +21792,6 @@
21764
21792
  DockPanel.prototype._evtDragOver = function (event) {
21765
21793
  // Mark the event as handled.
21766
21794
  event.preventDefault();
21767
- event.stopPropagation();
21768
21795
  // Show the drop indicator overlay and update the drop
21769
21796
  // action based on the drop target zone under the mouse.
21770
21797
  if ((this._tabsConstrained && event.source !== this) ||
@@ -21772,6 +21799,7 @@
21772
21799
  event.dropAction = 'none';
21773
21800
  }
21774
21801
  else {
21802
+ event.stopPropagation();
21775
21803
  event.dropAction = event.proposedAction;
21776
21804
  }
21777
21805
  };
@@ -21781,7 +21809,6 @@
21781
21809
  DockPanel.prototype._evtDrop = function (event) {
21782
21810
  // Mark the event as handled.
21783
21811
  event.preventDefault();
21784
- event.stopPropagation();
21785
21812
  // Hide the drop indicator overlay.
21786
21813
  this.overlay.hide(0);
21787
21814
  // Bail if the proposed action is to do nothing.
@@ -21793,7 +21820,8 @@
21793
21820
  var clientX = event.clientX, clientY = event.clientY;
21794
21821
  var _a = Private$5.findDropTarget(this, clientX, clientY, this._edges), zone = _a.zone, target = _a.target;
21795
21822
  // Bail if the drop zone is invalid.
21796
- if (zone === 'invalid') {
21823
+ if ((this._tabsConstrained && event.source !== this) ||
21824
+ zone === 'invalid') {
21797
21825
  event.dropAction = 'none';
21798
21826
  return;
21799
21827
  }
@@ -21857,6 +21885,8 @@
21857
21885
  }
21858
21886
  // Accept the proposed drop action.
21859
21887
  event.dropAction = event.proposedAction;
21888
+ // Stop propagation if we have not bailed so far.
21889
+ event.stopPropagation();
21860
21890
  // Activate the dropped widget.
21861
21891
  this.activateWidget(widget);
21862
21892
  };
@@ -23522,7 +23552,10 @@
23522
23552
  function MenuBar(options) {
23523
23553
  if (options === void 0) { options = {}; }
23524
23554
  var _this = _super.call(this, { node: Private$3.createNode() }) || this;
23555
+ // Track the index of the item that is currently focused. -1 means nothing focused.
23525
23556
  _this._activeIndex = -1;
23557
+ // Track which item can be focused using the TAB key. Unlike _activeIndex will always point to a menuitem.
23558
+ _this._tabFocusIndex = 0;
23526
23559
  _this._menus = [];
23527
23560
  _this._childMenu = null;
23528
23561
  _this.addClass('lm-MenuBar');
@@ -23619,6 +23652,10 @@
23619
23652
  }
23620
23653
  // Update the active index.
23621
23654
  this._activeIndex = value;
23655
+ // Update the focus index.
23656
+ if (value !== -1) {
23657
+ this._tabFocusIndex = value;
23658
+ }
23622
23659
  // Update focus to new active index
23623
23660
  if (this._activeIndex >= 0 &&
23624
23661
  this.contentNode.childNodes[this._activeIndex]) {
@@ -23843,7 +23880,7 @@
23843
23880
  */
23844
23881
  MenuBar.prototype.onActivateRequest = function (msg) {
23845
23882
  if (this.isAttached) {
23846
- this.node.focus();
23883
+ this.activeIndex = 0;
23847
23884
  }
23848
23885
  };
23849
23886
  /**
@@ -23854,6 +23891,9 @@
23854
23891
  var menus = this._menus;
23855
23892
  var renderer = this.renderer;
23856
23893
  var activeIndex = this._activeIndex;
23894
+ var tabFocusIndex = this._tabFocusIndex >= 0 && this._tabFocusIndex < menus.length
23895
+ ? this._tabFocusIndex
23896
+ : 0;
23857
23897
  var content = new Array(menus.length);
23858
23898
  var _loop_1 = function (i, n) {
23859
23899
  var title = menus[i].title;
@@ -23864,6 +23904,7 @@
23864
23904
  content[i] = renderer.renderItem({
23865
23905
  title: title,
23866
23906
  active: active,
23907
+ tabbable: i === tabFocusIndex,
23867
23908
  onfocus: function () {
23868
23909
  _this.activeIndex = i;
23869
23910
  }
@@ -23883,15 +23924,16 @@
23883
23924
  MenuBar.prototype._evtKeyDown = function (event) {
23884
23925
  // Fetch the key code for the event.
23885
23926
  var kc = event.keyCode;
23886
- // Do not trap the tab key.
23927
+ // Reset the active index on tab, but do not trap the tab key.
23887
23928
  if (kc === 9) {
23929
+ this.activeIndex = -1;
23888
23930
  return;
23889
23931
  }
23890
23932
  // A menu bar handles all other keydown events.
23891
23933
  event.preventDefault();
23892
23934
  event.stopPropagation();
23893
- // Enter, Up Arrow, Down Arrow
23894
- if (kc === 13 || kc === 38 || kc === 40) {
23935
+ // Enter, Space, Up Arrow, Down Arrow
23936
+ if (kc === 13 || kc === 32 || kc === 38 || kc === 40) {
23895
23937
  this.openActiveMenu();
23896
23938
  return;
23897
23939
  }
@@ -24183,7 +24225,8 @@
24183
24225
  var className = this.createItemClass(data);
24184
24226
  var dataset = this.createItemDataset(data);
24185
24227
  var aria = this.createItemARIA(data);
24186
- return h.li(__assign$2({ className: className, dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data));
24228
+ return h.li(__assign$2({ className: className,
24229
+ dataset: dataset, tabindex: data.tabbable ? '0' : '-1', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data));
24187
24230
  };
24188
24231
  /**
24189
24232
  * Render the icon element for a menu bar item.
@@ -24329,8 +24372,6 @@
24329
24372
  /* </DEPRECATED> */
24330
24373
  node.appendChild(content);
24331
24374
  content.setAttribute('role', 'menubar');
24332
- node.tabIndex = 0;
24333
- content.tabIndex = 0;
24334
24375
  return node;
24335
24376
  }
24336
24377
  Private.createNode = createNode;