@hpcc-js/phosphor 2.16.5 → 2.16.7

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.5";
9
- var BUILD_VERSION = "2.104.11";
8
+ var PKG_VERSION = "2.16.7";
9
+ var BUILD_VERSION = "2.104.14";
10
10
 
11
11
  // Copyright (c) Jupyter Development Team.
12
12
  // Distributed under the terms of the Modified BSD License.
@@ -2827,6 +2827,195 @@
2827
2827
  UUID.uuid4 = uuid4Factory(Random.getRandomValues);
2828
2828
  })(UUID || (UUID = {}));
2829
2829
 
2830
+ // Copyright (c) Jupyter Development Team.
2831
+ // Distributed under the terms of the Modified BSD License.
2832
+ /*-----------------------------------------------------------------------------
2833
+ | Copyright (c) 2014-2017, PhosphorJS Contributors
2834
+ |
2835
+ | Distributed under the terms of the BSD 3-Clause License.
2836
+ |
2837
+ | The full license is in the file LICENSE, distributed with this software.
2838
+ |----------------------------------------------------------------------------*/
2839
+ /**
2840
+ * A class which attaches a value to an external object.
2841
+ *
2842
+ * #### Notes
2843
+ * Attached properties are used to extend the state of an object with
2844
+ * semantic data from an unrelated class. They also encapsulate value
2845
+ * creation, coercion, and notification.
2846
+ *
2847
+ * Because attached property values are stored in a hash table, which
2848
+ * in turn is stored in a WeakMap keyed on the owner object, there is
2849
+ * non-trivial storage overhead involved in their use. The pattern is
2850
+ * therefore best used for the storage of rare data.
2851
+ */
2852
+ var AttachedProperty = /** @class */ (function () {
2853
+ /**
2854
+ * Construct a new attached property.
2855
+ *
2856
+ * @param options - The options for initializing the property.
2857
+ */
2858
+ function AttachedProperty(options) {
2859
+ this._pid = Private$r.nextPID();
2860
+ this.name = options.name;
2861
+ this._create = options.create;
2862
+ this._coerce = options.coerce || null;
2863
+ this._compare = options.compare || null;
2864
+ this._changed = options.changed || null;
2865
+ }
2866
+ /**
2867
+ * Get the current value of the property for a given owner.
2868
+ *
2869
+ * @param owner - The property owner of interest.
2870
+ *
2871
+ * @returns The current value of the property.
2872
+ *
2873
+ * #### Notes
2874
+ * If the value has not yet been set, the default value will be
2875
+ * computed and assigned as the current value of the property.
2876
+ */
2877
+ AttachedProperty.prototype.get = function (owner) {
2878
+ var value;
2879
+ var map = Private$r.ensureMap(owner);
2880
+ if (this._pid in map) {
2881
+ value = map[this._pid];
2882
+ }
2883
+ else {
2884
+ value = map[this._pid] = this._createValue(owner);
2885
+ }
2886
+ return value;
2887
+ };
2888
+ /**
2889
+ * Set the current value of the property for a given owner.
2890
+ *
2891
+ * @param owner - The property owner of interest.
2892
+ *
2893
+ * @param value - The value for the property.
2894
+ *
2895
+ * #### Notes
2896
+ * If the value has not yet been set, the default value will be
2897
+ * computed and used as the previous value for the comparison.
2898
+ */
2899
+ AttachedProperty.prototype.set = function (owner, value) {
2900
+ var oldValue;
2901
+ var map = Private$r.ensureMap(owner);
2902
+ if (this._pid in map) {
2903
+ oldValue = map[this._pid];
2904
+ }
2905
+ else {
2906
+ oldValue = map[this._pid] = this._createValue(owner);
2907
+ }
2908
+ var newValue = this._coerceValue(owner, value);
2909
+ this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
2910
+ };
2911
+ /**
2912
+ * Explicitly coerce the current property value for a given owner.
2913
+ *
2914
+ * @param owner - The property owner of interest.
2915
+ *
2916
+ * #### Notes
2917
+ * If the value has not yet been set, the default value will be
2918
+ * computed and used as the previous value for the comparison.
2919
+ */
2920
+ AttachedProperty.prototype.coerce = function (owner) {
2921
+ var oldValue;
2922
+ var map = Private$r.ensureMap(owner);
2923
+ if (this._pid in map) {
2924
+ oldValue = map[this._pid];
2925
+ }
2926
+ else {
2927
+ oldValue = map[this._pid] = this._createValue(owner);
2928
+ }
2929
+ var newValue = this._coerceValue(owner, oldValue);
2930
+ this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
2931
+ };
2932
+ /**
2933
+ * Get or create the default value for the given owner.
2934
+ */
2935
+ AttachedProperty.prototype._createValue = function (owner) {
2936
+ var create = this._create;
2937
+ return create(owner);
2938
+ };
2939
+ /**
2940
+ * Coerce the value for the given owner.
2941
+ */
2942
+ AttachedProperty.prototype._coerceValue = function (owner, value) {
2943
+ var coerce = this._coerce;
2944
+ return coerce ? coerce(owner, value) : value;
2945
+ };
2946
+ /**
2947
+ * Compare the old value and new value for equality.
2948
+ */
2949
+ AttachedProperty.prototype._compareValue = function (oldValue, newValue) {
2950
+ var compare = this._compare;
2951
+ return compare ? compare(oldValue, newValue) : oldValue === newValue;
2952
+ };
2953
+ /**
2954
+ * Run the change notification if the given values are different.
2955
+ */
2956
+ AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {
2957
+ var changed = this._changed;
2958
+ if (changed && !this._compareValue(oldValue, newValue)) {
2959
+ changed(owner, oldValue, newValue);
2960
+ }
2961
+ };
2962
+ return AttachedProperty;
2963
+ }());
2964
+ /**
2965
+ * The namespace for the `AttachedProperty` class statics.
2966
+ */
2967
+ (function (AttachedProperty) {
2968
+ /**
2969
+ * Clear the stored property data for the given owner.
2970
+ *
2971
+ * @param owner - The property owner of interest.
2972
+ *
2973
+ * #### Notes
2974
+ * This will clear all property values for the owner, but it will
2975
+ * **not** run the change notification for any of the properties.
2976
+ */
2977
+ function clearData(owner) {
2978
+ Private$r.ownerData.delete(owner);
2979
+ }
2980
+ AttachedProperty.clearData = clearData;
2981
+ })(AttachedProperty || (AttachedProperty = {}));
2982
+ /**
2983
+ * The namespace for the module implementation details.
2984
+ */
2985
+ var Private$r;
2986
+ (function (Private) {
2987
+ /**
2988
+ * A weak mapping of property owner to property map.
2989
+ */
2990
+ Private.ownerData = new WeakMap();
2991
+ /**
2992
+ * A function which computes successive unique property ids.
2993
+ */
2994
+ Private.nextPID = (function () {
2995
+ var id = 0;
2996
+ return function () {
2997
+ var rand = Math.random();
2998
+ var stem = ("" + rand).slice(2);
2999
+ return "pid-" + stem + "-" + id++;
3000
+ };
3001
+ })();
3002
+ /**
3003
+ * Lookup the data map for the property owner.
3004
+ *
3005
+ * This will create the map if one does not already exist.
3006
+ */
3007
+ function ensureMap(owner) {
3008
+ var map = Private.ownerData.get(owner);
3009
+ if (map) {
3010
+ return map;
3011
+ }
3012
+ map = Object.create(null);
3013
+ Private.ownerData.set(owner, map);
3014
+ return map;
3015
+ }
3016
+ Private.ensureMap = ensureMap;
3017
+ })(Private$r || (Private$r = {}));
3018
+
2830
3019
  // Copyright (c) Jupyter Development Team.
2831
3020
  /**
2832
3021
  * A concrete implementation of `ISignal`.
@@ -2884,8 +3073,26 @@
2884
3073
  * @param sender - The sender which owns the signal.
2885
3074
  */
2886
3075
  function Signal(sender) {
3076
+ this._blockedCount = 0;
2887
3077
  this.sender = sender;
2888
3078
  }
3079
+ /**
3080
+ * Block the signal during the execution of a callback.
3081
+ *
3082
+ * ### Notes
3083
+ * The callback function must be synchronous.
3084
+ *
3085
+ * @param fn The callback during which the signal is blocked
3086
+ */
3087
+ Signal.prototype.block = function (fn) {
3088
+ this._blockedCount++;
3089
+ try {
3090
+ fn();
3091
+ }
3092
+ finally {
3093
+ this._blockedCount--;
3094
+ }
3095
+ };
2889
3096
  /**
2890
3097
  * Connect a slot to the signal.
2891
3098
  *
@@ -2897,7 +3104,7 @@
2897
3104
  * @returns `true` if the connection succeeds, `false` otherwise.
2898
3105
  */
2899
3106
  Signal.prototype.connect = function (slot, thisArg) {
2900
- return Private$r.connect(this, slot, thisArg);
3107
+ return Private$q.connect(this, slot, thisArg);
2901
3108
  };
2902
3109
  /**
2903
3110
  * Disconnect a slot from the signal.
@@ -2910,7 +3117,7 @@
2910
3117
  * @returns `true` if the connection is removed, `false` otherwise.
2911
3118
  */
2912
3119
  Signal.prototype.disconnect = function (slot, thisArg) {
2913
- return Private$r.disconnect(this, slot, thisArg);
3120
+ return Private$q.disconnect(this, slot, thisArg);
2914
3121
  };
2915
3122
  /**
2916
3123
  * Emit the signal and invoke the connected slots.
@@ -2923,7 +3130,9 @@
2923
3130
  * Exceptions thrown by connected slots will be caught and logged.
2924
3131
  */
2925
3132
  Signal.prototype.emit = function (args) {
2926
- Private$r.emit(this, args);
3133
+ if (!this._blockedCount) {
3134
+ Private$q.emit(this, args);
3135
+ }
2927
3136
  };
2928
3137
  return Signal;
2929
3138
  }());
@@ -2931,6 +3140,27 @@
2931
3140
  * The namespace for the `Signal` class statics.
2932
3141
  */
2933
3142
  (function (Signal) {
3143
+ /**
3144
+ * Block all signals emitted by an object during
3145
+ * the execution of a callback.
3146
+ *
3147
+ * ### Notes
3148
+ * The callback function must be synchronous.
3149
+ *
3150
+ * @param sender The signals sender
3151
+ * @param fn The callback during which all signals are blocked
3152
+ */
3153
+ function blockAll(sender, fn) {
3154
+ var blockedProperty = Private$q.blockedProperty;
3155
+ blockedProperty.set(sender, blockedProperty.get(sender) + 1);
3156
+ try {
3157
+ fn();
3158
+ }
3159
+ finally {
3160
+ blockedProperty.set(sender, blockedProperty.get(sender) - 1);
3161
+ }
3162
+ }
3163
+ Signal.blockAll = blockAll;
2934
3164
  /**
2935
3165
  * Remove all connections between a sender and receiver.
2936
3166
  *
@@ -2944,7 +3174,7 @@
2944
3174
  * the receiver.
2945
3175
  */
2946
3176
  function disconnectBetween(sender, receiver) {
2947
- Private$r.disconnectBetween(sender, receiver);
3177
+ Private$q.disconnectBetween(sender, receiver);
2948
3178
  }
2949
3179
  Signal.disconnectBetween = disconnectBetween;
2950
3180
  /**
@@ -2953,7 +3183,7 @@
2953
3183
  * @param sender - The sender object of interest.
2954
3184
  */
2955
3185
  function disconnectSender(sender) {
2956
- Private$r.disconnectSender(sender);
3186
+ Private$q.disconnectSender(sender);
2957
3187
  }
2958
3188
  Signal.disconnectSender = disconnectSender;
2959
3189
  /**
@@ -2967,7 +3197,7 @@
2967
3197
  * the receiver.
2968
3198
  */
2969
3199
  function disconnectReceiver(receiver) {
2970
- Private$r.disconnectReceiver(receiver);
3200
+ Private$q.disconnectReceiver(receiver);
2971
3201
  }
2972
3202
  Signal.disconnectReceiver = disconnectReceiver;
2973
3203
  /**
@@ -2981,7 +3211,7 @@
2981
3211
  * the receiver.
2982
3212
  */
2983
3213
  function disconnectAll(object) {
2984
- Private$r.disconnectAll(object);
3214
+ Private$q.disconnectAll(object);
2985
3215
  }
2986
3216
  Signal.disconnectAll = disconnectAll;
2987
3217
  /**
@@ -2994,7 +3224,7 @@
2994
3224
  * associated with the object.
2995
3225
  */
2996
3226
  function clearData(object) {
2997
- Private$r.disconnectAll(object);
3227
+ Private$q.disconnectAll(object);
2998
3228
  }
2999
3229
  Signal.clearData = clearData;
3000
3230
  /**
@@ -3006,7 +3236,7 @@
3006
3236
  * The default exception handler is `console.error`.
3007
3237
  */
3008
3238
  function getExceptionHandler() {
3009
- return Private$r.exceptionHandler;
3239
+ return Private$q.exceptionHandler;
3010
3240
  }
3011
3241
  Signal.getExceptionHandler = getExceptionHandler;
3012
3242
  /**
@@ -3020,8 +3250,8 @@
3020
3250
  * The exception handler is invoked when a slot throws an exception.
3021
3251
  */
3022
3252
  function setExceptionHandler(handler) {
3023
- var old = Private$r.exceptionHandler;
3024
- Private$r.exceptionHandler = handler;
3253
+ var old = Private$q.exceptionHandler;
3254
+ Private$q.exceptionHandler = handler;
3025
3255
  return old;
3026
3256
  }
3027
3257
  Signal.setExceptionHandler = setExceptionHandler;
@@ -3029,7 +3259,7 @@
3029
3259
  /**
3030
3260
  * The namespace for the module implementation details.
3031
3261
  */
3032
- var Private$r;
3262
+ var Private$q;
3033
3263
  (function (Private) {
3034
3264
  /**
3035
3265
  * The signal exception handler function.
@@ -3230,6 +3460,9 @@
3230
3460
  * Exceptions thrown by connected slots will be caught and logged.
3231
3461
  */
3232
3462
  function emit(signal, args) {
3463
+ if (Private.blockedProperty.get(signal.sender) > 0) {
3464
+ return;
3465
+ }
3233
3466
  // If there are no receivers, there is nothing to do.
3234
3467
  var receivers = receiversForSender.get(signal.sender);
3235
3468
  if (!receivers || receivers.length === 0) {
@@ -3333,7 +3566,14 @@
3333
3566
  function isDeadConnection(connection) {
3334
3567
  return connection.signal === null;
3335
3568
  }
3336
- })(Private$r || (Private$r = {}));
3569
+ /**
3570
+ * A property indicating a sender has been blocked if its value is not 0.
3571
+ */
3572
+ Private.blockedProperty = new AttachedProperty({
3573
+ name: 'blocked',
3574
+ create: function () { return 0; }
3575
+ });
3576
+ })(Private$q || (Private$q = {}));
3337
3577
 
3338
3578
  /*! *****************************************************************************
3339
3579
  Copyright (c) Microsoft Corporation.
@@ -3838,11 +4078,11 @@
3838
4078
  * same selector are extremely fast.
3839
4079
  */
3840
4080
  function calculateSpecificity(selector) {
3841
- if (selector in Private$q.specificityCache) {
3842
- return Private$q.specificityCache[selector];
4081
+ if (selector in Private$p.specificityCache) {
4082
+ return Private$p.specificityCache[selector];
3843
4083
  }
3844
- var result = Private$q.calculateSingle(selector);
3845
- return (Private$q.specificityCache[selector] = result);
4084
+ var result = Private$p.calculateSingle(selector);
4085
+ return (Private$p.specificityCache[selector] = result);
3846
4086
  }
3847
4087
  Selector.calculateSpecificity = calculateSpecificity;
3848
4088
  /**
@@ -3857,17 +4097,17 @@
3857
4097
  * selector are extremely fast.
3858
4098
  */
3859
4099
  function isValid(selector) {
3860
- if (selector in Private$q.validityCache) {
3861
- return Private$q.validityCache[selector];
4100
+ if (selector in Private$p.validityCache) {
4101
+ return Private$p.validityCache[selector];
3862
4102
  }
3863
4103
  var result = true;
3864
4104
  try {
3865
- Private$q.testElem.querySelector(selector);
4105
+ Private$p.testElem.querySelector(selector);
3866
4106
  }
3867
4107
  catch (err) {
3868
4108
  result = false;
3869
4109
  }
3870
- return (Private$q.validityCache[selector] = result);
4110
+ return (Private$p.validityCache[selector] = result);
3871
4111
  }
3872
4112
  Selector.isValid = isValid;
3873
4113
  /**
@@ -3884,14 +4124,14 @@
3884
4124
  * falling back onto a document query otherwise.
3885
4125
  */
3886
4126
  function matches(element, selector) {
3887
- return Private$q.protoMatchFunc.call(element, selector);
4127
+ return Private$p.protoMatchFunc.call(element, selector);
3888
4128
  }
3889
4129
  Selector.matches = matches;
3890
4130
  })(Selector || (Selector = {}));
3891
4131
  /**
3892
4132
  * The namespace for the module implementation details.
3893
4133
  */
3894
- var Private$q;
4134
+ var Private$p;
3895
4135
  (function (Private) {
3896
4136
  /**
3897
4137
  * A cache of computed selector specificity values.
@@ -4029,7 +4269,7 @@
4029
4269
  * A regex which matches the negation pseudo-class globally.
4030
4270
  */
4031
4271
  var NEGATION_RE = /:not\(([^\)]+)\)/g;
4032
- })(Private$q || (Private$q = {}));
4272
+ })(Private$p || (Private$p = {}));
4033
4273
 
4034
4274
  // Copyright (c) Jupyter Development Team.
4035
4275
  // Distributed under the terms of the Modified BSD License.
@@ -4049,7 +4289,7 @@
4049
4289
  * The default keyboard layout is US-English.
4050
4290
  */
4051
4291
  function getKeyboardLayout() {
4052
- return Private$p.keyboardLayout;
4292
+ return Private$o.keyboardLayout;
4053
4293
  }
4054
4294
  /**
4055
4295
  * A concrete implementation of [[IKeyboardLayout]] based on keycodes.
@@ -4281,15 +4521,40 @@
4281
4521
  /**
4282
4522
  * The namespace for the module implementation details.
4283
4523
  */
4284
- var Private$p;
4524
+ var Private$o;
4285
4525
  (function (Private) {
4286
4526
  /**
4287
4527
  * The global keyboard layout instance.
4288
4528
  */
4289
4529
  Private.keyboardLayout = EN_US;
4290
- })(Private$p || (Private$p = {}));
4530
+ })(Private$o || (Private$o = {}));
4531
+
4532
+ /*! *****************************************************************************
4533
+ Copyright (c) Microsoft Corporation.
4534
+
4535
+ Permission to use, copy, modify, and/or distribute this software for any
4536
+ purpose with or without fee is hereby granted.
4537
+
4538
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4539
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4540
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4541
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4542
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4543
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4544
+ PERFORMANCE OF THIS SOFTWARE.
4545
+ ***************************************************************************** */
4546
+
4547
+ var __assign$1 = function() {
4548
+ __assign$1 = Object.assign || function __assign(t) {
4549
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4550
+ s = arguments[i];
4551
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4552
+ }
4553
+ return t;
4554
+ };
4555
+ return __assign$1.apply(this, arguments);
4556
+ };
4291
4557
 
4292
- // Copyright (c) Jupyter Development Team.
4293
4558
  /**
4294
4559
  * An object which manages a collection of commands.
4295
4560
  *
@@ -4395,7 +4660,7 @@
4395
4660
  throw new Error("Command '" + id + "' already registered.");
4396
4661
  }
4397
4662
  // Add the command to the registry.
4398
- this._commands[id] = Private$o.createCommand(options);
4663
+ this._commands[id] = Private$n.createCommand(options);
4399
4664
  // Emit the `commandChanged` signal.
4400
4665
  this._commandChanged.emit({ id: id, type: 'added' });
4401
4666
  // Return a disposable which will remove the command.
@@ -4427,6 +4692,17 @@
4427
4692
  }
4428
4693
  this._commandChanged.emit({ id: id, type: id ? 'changed' : 'many-changed' });
4429
4694
  };
4695
+ /**
4696
+ * Get the description for a specific command.
4697
+ *
4698
+ * @param id - The id of the command of interest.
4699
+ *
4700
+ * @returns The description for the command.
4701
+ */
4702
+ CommandRegistry.prototype.describedBy = function (id) {
4703
+ var cmd = this._commands[id];
4704
+ return cmd ? cmd.describedBy || { args: null } : { args: null };
4705
+ };
4430
4706
  /**
4431
4707
  * Get the display label for a specific command.
4432
4708
  *
@@ -4687,7 +4963,7 @@
4687
4963
  CommandRegistry.prototype.addKeyBinding = function (options) {
4688
4964
  var _this = this;
4689
4965
  // Create the binding for the given options.
4690
- var binding = Private$o.createKeyBinding(options);
4966
+ var binding = Private$n.createKeyBinding(options);
4691
4967
  // Add the key binding to the bindings array.
4692
4968
  this._keyBindings.push(binding);
4693
4969
  // Emit the `bindingChanged` signal.
@@ -4734,7 +5010,7 @@
4734
5010
  // Add the keystroke to the current key sequence.
4735
5011
  this._keystrokes.push(keystroke);
4736
5012
  // Find the exact and partial matches for the key sequence.
4737
- var _a = Private$o.matchKeyBinding(this._keyBindings, this._keystrokes, event), exact = _a.exact, partial = _a.partial;
5013
+ var _a = Private$n.matchKeyBinding(this._keyBindings, this._keystrokes, event), exact = _a.exact, partial = _a.partial;
4738
5014
  // If there is no exact match and no partial match, replay
4739
5015
  // any suppressed events and clear the pending state.
4740
5016
  if (!exact && !partial) {
@@ -4774,7 +5050,7 @@
4774
5050
  this._clearTimer();
4775
5051
  this._timerID = window.setTimeout(function () {
4776
5052
  _this._onPendingTimeout();
4777
- }, Private$o.CHORD_TIMEOUT);
5053
+ }, Private$n.CHORD_TIMEOUT);
4778
5054
  };
4779
5055
  /**
4780
5056
  * Clear the pending timeout.
@@ -4793,7 +5069,7 @@
4793
5069
  return;
4794
5070
  }
4795
5071
  this._replaying = true;
4796
- this._keydownEvents.forEach(Private$o.replayKeyEvent);
5072
+ this._keydownEvents.forEach(Private$n.replayKeyEvent);
4797
5073
  this._replaying = false;
4798
5074
  };
4799
5075
  /**
@@ -4951,26 +5227,37 @@
4951
5227
  }
4952
5228
  CommandRegistry.normalizeKeys = normalizeKeys;
4953
5229
  /**
4954
- * Format a keystroke for display on the local system.
5230
+ * Format keystrokes for display on the local system.
5231
+ *
5232
+ * If a list of keystrokes is provided, it will be displayed as
5233
+ * a comma-separated string
5234
+ *
5235
+ * @param keystroke The keystrokes to format
5236
+ * @returns The keystrokes representation
4955
5237
  */
4956
5238
  function formatKeystroke(keystroke) {
4957
- var mods = [];
4958
- var separator = Platform.IS_MAC ? ' ' : '+';
4959
- var parts = parseKeystroke(keystroke);
4960
- if (parts.ctrl) {
4961
- mods.push('Ctrl');
4962
- }
4963
- if (parts.alt) {
4964
- mods.push('Alt');
4965
- }
4966
- if (parts.shift) {
4967
- mods.push('Shift');
4968
- }
4969
- if (Platform.IS_MAC && parts.cmd) {
4970
- mods.push('Cmd');
5239
+ return typeof keystroke === 'string'
5240
+ ? formatSingleKey(keystroke)
5241
+ : keystroke.map(formatSingleKey).join(', ');
5242
+ function formatSingleKey(key) {
5243
+ var mods = [];
5244
+ var separator = Platform.IS_MAC ? ' ' : '+';
5245
+ var parts = parseKeystroke(key);
5246
+ if (parts.ctrl) {
5247
+ mods.push('Ctrl');
5248
+ }
5249
+ if (parts.alt) {
5250
+ mods.push('Alt');
5251
+ }
5252
+ if (parts.shift) {
5253
+ mods.push('Shift');
5254
+ }
5255
+ if (Platform.IS_MAC && parts.cmd) {
5256
+ mods.push('Cmd');
5257
+ }
5258
+ mods.push(parts.key);
5259
+ return mods.map(Private$n.formatKey).join(separator);
4971
5260
  }
4972
- mods.push(parts.key);
4973
- return mods.map(Private$o.formatKey).join(separator);
4974
5261
  }
4975
5262
  CommandRegistry.formatKeystroke = formatKeystroke;
4976
5263
  /**
@@ -5021,7 +5308,7 @@
5021
5308
  /**
5022
5309
  * The namespace for the module implementation details.
5023
5310
  */
5024
- var Private$o;
5311
+ var Private$n;
5025
5312
  (function (Private) {
5026
5313
  /**
5027
5314
  * The timeout in ms for triggering a key binding chord.
@@ -5048,6 +5335,7 @@
5048
5335
  /* </DEPRECATED> */
5049
5336
  return {
5050
5337
  execute: options.execute,
5338
+ describedBy: __assign$1({ args: null }, options.describedBy),
5051
5339
  label: asFunc(options.label, emptyStringFunc),
5052
5340
  mnemonic: asFunc(options.mnemonic, negativeOneFunc),
5053
5341
  icon: icon,
@@ -5293,7 +5581,7 @@
5293
5581
  clone.view = event.view || window;
5294
5582
  return clone;
5295
5583
  }
5296
- })(Private$o || (Private$o = {}));
5584
+ })(Private$n || (Private$n = {}));
5297
5585
 
5298
5586
  // Copyright (c) Jupyter Development Team.
5299
5587
  /**
@@ -5301,6 +5589,8 @@
5301
5589
  *
5302
5590
  * #### Notes
5303
5591
  * Most operations have `O(log32 n)` or better complexity.
5592
+ *
5593
+ * @deprecated This class will be removed in @lumino/collections@^2.0.0
5304
5594
  */
5305
5595
  var BPlusTree = /** @class */ (function () {
5306
5596
  /**
@@ -5586,6 +5876,8 @@
5586
5876
  }());
5587
5877
  /**
5588
5878
  * The namespace for the `BPlusTree` class statics.
5879
+ *
5880
+ * @deprecated This namespace will be removed in @lumino/collections@^2.0.0
5589
5881
  */
5590
5882
  (function (BPlusTree) {
5591
5883
  /**
@@ -6886,7 +7178,7 @@
6886
7178
  * Constant.
6887
7179
  */
6888
7180
  LinkedList.prototype.addFirst = function (value) {
6889
- var node = new Private$n.LinkedListNode(this, value);
7181
+ var node = new Private$m.LinkedListNode(this, value);
6890
7182
  if (!this._first) {
6891
7183
  this._first = node;
6892
7184
  this._last = node;
@@ -6910,7 +7202,7 @@
6910
7202
  * Constant.
6911
7203
  */
6912
7204
  LinkedList.prototype.addLast = function (value) {
6913
- var node = new Private$n.LinkedListNode(this, value);
7205
+ var node = new Private$m.LinkedListNode(this, value);
6914
7206
  if (!this._last) {
6915
7207
  this._first = node;
6916
7208
  this._last = node;
@@ -6943,10 +7235,10 @@
6943
7235
  if (!ref || ref === this._first) {
6944
7236
  return this.addFirst(value);
6945
7237
  }
6946
- if (!(ref instanceof Private$n.LinkedListNode) || ref.list !== this) {
7238
+ if (!(ref instanceof Private$m.LinkedListNode) || ref.list !== this) {
6947
7239
  throw new Error('Reference node is not owned by the list.');
6948
7240
  }
6949
- var node = new Private$n.LinkedListNode(this, value);
7241
+ var node = new Private$m.LinkedListNode(this, value);
6950
7242
  var _ref = ref;
6951
7243
  var prev = _ref.prev;
6952
7244
  node.next = _ref;
@@ -6976,10 +7268,10 @@
6976
7268
  if (!ref || ref === this._last) {
6977
7269
  return this.addLast(value);
6978
7270
  }
6979
- if (!(ref instanceof Private$n.LinkedListNode) || ref.list !== this) {
7271
+ if (!(ref instanceof Private$m.LinkedListNode) || ref.list !== this) {
6980
7272
  throw new Error('Reference node is not owned by the list.');
6981
7273
  }
6982
- var node = new Private$n.LinkedListNode(this, value);
7274
+ var node = new Private$m.LinkedListNode(this, value);
6983
7275
  var _ref = ref;
6984
7276
  var next = _ref.next;
6985
7277
  node.next = next;
@@ -7055,7 +7347,7 @@
7055
7347
  * The node must be owned by the list.
7056
7348
  */
7057
7349
  LinkedList.prototype.removeNode = function (node) {
7058
- if (!(node instanceof Private$n.LinkedListNode) || node.list !== this) {
7350
+ if (!(node instanceof Private$m.LinkedListNode) || node.list !== this) {
7059
7351
  throw new Error('Node is not owned by the list.');
7060
7352
  }
7061
7353
  var _node = node;
@@ -7301,7 +7593,7 @@
7301
7593
  /**
7302
7594
  * The namespace for the module implementation details.
7303
7595
  */
7304
- var Private$n;
7596
+ var Private$m;
7305
7597
  (function (Private) {
7306
7598
  /**
7307
7599
  * The internal linked list node implementation.
@@ -7333,7 +7625,7 @@
7333
7625
  return LinkedListNode;
7334
7626
  }());
7335
7627
  Private.LinkedListNode = LinkedListNode;
7336
- })(Private$n || (Private$n = {}));
7628
+ })(Private$m || (Private$m = {}));
7337
7629
 
7338
7630
  /*! *****************************************************************************
7339
7631
  Copyright (c) Microsoft Corporation.
@@ -7872,195 +8164,6 @@
7872
8164
  }
7873
8165
  })(MessageLoop || (MessageLoop = {}));
7874
8166
 
7875
- // Copyright (c) Jupyter Development Team.
7876
- // Distributed under the terms of the Modified BSD License.
7877
- /*-----------------------------------------------------------------------------
7878
- | Copyright (c) 2014-2017, PhosphorJS Contributors
7879
- |
7880
- | Distributed under the terms of the BSD 3-Clause License.
7881
- |
7882
- | The full license is in the file LICENSE, distributed with this software.
7883
- |----------------------------------------------------------------------------*/
7884
- /**
7885
- * A class which attaches a value to an external object.
7886
- *
7887
- * #### Notes
7888
- * Attached properties are used to extend the state of an object with
7889
- * semantic data from an unrelated class. They also encapsulate value
7890
- * creation, coercion, and notification.
7891
- *
7892
- * Because attached property values are stored in a hash table, which
7893
- * in turn is stored in a WeakMap keyed on the owner object, there is
7894
- * non-trivial storage overhead involved in their use. The pattern is
7895
- * therefore best used for the storage of rare data.
7896
- */
7897
- var AttachedProperty = /** @class */ (function () {
7898
- /**
7899
- * Construct a new attached property.
7900
- *
7901
- * @param options - The options for initializing the property.
7902
- */
7903
- function AttachedProperty(options) {
7904
- this._pid = Private$m.nextPID();
7905
- this.name = options.name;
7906
- this._create = options.create;
7907
- this._coerce = options.coerce || null;
7908
- this._compare = options.compare || null;
7909
- this._changed = options.changed || null;
7910
- }
7911
- /**
7912
- * Get the current value of the property for a given owner.
7913
- *
7914
- * @param owner - The property owner of interest.
7915
- *
7916
- * @returns The current value of the property.
7917
- *
7918
- * #### Notes
7919
- * If the value has not yet been set, the default value will be
7920
- * computed and assigned as the current value of the property.
7921
- */
7922
- AttachedProperty.prototype.get = function (owner) {
7923
- var value;
7924
- var map = Private$m.ensureMap(owner);
7925
- if (this._pid in map) {
7926
- value = map[this._pid];
7927
- }
7928
- else {
7929
- value = map[this._pid] = this._createValue(owner);
7930
- }
7931
- return value;
7932
- };
7933
- /**
7934
- * Set the current value of the property for a given owner.
7935
- *
7936
- * @param owner - The property owner of interest.
7937
- *
7938
- * @param value - The value for the property.
7939
- *
7940
- * #### Notes
7941
- * If the value has not yet been set, the default value will be
7942
- * computed and used as the previous value for the comparison.
7943
- */
7944
- AttachedProperty.prototype.set = function (owner, value) {
7945
- var oldValue;
7946
- var map = Private$m.ensureMap(owner);
7947
- if (this._pid in map) {
7948
- oldValue = map[this._pid];
7949
- }
7950
- else {
7951
- oldValue = map[this._pid] = this._createValue(owner);
7952
- }
7953
- var newValue = this._coerceValue(owner, value);
7954
- this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
7955
- };
7956
- /**
7957
- * Explicitly coerce the current property value for a given owner.
7958
- *
7959
- * @param owner - The property owner of interest.
7960
- *
7961
- * #### Notes
7962
- * If the value has not yet been set, the default value will be
7963
- * computed and used as the previous value for the comparison.
7964
- */
7965
- AttachedProperty.prototype.coerce = function (owner) {
7966
- var oldValue;
7967
- var map = Private$m.ensureMap(owner);
7968
- if (this._pid in map) {
7969
- oldValue = map[this._pid];
7970
- }
7971
- else {
7972
- oldValue = map[this._pid] = this._createValue(owner);
7973
- }
7974
- var newValue = this._coerceValue(owner, oldValue);
7975
- this._maybeNotify(owner, oldValue, (map[this._pid] = newValue));
7976
- };
7977
- /**
7978
- * Get or create the default value for the given owner.
7979
- */
7980
- AttachedProperty.prototype._createValue = function (owner) {
7981
- var create = this._create;
7982
- return create(owner);
7983
- };
7984
- /**
7985
- * Coerce the value for the given owner.
7986
- */
7987
- AttachedProperty.prototype._coerceValue = function (owner, value) {
7988
- var coerce = this._coerce;
7989
- return coerce ? coerce(owner, value) : value;
7990
- };
7991
- /**
7992
- * Compare the old value and new value for equality.
7993
- */
7994
- AttachedProperty.prototype._compareValue = function (oldValue, newValue) {
7995
- var compare = this._compare;
7996
- return compare ? compare(oldValue, newValue) : oldValue === newValue;
7997
- };
7998
- /**
7999
- * Run the change notification if the given values are different.
8000
- */
8001
- AttachedProperty.prototype._maybeNotify = function (owner, oldValue, newValue) {
8002
- var changed = this._changed;
8003
- if (changed && !this._compareValue(oldValue, newValue)) {
8004
- changed(owner, oldValue, newValue);
8005
- }
8006
- };
8007
- return AttachedProperty;
8008
- }());
8009
- /**
8010
- * The namespace for the `AttachedProperty` class statics.
8011
- */
8012
- (function (AttachedProperty) {
8013
- /**
8014
- * Clear the stored property data for the given owner.
8015
- *
8016
- * @param owner - The property owner of interest.
8017
- *
8018
- * #### Notes
8019
- * This will clear all property values for the owner, but it will
8020
- * **not** run the change notification for any of the properties.
8021
- */
8022
- function clearData(owner) {
8023
- Private$m.ownerData.delete(owner);
8024
- }
8025
- AttachedProperty.clearData = clearData;
8026
- })(AttachedProperty || (AttachedProperty = {}));
8027
- /**
8028
- * The namespace for the module implementation details.
8029
- */
8030
- var Private$m;
8031
- (function (Private) {
8032
- /**
8033
- * A weak mapping of property owner to property map.
8034
- */
8035
- Private.ownerData = new WeakMap();
8036
- /**
8037
- * A function which computes successive unique property ids.
8038
- */
8039
- Private.nextPID = (function () {
8040
- var id = 0;
8041
- return function () {
8042
- var rand = Math.random();
8043
- var stem = ("" + rand).slice(2);
8044
- return "pid-" + stem + "-" + id++;
8045
- };
8046
- })();
8047
- /**
8048
- * Lookup the data map for the property owner.
8049
- *
8050
- * This will create the map if one does not already exist.
8051
- */
8052
- function ensureMap(owner) {
8053
- var map = Private.ownerData.get(owner);
8054
- if (map) {
8055
- return map;
8056
- }
8057
- map = Object.create(null);
8058
- Private.ownerData.set(owner, map);
8059
- return map;
8060
- }
8061
- Private.ensureMap = ensureMap;
8062
- })(Private$m || (Private$m = {}));
8063
-
8064
8167
  /**
8065
8168
  * An object which manages a drag-drop operation.
8066
8169
  *
@@ -9367,7 +9470,10 @@
9367
9470
  }
9368
9471
  // Handle the simplest case of in-place text update first.
9369
9472
  if (oldVNode.type === 'text' && newVNode.type === 'text') {
9370
- currElem.textContent = newVNode.content;
9473
+ // Avoid spurious updates for performance.
9474
+ if (currElem.textContent !== newVNode.content) {
9475
+ currElem.textContent = newVNode.content;
9476
+ }
9371
9477
  currElem = currElem.nextSibling;
9372
9478
  continue;
9373
9479
  }
@@ -9673,15 +9779,15 @@
9673
9779
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9674
9780
  }
9675
9781
 
9676
- var __assign$1 = function() {
9677
- __assign$1 = Object.assign || function __assign(t) {
9782
+ var __assign$2 = function() {
9783
+ __assign$2 = Object.assign || function __assign(t) {
9678
9784
  for (var s, i = 1, n = arguments.length; i < n; i++) {
9679
9785
  s = arguments[i];
9680
9786
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9681
9787
  }
9682
9788
  return t;
9683
9789
  };
9684
- return __assign$1.apply(this, arguments);
9790
+ return __assign$2.apply(this, arguments);
9685
9791
  };
9686
9792
 
9687
9793
  function __rest(s, e) {
@@ -13318,7 +13424,7 @@
13318
13424
  * Titles must be rotated for horizontal accordion panel using CSS: see accordionpanel.css
13319
13425
  */
13320
13426
  function AccordionLayout(options) {
13321
- var _this = _super.call(this, __assign$1(__assign$1({}, options), { orientation: options.orientation || 'vertical' })) || this;
13427
+ var _this = _super.call(this, __assign$2(__assign$2({}, options), { orientation: options.orientation || 'vertical' })) || this;
13322
13428
  _this._titles = [];
13323
13429
  _this.titleSpace = options.titleSpace || 22;
13324
13430
  return _this;
@@ -13973,7 +14079,7 @@
13973
14079
  */
13974
14080
  function AccordionPanel(options) {
13975
14081
  if (options === void 0) { options = {}; }
13976
- var _this = _super.call(this, __assign$1(__assign$1({}, options), { layout: Private$d.createLayout(options) })) || this;
14082
+ var _this = _super.call(this, __assign$2(__assign$2({}, options), { layout: Private$d.createLayout(options) })) || this;
13977
14083
  _this._widgetSizesCache = new WeakMap();
13978
14084
  _this.addClass('lm-AccordionPanel');
13979
14085
  return _this;
@@ -14276,13 +14382,14 @@
14276
14382
  var Renderer = /** @class */ (function (_super) {
14277
14383
  __extends$4(Renderer, _super);
14278
14384
  function Renderer() {
14279
- var _this = _super !== null && _super.apply(this, arguments) || this;
14385
+ var _this = _super.call(this) || this;
14280
14386
  /**
14281
14387
  * A selector which matches any title node in the accordion.
14282
14388
  */
14283
14389
  _this.titleClassName = 'lm-AccordionPanel-title';
14284
14390
  _this._titleID = 0;
14285
14391
  _this._titleKeys = new WeakMap();
14392
+ _this._uuid = ++Renderer._nInstance;
14286
14393
  return _this;
14287
14394
  }
14288
14395
  /**
@@ -14308,7 +14415,6 @@
14308
14415
  handle.setAttribute('tabindex', '0');
14309
14416
  handle.id = this.createTitleKey(data);
14310
14417
  handle.className = this.titleClassName;
14311
- handle.title = data.caption;
14312
14418
  for (var aData in data.dataset) {
14313
14419
  handle.dataset[aData] = data.dataset[aData];
14314
14420
  }
@@ -14317,6 +14423,7 @@
14317
14423
  var label = handle.appendChild(document.createElement('span'));
14318
14424
  label.className = 'lm-AccordionPanel-titleLabel';
14319
14425
  label.textContent = data.label;
14426
+ label.title = data.caption || data.label;
14320
14427
  return handle;
14321
14428
  };
14322
14429
  /**
@@ -14333,11 +14440,12 @@
14333
14440
  Renderer.prototype.createTitleKey = function (data) {
14334
14441
  var key = this._titleKeys.get(data);
14335
14442
  if (key === undefined) {
14336
- key = "title-key-" + this._titleID++;
14443
+ key = "title-key-" + this._uuid + "-" + this._titleID++;
14337
14444
  this._titleKeys.set(data, key);
14338
14445
  }
14339
14446
  return key;
14340
14447
  };
14448
+ Renderer._nInstance = 0;
14341
14449
  return Renderer;
14342
14450
  }(SplitPanel$1.Renderer));
14343
14451
  AccordionPanel.Renderer = Renderer;
@@ -15700,7 +15808,7 @@
15700
15808
  * @returns The dataset for the command palette item.
15701
15809
  */
15702
15810
  Renderer.prototype.createItemDataset = function (data) {
15703
- return __assign$1(__assign$1({}, data.item.dataset), { command: data.item.command });
15811
+ return __assign$2(__assign$2({}, data.item.dataset), { command: data.item.command });
15704
15812
  };
15705
15813
  /**
15706
15814
  * Create the class name for the command item icon.
@@ -15749,9 +15857,7 @@
15749
15857
  */
15750
15858
  Renderer.prototype.formatItemShortcut = function (data) {
15751
15859
  var kb = data.item.keyBinding;
15752
- return kb
15753
- ? kb.keys.map(exports.CommandRegistry.formatKeystroke).join(', ')
15754
- : null;
15860
+ return kb ? exports.CommandRegistry.formatKeystroke(kb.keys) : null;
15755
15861
  };
15756
15862
  /**
15757
15863
  * Create the render content for the item label node.
@@ -16952,6 +17058,8 @@
16952
17058
  if (submenu === this._childMenu) {
16953
17059
  return;
16954
17060
  }
17061
+ // Prior to any DOM modifications save window data
17062
+ Menu.saveWindowData();
16955
17063
  // Ensure the current child menu is closed.
16956
17064
  this._closeChildMenu();
16957
17065
  // Update the private child state.
@@ -17024,6 +17132,18 @@
17024
17132
  this._closeTimerID = 0;
17025
17133
  }
17026
17134
  };
17135
+ /**
17136
+ * Save window data used for menu positioning in transient cache.
17137
+ *
17138
+ * In order to avoid layout trashing it is recommended to invoke this
17139
+ * method immediately prior to opening the menu and any DOM modifications
17140
+ * (like closing previously visible menu, or adding a class to menu widget).
17141
+ *
17142
+ * The transient cache will be released upon `open()` call.
17143
+ */
17144
+ Menu.saveWindowData = function () {
17145
+ Private$9.saveWindowData();
17146
+ };
17027
17147
  return Menu;
17028
17148
  }(Widget));
17029
17149
  /**
@@ -17050,7 +17170,7 @@
17050
17170
  var className = this.createItemClass(data);
17051
17171
  var dataset = this.createItemDataset(data);
17052
17172
  var aria = this.createItemARIA(data);
17053
- return h.li(__assign$1({ className: className,
17173
+ return h.li(__assign$2({ className: className,
17054
17174
  dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data), this.renderShortcut(data), this.renderSubmenu(data));
17055
17175
  };
17056
17176
  /**
@@ -17180,10 +17300,10 @@
17180
17300
  var result;
17181
17301
  var _a = data.item, type = _a.type, command = _a.command, dataset = _a.dataset;
17182
17302
  if (type === 'command') {
17183
- result = __assign$1(__assign$1({}, dataset), { type: type, command: command });
17303
+ result = __assign$2(__assign$2({}, dataset), { type: type, command: command });
17184
17304
  }
17185
17305
  else {
17186
- result = __assign$1(__assign$1({}, dataset), { type: type });
17306
+ result = __assign$2(__assign$2({}, dataset), { type: type });
17187
17307
  }
17188
17308
  return result;
17189
17309
  };
@@ -17266,9 +17386,7 @@
17266
17386
  */
17267
17387
  Renderer.prototype.formatShortcut = function (data) {
17268
17388
  var kb = data.item.keyBinding;
17269
- return kb
17270
- ? kb.keys.map(exports.CommandRegistry.formatKeystroke).join(', ')
17271
- : null;
17389
+ return kb ? exports.CommandRegistry.formatKeystroke(kb.keys) : null;
17272
17390
  };
17273
17391
  return Renderer;
17274
17392
  }());
@@ -17291,6 +17409,30 @@
17291
17409
  * The horizontal pixel overlap for an open submenu.
17292
17410
  */
17293
17411
  Private.SUBMENU_OVERLAP = 3;
17412
+ var transientWindowDataCache = null;
17413
+ var transientCacheCounter = 0;
17414
+ function getWindowData() {
17415
+ // if transient cache is in use, take one from it
17416
+ if (transientCacheCounter > 0) {
17417
+ transientCacheCounter--;
17418
+ return transientWindowDataCache;
17419
+ }
17420
+ return _getWindowData();
17421
+ }
17422
+ /**
17423
+ * Store window data in transient cache.
17424
+ *
17425
+ * The transient cache will be released upon `getWindowData()` call.
17426
+ * If this function is called multiple times, the cache will be
17427
+ * retained until as many calls to `getWindowData()` were made.
17428
+ *
17429
+ * Note: should be called before any DOM modifications.
17430
+ */
17431
+ function saveWindowData() {
17432
+ transientWindowDataCache = _getWindowData();
17433
+ transientCacheCounter++;
17434
+ }
17435
+ Private.saveWindowData = saveWindowData;
17294
17436
  /**
17295
17437
  * Create the DOM node for a menu.
17296
17438
  */
@@ -17386,28 +17528,33 @@
17386
17528
  return result;
17387
17529
  }
17388
17530
  Private.computeCollapsed = computeCollapsed;
17531
+ function _getWindowData() {
17532
+ return {
17533
+ pageXOffset: window.pageXOffset,
17534
+ pageYOffset: window.pageYOffset,
17535
+ clientWidth: document.documentElement.clientWidth,
17536
+ clientHeight: document.documentElement.clientHeight
17537
+ };
17538
+ }
17389
17539
  /**
17390
17540
  * Open a menu as a root menu at the target location.
17391
17541
  */
17392
17542
  function openRootMenu(menu, x, y, forceX, forceY) {
17543
+ // Get the current position and size of the main viewport.
17544
+ var windowData = getWindowData();
17545
+ var px = windowData.pageXOffset;
17546
+ var py = windowData.pageYOffset;
17547
+ var cw = windowData.clientWidth;
17548
+ var ch = windowData.clientHeight;
17393
17549
  // Ensure the menu is updated before attaching and measuring.
17394
17550
  MessageLoop.sendMessage(menu, Widget.Msg.UpdateRequest);
17395
- // Get the current position and size of the main viewport.
17396
- var px = window.pageXOffset;
17397
- var py = window.pageYOffset;
17398
- var cw = document.documentElement.clientWidth;
17399
- var ch = document.documentElement.clientHeight;
17400
17551
  // Compute the maximum allowed height for the menu.
17401
17552
  var maxHeight = ch - (forceY ? y : 0);
17402
17553
  // Fetch common variables.
17403
17554
  var node = menu.node;
17404
17555
  var style = node.style;
17405
17556
  // Clear the menu geometry and prepare it for measuring.
17406
- style.top = '';
17407
- style.left = '';
17408
- style.width = '';
17409
- style.height = '';
17410
- style.visibility = 'hidden';
17557
+ style.opacity = '0';
17411
17558
  style.maxHeight = maxHeight + "px";
17412
17559
  // Attach the menu to the document.
17413
17560
  Widget.attach(menu, document.body);
@@ -17427,34 +17574,30 @@
17427
17574
  }
17428
17575
  }
17429
17576
  // Update the position of the menu to the computed position.
17430
- style.top = Math.max(0, y) + "px";
17431
- style.left = Math.max(0, x) + "px";
17577
+ style.transform = "translate(" + Math.max(0, x) + "px, " + Math.max(0, y) + "px";
17432
17578
  // Finally, make the menu visible on the screen.
17433
- style.visibility = '';
17579
+ style.opacity = '1';
17434
17580
  }
17435
17581
  Private.openRootMenu = openRootMenu;
17436
17582
  /**
17437
17583
  * Open a menu as a submenu using an item node for positioning.
17438
17584
  */
17439
17585
  function openSubmenu(submenu, itemNode) {
17586
+ // Get the current position and size of the main viewport.
17587
+ var windowData = getWindowData();
17588
+ var px = windowData.pageXOffset;
17589
+ var py = windowData.pageYOffset;
17590
+ var cw = windowData.clientWidth;
17591
+ var ch = windowData.clientHeight;
17440
17592
  // Ensure the menu is updated before opening.
17441
17593
  MessageLoop.sendMessage(submenu, Widget.Msg.UpdateRequest);
17442
- // Get the current position and size of the main viewport.
17443
- var px = window.pageXOffset;
17444
- var py = window.pageYOffset;
17445
- var cw = document.documentElement.clientWidth;
17446
- var ch = document.documentElement.clientHeight;
17447
17594
  // Compute the maximum allowed height for the menu.
17448
17595
  var maxHeight = ch;
17449
17596
  // Fetch common variables.
17450
17597
  var node = submenu.node;
17451
17598
  var style = node.style;
17452
17599
  // Clear the menu geometry and prepare it for measuring.
17453
- style.top = '';
17454
- style.left = '';
17455
- style.width = '';
17456
- style.height = '';
17457
- style.visibility = 'hidden';
17600
+ style.opacity = '0';
17458
17601
  style.maxHeight = maxHeight + "px";
17459
17602
  // Attach the menu to the document.
17460
17603
  Widget.attach(submenu, document.body);
@@ -17477,10 +17620,9 @@
17477
17620
  y = itemRect.bottom + box.borderBottom + box.paddingBottom - height;
17478
17621
  }
17479
17622
  // Update the position of the menu to the computed position.
17480
- style.top = Math.max(0, y) + "px";
17481
- style.left = Math.max(0, x) + "px";
17623
+ style.transform = "translate(" + Math.max(0, x) + "px, " + Math.max(0, y) + "px";
17482
17624
  // Finally, make the menu visible on the screen.
17483
- style.visibility = '';
17625
+ style.opacity = '1';
17484
17626
  }
17485
17627
  Private.openSubmenu = openSubmenu;
17486
17628
  /**
@@ -17804,6 +17946,8 @@
17804
17946
  */
17805
17947
  ContextMenu.prototype.open = function (event) {
17806
17948
  var _this = this;
17949
+ // Prior to any DOM modifications update the window data.
17950
+ Menu.saveWindowData();
17807
17951
  // Clear the current contents of the context menu.
17808
17952
  this.menu.clearItems();
17809
17953
  // Bail early if there are no items to match.
@@ -17838,7 +17982,7 @@
17838
17982
  function createItem(options, id) {
17839
17983
  var selector = validateSelector(options.selector);
17840
17984
  var rank = options.rank !== undefined ? options.rank : Infinity;
17841
- return __assign$1(__assign$1({}, options), { selector: selector, rank: rank, id: id });
17985
+ return __assign$2(__assign$2({}, options), { selector: selector, rank: rank, id: id });
17842
17986
  }
17843
17987
  Private.createItem = createItem;
17844
17988
  /**
@@ -19068,6 +19212,7 @@
19068
19212
  this.closeIconSelector = '.lm-TabBar-tabCloseIcon';
19069
19213
  this._tabID = 0;
19070
19214
  this._tabKeys = new WeakMap();
19215
+ this._uuid = ++Renderer._nInstance;
19071
19216
  }
19072
19217
  /**
19073
19218
  * Render the virtual element for a tab.
@@ -19085,10 +19230,10 @@
19085
19230
  var dataset = this.createTabDataset(data);
19086
19231
  var aria = this.createTabARIA(data);
19087
19232
  if (data.title.closable) {
19088
- return h.li(__assign$1({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data), this.renderCloseIcon(data));
19233
+ return h.li(__assign$2({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data), this.renderCloseIcon(data));
19089
19234
  }
19090
19235
  else {
19091
- return h.li(__assign$1({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data));
19236
+ return h.li(__assign$2({ id: id, key: key, className: className, title: title, style: style, dataset: dataset }, aria), this.renderIcon(data), this.renderLabel(data));
19092
19237
  }
19093
19238
  };
19094
19239
  /**
@@ -19154,7 +19299,7 @@
19154
19299
  Renderer.prototype.createTabKey = function (data) {
19155
19300
  var key = this._tabKeys.get(data.title);
19156
19301
  if (key === undefined) {
19157
- key = "tab-key-" + this._tabID++;
19302
+ key = "tab-key-" + this._uuid + "-" + this._tabID++;
19158
19303
  this._tabKeys.set(data.title, key);
19159
19304
  }
19160
19305
  return key;
@@ -19233,6 +19378,7 @@
19233
19378
  var extra = data.title.iconClass;
19234
19379
  return extra ? name + " " + extra : name;
19235
19380
  };
19381
+ Renderer._nInstance = 0;
19236
19382
  return Renderer;
19237
19383
  }());
19238
19384
  TabBar.Renderer = Renderer;
@@ -23730,13 +23876,20 @@
23730
23876
  };
23731
23877
  /**
23732
23878
  * Handle the `'keydown'` event for the menu bar.
23879
+ *
23880
+ * #### Notes
23881
+ * All keys are trapped except the tab key that is ignored.
23733
23882
  */
23734
23883
  MenuBar.prototype._evtKeyDown = function (event) {
23735
- // A menu bar handles all keydown events.
23736
- event.preventDefault();
23737
- event.stopPropagation();
23738
23884
  // Fetch the key code for the event.
23739
23885
  var kc = event.keyCode;
23886
+ // Do not trap the tab key.
23887
+ if (kc === 9) {
23888
+ return;
23889
+ }
23890
+ // A menu bar handles all other keydown events.
23891
+ event.preventDefault();
23892
+ event.stopPropagation();
23740
23893
  // Enter, Up Arrow, Down Arrow
23741
23894
  if (kc === 13 || kc === 38 || kc === 40) {
23742
23895
  this.openActiveMenu();
@@ -23820,8 +23973,11 @@
23820
23973
  this.activeIndex = index;
23821
23974
  }
23822
23975
  else {
23976
+ var position = this._positionForMenu(index);
23977
+ Menu.saveWindowData();
23978
+ // Begin DOM modifications.
23823
23979
  this.activeIndex = index;
23824
- this._openChildMenu();
23980
+ this._openChildMenu(position);
23825
23981
  }
23826
23982
  };
23827
23983
  /**
@@ -23842,13 +23998,33 @@
23842
23998
  if (index === -1 && this._childMenu) {
23843
23999
  return;
23844
24000
  }
24001
+ // Get position for the new menu >before< updating active index.
24002
+ var position = this._positionForMenu(index);
24003
+ // Before any modification, update window data.
24004
+ Menu.saveWindowData();
24005
+ // Begin DOM modifications.
23845
24006
  // Update the active index to the hovered item.
23846
24007
  this.activeIndex = index;
23847
24008
  // Open the new menu if a menu is already open.
23848
24009
  if (this._childMenu) {
23849
- this._openChildMenu();
24010
+ this._openChildMenu(position);
23850
24011
  }
23851
24012
  };
24013
+ /**
24014
+ * Find initial position for the menu based on menubar item position.
24015
+ *
24016
+ * NOTE: this should be called before updating active index to avoid
24017
+ * an additional layout and style invalidation as changing active
24018
+ * index modifies DOM.
24019
+ */
24020
+ MenuBar.prototype._positionForMenu = function (index) {
24021
+ var itemNode = this.contentNode.children[index];
24022
+ var _a = itemNode.getBoundingClientRect(), left = _a.left, bottom = _a.bottom;
24023
+ return {
24024
+ top: bottom,
24025
+ left: left
24026
+ };
24027
+ };
23852
24028
  /**
23853
24029
  * Handle the `'mouseleave'` event for the menu bar.
23854
24030
  */
@@ -23864,7 +24040,9 @@
23864
24040
  * If a different child menu is already open, it will be closed,
23865
24041
  * even if there is no active menu.
23866
24042
  */
23867
- MenuBar.prototype._openChildMenu = function () {
24043
+ MenuBar.prototype._openChildMenu = function (options) {
24044
+ var _a;
24045
+ if (options === void 0) { options = {}; }
23868
24046
  // If there is no active menu, close the current menu.
23869
24047
  var newMenu = this.activeMenu;
23870
24048
  if (!newMenu) {
@@ -23883,20 +24061,26 @@
23883
24061
  oldMenu.close();
23884
24062
  }
23885
24063
  else {
23886
- this.addClass('lm-mod-active');
23887
- /* <DEPRECATED> */
23888
- this.addClass('p-mod-active');
23889
- /* </DEPRECATED> */
23890
24064
  document.addEventListener('mousedown', this, true);
23891
24065
  }
23892
24066
  // Ensure the menu bar is updated and look up the item node.
23893
24067
  MessageLoop.sendMessage(this, Widget.Msg.UpdateRequest);
23894
- var itemNode = this.contentNode.children[this._activeIndex];
23895
24068
  // Get the positioning data for the new menu.
23896
- var _a = itemNode.getBoundingClientRect(), left = _a.left, bottom = _a.bottom;
24069
+ var left = options.left, top = options.top;
24070
+ if (typeof left === 'undefined' || typeof top === 'undefined') {
24071
+ (_a = this._positionForMenu(this._activeIndex), left = _a.left, top = _a.top);
24072
+ }
24073
+ // Begin DOM modifications
24074
+ if (!oldMenu) {
24075
+ // Continue setup for new menu
24076
+ this.addClass('lm-mod-active');
24077
+ /* <DEPRECATED> */
24078
+ this.addClass('p-mod-active');
24079
+ /* </DEPRECATED> */
24080
+ }
23897
24081
  // Open the new menu at the computed location.
23898
24082
  if (newMenu.items.length > 0) {
23899
- newMenu.open(left, bottom, this._forceItemsPosition);
24083
+ newMenu.open(left, top, this._forceItemsPosition);
23900
24084
  }
23901
24085
  };
23902
24086
  /**
@@ -23999,7 +24183,7 @@
23999
24183
  var className = this.createItemClass(data);
24000
24184
  var dataset = this.createItemDataset(data);
24001
24185
  var aria = this.createItemARIA(data);
24002
- return h.li(__assign$1({ className: className, dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data));
24186
+ return h.li(__assign$2({ className: className, dataset: dataset, tabindex: '0', onfocus: data.onfocus }, aria), this.renderIcon(data), this.renderLabel(data));
24003
24187
  };
24004
24188
  /**
24005
24189
  * Render the icon element for a menu bar item.